diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-02-08 14:09:04 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-02-08 14:09:04 +0000 |
commit | 5ae9cc7f06276fe004b13d2138fbb70ecb2f4365 (patch) | |
tree | d6a17f6ab83d10f7b5e114a66aa5bad09c83d24a /src | |
parent | a4e4998a2994619eb5fcb75b623e882f775906d9 (diff) | |
download | libmicrohttpd-5ae9cc7f06276fe004b13d2138fbb70ecb2f4365.tar.gz libmicrohttpd-5ae9cc7f06276fe004b13d2138fbb70ecb2f4365.zip |
size_t vs. int fixes by Evgeny Grin, plus some additional fixes by CG
Diffstat (limited to 'src')
-rw-r--r-- | src/microhttpd/connection.c | 14 | ||||
-rw-r--r-- | src/microhttpd/digestauth.c | 16 | ||||
-rw-r--r-- | src/microhttpd/internal.h | 6 |
3 files changed, 18 insertions, 18 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 684c5b01..65ea70fe 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -396,7 +396,7 @@ try_ready_chunked_body (struct MHD_Connection *connection) | |||
396 | struct MHD_Response *response; | 396 | struct MHD_Response *response; |
397 | size_t size; | 397 | size_t size; |
398 | char cbuf[10]; /* 10: max strlen of "%x\r\n" */ | 398 | char cbuf[10]; /* 10: max strlen of "%x\r\n" */ |
399 | int cblen; | 399 | size_t cblen; |
400 | 400 | ||
401 | response = connection->response; | 401 | response = connection->response; |
402 | if (0 == connection->write_buffer_size) | 402 | if (0 == connection->write_buffer_size) |
@@ -1491,7 +1491,7 @@ process_request_body (struct MHD_Connection *connection) | |||
1491 | 1491 | ||
1492 | if (available > 0) | 1492 | if (available > 0) |
1493 | instant_retry = MHD_YES; | 1493 | instant_retry = MHD_YES; |
1494 | if (connection->current_chunk_size == 0) | 1494 | if (0 == connection->current_chunk_size) |
1495 | { | 1495 | { |
1496 | connection->remaining_upload_size = 0; | 1496 | connection->remaining_upload_size = 0; |
1497 | break; | 1497 | break; |
@@ -1625,7 +1625,7 @@ do_read (struct MHD_Connection *connection) | |||
1625 | static int | 1625 | static int |
1626 | do_write (struct MHD_Connection *connection) | 1626 | do_write (struct MHD_Connection *connection) |
1627 | { | 1627 | { |
1628 | int ret; | 1628 | ssize_t ret; |
1629 | size_t max; | 1629 | size_t max; |
1630 | 1630 | ||
1631 | max = connection->write_buffer_append_offset - connection->write_buffer_send_offset; | 1631 | max = connection->write_buffer_append_offset - connection->write_buffer_send_offset; |
@@ -1643,7 +1643,7 @@ do_write (struct MHD_Connection *connection) | |||
1643 | if (0 != (connection->daemon->options & MHD_USE_SSL)) | 1643 | if (0 != (connection->daemon->options & MHD_USE_SSL)) |
1644 | MHD_DLOG (connection->daemon, | 1644 | MHD_DLOG (connection->daemon, |
1645 | "Failed to send data: %s\n", | 1645 | "Failed to send data: %s\n", |
1646 | gnutls_strerror (ret)); | 1646 | gnutls_strerror ((int) ret)); |
1647 | else | 1647 | else |
1648 | #endif | 1648 | #endif |
1649 | MHD_DLOG (connection->daemon, | 1649 | MHD_DLOG (connection->daemon, |
@@ -1994,7 +1994,7 @@ int | |||
1994 | MHD_connection_handle_write (struct MHD_Connection *connection) | 1994 | MHD_connection_handle_write (struct MHD_Connection *connection) |
1995 | { | 1995 | { |
1996 | struct MHD_Response *response; | 1996 | struct MHD_Response *response; |
1997 | int ret; | 1997 | ssize_t ret; |
1998 | 1998 | ||
1999 | update_last_activity (connection); | 1999 | update_last_activity (connection); |
2000 | while (1) | 2000 | while (1) |
@@ -2035,7 +2035,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection) | |||
2035 | #if DEBUG_SEND_DATA | 2035 | #if DEBUG_SEND_DATA |
2036 | FPRINTF (stderr, | 2036 | FPRINTF (stderr, |
2037 | "Sent 100 continue response: `%.*s'\n", | 2037 | "Sent 100 continue response: `%.*s'\n", |
2038 | ret, | 2038 | (int) ret, |
2039 | &HTTP_100_CONTINUE[connection->continue_message_write_offset]); | 2039 | &HTTP_100_CONTINUE[connection->continue_message_write_offset]); |
2040 | #endif | 2040 | #endif |
2041 | connection->continue_message_write_offset += ret; | 2041 | connection->continue_message_write_offset += ret; |
@@ -2072,7 +2072,7 @@ MHD_connection_handle_write (struct MHD_Connection *connection) | |||
2072 | if (ret > 0) | 2072 | if (ret > 0) |
2073 | FPRINTF (stderr, | 2073 | FPRINTF (stderr, |
2074 | "Sent DATA response: `%.*s'\n", | 2074 | "Sent DATA response: `%.*s'\n", |
2075 | ret, | 2075 | (int) ret, |
2076 | &response->data[connection->response_write_position - | 2076 | &response->data[connection->response_write_position - |
2077 | response->data_start]); | 2077 | response->data_start]); |
2078 | #endif | 2078 | #endif |
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c index 87a2570e..3250b1a8 100644 --- a/src/microhttpd/digestauth.c +++ b/src/microhttpd/digestauth.c | |||
@@ -201,7 +201,7 @@ digest_calc_response (const char *ha1, | |||
201 | * @param key key to look up in data | 201 | * @param key key to look up in data |
202 | * @return size of the located value, 0 if otherwise | 202 | * @return size of the located value, 0 if otherwise |
203 | */ | 203 | */ |
204 | static int | 204 | static size_t |
205 | lookup_sub_value (char *dest, | 205 | lookup_sub_value (char *dest, |
206 | size_t size, | 206 | size_t size, |
207 | const char *data, | 207 | const char *data, |
@@ -381,7 +381,7 @@ MHD_digest_auth_get_username(struct MHD_Connection *connection) | |||
381 | * @param nonce_time The amount of time in seconds for a nonce to be invalid | 381 | * @param nonce_time The amount of time in seconds for a nonce to be invalid |
382 | * @param method HTTP method | 382 | * @param method HTTP method |
383 | * @param rnd A pointer to a character array for the random seed | 383 | * @param rnd A pointer to a character array for the random seed |
384 | * @param rnd_size The size of the random seed array | 384 | * @param rnd_size The size of the random seed array @a rnd |
385 | * @param uri HTTP URI (in MHD, without the arguments ("?k=v") | 385 | * @param uri HTTP URI (in MHD, without the arguments ("?k=v") |
386 | * @param realm A string of characters that describes the realm of auth. | 386 | * @param realm A string of characters that describes the realm of auth. |
387 | * @param nonce A pointer to a character array for the nonce to put in | 387 | * @param nonce A pointer to a character array for the nonce to put in |
@@ -390,7 +390,7 @@ static void | |||
390 | calculate_nonce (uint32_t nonce_time, | 390 | calculate_nonce (uint32_t nonce_time, |
391 | const char *method, | 391 | const char *method, |
392 | const char *rnd, | 392 | const char *rnd, |
393 | unsigned int rnd_size, | 393 | size_t rnd_size, |
394 | const char *uri, | 394 | const char *uri, |
395 | const char *realm, | 395 | const char *realm, |
396 | char *nonce) | 396 | char *nonce) |
@@ -407,14 +407,14 @@ calculate_nonce (uint32_t nonce_time, | |||
407 | timestamp[3] = (nonce_time & 0x000000ff); | 407 | timestamp[3] = (nonce_time & 0x000000ff); |
408 | MD5Update (&md5, timestamp, 4); | 408 | MD5Update (&md5, timestamp, 4); |
409 | MD5Update (&md5, ":", 1); | 409 | MD5Update (&md5, ":", 1); |
410 | MD5Update (&md5, method, strlen(method)); | 410 | MD5Update (&md5, method, strlen (method)); |
411 | MD5Update (&md5, ":", 1); | 411 | MD5Update (&md5, ":", 1); |
412 | if (rnd_size > 0) | 412 | if (rnd_size > 0) |
413 | MD5Update (&md5, rnd, rnd_size); | 413 | MD5Update (&md5, rnd, rnd_size); |
414 | MD5Update (&md5, ":", 1); | 414 | MD5Update (&md5, ":", 1); |
415 | MD5Update (&md5, uri, strlen(uri)); | 415 | MD5Update (&md5, uri, strlen (uri)); |
416 | MD5Update (&md5, ":", 1); | 416 | MD5Update (&md5, ":", 1); |
417 | MD5Update (&md5, realm, strlen(realm)); | 417 | MD5Update (&md5, realm, strlen (realm)); |
418 | MD5Final (tmpnonce, &md5); | 418 | MD5Final (tmpnonce, &md5); |
419 | cvthex (tmpnonce, sizeof (tmpnonce), nonce); | 419 | cvthex (tmpnonce, sizeof (tmpnonce), nonce); |
420 | cvthex (timestamp, 4, timestamphex); | 420 | cvthex (timestamp, 4, timestamphex); |
@@ -429,8 +429,8 @@ calculate_nonce (uint32_t nonce_time, | |||
429 | * @param connection the connection | 429 | * @param connection the connection |
430 | * @param key the key | 430 | * @param key the key |
431 | * @param value the value, can be NULL | 431 | * @param value the value, can be NULL |
432 | * @return MHD_YES if the key-value pair is in the headers, | 432 | * @return #MHD_YES if the key-value pair is in the headers, |
433 | * MHD_NO if not | 433 | * #MHD_NO if not |
434 | */ | 434 | */ |
435 | static int | 435 | static int |
436 | test_header (struct MHD_Connection *connection, | 436 | test_header (struct MHD_Connection *connection, |
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h index 9d50de25..95297087 100644 --- a/src/microhttpd/internal.h +++ b/src/microhttpd/internal.h | |||
@@ -782,13 +782,13 @@ struct MHD_Connection | |||
782 | * otherwise, this is the size of the current chunk. A value of | 782 | * otherwise, this is the size of the current chunk. A value of |
783 | * zero is also used when we're at the end of the chunks. | 783 | * zero is also used when we're at the end of the chunks. |
784 | */ | 784 | */ |
785 | unsigned int current_chunk_size; | 785 | size_t current_chunk_size; |
786 | 786 | ||
787 | /** | 787 | /** |
788 | * If we are receiving with chunked encoding, where are we currently | 788 | * If we are receiving with chunked encoding, where are we currently |
789 | * with respect to the current chunk (at what offset / position)? | 789 | * with respect to the current chunk (at what offset / position)? |
790 | */ | 790 | */ |
791 | unsigned int current_chunk_offset; | 791 | size_t current_chunk_offset; |
792 | 792 | ||
793 | /** | 793 | /** |
794 | * Handler used for processing read connection operations | 794 | * Handler used for processing read connection operations |
@@ -1217,7 +1217,7 @@ struct MHD_Daemon | |||
1217 | /** | 1217 | /** |
1218 | * Size of `digest_auth_random. | 1218 | * Size of `digest_auth_random. |
1219 | */ | 1219 | */ |
1220 | unsigned int digest_auth_rand_size; | 1220 | size_t digest_auth_rand_size; |
1221 | 1221 | ||
1222 | /** | 1222 | /** |
1223 | * Size of the nonce-nc array. | 1223 | * Size of the nonce-nc array. |