libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 324e9852db193ead4a319fc4099baf2b0b8c456d
parent 33affa9d1e8d99e469bf63e2af1cf03ebd33b362
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 22 Dec 2013 13:55:17 +0000

-work around compiler warnings

Diffstat:
MChangeLog | 3+++
Msrc/examples/demo.c | 4++--
Msrc/examples/digest_auth_example.c | 28++++++++++++++--------------
Msrc/examples/fileserver_example_external_select.c | 7+++----
Msrc/microhttpd/daemon.c | 3++-
Msrc/microhttpd/digestauth.c | 2+-
6 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,6 @@ +Sun Dec 22 14:54:30 CET 2013 + Adding a few lines to avoid warnings from picky compilers. -CG + Sat Dec 21 17:26:08 CET 2013 Fixed an issue with a missing argument in the postexample. Fixed issue with bogus offset increment involving sendfile diff --git a/src/examples/demo.c b/src/examples/demo.c @@ -258,7 +258,7 @@ list_directory (struct ResponseDataContext *rdc, { if ('.' == de->d_name[0]) continue; - if (sizeof (fullname) <= + if (sizeof (fullname) <= (size_t) snprintf (fullname, sizeof (fullname), "%s/%s", dirname, de->d_name)) @@ -557,7 +557,7 @@ process_upload_data (void *cls, uc->filename = strdup (fn); } if ( (0 != size) && - (size != write (uc->fd, data, size)) ) + (size != (size_t) write (uc->fd, data, size)) ) { /* write failed; likely: disk full */ fprintf (stderr, diff --git a/src/examples/digest_auth_example.c b/src/examples/digest_auth_example.c @@ -47,41 +47,41 @@ ahc_echo (void *cls, int ret; username = MHD_digest_auth_get_username(connection); - if (username == NULL) + if (username == NULL) { - response = MHD_create_response_from_buffer(strlen (DENIED), + response = MHD_create_response_from_buffer(strlen (DENIED), DENIED, - MHD_RESPMEM_PERSISTENT); + MHD_RESPMEM_PERSISTENT); ret = MHD_queue_auth_fail_response(connection, realm, MY_OPAQUE_STR, response, - MHD_NO); - MHD_destroy_response(response); + MHD_NO); + MHD_destroy_response(response); return ret; } ret = MHD_digest_auth_check(connection, realm, - username, - password, + username, + password, 300); free(username); if ( (ret == MHD_INVALID_NONCE) || (ret == MHD_NO) ) { - response = MHD_create_response_from_buffer(strlen (DENIED), + response = MHD_create_response_from_buffer(strlen (DENIED), DENIED, - MHD_RESPMEM_PERSISTENT); - if (NULL == response) + MHD_RESPMEM_PERSISTENT); + if (NULL == response) return MHD_NO; ret = MHD_queue_auth_fail_response(connection, realm, MY_OPAQUE_STR, response, - (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO); - MHD_destroy_response(response); + (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO); + MHD_destroy_response(response); return ret; } response = MHD_create_response_from_buffer(strlen(PAGE), PAGE, MHD_RESPMEM_PERSISTENT); - ret = MHD_queue_response(connection, MHD_HTTP_OK, response); + ret = MHD_queue_response(connection, MHD_HTTP_OK, response); MHD_destroy_response(response); return ret; } @@ -91,7 +91,7 @@ main (int argc, char *const *argv) { int fd; char rnd[8]; - size_t len; + ssize_t len; size_t off; struct MHD_Daemon *d; diff --git a/src/examples/fileserver_example_external_select.c b/src/examples/fileserver_example_external_select.c @@ -134,12 +134,11 @@ main (int argc, char *const *argv) if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max)) break; /* fatal internal error */ if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES) - { - if (tv.tv_sec * 1000 < mhd_timeout) + if (((MHD_UNSIGNED_LONG_LONG)tv.tv_sec) < mhd_timeout / 1000LL) { - tv.tv_sec = mhd_timeout / 1000; - tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000; + tv.tv_sec = mhd_timeout / 1000LL; + tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000LL)) * 1000LL; } } select (max + 1, &rs, &ws, &es, &tv); diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -1878,6 +1878,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon, #endif have_timeout = MHD_NO; + earliest_deadline = 0; /* avoid compiler warnings */ for (pos = daemon->manual_timeout_head; NULL != pos; pos = pos->nextX) { if (0 != pos->connection_timeout) @@ -2457,7 +2458,7 @@ MHD_epoll (struct MHD_Daemon *daemon, #endif return MHD_NO; } - for (i=0;i<num_events;i++) + for (i=0;i<(unsigned int) num_events;i++) { if (NULL == events[i].data.ptr) continue; /* shutdown signal! */ diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c @@ -258,7 +258,7 @@ lookup_sub_value (char *dest, } else { - if (size > (q2 - q1) + 1) + if (size > (size_t) ((q2 - q1) + 1)) size = (q2 - q1) + 1; size--; memcpy (dest,