diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-04-23 16:16:22 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2022-04-23 16:16:22 +0300 |
commit | 28f02d2eaa30c08743d95565fe7404cba17b3955 (patch) | |
tree | ee233f5b2a5db452682034eb43da3f6652389f80 | |
parent | d1c74589fba965e9e1f5fc1479a3a3d5a4cfe00a (diff) | |
download | libmicrohttpd-28f02d2eaa30c08743d95565fe7404cba17b3955.tar.gz libmicrohttpd-28f02d2eaa30c08743d95565fe7404cba17b3955.zip |
doc/examples: do not use non-literals for printf()
-rw-r--r-- | doc/examples/largepost.c | 18 | ||||
-rw-r--r-- | doc/examples/sessions.c | 12 | ||||
-rw-r--r-- | doc/examples/simplepost.c | 6 |
3 files changed, 18 insertions, 18 deletions
diff --git a/doc/examples/largepost.c b/doc/examples/largepost.c index 6cfaf833..da9c1c56 100644 --- a/doc/examples/largepost.c +++ b/doc/examples/largepost.c | |||
@@ -66,14 +66,14 @@ struct connection_info_struct | |||
66 | }; | 66 | }; |
67 | 67 | ||
68 | 68 | ||
69 | const char *askpage = | 69 | #define ASKPAGE \ |
70 | "<html><body>\n\ | 70 | "<html><body>\n" \ |
71 | Upload a file, please!<br>\n\ | 71 | "Upload a file, please!<br>\n" \ |
72 | There are %u clients uploading at the moment.<br>\n\ | 72 | "There are %u clients uploading at the moment.<br>\n" \ |
73 | <form action=\"/filepost\" method=\"post\" enctype=\"multipart/form-data\">\n\ | 73 | "<form action=\"/filepost\" method=\"post\" enctype=\"multipart/form-data\">\n" \ |
74 | <input name=\"file\" type=\"file\">\n\ | 74 | "<input name=\"file\" type=\"file\">\n" \ |
75 | <input type=\"submit\" value=\" Send \"></form>\n\ | 75 | "<input type=\"submit\" value=\" Send \"></form>\n" \ |
76 | </body></html>"; | 76 | "</body></html>" |
77 | const char *busypage = | 77 | const char *busypage = |
78 | "<html><body>This server is busy, please try again later.</body></html>"; | 78 | "<html><body>This server is busy, please try again later.</body></html>"; |
79 | const char *completepage = | 79 | const char *completepage = |
@@ -271,7 +271,7 @@ answer_to_connection (void *cls, | |||
271 | 271 | ||
272 | snprintf (buffer, | 272 | snprintf (buffer, |
273 | sizeof (buffer), | 273 | sizeof (buffer), |
274 | askpage, | 274 | ASKPAGE, |
275 | nr_of_uploading_clients); | 275 | nr_of_uploading_clients); |
276 | return send_page (connection, | 276 | return send_page (connection, |
277 | buffer, | 277 | buffer, |
diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c index 5b4d4b45..fc4a498c 100644 --- a/doc/examples/sessions.c +++ b/doc/examples/sessions.c | |||
@@ -339,12 +339,12 @@ fill_v1_form (const void *cls, | |||
339 | struct MHD_Connection *connection) | 339 | struct MHD_Connection *connection) |
340 | { | 340 | { |
341 | enum MHD_Result ret; | 341 | enum MHD_Result ret; |
342 | const char *form = cls; | ||
343 | char *reply; | 342 | char *reply; |
344 | struct MHD_Response *response; | 343 | struct MHD_Response *response; |
344 | (void) cls; /* Unused */ | ||
345 | 345 | ||
346 | if (-1 == asprintf (&reply, | 346 | if (-1 == asprintf (&reply, |
347 | form, | 347 | MAIN_PAGE, |
348 | session->value_1)) | 348 | session->value_1)) |
349 | { | 349 | { |
350 | /* oops */ | 350 | /* oops */ |
@@ -381,12 +381,12 @@ fill_v1_v2_form (const void *cls, | |||
381 | struct MHD_Connection *connection) | 381 | struct MHD_Connection *connection) |
382 | { | 382 | { |
383 | enum MHD_Result ret; | 383 | enum MHD_Result ret; |
384 | const char *form = cls; | ||
385 | char *reply; | 384 | char *reply; |
386 | struct MHD_Response *response; | 385 | struct MHD_Response *response; |
386 | (void) cls; /* Unused */ | ||
387 | 387 | ||
388 | if (-1 == asprintf (&reply, | 388 | if (-1 == asprintf (&reply, |
389 | form, | 389 | SECOND_PAGE, |
390 | session->value_1, | 390 | session->value_1, |
391 | session->value_2)) | 391 | session->value_2)) |
392 | { | 392 | { |
@@ -446,8 +446,8 @@ not_found_page (const void *cls, | |||
446 | * List of all pages served by this HTTP server. | 446 | * List of all pages served by this HTTP server. |
447 | */ | 447 | */ |
448 | static struct Page pages[] = { | 448 | static struct Page pages[] = { |
449 | { "/", "text/html", &fill_v1_form, MAIN_PAGE }, | 449 | { "/", "text/html", &fill_v1_form, NULL }, |
450 | { "/2", "text/html", &fill_v1_v2_form, SECOND_PAGE }, | 450 | { "/2", "text/html", &fill_v1_v2_form, NULL }, |
451 | { "/S", "text/html", &serve_simple_form, SUBMIT_PAGE }, | 451 | { "/S", "text/html", &serve_simple_form, SUBMIT_PAGE }, |
452 | { "/F", "text/html", &serve_simple_form, LAST_PAGE }, | 452 | { "/F", "text/html", &serve_simple_form, LAST_PAGE }, |
453 | { NULL, NULL, ¬_found_page, NULL } /* 404 */ | 453 | { NULL, NULL, ¬_found_page, NULL } /* 404 */ |
diff --git a/doc/examples/simplepost.c b/doc/examples/simplepost.c index 0faa0948..52146ce3 100644 --- a/doc/examples/simplepost.c +++ b/doc/examples/simplepost.c | |||
@@ -41,8 +41,8 @@ const char *askpage = | |||
41 | <input type=\"submit\" value=\" Send \"></form>\ | 41 | <input type=\"submit\" value=\" Send \"></form>\ |
42 | </body></html>"; | 42 | </body></html>"; |
43 | 43 | ||
44 | const char *greetingpage = | 44 | #define GREETINGPAGE \ |
45 | "<html><body><h1>Welcome, %s!</center></h1></body></html>"; | 45 | "<html><body><h1>Welcome, %s!</center></h1></body></html>" |
46 | 46 | ||
47 | const char *errorpage = | 47 | const char *errorpage = |
48 | "<html><body>This doesn't seem to be right.</body></html>"; | 48 | "<html><body>This doesn't seem to be right.</body></html>"; |
@@ -88,7 +88,7 @@ iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key, | |||
88 | if (! answerstring) | 88 | if (! answerstring) |
89 | return MHD_NO; | 89 | return MHD_NO; |
90 | 90 | ||
91 | snprintf (answerstring, MAXANSWERSIZE, greetingpage, data); | 91 | snprintf (answerstring, MAXANSWERSIZE, GREETINGPAGE, data); |
92 | con_info->answerstring = answerstring; | 92 | con_info->answerstring = answerstring; |
93 | } | 93 | } |
94 | else | 94 | else |