aboutsummaryrefslogtreecommitdiffstats
path: root/pb_decode.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-04-18 20:15:36 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-04-18 20:15:36 +0300
commitd1ca88d20ec1b205752546a40ef520a392d0002f (patch)
tree8b5452856d910af7eabba780b91e9bbbbd25fd48 /pb_decode.c
parent9fbe9a5de30c3326bd7015e91c5ba634df49ee25 (diff)
Fixing compiler warnings, mostly related to unused parameters.
Thanks to David Hotham for the patch. Fixes issue 8.
Diffstat (limited to 'pb_decode.c')
-rw-r--r--pb_decode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/pb_decode.c b/pb_decode.c
index 1e2fea0a..fd234884 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -75,7 +75,7 @@ static bool checkreturn pb_decode_varint32(pb_istream_t *stream, uint32_t *dest)
{
uint64_t temp;
bool status = pb_decode_varint(stream, &temp);
- *dest = temp;
+ *dest = (uint32_t)temp;
return status;
}
@@ -448,6 +448,7 @@ static void endian_copy(void *dest, void *src, size_t destsize, size_t srcsize)
#ifdef __BIG_ENDIAN__
memcpy(dest, (char*)src + (srcsize - destsize), destsize);
#else
+ UNUSED(srcsize);
memcpy(dest, src, destsize);
#endif
}
@@ -480,6 +481,7 @@ bool checkreturn pb_dec_fixed32(pb_istream_t *stream, const pb_field_t *field, v
}
return status;
#else
+ UNUSED(field);
return pb_read(stream, (uint8_t*)dest, 4);
#endif
}
@@ -496,6 +498,7 @@ bool checkreturn pb_dec_fixed64(pb_istream_t *stream, const pb_field_t *field, v
}
return status;
#else
+ UNUSED(field);
return pb_read(stream, (uint8_t*)dest, 8);
#endif
}
@@ -524,7 +527,7 @@ bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_t *field, vo
return false;
/* Check length, noting the null terminator */
- if (size > field->data_size - 1)
+ if (size + 1 > field->data_size)
return false;
status = pb_read(stream, (uint8_t*)dest, size);