Commit a3d87253 authored by lahiker42's avatar lahiker42

Be more permissive in accepting packed data for non-packed repeated members.


git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@285 00440858-1255-0410-a3e6-75ea37f81c3a
parent 0ec4e415
0.16 (NOT YET RELEASED)
- treat a "length-prefixed" wire-type message for a repeated field
as packed-repeated whenever it makes sense (for all types
other than messages, strings, and bytes).
- switch to New BSD license.
0.15:
- make protobuf_c_message_init() into a function (Issue #49, daveb)
- Fix for freeing memory after unpacking bytes w/o a default-value.
......@@ -34,7 +39,7 @@
0.12:
- for field names which are reserved words, use the real name
given in the protobuf-c file, not the mangled name which
is the name of the member in the C structure. (Andrei Nigmatulin)
is the name of the member in the C structure. (Andrei Nigmatulin)
- add protobuf_c_message_init() function; add virtual function
that implements it efficiently. (Andrei Nigmatulin)
- bug fix for sfixed32, fixed32, float wire-types on
......@@ -64,13 +69,13 @@
- build issue: needed $(EXEEXT) in dependency lists for cygwin
- bug fix: protobuf_c_service_get_method_by_name() was not correct b/c
the service's methods were not sorted by name (the header file
used to incorrectly state that they were).
Now we correctly implement protobuf_c_service_get_method_by_name()
(using a bsearch indexed by separate array).
used to incorrectly state that they were).
Now we correctly implement protobuf_c_service_get_method_by_name()
(using a bsearch indexed by separate array).
- generated source incompatibility: we added a new
member to ProtobufCServiceDescriptor (method_indices_by_name).
You will have to run the latest protobuf
to generate those structures.
You will have to run the latest protobuf
to generate those structures.
- rename rpc-client's "autoretry" mechanism to "autoreconnect".
- bug fixes using TCP clients with the RPC system.
- handle allocation failures more gracefully (Jason Lunz) (issue 15)
......
......@@ -2007,6 +2007,14 @@ no_unpacking_needed:
return TRUE;
}
static protobuf_c_boolean
is_packable_type (ProtobufCType type)
{
return type != PROTOBUF_C_TYPE_STRING
&& type != PROTOBUF_C_TYPE_BYTES
&& type != PROTOBUF_C_TYPE_MESSAGE;
}
static protobuf_c_boolean
parse_member (ScannedMember *scanned_member,
ProtobufCMessage *message,
......@@ -2032,8 +2040,8 @@ parse_member (ScannedMember *scanned_member,
case PROTOBUF_C_LABEL_OPTIONAL:
return parse_optional_member (scanned_member, member, message, allocator);
case PROTOBUF_C_LABEL_REPEATED:
if (field->packed
&& scanned_member->wire_type == PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED)
if (scanned_member->wire_type == PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED
&& (field->packed || is_packable_type (field->type)))
return parse_packed_repeated_member (scanned_member, member, message);
else
return parse_repeated_member (scanned_member, member, message, allocator);
......@@ -2286,8 +2294,8 @@ protobuf_c_message_unpack (const ProtobufCMessageDescriptor *desc,
if (field != NULL && field->label == PROTOBUF_C_LABEL_REPEATED)
{
size_t *n = STRUCT_MEMBER_PTR (size_t, rv, field->quantifier_offset);
if (field->packed
&& wire_type == PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED)
if (wire_type == PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED
&& (field->packed || is_packable_type (field->type)))
{
size_t count;
if (!count_packed_elements (field->type,
......
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