libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit 2e39679641cff16c0bec1d36d1fbb2954e468882
parent bb5ad73c5fff8c13c10c8e2948af09559f3b397c
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Sun, 27 Apr 2025 13:15:12 +0200

demo.c: fixed compiler warnings

Diffstat:
Msrc/examples2/demo.c | 29+++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/examples2/demo.c b/src/examples2/demo.c @@ -1,7 +1,7 @@ /* This file is part of libmicrohttpd Copyright (C) 2013-2024 Christian Grothoff (and other contributing authors) - Copyright (C) 2014-2022 Evgeny Grin (Karlson2k) + Copyright (C) 2014-2025 Evgeny Grin (Karlson2k) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -316,7 +316,7 @@ list_directory (struct ResponseDataContext *rdc, rdc->buf_size = 2 * rdc->buf_size + 1024; if (NULL == (r = realloc (rdc->buf, rdc->buf_size))) break; /* out of memory */ - rdc->buf = r; + rdc->buf = (char *) r; } res = snprintf (rdc->buf + rdc->off, rdc->buf_size - rdc->off, @@ -354,7 +354,7 @@ update_directory (void) rdc.off = 0; rdc.buf_size = initial_allocation; - rdc.buf = malloc (rdc.buf_size); + rdc.buf = (char *) malloc (rdc.buf_size); if (NULL == rdc.buf) { update_cached_response (NULL); @@ -533,7 +533,7 @@ stream_reader (struct MHD_Request *req, uint_fast64_t off, enum MHD_Bool final_data) { - struct UploadContext *uc = cls; + struct UploadContext *uc = (struct UploadContext *) cls; (void) content_type; /* Unused. Silent compiler warning. */ (void) encoding; /* Unused. Silent compiler warning. */ @@ -660,7 +660,7 @@ static enum MHD_Bool handle_full_upload (void *cls, const struct MHD_PostField *data) { - struct UploadContext *uc = cls; + struct UploadContext *uc = (struct UploadContext *) cls; int fd; if (0 != strcmp ("upload", @@ -721,7 +721,7 @@ done_cb (struct MHD_Request *req, void *cls, enum MHD_PostParseResult parsing_result) { - struct UploadContext *uc = cls; + struct UploadContext *uc = (struct UploadContext *) cls; const struct MHD_UploadAction *ret; const struct MHD_StringNullable *cat; const struct MHD_StringNullable *lang; @@ -1002,7 +1002,7 @@ generate_page (void *cls, { struct UploadContext *uc; - uc = malloc (sizeof (struct UploadContext)); + uc = (struct UploadContext *) malloc (sizeof (struct UploadContext)); if (NULL == uc) return MHD_action_abort_request (request); /* out of memory, close connection */ memset (uc, @@ -1121,34 +1121,31 @@ main (int argc, MHD_response_from_buffer_static ( MHD_HTTP_STATUS_NOT_FOUND, strlen (FILE_NOT_FOUND_PAGE), - (const void *) FILE_NOT_FOUND_PAGE); + FILE_NOT_FOUND_PAGE); mark_as_html (file_not_found_response); if (MHD_SC_OK != MHD_response_set_option (file_not_found_response, - &MHD_R_OPTION_REUSABLE ( - MHD_YES))) + &MHD_R_OPTION_REUSABLE (MHD_YES))) return 1; request_refused_response = MHD_response_from_buffer_static ( MHD_HTTP_STATUS_FORBIDDEN, strlen (REQUEST_REFUSED_PAGE), - (const void *) REQUEST_REFUSED_PAGE); + REQUEST_REFUSED_PAGE); mark_as_html (request_refused_response); if (MHD_SC_OK != MHD_response_set_option (request_refused_response, - &MHD_R_OPTION_REUSABLE ( - MHD_YES))) + &MHD_R_OPTION_REUSABLE (MHD_YES))) return 1; internal_error_response = MHD_response_from_buffer_static ( MHD_HTTP_STATUS_INTERNAL_SERVER_ERROR, strlen (INTERNAL_ERROR_PAGE), - (const void *) INTERNAL_ERROR_PAGE); + INTERNAL_ERROR_PAGE); mark_as_html (internal_error_response); if (MHD_SC_OK != MHD_response_set_option (internal_error_response, - &MHD_R_OPTION_REUSABLE ( - MHD_YES))) + &MHD_R_OPTION_REUSABLE (MHD_YES))) return 1; update_directory (); d = MHD_daemon_create (&generate_page,