From: Sree Harsha Totakura Date: Mon, 5 Nov 2012 19:05:49 +0000 (+0000) Subject: coverity fixes X-Git-Tag: initial-import-from-subversion-38251~10999 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=36407c989a9dd94a54a185ae67244bbdddc0b566;p=oweals%2Fgnunet.git coverity fixes --- diff --git a/src/stream/stream_api.c b/src/stream/stream_api.c index 3abea2a49..1aec60285 100644 --- a/src/stream/stream_api.c +++ b/src/stream/stream_api.c @@ -877,10 +877,10 @@ write_data (struct GNUNET_STREAM_Socket *socket) } } /* Now send new packets if there is enough buffer space */ - while ( (NULL != io_handle->messages[packet]) && - (socket->receiver_window_available - >= ntohs (io_handle->messages[packet]->header.header.size)) && - (packet < GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH)) + while ((packet < GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH) && + (NULL != io_handle->messages[packet]) && + (socket->receiver_window_available + >= ntohs (io_handle->messages[packet]->header.header.size))) { socket->receiver_window_available -= ntohs (io_handle->messages[packet]->header.header.size); @@ -968,7 +968,10 @@ call_read_processor (void *cls, for (packet = 0; packet < GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH; packet++) { if (socket->copy_offset == socket->receive_buffer_boundaries[packet]) - { packet++; break; } + { + packet++; + break; + } if (socket->copy_offset < socket->receive_buffer_boundaries[packet]) break; } @@ -999,7 +1002,7 @@ call_read_processor (void *cls, /* Fix relative boundaries */ for (packet=0; packet < GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH; packet++) { - if (packet < GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH - sequence_increase) + if (packet < (GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH - sequence_increase)) { uint32_t ahead_buffer_boundary; @@ -1108,7 +1111,7 @@ handle_data (struct GNUNET_STREAM_Socket *socket, expecting */ relative_sequence_number = ntohl (msg->sequence_number) - socket->read_sequence_number; - if ( relative_sequence_number > GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH) + if ( relative_sequence_number >= GNUNET_STREAM_ACK_BITMAP_BIT_LENGTH) { LOG (GNUNET_ERROR_TYPE_DEBUG, "%s: Ignoring received message with sequence number %u\n", @@ -1490,6 +1493,7 @@ control_retransmission_task (void *cls, GNUNET_NO); else GNUNET_break (0); + break; default: GNUNET_break (0); }