@@ -188,7 +188,7 @@ mg_handle_form_request(struct mg_connection *conn,
188188 char path[512 ];
189189 char buf[MG_BUF_LEN]; /* Must not be smaller than ~900 */
190190 int field_storage;
191- int buf_fill = 0 ;
191+ size_t buf_fill = 0 ;
192192 int r;
193193 int field_count = 0 ;
194194 struct mg_file fstore = STRUCT_FILE_INITIALIZER;
@@ -397,10 +397,10 @@ mg_handle_form_request(struct mg_connection *conn,
397397 int end_of_key_value_pair_found = 0 ;
398398 int get_block;
399399
400- if (( size_t ) buf_fill < (sizeof (buf) - 1 )) {
400+ if (buf_fill < (sizeof (buf) - 1 )) {
401401
402- size_t to_read = sizeof (buf) - 1 - ( size_t ) buf_fill;
403- r = mg_read (conn, buf + ( size_t ) buf_fill, to_read);
402+ size_t to_read = sizeof (buf) - 1 - buf_fill;
403+ r = mg_read (conn, buf + buf_fill, to_read);
404404 if ((r < 0 ) || ((r == 0 ) && all_data_read)) {
405405 /* read error */
406406 return -1 ;
@@ -529,11 +529,11 @@ mg_handle_form_request(struct mg_connection *conn,
529529 buf + (size_t )used,
530530 sizeof (buf) - (size_t )used);
531531 next = buf;
532- buf_fill -= ( int ) used;
533- if (( size_t ) buf_fill < (sizeof (buf) - 1 )) {
532+ buf_fill -= used;
533+ if (buf_fill < (sizeof (buf) - 1 )) {
534534
535- size_t to_read = sizeof (buf) - 1 - ( size_t ) buf_fill;
536- r = mg_read (conn, buf + ( size_t ) buf_fill, to_read);
535+ size_t to_read = sizeof (buf) - 1 - buf_fill;
536+ r = mg_read (conn, buf + buf_fill, to_read);
537537 if ((r < 0 ) || ((r == 0 ) && all_data_read)) {
538538#if !defined(NO_FILESYSTEMS)
539539 /* read error */
@@ -592,7 +592,7 @@ mg_handle_form_request(struct mg_connection *conn,
592592 /* Proceed to next entry */
593593 used = next - buf;
594594 memmove (buf, buf + (size_t )used, sizeof (buf) - (size_t )used);
595- buf_fill -= ( int ) used;
595+ buf_fill -= used;
596596 }
597597
598598 return field_count;
@@ -682,12 +682,12 @@ mg_handle_form_request(struct mg_connection *conn,
682682 for (part_no = 0 ;; part_no++) {
683683 size_t towrite, fnlen, n;
684684 int get_block;
685- size_t to_read = sizeof (buf) - 1 - ( size_t ) buf_fill;
685+ size_t to_read = sizeof (buf) - 1 - buf_fill;
686686
687687 /* Unused without filesystems */
688688 (void )n;
689689
690- r = mg_read (conn, buf + ( size_t ) buf_fill, to_read);
690+ r = mg_read (conn, buf + buf_fill, to_read);
691691 if ((r < 0 ) || ((r == 0 ) && all_data_read)) {
692692 /* read error */
693693 mg_free (boundary);
@@ -1001,12 +1001,12 @@ mg_handle_form_request(struct mg_connection *conn,
10011001#endif /* NO_FILESYSTEMS */
10021002
10031003 memmove (buf, hend + towrite, bl + 4 );
1004- buf_fill = ( int )( bl + 4 ) ;
1004+ buf_fill = bl + 4 ;
10051005 hend = buf;
10061006
10071007 /* Read new data */
1008- to_read = sizeof (buf) - 1 - ( size_t ) buf_fill;
1009- r = mg_read (conn, buf + ( size_t ) buf_fill, to_read);
1008+ to_read = sizeof (buf) - 1 - buf_fill;
1009+ r = mg_read (conn, buf + buf_fill, to_read);
10101010 if ((r < 0 ) || ((r == 0 ) && all_data_read)) {
10111011#if !defined(NO_FILESYSTEMS)
10121012 /* read error */
@@ -1025,7 +1025,7 @@ mg_handle_form_request(struct mg_connection *conn,
10251025 /* buf_fill is at least 8 here */
10261026
10271027 /* Find boundary */
1028- next = search_boundary (buf, ( size_t ) buf_fill, boundary, bl);
1028+ next = search_boundary (buf, buf_fill, boundary, bl);
10291029
10301030 if (!next && (r == 0 )) {
10311031 /* incomplete request */
@@ -1100,7 +1100,7 @@ mg_handle_form_request(struct mg_connection *conn,
11001100 if (next) {
11011101 used = next - buf + 2 ;
11021102 memmove (buf, buf + (size_t )used, sizeof (buf) - (size_t )used);
1103- buf_fill -= ( int ) used;
1103+ buf_fill -= used;
11041104 } else {
11051105 buf_fill = 0 ;
11061106 }
0 commit comments