commit 0fd07156b15e4e9ecd39fa01c0a2d3177a5fd275
parent ddd450e0e0d50ea308f4220f04ee7e0b4bb87e20
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Sat, 27 Jun 2026 23:03:42 +0200
mhd_read_file(): improved, fixed and de-duplicated doxy
Diffstat:
2 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/src/mhd2/mhd_read_file.c b/src/mhd2/mhd_read_file.c
@@ -59,18 +59,7 @@
# include <string.h> /* for memset() */
# include <io.h> /* for _get_osfhandle() */
#endif
-/**
- * Read data from the file to the provided buffer
- *
- * @param file_fd the FD of file to read
- * @param buf_size the size of the @a buf buffer
- * @param[out] buf the buffer to fill with the read data
- * @param[out] size_filled the pointer to variable to get the size of the data
- * actually put to the @a buffer
- * @return #mhd_FILE_READ_OK if succeed (the @a size_filled gets the actual
- * read size),
- * error otherwise
- */
+
MHD_INTERNAL MHD_FN_MUST_CHECK_RESULT_ MHD_FN_PAR_NONNULL_ALL_
MHD_FN_PAR_OUT_SIZE_ (4, 3) MHD_FN_PAR_OUT_ (5) enum mhd_FileReadResult
mhd_read_file (int file_fd,
diff --git a/src/mhd2/mhd_read_file.h b/src/mhd2/mhd_read_file.h
@@ -77,15 +77,20 @@ enum mhd_FileReadResult
/**
- * Read data from the file to the provided buffer
+ * Perform one iteration of data reading from the file to the provided buffer.
+ *
+ * This function may read the file completely or just some part of it -- the
+ * amount is not controlled. Whatever is provided by the OS on a single file
+ * read operation is returned.
*
* @param file_fd the FD of file to read
+ * @param offset the offset in the file to read from
* @param buf_size the size of the @a buf buffer
* @param[out] buf the buffer to fill with the read data
* @param[out] size_filled the pointer to variable to get the size of the data
* actually put to the @a buffer
- * @return #mhd_FILE_READ_OK if succeed (the @a size_filled gets the actual
- * read size),
+ * @return #mhd_FILE_READ_OK if read succeeded (the @a size_filled gets
+ * the actual read size),
* error otherwise
*/
MHD_INTERNAL enum mhd_FileReadResult