Fix build warnings on MS compilers
authordch <david.hotham@metaswitch.com>
Sun, 2 Sep 2012 20:24:19 +0000 (21:24 +0100)
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>
Mon, 3 Sep 2012 14:18:49 +0000 (17:18 +0300)
Update issue 33
Status: FixedInGit

pb_decode.c

index 2235280..65db511 100644 (file)
@@ -539,9 +539,9 @@ bool checkreturn pb_dec_varint(pb_istream_t *stream, const pb_field_t *field, vo
     
     switch (field->data_size)
     {
-        case 1: *(uint8_t*)dest = value; break;
-        case 2: *(uint16_t*)dest = value; break;
-        case 4: *(uint32_t*)dest = value; break;
+        case 1: *(uint8_t*)dest = (uint8_t)value; break;
+        case 2: *(uint16_t*)dest = (uint16_t)value; break;
+        case 4: *(uint32_t*)dest = (uint32_t)value; break;
         case 8: *(uint64_t*)dest = value; break;
         default: PB_RETURN_ERROR(stream, "invalid data_size");
     }
@@ -556,7 +556,7 @@ bool checkreturn pb_dec_svarint(pb_istream_t *stream, const pb_field_t *field, v
     
     switch (field->data_size)
     {
-        case 4: *(int32_t*)dest = value; break;
+        case 4: *(int32_t*)dest = (int32_t)value; break;
         case 8: *(int64_t*)dest = value; break;
         default: PB_RETURN_ERROR(stream, "invalid data_size");
     }