[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 04/09: test_postprocessor{,_amp,_large}: fixed compiler
From: |
gnunet |
Subject: |
[libmicrohttpd] 04/09: test_postprocessor{,_amp,_large}: fixed compiler warnings, fixed extra-long strings |
Date: |
Mon, 13 Jun 2022 20:28:35 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 9f805215338dd421d55aa8f51596359696562a0e
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Mon Jun 13 21:24:51 2022 +0300
test_postprocessor{,_amp,_large}: fixed compiler warnings, fixed extra-long
strings
---
src/microhttpd/test_postprocessor.c | 38 ++++++++++++++++---------
src/microhttpd/test_postprocessor_amp.c | 47 +++++++++++++++++++++++++++++--
src/microhttpd/test_postprocessor_large.c | 6 ++--
3 files changed, 72 insertions(+), 19 deletions(-)
diff --git a/src/microhttpd/test_postprocessor.c
b/src/microhttpd/test_postprocessor.c
index 9a5977bc..ab68541b 100644
--- a/src/microhttpd/test_postprocessor.c
+++ b/src/microhttpd/test_postprocessor.c
@@ -87,14 +87,24 @@ struct expResult exp_results[] = {
#define URL_ENC_END (URL_ENC_START + 4)
{NULL, NULL, NULL, NULL, NULL},
#define FORM_DATA \
- "--AaB03x\r\ncontent-disposition: form-data; name=\"field1\"\r\n\r\nJoe
Blow\r\n--AaB03x\r\ncontent-disposition: form-data; name=\"pics\";
filename=\"file1.txt\"\r\nContent-Type:
text/plain\r\nContent-Transfer-Encoding:
binary\r\n\r\nfiledata\r\n--AaB03x--\r\n"
+ "--AaB03x\r\ncontent-disposition: form-data; name=\"field1\"\r\n\r\n" \
+ "Joe Blow\r\n--AaB03x\r\ncontent-disposition: form-data; name=\"pics\";" \
+ " filename=\"file1.txt\"\r\nContent-Type: text/plain\r\n" \
+ "Content-Transfer-Encoding: binary\r\n\r\nfiledata\r\n--AaB03x--\r\n"
#define FORM_START (URL_ENC_END + 1)
{"field1", NULL, NULL, NULL, "Joe Blow"},
{"pics", "file1.txt", "text/plain", "binary", "filedata"},
#define FORM_END (FORM_START + 2)
{NULL, NULL, NULL, NULL, NULL},
#define FORM_NESTED_DATA \
- "--AaB03x\r\ncontent-disposition: form-data; name=\"field1\"\r\n\r\nJane
Blow\r\n--AaB03x\r\ncontent-disposition: form-data;
name=\"pics\"\r\nContent-type: multipart/mixed,
boundary=BbC04y\r\n\r\n--BbC04y\r\nContent-disposition: attachment;
filename=\"file1.txt\"\r\nContent-Type:
text/plain\r\n\r\nfiledata1\r\n--BbC04y\r\nContent-disposition: attachment;
filename=\"file2.gif\"\r\nContent-type: image/gif\r\nContent-Transfer-Encoding:
binary\r\n\r\nfiledata2\r\n--BbC04y--\r\n--AaB03x--"
+ "--AaB03x\r\ncontent-disposition: form-data; name=\"field1\"\r\n\r\n" \
+ "Jane Blow\r\n--AaB03x\r\ncontent-disposition: form-data; name=\"pics\"\r\n"
\
+ "Content-type: multipart/mixed, boundary=BbC04y\r\n\r\n--BbC04y\r\n" \
+ "Content-disposition: attachment; filename=\"file1.txt\"\r\n" \
+ "Content-Type: text/plain\r\n\r\nfiledata1\r\n--BbC04y\r\n" \
+ "Content-disposition: attachment; filename=\"file2.gif\"\r\n" \
+ "Content-type: image/gif\r\nContent-Transfer-Encoding: binary\r\n\r\n" \
+ "filedata2\r\n--BbC04y--\r\n--AaB03x--"
#define FORM_NESTED_START (FORM_END + 1)
{"field1", NULL, NULL, NULL, "Jane Blow"},
{"pics", "file1.txt", "text/plain", NULL, "filedata1"},
@@ -210,13 +220,13 @@ value_checker (void *cls,
}
-static int
+static unsigned int
test_urlencoding_case (unsigned int want_start,
unsigned int want_end,
const char *url_data)
{
size_t step;
- int errors = 0;
+ unsigned int errors = 0;
const size_t size = strlen (url_data);
for (step = 1; size >= step; ++step)
@@ -278,7 +288,7 @@ test_urlencoding_case (unsigned int want_start,
}
-static int
+static unsigned int
test_urlencoding (void)
{
unsigned int errorCount = 0;
@@ -357,7 +367,7 @@ test_urlencoding (void)
}
-static int
+static unsigned int
test_multipart_garbage (void)
{
struct MHD_Connection connection;
@@ -425,7 +435,7 @@ test_multipart_garbage (void)
}
-static int
+static unsigned int
test_multipart_splits (void)
{
struct MHD_Connection connection;
@@ -487,7 +497,7 @@ test_multipart_splits (void)
}
-static int
+static unsigned int
test_multipart (void)
{
struct MHD_Connection connection;
@@ -544,7 +554,7 @@ test_multipart (void)
}
-static int
+static unsigned int
test_nested_multipart (void)
{
struct MHD_Connection connection;
@@ -619,8 +629,8 @@ value_checker2 (void *cls,
}
-static int
-test_overflow ()
+static unsigned int
+test_overflow (void)
{
struct MHD_Connection connection;
struct MHD_HTTP_Req_Header header;
@@ -675,7 +685,7 @@ test_overflow ()
}
-static int
+static unsigned int
test_empty_key (void)
{
const char form_data[] = "=abcdef";
@@ -726,7 +736,7 @@ test_empty_key (void)
}
-static int
+static unsigned int
test_double_value (void)
{
const char form_data[] = URL_DATA "=abcdef";
@@ -822,5 +832,5 @@ main (int argc, char *const *argv)
errorCount += test_overflow ();
if (errorCount != 0)
fprintf (stderr, "Error (code: %u)\n", errorCount);
- return errorCount != 0; /* 0 == pass */
+ return (errorCount == 0) ? 0 : 1; /* 0 == pass */
}
diff --git a/src/microhttpd/test_postprocessor_amp.c
b/src/microhttpd/test_postprocessor_amp.c
index 0569cb1f..c72b85f3 100644
--- a/src/microhttpd/test_postprocessor_amp.c
+++ b/src/microhttpd/test_postprocessor_amp.c
@@ -7,7 +7,7 @@
uint64_t num_errors;
-enum MHD_Result
+static enum MHD_Result
check_post (void *cls, enum MHD_ValueKind kind, const char *key,
const char *filename, const char *content_type,
const char *content_encoding, const char *data,
@@ -32,7 +32,50 @@ main (int argc, char *const *argv)
struct MHD_HTTP_Req_Header header;
struct MHD_PostProcessor *pp;
const char *post =
-
"a=xx+xx+xxx+xxxxx+xxxx+xxxxxxxx+xxx+xxxxxx+xxx+xxx+xxxxxxx+xxxxx%0A+++++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++--%3E%0A++++++++++++++%3Cxxxxx+xxxxx%3D%22xxx%25%22%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%22+xxxxx%3D%22xxxxx%22%3E%0A+++++++++++++++++++%3Cxxxxx+xxxxx%3D%22xxx%25%22%3E%0A+++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++++++++++++++%3Cxx+xxxxx%3D%22xxxx%22%3E%0A+++++++++++++++++++++++++++++++%3Cx
[...]
+ "a=xx+xx+xxx+xxxxx+xxxx+xxxxxxxx+xxx+xxxxxx+xxx+xxx+xxxxxxx+xxxxx%0A+++"
+ "++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+ "xxxxxxxxxxxxxx%0A+++++++--%3E%0A++++++++++++++%3Cxxxxx+xxxxx%3D%22xxx%"
+ "25%22%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%2"
+ "2+xxxxx%3D%22xxxxx%22%3E%0A+++++++++++++++++++%3Cxxxxx+xxxxx%3D%22xxx%"
+ "25%22%3E%0A+++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++++++++++++"
+ "++%3Cxx+xxxxx%3D%22xxxx%22%3E%0A+++++++++++++++++++++++++++++++%3Cx+xx"
+ "xxx%3D%22xxxx-xxxxx%3Axxxxx%22%3Exxxxx%3A%3C%2Fx%3E%0A%0A+++++++++++++"
+ "++++++++++++++++++%3Cx+xxxxx%3D%22xxxx-xxxxx%3Axxxxx%22%3Exxx%3A%3C%2F"
+ "x%3E%0A%0A+++++++++++++++++++++++++++++++%3Cx+xxxxx%3D%22xxxx-xxxxx%3A"
+ "xxxxx%3B+xxxx-xxxxxx%3A+xxxx%3B%22%3Exxxxx+xxxxx%3A%3C%2Fx%3E%0A++++++"
+ "+++++++++++++++++++++%3C%2Fxx%3E%0A+++++++++++++++++++++++%3C%2Fxx%3E%"
+ "0A+++++++++++++++++++%3C%2Fxxxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++"
+ "++++++++++++%3Cxx+xxxxx%3D%22xxxx-xxxxx%3A+xxxxx%3B+xxxxx%3A+xxxx%22%3"
+ "E%26xxxxx%3B+%3Cxxxx%0A+++++++++++++++++++++++xxxxx%3D%22xxxxxxxxxxxxx"
+ "xx%22%3Exxxx.xx%3C%2Fxxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A++++++++++"
+ "+%3C%2Fxx%3E%0A++++++++++++++++++++++++++%3Cxx%3E%0A++++++++++++++++++"
+ "+%3Cxx+xxxxx%3D%22xxxx-xxxxx%3A+xxxxx%3B+xxxxx%3A+xxxx%22%3E%26xxxxx%3"
+ "B+%3Cxxxx%0A+++++++++++++++++++++++++++xxxxx%3D%22xxxxxxxxxxxxxxx%22%3"
+ "Exxx.xx%3C%2Fxxxx%3E%0A+++++++++++++++++++%3C%2Fxx%3E%0A++++++++++++++"
+ "+%3C%2Fxx%3E%0A++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+x"
+ "xxxx%3D%22xxxx-xxxxx%3A+xxxxx%3Bxxxx-xxxxxx%3A+xxxx%3B+xxxxx%3A+xxxx%2"
+ "2%3E%26xxxxx%3B+%3Cxxxx%0A+++++++++++++++++++++++xxxxx%3D%22xxxxxxxxxx"
+ "xxxxx%22%3Exxxx.xx%3C%2Fxxxx%3E%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A"
+ "+++++++%3C%2Fxxxxx%3E%0A+++++++%3C%21--%0A+++++++xxxxxxxxxxxxxxxxxxxxx"
+ "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++x"
+ "xx+xx+xxxxx+xxxxxxx+xxxxxxx%0A+++++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+ "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++--%3E%0A+++%3"
+ "C%2Fxxx%3E%0A%0A%0A%0A+++%3Cxxx+xxxxx%3D%22xxxxxxxxx%22+xx%3D%22xxxxxx"
+ "xxx%22%3E%3C%2Fxxx%3E%0A%0A+++%3Cxxx+xx%3D%22xxxx%22+xxxxx%3D%22xxxx%2"
+ "2%3E%0A+++++++%3Cxxxxx+xxxxx%3D%22xxxxxxxxx%22%3E%0A+++++++++++%3Cxx%3"
+ "E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%22+xx%3D%22xxxxxxxxxxxxx%22+xx"
+ "xxx%3D%22xxxxxxxxxxxxx%22%3E%0A+++++++++++++++++++%3Cxxx+xx%3D%22xxxxx"
+ "x%22%3E%3C%2Fxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx"
+ "%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xx%3D%22xxxxxxxxxxxxx"
+ "xxxx%22+xxxxx%3D%22xxxxxxxxxxxxxxxxx%22%3E%3C%2Fxx%3E%0A++++++++++++++"
+ "+%3Cxx+xx%3D%22xxxxxxxxxxxxxx%22+xxxxx%3D%22xxxxxxxxxxxxxx%22%3E%0A+++"
+ "++++++++++++++++%3Cxxx+xx%3D%22xxxxxxx%22%3E%3C%2Fxxx%3E%0A+++++++++++"
+ "++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++++++++++%3Cxx%3E%0A+++++"
+ "++++++++++%3Cxx+xxxxxxx%3D%22x%22+xx%3D%22xxxxxxxxxxxxx%22+xxxxx%3D%22"
+ "xxxxxxxxxxxxx%22%3E%0A+++++++++++++++++++%3Cxxx+xx%3D%22xxxxxx%22%3E%3"
+ "C%2Fxxx%3E%0A+++++++++++++++%3C%2Fxx%3E%0A+++++++++++%3C%2Fxx%3E%0A+++"
+ "++++%3C%2Fxxxxx%3E%0A+++%3C%2Fxxx%3E%0A%3C%2Fxxx%3E%0A%0A%3Cxxx+xx%3D%"
+ "22xxxxxx%22%3E%3C%2Fxxx%3E%0A%0A%3C%2Fxxxx%3E%0A%3C%2Fxxxx%3E+&b=value";
(void) argc; (void) argv; /* Unused. Silent compiler warning. */
num_errors = 0;
diff --git a/src/microhttpd/test_postprocessor_large.c
b/src/microhttpd/test_postprocessor_large.c
index 0a821f09..9f7096fa 100644
--- a/src/microhttpd/test_postprocessor_large.c
+++ b/src/microhttpd/test_postprocessor_large.c
@@ -42,7 +42,7 @@ value_checker (void *cls,
const char *transfer_encoding,
const char *data, uint64_t off, size_t size)
{
- unsigned int *pos = cls;
+ size_t *pos = (size_t *) cls;
(void) kind; (void) key; (void) filename; (void) content_type; /* Unused.
Silent compiler warning. */
(void) transfer_encoding; (void) data; (void) off; /* Unused.
Silent compiler warning. */
#if 0
@@ -60,7 +60,7 @@ value_checker (void *cls,
static int
-test_simple_large ()
+test_simple_large (void)
{
struct MHD_Connection connection;
struct MHD_HTTP_Req_Header header;
@@ -69,7 +69,7 @@ test_simple_large ()
size_t delta;
size_t size;
char data[102400];
- unsigned int pos;
+ size_t pos;
pos = 0;
memset (data, 'A', sizeof (data));
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (6884fa83 -> 9668d71f), gnunet, 2022/06/13
- [libmicrohttpd] 04/09: test_postprocessor{,_amp,_large}: fixed compiler warnings, fixed extra-long strings,
gnunet <=
- [libmicrohttpd] 02/09: postprocessor.c: added assert, gnunet, 2022/06/13
- [libmicrohttpd] 03/09: test_postprocessor_md: removed include of .c file, fixed extra long lines, gnunet, 2022/06/13
- [libmicrohttpd] 08/09: test_http_reasons: fixed compiler warnings, gnunet, 2022/06/13
- [libmicrohttpd] 09/09: test_start_stop: fixed compiler warnings, gnunet, 2022/06/13
- [libmicrohttpd] 05/09: test_str: minor refactoring, fixed compiler warnings, gnunet, 2022/06/13
- [libmicrohttpd] 01/09: postprocessor.h: added new internal header, gnunet, 2022/06/13
- [libmicrohttpd] 07/09: test_daemon: fixed compiler warnings, gnunet, 2022/06/13
- [libmicrohttpd] 06/09: test_str_token{,s,s_remove}: fixed compiler warnings, gnunet, 2022/06/13