[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 13/26: doc/examples: do not use non-literals for printf(
From: |
gnunet |
Subject: |
[libmicrohttpd] 13/26: doc/examples: do not use non-literals for printf() |
Date: |
Mon, 25 Apr 2022 15:08:37 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 28f02d2eaa30c08743d95565fe7404cba17b3955
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sat Apr 23 16:16:22 2022 +0300
doc/examples: do not use non-literals for printf()
---
doc/examples/largepost.c | 18 +++++++++---------
doc/examples/sessions.c | 12 ++++++------
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
};
-const char *askpage =
- "<html><body>\n\
- Upload a file, please!<br>\n\
- There are %u clients uploading at the moment.<br>\n\
- <form action=\"/filepost\" method=\"post\"
enctype=\"multipart/form-data\">\n\
- <input name=\"file\" type=\"file\">\n\
- <input type=\"submit\" value=\" Send \"></form>\n\
- </body></html>";
+#define ASKPAGE \
+ "<html><body>\n" \
+ "Upload a file, please!<br>\n" \
+ "There are %u clients uploading at the moment.<br>\n" \
+ "<form action=\"/filepost\" method=\"post\"
enctype=\"multipart/form-data\">\n" \
+ "<input name=\"file\" type=\"file\">\n" \
+ "<input type=\"submit\" value=\" Send \"></form>\n" \
+ "</body></html>"
const char *busypage =
"<html><body>This server is busy, please try again later.</body></html>";
const char *completepage =
@@ -271,7 +271,7 @@ answer_to_connection (void *cls,
snprintf (buffer,
sizeof (buffer),
- askpage,
+ ASKPAGE,
nr_of_uploading_clients);
return send_page (connection,
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,
struct MHD_Connection *connection)
{
enum MHD_Result ret;
- const char *form = cls;
char *reply;
struct MHD_Response *response;
+ (void) cls; /* Unused */
if (-1 == asprintf (&reply,
- form,
+ MAIN_PAGE,
session->value_1))
{
/* oops */
@@ -381,12 +381,12 @@ fill_v1_v2_form (const void *cls,
struct MHD_Connection *connection)
{
enum MHD_Result ret;
- const char *form = cls;
char *reply;
struct MHD_Response *response;
+ (void) cls; /* Unused */
if (-1 == asprintf (&reply,
- form,
+ SECOND_PAGE,
session->value_1,
session->value_2))
{
@@ -446,8 +446,8 @@ not_found_page (const void *cls,
* List of all pages served by this HTTP server.
*/
static struct Page pages[] = {
- { "/", "text/html", &fill_v1_form, MAIN_PAGE },
- { "/2", "text/html", &fill_v1_v2_form, SECOND_PAGE },
+ { "/", "text/html", &fill_v1_form, NULL },
+ { "/2", "text/html", &fill_v1_v2_form, NULL },
{ "/S", "text/html", &serve_simple_form, SUBMIT_PAGE },
{ "/F", "text/html", &serve_simple_form, LAST_PAGE },
{ 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 =
<input type=\"submit\" value=\" Send \"></form>\
</body></html>";
-const char *greetingpage =
- "<html><body><h1>Welcome, %s!</center></h1></body></html>";
+#define GREETINGPAGE \
+ "<html><body><h1>Welcome, %s!</center></h1></body></html>"
const char *errorpage =
"<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,
if (! answerstring)
return MHD_NO;
- snprintf (answerstring, MAXANSWERSIZE, greetingpage, data);
+ snprintf (answerstring, MAXANSWERSIZE, GREETINGPAGE, data);
con_info->answerstring = answerstring;
}
else
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (a3ce7049 -> 0179be6c), gnunet, 2022/04/25
- [libmicrohttpd] 03/26: autoinit_funcs.h: added functions prototypes, gnunet, 2022/04/25
- [libmicrohttpd] 02/26: daemon.c: added prototypes for non-static functions, gnunet, 2022/04/25
- [libmicrohttpd] 04/26: autoinit_funcs.h: improved formatting, gnunet, 2022/04/25
- [libmicrohttpd] 01/26: MHD_start_daemon: simplified logic for AUTO flags, gnunet, 2022/04/25
- [libmicrohttpd] 06/26: websocket_threaded_example: mark function as static, gnunet, 2022/04/25
- [libmicrohttpd] 07/26: basicauth: very minor optimisaion, gnunet, 2022/04/25
- [libmicrohttpd] 05/26: Fixed old-style functions definitions, gnunet, 2022/04/25
- [libmicrohttpd] 13/26: doc/examples: do not use non-literals for printf(),
gnunet <=
- [libmicrohttpd] 19/26: md5.c: muted compiler alignment warnings, gnunet, 2022/04/25
- [libmicrohttpd] 10/26: microhttpd2.h: fixed code style, gnunet, 2022/04/25
- [libmicrohttpd] 11/26: test_shutdown_select: fixed code style, gnunet, 2022/04/25
- [libmicrohttpd] 08/26: configure: changed warning compiler flags, gnunet, 2022/04/25
- [libmicrohttpd] 14/26: doc/examples: improved formatting, gnunet, 2022/04/25
- [libmicrohttpd] 12/26: src/examples: fixed printf format specifiers, gnunet, 2022/04/25
- [libmicrohttpd] 15/26: doc/examples: avoid usage of unportable functions, gnunet, 2022/04/25
- [libmicrohttpd] 09/26: Fixed many macros, gnunet, 2022/04/25
- [libmicrohttpd] 20/26: sha256.c: fixed coding style, gnunet, 2022/04/25
- [libmicrohttpd] 26/26: test_postprocessor: fixed typo, gnunet, 2022/04/25