diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2012-09-03 17:35:14 +0300 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2012-09-03 17:35:14 +0300 |
commit | b214de4e1e53f14354db36b8f199db6177a63744 (patch) | |
tree | 5b45b98c14a59d075d3ab939efc13ecb1ab9f8e5 /pb_encode.c | |
parent | be78e3b4d0ff9839817b0eeef5d3e75056b53af1 (diff) |
Enable -Wconversion for core and fix the warnings.
This should help avoid issue 33 in the future.
Diffstat (limited to 'pb_encode.c')
-rw-r--r-- | pb_encode.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pb_encode.c b/pb_encode.c index a887382..5d1965d 100644 --- a/pb_encode.c +++ b/pb_encode.c @@ -205,7 +205,7 @@ bool checkreturn pb_encode(pb_ostream_t *stream, const pb_field_t fields[], cons bool checkreturn pb_encode_varint(pb_ostream_t *stream, uint64_t value) { uint8_t buffer[10]; - int i = 0; + size_t i = 0; if (value == 0) return pb_write(stream, (uint8_t*)&value, 1); @@ -225,9 +225,9 @@ bool checkreturn pb_encode_svarint(pb_ostream_t *stream, int64_t value) { uint64_t zigzagged; if (value < 0) - zigzagged = ~(value << 1); + zigzagged = (uint64_t)(~(value << 1)); else - zigzagged = value << 1; + zigzagged = (uint64_t)(value << 1); return pb_encode_varint(stream, zigzagged); } @@ -266,7 +266,7 @@ bool checkreturn pb_encode_fixed64(pb_ostream_t *stream, const void *value) #endif } -bool checkreturn pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, int field_number) +bool checkreturn pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number) { uint64_t tag = wiretype | (field_number << 3); return pb_encode_varint(stream, tag); @@ -370,7 +370,7 @@ bool checkreturn pb_enc_varint(pb_ostream_t *stream, const pb_field_t *field, co bool checkreturn pb_enc_svarint(pb_ostream_t *stream, const pb_field_t *field, const void *src) { - uint64_t value = 0; + int64_t value = 0; switch (field->data_size) { |