comparison common/listutil.h @ 1081:edbf5e5e88f4

(issue118) Extend verify_binary to carry an open file * binverify.c: Change result to a structure containing an open fptr Use in Memory data for windows verification. * mainwindow.cpp, selftest.c: Handle the returend structure * binverifytest.cpp: Test for the exclusive read and update signature. * listutil.c: Add optional fptr parameter to read_file
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 11 Sep 2014 12:05:24 +0200
parents 78798d3af8f0
children
comparison
equal deleted inserted replaced
1080:898b1ddcca11 1081:edbf5e5e88f4
11 #ifdef __cplusplus 11 #ifdef __cplusplus
12 extern "C" { 12 extern "C" {
13 #endif 13 #endif
14 14
15 #include <stddef.h> 15 #include <stddef.h>
16 #include <stdio.h>
16 17
17 /** 18 /**
18 * @file listutil.h 19 * @file listutil.h
19 * @brief Functions to work with the certificate list. 20 * @brief Functions to work with the certificate list.
20 */ 21 */
82 char **get_certs_from_list (char *data, const size_t size); 83 char **get_certs_from_list (char *data, const size_t size);
83 84
84 /** 85 /**
85 * @brief Read a file into memory. 86 * @brief Read a file into memory.
86 * 87 *
87 * The caller needs to free data 88 * The caller needs to free data. If fptr is not NULL it will
89 * recieve the pointer to the read file structure. The caller
90 * is responsible for closing this.
91 * fptr only needs to be closed and is only valid if the
92 * return value is 0.
88 * 93 *
89 * @param[in] file_name Name of the file. 94 * @param[in] file_name Name of the file.
90 * @param[out] data the file content 95 * @param[out] data the file content
91 * @param[out] size size in bytes of the file content. 96 * @param[out] size size in bytes of the file content.
92 * @param[in] max_size the maximum amount of bytes to read. 97 * @param[in] max_size the maximum amount of bytes to read.
98 * @param[out] fptr pointer to recieve the FILE ptr or NULL
93 * 99 *
94 * @return 0 on success an error code otherwise. 100 * @return 0 on success an error code otherwise.
95 */ 101 */
96 int read_file(const char *file_name, char **data, size_t *size, 102 int read_file(const char *file_name, char **data, size_t *size,
97 const size_t max_size); 103 const size_t max_size, FILE **fptr);
98 #ifdef __cplusplus 104 #ifdef __cplusplus
99 } 105 }
100 #endif 106 #endif
101 #endif 107 #endif

http://wald.intevation.org/projects/trustbridge/