commit 9c1c0171de2507aa2b8724e6b451c354b88810ba
parent 7f786eb527a18836b3937b1b1c7a47f53edc92c1
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Sun, 16 Aug 2026 17:36:08 +0200
mhd_read_file: corrected doxy, added asserts
Diffstat:
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/mhd2/mhd_read_file.c b/src/mhd2/mhd_read_file.c
@@ -76,6 +76,8 @@ mhd_read_file (int file_fd,
# endif /* HAVE_PREAD */
ssize_t res;
+ mhd_assert (0u != buf_size);
+
*size_filled = 0;
if ((0 > pos_off)
@@ -114,6 +116,8 @@ mhd_read_file (int file_fd,
# endif
ssize_t res;
+ mhd_assert (0u != buf_size);
+
*size_filled = 0;
if ((0 > pos_off)
@@ -155,6 +159,8 @@ mhd_read_file (int file_fd,
DWORD reqReadSize;
DWORD resReadSize;
+ mhd_assert (0u != buf_size);
+
*size_filled = 0;
if ((((intptr_t)-2) == sys_fd)
|| (INVALID_HANDLE_VALUE == w_hndl))
diff --git a/src/mhd2/mhd_read_file.h b/src/mhd2/mhd_read_file.h
@@ -85,12 +85,13 @@ enum mhd_FileReadResult
*
* @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 buf_size the size of the @p buf buffer, must be > 0
* @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 read succeeded (the @a size_filled gets
+ * actually put to the @p buf buffer
+ * @return #mhd_FILE_READ_OK if read succeeded (the @p size_filled gets
* the actual read size),
+ * #mhd_FILE_READ_EOF if @p offset is at the end or after end of file,
* error otherwise
*/
MHD_INTERNAL enum mhd_FileReadResult