mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2025-01-14 09:17:55 +08:00
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
This commit is contained in:
parent
9f39b7621e
commit
b915eed32f
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user