else
{
/* Multibyte case */
- int bitpos = 7;
+ uint8_t bitpos = 7;
result = byte & 0x7F;
do
return false;
result |= (uint32_t)(byte & 0x7F) << bitpos;
- bitpos += 7;
+ bitpos = (uint8_t)(bitpos + 7);
} while (byte & 0x80);
}
bool checkreturn pb_decode_varint(pb_istream_t *stream, uint64_t *dest)
{
uint8_t byte;
- int bitpos = 0;
+ uint8_t bitpos = 0;
uint64_t result = 0;
do
return false;
result |= (uint64_t)(byte & 0x7F) << bitpos;
- bitpos += 7;
+ bitpos = (uint8_t)(bitpos + 7);
} while (byte & 0x80);
*dest = result;
typedef struct {
const pb_field_t *start; /* Start of the pb_field_t array */
const pb_field_t *current; /* Current position of the iterator */
- int field_index; /* Zero-based index of the field. */
- int required_field_index; /* Zero-based index that counts only the required fields */
+ unsigned field_index; /* Zero-based index of the field. */
+ unsigned required_field_index; /* Zero-based index that counts only the required fields */
void *dest_struct; /* Pointer to the destination structure to decode to */
void *pData; /* Pointer where to store current field value */
void *pSize; /* Pointer where to store the size of current array field */
static bool checkreturn pb_field_find(pb_field_iterator_t *iter, uint32_t tag)
{
- int start = iter->field_index;
+ unsigned start = iter->field_index;
do {
if (iter->current->tag == tag)
* seeking to the end of the field array. Usually we
* are already close to end after decoding.
*/
- int req_field_count;
+ unsigned req_field_count;
uint8_t last_type;
- int i;
+ unsigned i;
do {
req_field_count = iter.required_field_index;
last_type = iter.current->type;