summaryrefslogtreecommitdiffstats
path: root/pb_encode.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2014-08-18 20:09:52 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2014-08-18 20:09:52 +0300
commit1dd9f1900fca0c137324c05a9421f1ba180b2470 (patch)
treef0788fa698b0c49bc06dfea181a1d062a4feb09f /pb_encode.c
parent0b517b07789049089e19b714311c596399d53f8e (diff)
Change the _count fields to use pb_size_t datatype.
Update issue 82 Status: FixedInGit
Diffstat (limited to 'pb_encode.c')
-rw-r--r--pb_encode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pb_encode.c b/pb_encode.c
index 6041c641..3dce1c10 100644
--- a/pb_encode.c
+++ b/pb_encode.c
@@ -246,7 +246,7 @@ static bool checkreturn encode_basic_field(pb_ostream_t *stream,
break;
case PB_HTYPE_REPEATED:
- if (!encode_array(stream, field, pData, *(const size_t*)pSize, func))
+ if (!encode_array(stream, field, pData, *(const pb_size_t*)pSize, func))
return false;
break;
@@ -630,7 +630,6 @@ static bool checkreturn pb_enc_bytes(pb_ostream_t *stream, const pb_field_t *fie
static bool checkreturn pb_enc_string(pb_ostream_t *stream, const pb_field_t *field, const void *src)
{
- /* strnlen() is not always available, so just use a loop */
size_t size = 0;
size_t max_size = field->data_size;
const char *p = (const char*)src;
@@ -644,6 +643,7 @@ static bool checkreturn pb_enc_string(pb_ostream_t *stream, const pb_field_t *fi
}
else
{
+ /* strnlen() is not always available, so just use a loop */
while (size < max_size && *p != '\0')
{
size++;