diff 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
line wrap: on
line diff
--- a/common/listutil.h	Thu Sep 11 12:00:10 2014 +0200
+++ b/common/listutil.h	Thu Sep 11 12:05:24 2014 +0200
@@ -13,6 +13,7 @@
 #endif
 
 #include <stddef.h>
+#include <stdio.h>
 
 /**
  * @file listutil.h
@@ -84,17 +85,22 @@
 /**
  *  @brief Read a file into memory.
  *
- * The caller needs to free data
+ * The caller needs to free data. If fptr is not NULL it will
+ * recieve the pointer to the read file structure. The caller
+ * is responsible for closing this.
+ * fptr only needs to be closed and is only valid if the
+ * return value is 0.
  *
  * @param[in] file_name Name of the file.
  * @param[out] data the file content
  * @param[out] size size in bytes of the file content.
  * @param[in] max_size the maximum amount of bytes to read.
+ * @param[out] fptr pointer to recieve the FILE ptr or NULL
  *
  * @return 0 on success an error code otherwise.
  */
 int read_file(const char *file_name, char **data, size_t *size,
-              const size_t max_size);
+              const size_t max_size, FILE **fptr);
 #ifdef __cplusplus
 }
 #endif

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