Commit b915eed3 authored by Ilya Lipnitskiy's avatar Ilya Lipnitskiy

protobuf-c/protobuf-c.c: fix compiler warnings (fixes #115)

protoc-c/c_enum.cc: fix compiler warnings
protoc-c/c_field.cc: fix compiler warnings
parent 9f39b762
......@@ -1592,6 +1592,7 @@ merge_messages (ProtobufCMessage *earlier_msg,
ProtobufCMessage **lm =
STRUCT_MEMBER_PTR (ProtobufCMessage *, latter_msg, fields[i].offset);
if (*em != NULL)
{
if (*lm != NULL)
{
if (!merge_messages (*em, *lm, allocator))
......@@ -1604,6 +1605,7 @@ merge_messages (ProtobufCMessage *earlier_msg,
*lm = *em;
*em = NULL;
}
}
}
else if (fields[i].label == PROTOBUF_C_LABEL_OPTIONAL)
{
......@@ -2274,7 +2276,6 @@ protobuf_c_message_unpack (const ProtobufCMessageDescriptor *desc,
unsigned i_slab;
unsigned last_field_index = 0;
unsigned char required_fields_bitmap[MAX_MEMBERS_FOR_HASH_SIZE/8] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
static const unsigned word_bits = sizeof(long) * 8;
ASSERT_IS_MESSAGE_DESCRIPTOR (desc);
......@@ -2283,9 +2284,9 @@ protobuf_c_message_unpack (const ProtobufCMessageDescriptor *desc,
/* We treat all fields % (16*8), which should be good enough. */
#define REQUIRED_FIELD_BITMAP_SET(index) \
required_fields_bitmap[(index/8)%sizeof(required_fields_bitmap)] |= (1<<((index)%8))
(required_fields_bitmap[(index/8)%sizeof(required_fields_bitmap)] |= (1<<((index)%8)))
#define REQUIRED_FIELD_BITMAP_IS_SET(index) \
required_fields_bitmap[(index/8)%sizeof(required_fields_bitmap)] & (1<<((index)%8))
(required_fields_bitmap[(index/8)%sizeof(required_fields_bitmap)] & (1<<((index)%8)))
DO_ALLOC (rv, allocator, desc->sizeof_message, return NULL);
scanned_member_slabs[0] = first_member_slab;
......
......@@ -223,8 +223,8 @@ void EnumGenerator::GenerateEnumDescriptor(io::Printer* printer) {
if (descriptor_->value_count() > 0) {
unsigned range_start = 0;
unsigned range_len = 1;
unsigned range_start_value = value_index[0].value;
unsigned last_value = range_start_value;
int range_start_value = value_index[0].value;
int last_value = range_start_value;
for (int j = 1; j < descriptor_->value_count(); j++) {
if (value_index[j-1].value != value_index[j].value) {
if (last_value + 1 == value_index[j].value) {
......
......@@ -136,7 +136,6 @@ void FieldGenerator::GenerateDescriptorInitializerGeneric(io::Printer* printer,
" $value$,\n"
" PROTOBUF_C_LABEL_$LABEL$,\n"
" PROTOBUF_C_TYPE_$TYPE$,\n");
bool packed = false;
switch (descriptor_->label()) {
case FieldDescriptor::LABEL_REQUIRED:
printer->Print(variables, " 0, /* quantifier_offset */\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment