commit 4b6419b1f3a9e89dbcafaf31eaf611455e6a207a
parent 85775e29a91f2bd643803c2696758f6c9c90bf72
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date: Tue, 19 Apr 2022 20:21:52 +0300
doc/examples: Fixed drop of 'const' qualifiers
Diffstat:
7 files changed, 12 insertions(+), 31 deletions(-)
diff --git a/doc/examples/basicauthentication.c b/doc/examples/basicauthentication.c
@@ -54,9 +54,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
if (fail)
{
const char *page = "<html><body>Go away.</body></html>";
- response =
- MHD_create_response_from_buffer (strlen (page), (void *) page,
- MHD_RESPMEM_PERSISTENT);
+ response = MHD_create_response_from_buffer_static (strlen (page), page);
ret = MHD_queue_basic_auth_fail_response (connection,
"my realm",
response);
@@ -64,9 +62,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
else
{
const char *page = "<html><body>A secret.</body></html>";
- response =
- MHD_create_response_from_buffer (strlen (page), (void *) page,
- MHD_RESPMEM_PERSISTENT);
+ response = MHD_create_response_from_buffer_static (strlen (page), page);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
}
MHD_destroy_response (response);
diff --git a/doc/examples/hellobrowser.c b/doc/examples/hellobrowser.c
@@ -31,9 +31,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
(void) upload_data_size; /* Unused. Silent compiler warning. */
(void) req_cls; /* Unused. Silent compiler warning. */
- response =
- MHD_create_response_from_buffer (strlen (page), (void *) page,
- MHD_RESPMEM_PERSISTENT);
+ response = MHD_create_response_from_buffer_static (strlen (page), page);
ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
MHD_destroy_response (response);
diff --git a/doc/examples/largepost.c b/doc/examples/largepost.c
@@ -98,10 +98,7 @@ send_page (struct MHD_Connection *connection,
enum MHD_Result ret;
struct MHD_Response *response;
- response =
- MHD_create_response_from_buffer (strlen (page),
- (void *) page,
- MHD_RESPMEM_MUST_COPY);
+ response = MHD_create_response_from_buffer_static (strlen (page), page);
if (! response)
return MHD_NO;
MHD_add_response_header (response,
diff --git a/doc/examples/responseheaders.c b/doc/examples/responseheaders.c
@@ -49,9 +49,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
if (fd != -1)
(void) close (fd);
response =
- MHD_create_response_from_buffer (strlen (errorstr),
- (void *) errorstr,
- MHD_RESPMEM_PERSISTENT);
+ MHD_create_response_from_buffer_static (strlen (errorstr), errorstr);
if (NULL != response)
{
ret =
diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c
@@ -311,9 +311,7 @@ serve_simple_form (const void *cls,
struct MHD_Response *response;
/* return static form */
- response = MHD_create_response_from_buffer (strlen (form),
- (void *) form,
- MHD_RESPMEM_PERSISTENT);
+ response = MHD_create_response_from_buffer_static (strlen (form), form);
add_session_cookie (session, response);
MHD_add_response_header (response,
MHD_HTTP_HEADER_CONTENT_ENCODING,
@@ -431,9 +429,8 @@ not_found_page (const void *cls,
(void) session; /* Unused. Silent compiler warning. */
/* unsupported HTTP method */
- response = MHD_create_response_from_buffer (strlen (NOT_FOUND_ERROR),
- (void *) NOT_FOUND_ERROR,
- MHD_RESPMEM_PERSISTENT);
+ response = MHD_create_response_from_buffer_static (strlen (NOT_FOUND_ERROR),
+ NOT_FOUND_ERROR);
ret = MHD_queue_response (connection,
MHD_HTTP_NOT_FOUND,
response);
@@ -651,9 +648,8 @@ create_response (void *cls,
return ret;
}
/* unsupported HTTP method */
- response = MHD_create_response_from_buffer (strlen (METHOD_ERROR),
- (void *) METHOD_ERROR,
- MHD_RESPMEM_PERSISTENT);
+ response = MHD_create_response_from_buffer_static (strlen (METHOD_ERROR),
+ METHOD_ERROR);
ret = MHD_queue_response (connection,
MHD_HTTP_NOT_ACCEPTABLE,
response);
diff --git a/doc/examples/simplepost.c b/doc/examples/simplepost.c
@@ -55,9 +55,7 @@ send_page (struct MHD_Connection *connection, const char *page)
struct MHD_Response *response;
- response =
- MHD_create_response_from_buffer (strlen (page), (void *) page,
- MHD_RESPMEM_PERSISTENT);
+ response = MHD_create_response_from_buffer_static (strlen (page), page);
if (! response)
return MHD_NO;
diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c
@@ -208,9 +208,7 @@ secret_page (struct MHD_Connection *connection)
struct MHD_Response *response;
const char *page = "<html><body>A secret.</body></html>";
- response =
- MHD_create_response_from_buffer (strlen (page), (void *) page,
- MHD_RESPMEM_PERSISTENT);
+ response = MHD_create_response_from_buffer_static (strlen (page), page);
if (! response)
return MHD_NO;