diff --git a/src/framework/framework.pb-c.c b/src/framework/framework.pb-c.c index 394c17f09724a9db2bfc62603a3ffa46cf032899..b8d76282ec1a8988887ee048c1626589f87c891b 100644 --- a/src/framework/framework.pb-c.c +++ b/src/framework/framework.pb-c.c @@ -14,20 +14,22 @@ void paddle_mobile__framework__proto__version__init( *message = init_value; } PaddleMobile__Framework__Proto__Version * -paddle_mobile__framework__proto__version__unpack(ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) { - return (PaddleMobile__Framework__Proto__Version *)protobuf_c_message_unpack( - &paddle_mobile__framework__proto__version__descriptor, allocator, len, - data); +paddle_mobile__framework__proto__version__unpack( + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data) { + return (PaddleMobile__Framework__Proto__Version *) + PaddleMobile__Framework__protobuf_c_message_unpack( + &paddle_mobile__framework__proto__version__descriptor, allocator, len, + data); } void paddle_mobile__framework__proto__version__free_unpacked( PaddleMobile__Framework__Proto__Version *message, - ProtobufCAllocator *allocator) { + PaddleMobile__Framework__ProtobufCAllocator *allocator) { if (!message) return; assert(message->base.descriptor == &paddle_mobile__framework__proto__version__descriptor); - protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); + PaddleMobile__Framework__protobuf_c_message_free_unpacked( + (PaddleMobile__Framework__ProtobufCMessage *)message, allocator); } void paddle_mobile__framework__proto__op_desc__attr__init( PaddleMobile__Framework__Proto__OpDesc__Attr *message) { @@ -48,20 +50,22 @@ void paddle_mobile__framework__proto__op_desc__init( *message = init_value; } PaddleMobile__Framework__Proto__OpDesc * -paddle_mobile__framework__proto__op_desc__unpack(ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) { - return (PaddleMobile__Framework__Proto__OpDesc *)protobuf_c_message_unpack( - &paddle_mobile__framework__proto__op_desc__descriptor, allocator, len, - data); +paddle_mobile__framework__proto__op_desc__unpack( + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data) { + return (PaddleMobile__Framework__Proto__OpDesc *) + PaddleMobile__Framework__protobuf_c_message_unpack( + &paddle_mobile__framework__proto__op_desc__descriptor, allocator, len, + data); } void paddle_mobile__framework__proto__op_desc__free_unpacked( PaddleMobile__Framework__Proto__OpDesc *message, - ProtobufCAllocator *allocator) { + PaddleMobile__Framework__ProtobufCAllocator *allocator) { if (!message) return; assert(message->base.descriptor == &paddle_mobile__framework__proto__op_desc__descriptor); - protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); + PaddleMobile__Framework__protobuf_c_message_free_unpacked( + (PaddleMobile__Framework__ProtobufCMessage *)message, allocator); } void paddle_mobile__framework__proto__op_proto__var__init( PaddleMobile__Framework__Proto__OpProto__Var *message) { @@ -82,20 +86,22 @@ void paddle_mobile__framework__proto__op_proto__init( *message = init_value; } PaddleMobile__Framework__Proto__OpProto * -paddle_mobile__framework__proto__op_proto__unpack(ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) { - return (PaddleMobile__Framework__Proto__OpProto *)protobuf_c_message_unpack( - &paddle_mobile__framework__proto__op_proto__descriptor, allocator, len, - data); +paddle_mobile__framework__proto__op_proto__unpack( + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data) { + return (PaddleMobile__Framework__Proto__OpProto *) + PaddleMobile__Framework__protobuf_c_message_unpack( + &paddle_mobile__framework__proto__op_proto__descriptor, allocator, + len, data); } void paddle_mobile__framework__proto__op_proto__free_unpacked( PaddleMobile__Framework__Proto__OpProto *message, - ProtobufCAllocator *allocator) { + PaddleMobile__Framework__ProtobufCAllocator *allocator) { if (!message) return; assert(message->base.descriptor == &paddle_mobile__framework__proto__op_proto__descriptor); - protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); + PaddleMobile__Framework__protobuf_c_message_free_unpacked( + (PaddleMobile__Framework__ProtobufCMessage *)message, allocator); } void paddle_mobile__framework__proto__var_type__tensor_desc__init( PaddleMobile__Framework__Proto__VarType__TensorDesc *message) { @@ -142,20 +148,22 @@ void paddle_mobile__framework__proto__var_type__init( *message = init_value; } PaddleMobile__Framework__Proto__VarType * -paddle_mobile__framework__proto__var_type__unpack(ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) { - return (PaddleMobile__Framework__Proto__VarType *)protobuf_c_message_unpack( - &paddle_mobile__framework__proto__var_type__descriptor, allocator, len, - data); +paddle_mobile__framework__proto__var_type__unpack( + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data) { + return (PaddleMobile__Framework__Proto__VarType *) + PaddleMobile__Framework__protobuf_c_message_unpack( + &paddle_mobile__framework__proto__var_type__descriptor, allocator, + len, data); } void paddle_mobile__framework__proto__var_type__free_unpacked( PaddleMobile__Framework__Proto__VarType *message, - ProtobufCAllocator *allocator) { + PaddleMobile__Framework__ProtobufCAllocator *allocator) { if (!message) return; assert(message->base.descriptor == &paddle_mobile__framework__proto__var_type__descriptor); - protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); + PaddleMobile__Framework__protobuf_c_message_free_unpacked( + (PaddleMobile__Framework__ProtobufCMessage *)message, allocator); } void paddle_mobile__framework__proto__var_desc__init( PaddleMobile__Framework__Proto__VarDesc *message) { @@ -164,20 +172,22 @@ void paddle_mobile__framework__proto__var_desc__init( *message = init_value; } PaddleMobile__Framework__Proto__VarDesc * -paddle_mobile__framework__proto__var_desc__unpack(ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) { - return (PaddleMobile__Framework__Proto__VarDesc *)protobuf_c_message_unpack( - &paddle_mobile__framework__proto__var_desc__descriptor, allocator, len, - data); +paddle_mobile__framework__proto__var_desc__unpack( + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data) { + return (PaddleMobile__Framework__Proto__VarDesc *) + PaddleMobile__Framework__protobuf_c_message_unpack( + &paddle_mobile__framework__proto__var_desc__descriptor, allocator, + len, data); } void paddle_mobile__framework__proto__var_desc__free_unpacked( PaddleMobile__Framework__Proto__VarDesc *message, - ProtobufCAllocator *allocator) { + PaddleMobile__Framework__ProtobufCAllocator *allocator) { if (!message) return; assert(message->base.descriptor == &paddle_mobile__framework__proto__var_desc__descriptor); - protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); + PaddleMobile__Framework__protobuf_c_message_free_unpacked( + (PaddleMobile__Framework__ProtobufCMessage *)message, allocator); } void paddle_mobile__framework__proto__block_desc__init( PaddleMobile__Framework__Proto__BlockDesc *message) { @@ -187,18 +197,21 @@ void paddle_mobile__framework__proto__block_desc__init( } PaddleMobile__Framework__Proto__BlockDesc * paddle_mobile__framework__proto__block_desc__unpack( - ProtobufCAllocator *allocator, size_t len, const uint8_t *data) { - return (PaddleMobile__Framework__Proto__BlockDesc *)protobuf_c_message_unpack( - &paddle_mobile__framework__proto__block_desc__descriptor, allocator, len, - data); + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data) { + return (PaddleMobile__Framework__Proto__BlockDesc *) + PaddleMobile__Framework__protobuf_c_message_unpack( + &paddle_mobile__framework__proto__block_desc__descriptor, allocator, + len, data); } void paddle_mobile__framework__proto__block_desc__free_unpacked( PaddleMobile__Framework__Proto__BlockDesc *message, - ProtobufCAllocator *allocator) { + PaddleMobile__Framework__ProtobufCAllocator *allocator) { if (!message) return; assert(message->base.descriptor == &paddle_mobile__framework__proto__block_desc__descriptor); - protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); + PaddleMobile__Framework__protobuf_c_message_free_unpacked( + (PaddleMobile__Framework__ProtobufCMessage *)message, allocator); } void paddle_mobile__framework__proto__program_desc__init( PaddleMobile__Framework__Proto__ProgramDesc *message) { @@ -208,23 +221,25 @@ void paddle_mobile__framework__proto__program_desc__init( } PaddleMobile__Framework__Proto__ProgramDesc * paddle_mobile__framework__proto__program_desc__unpack( - ProtobufCAllocator *allocator, size_t len, const uint8_t *data) { + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data) { return (PaddleMobile__Framework__Proto__ProgramDesc *) - protobuf_c_message_unpack( + PaddleMobile__Framework__protobuf_c_message_unpack( &paddle_mobile__framework__proto__program_desc__descriptor, allocator, len, data); } void paddle_mobile__framework__proto__program_desc__free_unpacked( PaddleMobile__Framework__Proto__ProgramDesc *message, - ProtobufCAllocator *allocator) { + PaddleMobile__Framework__ProtobufCAllocator *allocator) { if (!message) return; assert(message->base.descriptor == &paddle_mobile__framework__proto__program_desc__descriptor); - protobuf_c_message_free_unpacked((ProtobufCMessage *)message, allocator); + PaddleMobile__Framework__protobuf_c_message_free_unpacked( + (PaddleMobile__Framework__ProtobufCMessage *)message, allocator); } static const int64_t paddle_mobile__framework__proto__version__version__default_value = 0ll; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__version__field_descriptors[1] = { { "version", 1, PROTOBUF_C_LABEL_OPTIONAL, PROTOBUF_C_TYPE_INT64, @@ -239,10 +254,10 @@ static const unsigned paddle_mobile__framework__proto__version__field_indices_by_name[] = { 0, /* field[0] = version */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__version__number_ranges[1 + 1] = {{1, 0}, {0, 1}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__version__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.Version", @@ -260,7 +275,7 @@ const ProtobufCMessageDescriptor NULL, NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__op_desc__attr__field_descriptors[14] = { { "name", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, @@ -381,10 +396,10 @@ static const unsigned 7, /* field[7] = strings */ 1, /* field[1] = type */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__op_desc__attr__number_ranges[2 + 1] = { {1, 0}, {10, 8}, {0, 14}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__op_desc__attr__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.OpDesc.Attr", @@ -403,7 +418,7 @@ const ProtobufCMessageDescriptor NULL, NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__op_desc__var__field_descriptors[2] = { { "parameter", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, @@ -425,10 +440,10 @@ static const unsigned 1, /* field[1] = arguments */ 0, /* field[0] = parameter */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__op_desc__var__number_ranges[1 + 1] = { {1, 0}, {0, 2}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__op_desc__var__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.OpDesc.Var", @@ -449,7 +464,7 @@ const ProtobufCMessageDescriptor }; static const protobuf_c_boolean paddle_mobile__framework__proto__op_desc__is_target__default_value = 0; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__op_desc__field_descriptors[5] = { { "inputs", 1, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, @@ -499,10 +514,10 @@ static const unsigned 1, /* field[1] = outputs */ 2, /* field[2] = type */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__op_desc__number_ranges[1 + 1] = {{1, 0}, {0, 5}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__op_desc__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.OpDesc", @@ -529,7 +544,7 @@ static const protobuf_c_boolean static const protobuf_c_boolean paddle_mobile__framework__proto__op_proto__var__dispensable__default_value = 0; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__op_proto__var__field_descriptors[6] = { { "name", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, @@ -593,10 +608,10 @@ static const unsigned 0, /* field[0] = name */ 5, /* field[5] = reuse */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__op_proto__var__number_ranges[1 + 1] = { {1, 0}, {0, 6}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__op_proto__var__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.OpProto.Var", @@ -618,7 +633,7 @@ const ProtobufCMessageDescriptor static const protobuf_c_boolean paddle_mobile__framework__proto__op_proto__attr__generated__default_value = 0; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__op_proto__attr__field_descriptors[4] = { { "name", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, @@ -660,10 +675,10 @@ static const unsigned 0, /* field[0] = name */ 1, /* field[1] = type */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__op_proto__attr__number_ranges[1 + 1] = { {1, 0}, {0, 4}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__op_proto__attr__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.OpProto.Attr", @@ -682,7 +697,7 @@ const ProtobufCMessageDescriptor NULL, NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__op_proto__field_descriptors[5] = { { "type", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, @@ -731,10 +746,10 @@ static const unsigned 2, /* field[2] = outputs */ 0, /* field[0] = type */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__op_proto__number_ranges[1 + 1] = {{1, 0}, {0, 5}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__op_proto__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.OpProto", @@ -752,7 +767,7 @@ const ProtobufCMessageDescriptor NULL, NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__var_type__tensor_desc__field_descriptors [2] = { { @@ -780,11 +795,11 @@ static const unsigned 0, /* field[0] = data_type */ 1, /* field[1] = dims */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__var_type__tensor_desc__number_ranges[1 + 1] = { {1, 0}, {0, 2}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__tensor_desc__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.VarType.TensorDesc", @@ -806,7 +821,7 @@ const ProtobufCMessageDescriptor static const int32_t paddle_mobile__framework__proto__var_type__lo_dtensor_desc__lod_level__default_value = 0; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__var_type__lo_dtensor_desc__field_descriptors [2] = { { @@ -837,10 +852,10 @@ static const unsigned 1, /* field[1] = lod_level */ 0, /* field[0] = tensor */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__var_type__lo_dtensor_desc__number_ranges [1 + 1] = {{1, 0}, {0, 2}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__lo_dtensor_desc__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.VarType.LoDTensorDesc", @@ -862,7 +877,7 @@ const ProtobufCMessageDescriptor static const int32_t paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__lod_level__default_value = 0; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__field_descriptors [2] = { { @@ -896,10 +911,10 @@ static const unsigned 1, /* field[1] = lod_level */ 0, /* field[0] = tensor */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__number_ranges [1 + 1] = {{1, 0}, {0, 2}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.VarType.LoDTensorArrayDesc", @@ -918,7 +933,7 @@ const ProtobufCMessageDescriptor NULL, NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__var_type__reader_desc__field_descriptors[1] = { { "lod_tensor", 1, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, @@ -936,11 +951,11 @@ static const unsigned [] = { 0, /* field[0] = lod_tensor */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__var_type__reader_desc__number_ranges[1 + 1] = { {1, 0}, {0, 1}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__reader_desc__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.VarType.ReaderDesc", @@ -959,7 +974,7 @@ const ProtobufCMessageDescriptor NULL, NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__var_type__channel_desc__field_descriptors [2] = { { @@ -986,11 +1001,11 @@ static const unsigned 1, /* field[1] = capacity */ 0, /* field[0] = data_type */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__var_type__channel_desc__number_ranges[1 + 1] = {{1, 0}, {0, 2}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__channel_desc__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.VarType.ChannelDesc", @@ -1009,7 +1024,7 @@ const ProtobufCMessageDescriptor NULL, NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__var_type__tuple__field_descriptors[1] = { { "element_type", 1, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_ENUM, @@ -1027,10 +1042,10 @@ static const unsigned { 0, /* field[0] = element_type */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__var_type__tuple__number_ranges[1 + 1] = { {1, 0}, {0, 1}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__tuple__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.VarType.Tuple", @@ -1049,7 +1064,7 @@ const ProtobufCMessageDescriptor NULL, NULL /* reserved[123] */ }; -static const ProtobufCEnumValue +static const PaddleMobile__Framework__ProtobufCEnumValue paddle_mobile__framework__proto__var_type__type__enum_values_by_number[22] = { {"BOOL", "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__BOOL", @@ -1102,10 +1117,10 @@ static const ProtobufCEnumValue {"INT8", "PADDLE_MOBILE__FRAMEWORK__PROTO__VAR_TYPE__TYPE__INT8", 21}, }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__var_type__type__value_ranges[] = {{0, 0}, {0, 22}}; -static const ProtobufCEnumValueIndex +static const PaddleMobile__Framework__ProtobufCEnumValueIndex paddle_mobile__framework__proto__var_type__type__enum_values_by_name[22] = { {"BOOL", 0}, {"CHANNEL", 16}, {"FEED_MINIBATCH", 9}, {"FETCH_LIST", 10}, @@ -1119,7 +1134,7 @@ static const ProtobufCEnumValueIndex {"SIZE_T", 19}, {"STEP_SCOPES", 11}, {"TUPLE", 18}, {"UINT8", 20}, }; -const ProtobufCEnumDescriptor +const PaddleMobile__Framework__ProtobufCEnumDescriptor paddle_mobile__framework__proto__var_type__type__descriptor = { PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.VarType.Type", @@ -1137,7 +1152,7 @@ const ProtobufCEnumDescriptor NULL, NULL /* reserved[1234] */ }; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__var_type__field_descriptors[7] = { { "type", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_ENUM, @@ -1206,10 +1221,10 @@ static const unsigned 6, /* field[6] = tuple */ 0, /* field[0] = type */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__var_type__number_ranges[1 + 1] = {{1, 0}, {0, 7}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.VarType", @@ -1229,7 +1244,7 @@ const ProtobufCMessageDescriptor }; static const protobuf_c_boolean paddle_mobile__framework__proto__var_desc__persistable__default_value = 0; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__var_desc__field_descriptors[3] = { { "name", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_STRING, @@ -1262,10 +1277,10 @@ static const unsigned 2, /* field[2] = persistable */ 1, /* field[1] = type */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__var_desc__number_ranges[1 + 1] = {{1, 0}, {0, 3}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_desc__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.VarDesc", @@ -1286,7 +1301,7 @@ const ProtobufCMessageDescriptor static const int32_t paddle_mobile__framework__proto__block_desc__forward_block_idx__default_value = -1; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__block_desc__field_descriptors[5] = { { "idx", 1, PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_TYPE_INT32, @@ -1339,10 +1354,10 @@ static const unsigned 1, /* field[1] = parent_idx */ 2, /* field[2] = vars */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__block_desc__number_ranges[1 + 1] = { {1, 0}, {0, 5}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__block_desc__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.BlockDesc", @@ -1360,7 +1375,7 @@ const ProtobufCMessageDescriptor NULL, NULL /* reserved[123] */ }; -static const ProtobufCFieldDescriptor +static const PaddleMobile__Framework__ProtobufCFieldDescriptor paddle_mobile__framework__proto__program_desc__field_descriptors[2] = { { "blocks", 1, PROTOBUF_C_LABEL_REPEATED, PROTOBUF_C_TYPE_MESSAGE, @@ -1384,10 +1399,10 @@ static const unsigned 0, /* field[0] = blocks */ 1, /* field[1] = version */ }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__program_desc__number_ranges[1 + 1] = { {1, 0}, {0, 2}}; -const ProtobufCMessageDescriptor +const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__program_desc__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.ProgramDesc", @@ -1406,7 +1421,7 @@ const ProtobufCMessageDescriptor NULL, NULL /* reserved[123] */ }; -static const ProtobufCEnumValue +static const PaddleMobile__Framework__ProtobufCEnumValue paddle_mobile__framework__proto__attr_type__enum_values_by_number[12] = { {"INT", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__INT", 0}, {"FLOAT", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__FLOAT", 1}, @@ -1421,16 +1436,16 @@ static const ProtobufCEnumValue {"BLOCKS", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__BLOCKS", 10}, {"LONGS", "PADDLE_MOBILE__FRAMEWORK__PROTO__ATTR_TYPE__LONGS", 11}, }; -static const ProtobufCIntRange +static const PaddleMobile__Framework__ProtobufCIntRange paddle_mobile__framework__proto__attr_type__value_ranges[] = {{0, 0}, {0, 12}}; -static const ProtobufCEnumValueIndex +static const PaddleMobile__Framework__ProtobufCEnumValueIndex paddle_mobile__framework__proto__attr_type__enum_values_by_name[12] = { {"BLOCK", 8}, {"BLOCKS", 10}, {"BOOLEAN", 6}, {"BOOLEANS", 7}, {"FLOAT", 1}, {"FLOATS", 4}, {"INT", 0}, {"INTS", 3}, {"LONG", 9}, {"LONGS", 11}, {"STRING", 2}, {"STRINGS", 5}, }; -const ProtobufCEnumDescriptor +const PaddleMobile__Framework__ProtobufCEnumDescriptor paddle_mobile__framework__proto__attr_type__descriptor = { PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, "paddle_mobile.framework.proto.AttrType", diff --git a/src/framework/framework.pb-c.h b/src/framework/framework.pb-c.h index a0f2eaee12acded26ce210c1016aeba0c4eba4ed..910963f1e6419c9cbadd2338c67bec97abf94dd6 100644 --- a/src/framework/framework.pb-c.h +++ b/src/framework/framework.pb-c.h @@ -117,7 +117,7 @@ typedef enum _PaddleMobile__Framework__Proto__AttrType { * that supports old versions following the version and compatibility policy. */ struct _PaddleMobile__Framework__Proto__Version { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; protobuf_c_boolean has_version; int64_t version; }; @@ -129,7 +129,7 @@ struct _PaddleMobile__Framework__Proto__Version { } struct _PaddleMobile__Framework__Proto__OpDesc__Attr { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; char *name; PaddleMobile__Framework__Proto__AttrType type; protobuf_c_boolean has_i; @@ -165,7 +165,7 @@ struct _PaddleMobile__Framework__Proto__OpDesc__Attr { } struct _PaddleMobile__Framework__Proto__OpDesc__Var { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; char *parameter; size_t n_arguments; char **arguments; @@ -182,7 +182,7 @@ struct _PaddleMobile__Framework__Proto__OpDesc__Var { * derived class type. */ struct _PaddleMobile__Framework__Proto__OpDesc { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; char *type; size_t n_inputs; PaddleMobile__Framework__Proto__OpDesc__Var **inputs; @@ -204,7 +204,7 @@ struct _PaddleMobile__Framework__Proto__OpDesc { * VarProto describes the C++ type framework::Variable. */ struct _PaddleMobile__Framework__Proto__OpProto__Var { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; char *name; char *comment; protobuf_c_boolean has_duplicable; @@ -226,7 +226,7 @@ struct _PaddleMobile__Framework__Proto__OpProto__Var { * AttrProto describes the C++ type Attribute. */ struct _PaddleMobile__Framework__Proto__OpProto__Attr { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; char *name; PaddleMobile__Framework__Proto__AttrType type; char *comment; @@ -249,7 +249,7 @@ struct _PaddleMobile__Framework__Proto__OpProto__Attr { * OpProto describes a C++ framework::OperatorBase derived class. */ struct _PaddleMobile__Framework__Proto__OpProto { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; char *type; size_t n_inputs; PaddleMobile__Framework__Proto__OpProto__Var **inputs; @@ -267,7 +267,7 @@ struct _PaddleMobile__Framework__Proto__OpProto { } struct _PaddleMobile__Framework__Proto__VarType__TensorDesc { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; /* * Should only be PODType. Is enforced in C++ */ @@ -286,7 +286,7 @@ struct _PaddleMobile__Framework__Proto__VarType__TensorDesc { } struct _PaddleMobile__Framework__Proto__VarType__LoDTensorDesc { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; PaddleMobile__Framework__Proto__VarType__TensorDesc *tensor; protobuf_c_boolean has_lod_level; int32_t lod_level; @@ -299,7 +299,7 @@ struct _PaddleMobile__Framework__Proto__VarType__LoDTensorDesc { } struct _PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; PaddleMobile__Framework__Proto__VarType__TensorDesc *tensor; protobuf_c_boolean has_lod_level; int32_t lod_level; @@ -312,7 +312,7 @@ struct _PaddleMobile__Framework__Proto__VarType__LoDTensorArrayDesc { } struct _PaddleMobile__Framework__Proto__VarType__ReaderDesc { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; size_t n_lod_tensor; PaddleMobile__Framework__Proto__VarType__LoDTensorDesc **lod_tensor; }; @@ -324,7 +324,7 @@ struct _PaddleMobile__Framework__Proto__VarType__ReaderDesc { } struct _PaddleMobile__Framework__Proto__VarType__ChannelDesc { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; PaddleMobile__Framework__Proto__VarType__Type data_type; int64_t capacity; }; @@ -336,7 +336,7 @@ struct _PaddleMobile__Framework__Proto__VarType__ChannelDesc { } struct _PaddleMobile__Framework__Proto__VarType__Tuple { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; size_t n_element_type; PaddleMobile__Framework__Proto__VarType__Type *element_type; }; @@ -348,7 +348,7 @@ struct _PaddleMobile__Framework__Proto__VarType__Tuple { } struct _PaddleMobile__Framework__Proto__VarType { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; PaddleMobile__Framework__Proto__VarType__Type type; PaddleMobile__Framework__Proto__VarType__TensorDesc *selected_rows; PaddleMobile__Framework__Proto__VarType__LoDTensorDesc *lod_tensor; @@ -366,7 +366,7 @@ struct _PaddleMobile__Framework__Proto__VarType { } struct _PaddleMobile__Framework__Proto__VarDesc { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; char *name; PaddleMobile__Framework__Proto__VarType *type; protobuf_c_boolean has_persistable; @@ -380,7 +380,7 @@ struct _PaddleMobile__Framework__Proto__VarDesc { } struct _PaddleMobile__Framework__Proto__BlockDesc { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; int32_t idx; int32_t parent_idx; size_t n_vars; @@ -405,7 +405,7 @@ struct _PaddleMobile__Framework__Proto__BlockDesc { * way to distinguish them. Maybe ID or name? */ struct _PaddleMobile__Framework__Proto__ProgramDesc { - ProtobufCMessage base; + PaddleMobile__Framework__ProtobufCMessage base; size_t n_blocks; PaddleMobile__Framework__Proto__BlockDesc **blocks; PaddleMobile__Framework__Proto__Version *version; @@ -421,12 +421,12 @@ struct _PaddleMobile__Framework__Proto__ProgramDesc { void paddle_mobile__framework__proto__version__init( PaddleMobile__Framework__Proto__Version *message); PaddleMobile__Framework__Proto__Version * -paddle_mobile__framework__proto__version__unpack(ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); +paddle_mobile__framework__proto__version__unpack( + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data); void paddle_mobile__framework__proto__version__free_unpacked( PaddleMobile__Framework__Proto__Version *message, - ProtobufCAllocator *allocator); + PaddleMobile__Framework__ProtobufCAllocator *allocator); /* PaddleMobile__Framework__Proto__OpDesc__Attr methods */ void paddle_mobile__framework__proto__op_desc__attr__init( PaddleMobile__Framework__Proto__OpDesc__Attr *message); @@ -437,12 +437,12 @@ void paddle_mobile__framework__proto__op_desc__var__init( void paddle_mobile__framework__proto__op_desc__init( PaddleMobile__Framework__Proto__OpDesc *message); PaddleMobile__Framework__Proto__OpDesc * -paddle_mobile__framework__proto__op_desc__unpack(ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); +paddle_mobile__framework__proto__op_desc__unpack( + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data); void paddle_mobile__framework__proto__op_desc__free_unpacked( PaddleMobile__Framework__Proto__OpDesc *message, - ProtobufCAllocator *allocator); + PaddleMobile__Framework__ProtobufCAllocator *allocator); /* PaddleMobile__Framework__Proto__OpProto__Var methods */ void paddle_mobile__framework__proto__op_proto__var__init( PaddleMobile__Framework__Proto__OpProto__Var *message); @@ -453,12 +453,12 @@ void paddle_mobile__framework__proto__op_proto__attr__init( void paddle_mobile__framework__proto__op_proto__init( PaddleMobile__Framework__Proto__OpProto *message); PaddleMobile__Framework__Proto__OpProto * -paddle_mobile__framework__proto__op_proto__unpack(ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); +paddle_mobile__framework__proto__op_proto__unpack( + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data); void paddle_mobile__framework__proto__op_proto__free_unpacked( PaddleMobile__Framework__Proto__OpProto *message, - ProtobufCAllocator *allocator); + PaddleMobile__Framework__ProtobufCAllocator *allocator); /* PaddleMobile__Framework__Proto__VarType__TensorDesc methods */ void paddle_mobile__framework__proto__var_type__tensor_desc__init( PaddleMobile__Framework__Proto__VarType__TensorDesc *message); @@ -481,40 +481,42 @@ void paddle_mobile__framework__proto__var_type__tuple__init( void paddle_mobile__framework__proto__var_type__init( PaddleMobile__Framework__Proto__VarType *message); PaddleMobile__Framework__Proto__VarType * -paddle_mobile__framework__proto__var_type__unpack(ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); +paddle_mobile__framework__proto__var_type__unpack( + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data); void paddle_mobile__framework__proto__var_type__free_unpacked( PaddleMobile__Framework__Proto__VarType *message, - ProtobufCAllocator *allocator); + PaddleMobile__Framework__ProtobufCAllocator *allocator); /* PaddleMobile__Framework__Proto__VarDesc methods */ void paddle_mobile__framework__proto__var_desc__init( PaddleMobile__Framework__Proto__VarDesc *message); PaddleMobile__Framework__Proto__VarDesc * -paddle_mobile__framework__proto__var_desc__unpack(ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); +paddle_mobile__framework__proto__var_desc__unpack( + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data); void paddle_mobile__framework__proto__var_desc__free_unpacked( PaddleMobile__Framework__Proto__VarDesc *message, - ProtobufCAllocator *allocator); + PaddleMobile__Framework__ProtobufCAllocator *allocator); /* PaddleMobile__Framework__Proto__BlockDesc methods */ void paddle_mobile__framework__proto__block_desc__init( PaddleMobile__Framework__Proto__BlockDesc *message); PaddleMobile__Framework__Proto__BlockDesc * paddle_mobile__framework__proto__block_desc__unpack( - ProtobufCAllocator *allocator, size_t len, const uint8_t *data); + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data); void paddle_mobile__framework__proto__block_desc__free_unpacked( PaddleMobile__Framework__Proto__BlockDesc *message, - ProtobufCAllocator *allocator); + PaddleMobile__Framework__ProtobufCAllocator *allocator); /* PaddleMobile__Framework__Proto__ProgramDesc methods */ void paddle_mobile__framework__proto__program_desc__init( PaddleMobile__Framework__Proto__ProgramDesc *message); PaddleMobile__Framework__Proto__ProgramDesc * paddle_mobile__framework__proto__program_desc__unpack( - ProtobufCAllocator *allocator, size_t len, const uint8_t *data); + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data); void paddle_mobile__framework__proto__program_desc__free_unpacked( PaddleMobile__Framework__Proto__ProgramDesc *message, - ProtobufCAllocator *allocator); + PaddleMobile__Framework__ProtobufCAllocator *allocator); /* --- per-message closures --- */ typedef void (*PaddleMobile__Framework__Proto__Version_Closure)( @@ -569,43 +571,43 @@ typedef void (*PaddleMobile__Framework__Proto__ProgramDesc_Closure)( /* --- descriptors --- */ -extern const ProtobufCEnumDescriptor +extern const PaddleMobile__Framework__ProtobufCEnumDescriptor paddle_mobile__framework__proto__attr_type__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__version__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__op_desc__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__op_desc__attr__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__op_desc__var__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__op_proto__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__op_proto__var__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__op_proto__attr__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__tensor_desc__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__lo_dtensor_desc__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__lo_dtensor_array_desc__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__reader_desc__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__channel_desc__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_type__tuple__descriptor; -extern const ProtobufCEnumDescriptor +extern const PaddleMobile__Framework__ProtobufCEnumDescriptor paddle_mobile__framework__proto__var_type__type__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__var_desc__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__block_desc__descriptor; -extern const ProtobufCMessageDescriptor +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor paddle_mobile__framework__proto__program_desc__descriptor; PROTOBUF_C__END_DECLS diff --git a/src/protobuf-c/protobuf-c.c b/src/protobuf-c/protobuf-c.c index 1092e3f78b02a343d8c8965ea7b2d777a6fac9ae..7a08a82f792c4ba856e7276745dff1d6a19bdb18 100644 --- a/src/protobuf-c/protobuf-c.c +++ b/src/protobuf-c/protobuf-c.c @@ -40,7 +40,8 @@ /** * \todo 64-BIT OPTIMIZATION: certain implementations use 32-bit math - * even on 64-bit platforms (uint64_size, uint64_pack, parse_uint64). + * even on 64-bit platforms (uint64_size, PaddleMobile__Framework__uint64_pack, + * PaddleMobile__Framework__parse_uint64). * * \todo Use size_t consistently. */ @@ -84,31 +85,33 @@ #define PROTOBUF_C_UNPACK_ERROR(...) #endif -const char protobuf_c_empty_string[] = ""; +const char PaddleMobile__Framework__protobuf_c_empty_string[] = ""; /** - * Internal `ProtobufCMessage` manipulation macro. + * Internal `PaddleMobile__Framework__ProtobufCMessage` manipulation macro. * - * Base macro for manipulating a `ProtobufCMessage`. Used by STRUCT_MEMBER() and - * STRUCT_MEMBER_PTR(). + * Base macro for manipulating a `PaddleMobile__Framework__ProtobufCMessage`. + * Used by STRUCT_MEMBER() and STRUCT_MEMBER_PTR(). */ #define STRUCT_MEMBER_P(struct_p, struct_offset) \ ((void *)((uint8_t *)(struct_p) + (struct_offset))) /** - * Return field in a `ProtobufCMessage` based on offset. + * Return field in a `PaddleMobile__Framework__ProtobufCMessage` based on + * offset. * - * Take a pointer to a `ProtobufCMessage` and find the field at the offset. - * Cast it to the passed type. + * Take a pointer to a `PaddleMobile__Framework__ProtobufCMessage` and find the + * field at the offset. Cast it to the passed type. */ #define STRUCT_MEMBER(member_type, struct_p, struct_offset) \ (*(member_type *)STRUCT_MEMBER_P((struct_p), (struct_offset))) /** - * Return field in a `ProtobufCMessage` based on offset. + * Return field in a `PaddleMobile__Framework__ProtobufCMessage` based on + * offset. * - * Take a pointer to a `ProtobufCMessage` and find the field at the offset. Cast - * it to a pointer to the passed type. + * Take a pointer to a `PaddleMobile__Framework__ProtobufCMessage` and find the + * field at the offset. Cast it to a pointer to the passed type. */ #define STRUCT_MEMBER_PTR(member_type, struct_p, struct_offset) \ ((member_type *)STRUCT_MEMBER_P((struct_p), (struct_offset))) @@ -131,56 +134,68 @@ const char protobuf_c_empty_string[] = ""; /* --- version --- */ -const char *protobuf_c_version(void) { return PROTOBUF_C_VERSION; } +const char *PaddleMobile__Framework__protobuf_c_version(void) { + return PROTOBUF_C_VERSION; +} -uint32_t protobuf_c_version_number(void) { return PROTOBUF_C_VERSION_NUMBER; } +uint32_t PaddleMobile__Framework__protobuf_c_version_number(void) { + return PROTOBUF_C_VERSION_NUMBER; +} /* --- allocator --- */ -static void *system_alloc(void *allocator_data, size_t size) { +static void *PaddleMobile__Framework__system_alloc(void *allocator_data, + size_t size) { return malloc(size); } -static void system_free(void *allocator_data, void *data) { free(data); } +static void PaddleMobile__Framework__system_free(void *allocator_data, + void *data) { + free(data); +} -static inline void *do_alloc(ProtobufCAllocator *allocator, size_t size) { +static inline void *PaddleMobile__Framework__do_alloc( + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t size) { return allocator->alloc(allocator->allocator_data, size); } -static inline void do_free(ProtobufCAllocator *allocator, void *data) { +static inline void PaddleMobile__Framework__do_free( + PaddleMobile__Framework__ProtobufCAllocator *allocator, void *data) { if (data != NULL) allocator->free(allocator->allocator_data, data); } /* * This allocator uses the system's malloc() and free(). It is the default - * allocator used if NULL is passed as the ProtobufCAllocator to an exported - * function. + * allocator used if NULL is passed as the + * PaddleMobile__Framework__ProtobufCAllocator to an exported function. */ -static ProtobufCAllocator protobuf_c__allocator = { - .alloc = &system_alloc, - .free = &system_free, +static PaddleMobile__Framework__ProtobufCAllocator protobuf_c__allocator = { + .alloc = &PaddleMobile__Framework__system_alloc, + .free = &PaddleMobile__Framework__system_free, .allocator_data = NULL, }; /* === buffer-simple === */ -void protobuf_c_buffer_simple_append(ProtobufCBuffer *buffer, size_t len, - const uint8_t *data) { - ProtobufCBufferSimple *simp = (ProtobufCBufferSimple *)buffer; +void PaddleMobile__Framework__protobuf_c_buffer_simple_append( + PaddleMobile__Framework__ProtobufCBuffer *buffer, size_t len, + const uint8_t *data) { + PaddleMobile__Framework__ProtobufCBufferSimple *simp = + (PaddleMobile__Framework__ProtobufCBufferSimple *)buffer; size_t new_len = simp->len + len; if (new_len > simp->alloced) { - ProtobufCAllocator *allocator = simp->allocator; + PaddleMobile__Framework__ProtobufCAllocator *allocator = simp->allocator; size_t new_alloced = simp->alloced * 2; uint8_t *new_data; if (allocator == NULL) allocator = &protobuf_c__allocator; while (new_alloced < new_len) new_alloced += new_alloced; - new_data = do_alloc(allocator, new_alloced); + new_data = PaddleMobile__Framework__do_alloc(allocator, new_alloced); if (!new_data) return; memcpy(new_data, simp->data, simp->len); if (simp->must_free_data) - do_free(allocator, simp->data); + PaddleMobile__Framework__do_free(allocator, simp->data); else simp->must_free_data = TRUE; simp->data = new_data; @@ -191,9 +206,11 @@ void protobuf_c_buffer_simple_append(ProtobufCBuffer *buffer, size_t len, } /** - * \defgroup packedsz protobuf_c_message_get_packed_size() implementation + * \defgroup packedsz + * PaddleMobile__Framework__protobuf_c_message_get_packed_size() implementation * - * Routines mainly used by protobuf_c_message_get_packed_size(). + * Routines mainly used by + * PaddleMobile__Framework__protobuf_c_message_get_packed_size(). * * \ingroup internal * @{ @@ -366,8 +383,9 @@ static inline size_t sint64_size(int64_t v) { return uint64_size(zigzag64(v)); } * \return * Number of bytes required. */ -static size_t required_field_get_packed_size( - const ProtobufCFieldDescriptor *field, const void *member) { +static size_t PaddleMobile__Framework__required_field_get_packed_size( + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field, + const void *member) { size_t rv = get_tag_size(field->id); switch (field->type) { @@ -401,12 +419,16 @@ static size_t required_field_get_packed_size( return rv + uint32_size(len) + len; } case PROTOBUF_C_TYPE_BYTES: { - size_t len = ((const ProtobufCBinaryData *)member)->len; + size_t len = + ((const PaddleMobile__Framework__ProtobufCBinaryData *)member)->len; return rv + uint32_size(len) + len; } case PROTOBUF_C_TYPE_MESSAGE: { - const ProtobufCMessage *msg = *(ProtobufCMessage *const *)member; - size_t subrv = msg ? protobuf_c_message_get_packed_size(msg) : 0; + const PaddleMobile__Framework__ProtobufCMessage *msg = + *(PaddleMobile__Framework__ProtobufCMessage *const *)member; + size_t subrv = + msg ? PaddleMobile__Framework__protobuf_c_message_get_packed_size(msg) + : 0; return rv + uint32_size(subrv) + subrv; } } @@ -428,9 +450,9 @@ static size_t required_field_get_packed_size( * \return * Number of bytes required. */ -static size_t oneof_field_get_packed_size(const ProtobufCFieldDescriptor *field, - uint32_t oneof_case, - const void *member) { +static size_t PaddleMobile__Framework__oneof_field_get_packed_size( + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field, + uint32_t oneof_case, const void *member) { if (oneof_case != field->id) { return 0; } @@ -439,7 +461,7 @@ static size_t oneof_field_get_packed_size(const ProtobufCFieldDescriptor *field, const void *ptr = *(const void *const *)member; if (ptr == NULL || ptr == field->default_value) return 0; } - return required_field_get_packed_size(field, member); + return PaddleMobile__Framework__required_field_get_packed_size(field, member); } /** @@ -456,9 +478,9 @@ static size_t oneof_field_get_packed_size(const ProtobufCFieldDescriptor *field, * \return * Number of bytes required. */ -static size_t optional_field_get_packed_size( - const ProtobufCFieldDescriptor *field, const protobuf_c_boolean has, - const void *member) { +static size_t PaddleMobile__Framework__optional_field_get_packed_size( + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field, + const protobuf_c_boolean has, const void *member) { if (field->type == PROTOBUF_C_TYPE_MESSAGE || field->type == PROTOBUF_C_TYPE_STRING) { const void *ptr = *(const void *const *)member; @@ -466,11 +488,12 @@ static size_t optional_field_get_packed_size( } else { if (!has) return 0; } - return required_field_get_packed_size(field, member); + return PaddleMobile__Framework__required_field_get_packed_size(field, member); } -static protobuf_c_boolean field_is_zeroish( - const ProtobufCFieldDescriptor *field, const void *member) { +static protobuf_c_boolean PaddleMobile__Framework__field_is_zeroish( + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field, + const void *member) { protobuf_c_boolean ret = FALSE; switch (field->type) { @@ -527,10 +550,11 @@ static protobuf_c_boolean field_is_zeroish( * \return * Number of bytes required. */ -static size_t unlabeled_field_get_packed_size( - const ProtobufCFieldDescriptor *field, const void *member) { - if (field_is_zeroish(field, member)) return 0; - return required_field_get_packed_size(field, member); +static size_t PaddleMobile__Framework__unlabeled_field_get_packed_size( + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field, + const void *member) { + if (PaddleMobile__Framework__field_is_zeroish(field, member)) return 0; + return PaddleMobile__Framework__required_field_get_packed_size(field, member); } /** @@ -547,8 +571,9 @@ static size_t unlabeled_field_get_packed_size( * \return * Number of bytes required. */ -static size_t repeated_field_get_packed_size( - const ProtobufCFieldDescriptor *field, size_t count, const void *member) { +static size_t PaddleMobile__Framework__repeated_field_get_packed_size( + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field, + size_t count, const void *member) { size_t header_size; size_t rv = 0; unsigned i; @@ -597,14 +622,16 @@ static size_t repeated_field_get_packed_size( break; case PROTOBUF_C_TYPE_BYTES: for (i = 0; i < count; i++) { - size_t len = ((ProtobufCBinaryData *)array)[i].len; + size_t len = + ((PaddleMobile__Framework__ProtobufCBinaryData *)array)[i].len; rv += uint32_size(len) + len; } break; case PROTOBUF_C_TYPE_MESSAGE: for (i = 0; i < count; i++) { size_t len = - protobuf_c_message_get_packed_size(((ProtobufCMessage **)array)[i]); + PaddleMobile__Framework__protobuf_c_message_get_packed_size( + ((PaddleMobile__Framework__ProtobufCMessage **)array)[i]); rv += uint32_size(len) + len; } break; @@ -625,8 +652,8 @@ static size_t repeated_field_get_packed_size( * \return * Number of bytes required. */ -static inline size_t unknown_field_get_packed_size( - const ProtobufCMessageUnknownField *field) { +static inline size_t PaddleMobile__Framework__unknown_field_get_packed_size( + const PaddleMobile__Framework__ProtobufCMessageUnknownField *field) { return get_tag_size(field->tag) + field->len; } @@ -635,35 +662,40 @@ static inline size_t unknown_field_get_packed_size( /* * Calculate the serialized size of the message. */ -size_t protobuf_c_message_get_packed_size(const ProtobufCMessage *message) { +size_t PaddleMobile__Framework__protobuf_c_message_get_packed_size( + const PaddleMobile__Framework__ProtobufCMessage *message) { unsigned i; size_t rv = 0; ASSERT_IS_MESSAGE(message); for (i = 0; i < message->descriptor->n_fields; i++) { - const ProtobufCFieldDescriptor *field = message->descriptor->fields + i; + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field = + message->descriptor->fields + i; const void *member = ((const char *)message) + field->offset; const void *qmember = ((const char *)message) + field->quantifier_offset; if (field->label == PROTOBUF_C_LABEL_REQUIRED) { - rv += required_field_get_packed_size(field, member); + rv += PaddleMobile__Framework__required_field_get_packed_size(field, + member); } else if ((field->label == PROTOBUF_C_LABEL_OPTIONAL || field->label == PROTOBUF_C_LABEL_NONE) && (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_ONEOF))) { - rv += oneof_field_get_packed_size(field, *(const uint32_t *)qmember, - member); + rv += PaddleMobile__Framework__oneof_field_get_packed_size( + field, *(const uint32_t *)qmember, member); } else if (field->label == PROTOBUF_C_LABEL_OPTIONAL) { - rv += optional_field_get_packed_size( + rv += PaddleMobile__Framework__optional_field_get_packed_size( field, *(protobuf_c_boolean *)qmember, member); } else if (field->label == PROTOBUF_C_LABEL_NONE) { - rv += unlabeled_field_get_packed_size(field, member); + rv += PaddleMobile__Framework__unlabeled_field_get_packed_size(field, + member); } else { - rv += repeated_field_get_packed_size(field, *(const size_t *)qmember, - member); + rv += PaddleMobile__Framework__repeated_field_get_packed_size( + field, *(const size_t *)qmember, member); } } for (i = 0; i < message->n_unknown_fields; i++) - rv += unknown_field_get_packed_size(&message->unknown_fields[i]); + rv += PaddleMobile__Framework__unknown_field_get_packed_size( + &message->unknown_fields[i]); return rv; } @@ -687,7 +719,8 @@ size_t protobuf_c_message_get_packed_size(const ProtobufCMessage *message) { * \return * Number of bytes written to `out`. */ -static inline size_t uint32_pack(uint32_t value, uint8_t *out) { +static inline size_t PaddleMobile__Framework__uint32_pack(uint32_t value, + uint8_t *out) { unsigned rv = 0; if (value >= 0x80) { @@ -722,12 +755,13 @@ static inline size_t uint32_pack(uint32_t value, uint8_t *out) { * \return * Number of bytes written to `out`. */ -static size_t uint64_pack(uint64_t value, uint8_t *out) { +static size_t PaddleMobile__Framework__uint64_pack(uint64_t value, + uint8_t *out) { uint32_t hi = (uint32_t)(value >> 32); uint32_t lo = (uint32_t)value; unsigned rv; - if (hi == 0) return uint32_pack((uint32_t)lo, out); + if (hi == 0) return PaddleMobile__Framework__uint32_pack((uint32_t)lo, out); out[0] = (lo) | 0x80; out[1] = (lo >> 7) | 0x80; out[2] = (lo >> 14) | 0x80; @@ -749,20 +783,20 @@ static size_t uint64_pack(uint64_t value, uint8_t *out) { } /** - * Pack a ProtobufCBinaryData and return the number of bytes written. The output - * includes a length delimiter. + * Pack a PaddleMobile__Framework__ProtobufCBinaryData and return the number of + * bytes written. The output includes a length delimiter. * * \param bd - * ProtobufCBinaryData to encode. + * PaddleMobile__Framework__ProtobufCBinaryData to encode. * \param[out] out * Packed value. * \return * Number of bytes written to `out`. */ -static inline size_t binary_data_pack(const ProtobufCBinaryData *bd, - uint8_t *out) { +static inline size_t PaddleMobile__Framework__binary_data_pack( + const PaddleMobile__Framework__ProtobufCBinaryData *bd, uint8_t *out) { size_t len = bd->len; - size_t rv = uint32_pack(len, out); + size_t rv = PaddleMobile__Framework__uint32_pack(len, out); memcpy(out + rv, bd->data, len); return rv + len; } @@ -772,7 +806,7 @@ static inline size_t binary_data_pack(const ProtobufCBinaryData *bd, * * Wire-type will be added in required_field_pack(). * - * \todo Just call uint64_pack on 64-bit platforms. + * \todo Just call PaddleMobile__Framework__uint64_pack on 64-bit platforms. * * \param id * Tag value to encode. @@ -781,11 +815,11 @@ static inline size_t binary_data_pack(const ProtobufCBinaryData *bd, * \return * Number of bytes written to `out`. */ -static size_t tag_pack(uint32_t id, uint8_t *out) { +static size_t PaddleMobile__Framework__tag_pack(uint32_t id, uint8_t *out) { if (id < (1UL << (32 - 3))) - return uint32_pack(id << 3, out); + return PaddleMobile__Framework__uint32_pack(id << 3, out); else - return uint64_pack(((uint64_t)id) << 3, out); + return PaddleMobile__Framework__uint64_pack(((uint64_t)id) << 3, out); } /** @@ -798,7 +832,8 @@ static size_t tag_pack(uint32_t id, uint8_t *out) { * \return * Size of the field. */ -static inline size_t sizeof_elt_in_repeated_array(ProtobufCType type) { +static inline size_t PaddleMobile__Framework__sizeof_elt_in_repeated_array( + PaddleMobile__Framework__ProtobufCType type) { switch (type) { case PROTOBUF_C_TYPE_SINT32: case PROTOBUF_C_TYPE_INT32: @@ -821,14 +856,15 @@ static inline size_t sizeof_elt_in_repeated_array(ProtobufCType type) { case PROTOBUF_C_TYPE_MESSAGE: return sizeof(void *); case PROTOBUF_C_TYPE_BYTES: - return sizeof(ProtobufCBinaryData); + return sizeof(PaddleMobile__Framework__ProtobufCBinaryData); } PROTOBUF_C__ASSERT_NOT_REACHED(); return 0; } -static inline int int_range_lookup(unsigned n_ranges, - const ProtobufCIntRange *ranges, int value) { +static inline int PaddleMobile__Framework__int_range_lookup( + unsigned n_ranges, const PaddleMobile__Framework__ProtobufCIntRange *ranges, + int value) { unsigned n; unsigned start; @@ -861,9 +897,9 @@ static inline int int_range_lookup(unsigned n_ranges, return -1; } -static size_t parse_tag_and_wiretype(size_t len, const uint8_t *data, - uint32_t *tag_out, - ProtobufCWireType *wiretype_out) { +static size_t PaddleMobile__Framework__parse_tag_and_wiretype( + size_t len, const uint8_t *data, uint32_t *tag_out, + PaddleMobile__Framework__ProtobufCWireType *wiretype_out) { unsigned max_rv = len > 5 ? 5 : len; uint32_t tag = (data[0] & 0x7f) >> 3; unsigned shift = 4; @@ -889,20 +925,20 @@ static size_t parse_tag_and_wiretype(size_t len, const uint8_t *data, /* sizeof(ScannedMember) must be <= (1UL<descriptor->fields; + const PaddleMobile__Framework__ProtobufCFieldDescriptor *fields = + latter_msg->descriptor->fields; for (i = 0; i < latter_msg->descriptor->n_fields; i++) { if (fields[i].label == PROTOBUF_C_LABEL_REPEATED) { size_t *n_earlier = @@ -969,18 +1008,21 @@ static protobuf_c_boolean merge_messages(ProtobufCMessage *earlier_msg, if (*n_earlier > 0) { if (*n_latter > 0) { /* Concatenate the repeated field */ - size_t el_size = sizeof_elt_in_repeated_array(fields[i].type); + size_t el_size = + PaddleMobile__Framework__sizeof_elt_in_repeated_array( + fields[i].type); uint8_t *new_field; - new_field = do_alloc(allocator, (*n_earlier + *n_latter) * el_size); + new_field = PaddleMobile__Framework__do_alloc( + allocator, (*n_earlier + *n_latter) * el_size); if (!new_field) return FALSE; memcpy(new_field, *p_earlier, *n_earlier * el_size); memcpy(new_field + *n_earlier * el_size, *p_latter, *n_latter * el_size); - do_free(allocator, *p_latter); - do_free(allocator, *p_earlier); + PaddleMobile__Framework__do_free(allocator, *p_latter); + PaddleMobile__Framework__do_free(allocator, *p_earlier); *p_latter = new_field; *n_latter = *n_earlier + *n_latter; } else { @@ -994,7 +1036,7 @@ static protobuf_c_boolean merge_messages(ProtobufCMessage *earlier_msg, } } else if (fields[i].label == PROTOBUF_C_LABEL_OPTIONAL || fields[i].label == PROTOBUF_C_LABEL_NONE) { - const ProtobufCFieldDescriptor *field; + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field; uint32_t *earlier_case_p = STRUCT_MEMBER_PTR(uint32_t, earlier_msg, fields[i].quantifier_offset); uint32_t *latter_case_p = @@ -1007,7 +1049,7 @@ static protobuf_c_boolean merge_messages(ProtobufCMessage *earlier_msg, if (fields[i].flags & PROTOBUF_C_FIELD_FLAG_ONEOF) { if (*latter_case_p == 0) { /* lookup correct oneof field */ - int field_index = int_range_lookup( + int field_index = PaddleMobile__Framework__int_range_lookup( latter_msg->descriptor->n_field_ranges, latter_msg->descriptor->field_ranges, *earlier_case_p); field = latter_msg->descriptor->fields + field_index; @@ -1025,11 +1067,14 @@ static protobuf_c_boolean merge_messages(ProtobufCMessage *earlier_msg, switch (field->type) { case PROTOBUF_C_TYPE_MESSAGE: { - ProtobufCMessage *em = *(ProtobufCMessage **)earlier_elem; - ProtobufCMessage *lm = *(ProtobufCMessage **)latter_elem; + PaddleMobile__Framework__ProtobufCMessage *em = + *(PaddleMobile__Framework__ProtobufCMessage **)earlier_elem; + PaddleMobile__Framework__ProtobufCMessage *lm = + *(PaddleMobile__Framework__ProtobufCMessage **)latter_elem; if (em != NULL) { if (lm != NULL) { - if (!merge_messages(em, lm, allocator)) return FALSE; + if (!PaddleMobile__Framework__merge_messages(em, lm, allocator)) + return FALSE; /* Already merged */ need_to_merge = FALSE; } else { @@ -1040,9 +1085,14 @@ static protobuf_c_boolean merge_messages(ProtobufCMessage *earlier_msg, break; } case PROTOBUF_C_TYPE_BYTES: { - uint8_t *e_data = ((ProtobufCBinaryData *)earlier_elem)->data; - uint8_t *l_data = ((ProtobufCBinaryData *)latter_elem)->data; - const ProtobufCBinaryData *d_bd = (ProtobufCBinaryData *)def_val; + uint8_t *e_data = + ((PaddleMobile__Framework__ProtobufCBinaryData *)earlier_elem) + ->data; + uint8_t *l_data = + ((PaddleMobile__Framework__ProtobufCBinaryData *)latter_elem) + ->data; + const PaddleMobile__Framework__ProtobufCBinaryData *d_bd = + (PaddleMobile__Framework__ProtobufCBinaryData *)def_val; need_to_merge = (e_data != NULL && (d_bd == NULL || e_data != d_bd->data)) && @@ -1067,7 +1117,8 @@ static protobuf_c_boolean merge_messages(ProtobufCMessage *earlier_msg, } if (need_to_merge) { - size_t el_size = sizeof_elt_in_repeated_array(field->type); + size_t el_size = + PaddleMobile__Framework__sizeof_elt_in_repeated_array(field->type); memcpy(latter_elem, earlier_elem, el_size); /* * Reset the element from the old message to 0 @@ -1096,11 +1147,11 @@ static protobuf_c_boolean merge_messages(ProtobufCMessage *earlier_msg, * Given a raw slab of packed-repeated values, determine the number of * elements. This function detects certain kinds of errors but not * others; the remaining error checking is done by - * parse_packed_repeated_member(). + * PaddleMobile__Framework__parse_packed_repeated_member(). */ -static protobuf_c_boolean count_packed_elements(ProtobufCType type, size_t len, - const uint8_t *data, - size_t *count_out) { +static protobuf_c_boolean PaddleMobile__Framework__count_packed_elements( + PaddleMobile__Framework__ProtobufCType type, size_t len, + const uint8_t *data, size_t *count_out) { switch (type) { case PROTOBUF_C_TYPE_SFIXED32: case PROTOBUF_C_TYPE_FIXED32: @@ -1129,7 +1180,7 @@ static protobuf_c_boolean count_packed_elements(ProtobufCType type, size_t len, case PROTOBUF_C_TYPE_INT64: case PROTOBUF_C_TYPE_SINT64: case PROTOBUF_C_TYPE_UINT64: - *count_out = max_b128_numbers(len, data); + *count_out = PaddleMobile__Framework__max_b128_numbers(len, data); return TRUE; case PROTOBUF_C_TYPE_BOOL: *count_out = len; @@ -1144,7 +1195,8 @@ static protobuf_c_boolean count_packed_elements(ProtobufCType type, size_t len, } } -static inline uint32_t parse_uint32(unsigned len, const uint8_t *data) { +static inline uint32_t PaddleMobile__Framework__parse_uint32( + unsigned len, const uint8_t *data) { uint32_t rv = data[0] & 0x7f; if (len > 1) { rv |= ((uint32_t)(data[1] & 0x7f) << 7); @@ -1159,8 +1211,9 @@ static inline uint32_t parse_uint32(unsigned len, const uint8_t *data) { return rv; } -static inline uint32_t parse_int32(unsigned len, const uint8_t *data) { - return parse_uint32(len, data); +static inline uint32_t PaddleMobile__Framework__parse_int32( + unsigned len, const uint8_t *data) { + return PaddleMobile__Framework__parse_uint32(len, data); } static inline int32_t unzigzag32(uint32_t v) { @@ -1170,7 +1223,8 @@ static inline int32_t unzigzag32(uint32_t v) { return v >> 1; } -static inline uint32_t parse_fixed_uint32(const uint8_t *data) { +static inline uint32_t PaddleMobile__Framework__parse_fixed_uint32( + const uint8_t *data) { #if !defined(WORDS_BIGENDIAN) uint32_t t; memcpy(&t, data, 4); @@ -1181,11 +1235,12 @@ static inline uint32_t parse_fixed_uint32(const uint8_t *data) { #endif } -static uint64_t parse_uint64(unsigned len, const uint8_t *data) { +static uint64_t PaddleMobile__Framework__parse_uint64(unsigned len, + const uint8_t *data) { unsigned shift, i; uint64_t rv; - if (len < 5) return parse_uint32(len, data); + if (len < 5) return PaddleMobile__Framework__parse_uint32(len, data); rv = ((uint64_t)(data[0] & 0x7f)) | ((uint64_t)(data[1] & 0x7f) << 7) | ((uint64_t)(data[2] & 0x7f) << 14) | ((uint64_t)(data[3] & 0x7f) << 21); shift = 28; @@ -1196,75 +1251,83 @@ static uint64_t parse_uint64(unsigned len, const uint8_t *data) { return rv; } -static inline int64_t unzigzag64(uint64_t v) { +static inline int64_t PaddleMobile__Framework__unzigzag64(uint64_t v) { if (v & 1) return -(v >> 1) - 1; else return v >> 1; } -static inline uint64_t parse_fixed_uint64(const uint8_t *data) { +static inline uint64_t PaddleMobile__Framework__parse_fixed_uint64( + const uint8_t *data) { #if !defined(WORDS_BIGENDIAN) uint64_t t; memcpy(&t, data, 8); return t; #else - return (uint64_t)parse_fixed_uint32(data) | - (((uint64_t)parse_fixed_uint32(data + 4)) << 32); + return (uint64_t)PaddleMobile__Framework__parse_fixed_uint32(data) | + (((uint64_t)PaddleMobile__Framework__parse_fixed_uint32(data + 4)) + << 32); #endif } -static protobuf_c_boolean parse_boolean(unsigned len, const uint8_t *data) { +static protobuf_c_boolean PaddleMobile__Framework__parse_boolean( + unsigned len, const uint8_t *data) { unsigned i; for (i = 0; i < len; i++) if (data[i] & 0x7f) return TRUE; return FALSE; } -static protobuf_c_boolean parse_required_member( - ScannedMember *scanned_member, void *member, ProtobufCAllocator *allocator, +static protobuf_c_boolean PaddleMobile__Framework__parse_required_member( + ScannedMember *scanned_member, void *member, + PaddleMobile__Framework__ProtobufCAllocator *allocator, protobuf_c_boolean maybe_clear) { unsigned len = scanned_member->len; const uint8_t *data = scanned_member->data; - ProtobufCWireType wire_type = scanned_member->wire_type; + PaddleMobile__Framework__ProtobufCWireType wire_type = + scanned_member->wire_type; switch (scanned_member->field->type) { case PROTOBUF_C_TYPE_ENUM: case PROTOBUF_C_TYPE_INT32: if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) return FALSE; - *(int32_t *)member = parse_int32(len, data); + *(int32_t *)member = PaddleMobile__Framework__parse_int32(len, data); return TRUE; case PROTOBUF_C_TYPE_UINT32: if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) return FALSE; - *(uint32_t *)member = parse_uint32(len, data); + *(uint32_t *)member = PaddleMobile__Framework__parse_uint32(len, data); return TRUE; case PROTOBUF_C_TYPE_SINT32: if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) return FALSE; - *(int32_t *)member = unzigzag32(parse_uint32(len, data)); + *(int32_t *)member = + unzigzag32(PaddleMobile__Framework__parse_uint32(len, data)); return TRUE; case PROTOBUF_C_TYPE_SFIXED32: case PROTOBUF_C_TYPE_FIXED32: case PROTOBUF_C_TYPE_FLOAT: if (wire_type != PROTOBUF_C_WIRE_TYPE_32BIT) return FALSE; - *(uint32_t *)member = parse_fixed_uint32(data); + *(uint32_t *)member = PaddleMobile__Framework__parse_fixed_uint32(data); return TRUE; case PROTOBUF_C_TYPE_INT64: case PROTOBUF_C_TYPE_UINT64: if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) return FALSE; - *(uint64_t *)member = parse_uint64(len, data); + *(uint64_t *)member = PaddleMobile__Framework__parse_uint64(len, data); return TRUE; case PROTOBUF_C_TYPE_SINT64: if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) return FALSE; - *(int64_t *)member = unzigzag64(parse_uint64(len, data)); + *(int64_t *)member = PaddleMobile__Framework__unzigzag64( + PaddleMobile__Framework__parse_uint64(len, data)); return TRUE; case PROTOBUF_C_TYPE_SFIXED64: case PROTOBUF_C_TYPE_FIXED64: case PROTOBUF_C_TYPE_DOUBLE: if (wire_type != PROTOBUF_C_WIRE_TYPE_64BIT) return FALSE; - *(uint64_t *)member = parse_fixed_uint64(data); + *(uint64_t *)member = PaddleMobile__Framework__parse_fixed_uint64(data); return TRUE; case PROTOBUF_C_TYPE_BOOL: - *(protobuf_c_boolean *)member = parse_boolean(len, data); + *(protobuf_c_boolean *)member = + PaddleMobile__Framework__parse_boolean(len, data); return TRUE; case PROTOBUF_C_TYPE_STRING: { char **pstr = member; @@ -1274,17 +1337,18 @@ static protobuf_c_boolean parse_required_member( if (maybe_clear && *pstr != NULL) { const char *def = scanned_member->field->default_value; - if (*pstr != NULL && *pstr != def) do_free(allocator, *pstr); + if (*pstr != NULL && *pstr != def) + PaddleMobile__Framework__do_free(allocator, *pstr); } - *pstr = do_alloc(allocator, len - pref_len + 1); + *pstr = PaddleMobile__Framework__do_alloc(allocator, len - pref_len + 1); if (*pstr == NULL) return FALSE; memcpy(*pstr, data + pref_len, len - pref_len); (*pstr)[len - pref_len] = 0; return TRUE; } case PROTOBUF_C_TYPE_BYTES: { - ProtobufCBinaryData *bd = member; - const ProtobufCBinaryData *def_bd; + PaddleMobile__Framework__ProtobufCBinaryData *bd = member; + const PaddleMobile__Framework__ProtobufCBinaryData *def_bd; unsigned pref_len = scanned_member->length_prefix_len; if (wire_type != PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED) return FALSE; @@ -1292,10 +1356,10 @@ static protobuf_c_boolean parse_required_member( def_bd = scanned_member->field->default_value; if (maybe_clear && bd->data != NULL && (def_bd == NULL || bd->data != def_bd->data)) { - do_free(allocator, bd->data); + PaddleMobile__Framework__do_free(allocator, bd->data); } if (len - pref_len > 0) { - bd->data = do_alloc(allocator, len - pref_len); + bd->data = PaddleMobile__Framework__do_alloc(allocator, len - pref_len); if (bd->data == NULL) return FALSE; memcpy(bd->data, data + pref_len, len - pref_len); } else { @@ -1305,24 +1369,26 @@ static protobuf_c_boolean parse_required_member( return TRUE; } case PROTOBUF_C_TYPE_MESSAGE: { - ProtobufCMessage **pmessage = member; - ProtobufCMessage *subm; - const ProtobufCMessage *def_mess; + PaddleMobile__Framework__ProtobufCMessage **pmessage = member; + PaddleMobile__Framework__ProtobufCMessage *subm; + const PaddleMobile__Framework__ProtobufCMessage *def_mess; protobuf_c_boolean merge_successful = TRUE; unsigned pref_len = scanned_member->length_prefix_len; if (wire_type != PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED) return FALSE; def_mess = scanned_member->field->default_value; - subm = - protobuf_c_message_unpack(scanned_member->field->descriptor, - allocator, len - pref_len, data + pref_len); + subm = PaddleMobile__Framework__protobuf_c_message_unpack( + scanned_member->field->descriptor, allocator, len - pref_len, + data + pref_len); if (maybe_clear && *pmessage != NULL && *pmessage != def_mess) { if (subm != NULL) - merge_successful = merge_messages(*pmessage, subm, allocator); + merge_successful = PaddleMobile__Framework__merge_messages( + *pmessage, subm, allocator); /* Delete the previous message */ - protobuf_c_message_free_unpacked(*pmessage, allocator); + PaddleMobile__Framework__protobuf_c_message_free_unpacked(*pmessage, + allocator); } *pmessage = subm; if (subm == NULL || !merge_successful) return FALSE; @@ -1332,43 +1398,48 @@ static protobuf_c_boolean parse_required_member( return FALSE; } -static protobuf_c_boolean parse_oneof_member(ScannedMember *scanned_member, - void *member, - ProtobufCMessage *message, - ProtobufCAllocator *allocator) { +static protobuf_c_boolean PaddleMobile__Framework__parse_oneof_member( + ScannedMember *scanned_member, void *member, + PaddleMobile__Framework__ProtobufCMessage *message, + PaddleMobile__Framework__ProtobufCAllocator *allocator) { uint32_t *oneof_case = STRUCT_MEMBER_PTR( uint32_t, message, scanned_member->field->quantifier_offset); /* If we have already parsed a member of this oneof, free it. */ if (*oneof_case != 0) { /* lookup field */ - int field_index = - int_range_lookup(message->descriptor->n_field_ranges, - message->descriptor->field_ranges, *oneof_case); - const ProtobufCFieldDescriptor *old_field = + int field_index = PaddleMobile__Framework__int_range_lookup( + message->descriptor->n_field_ranges, message->descriptor->field_ranges, + *oneof_case); + const PaddleMobile__Framework__ProtobufCFieldDescriptor *old_field = message->descriptor->fields + field_index; - size_t el_size = sizeof_elt_in_repeated_array(old_field->type); + size_t el_size = + PaddleMobile__Framework__sizeof_elt_in_repeated_array(old_field->type); switch (old_field->type) { case PROTOBUF_C_TYPE_STRING: { char **pstr = member; const char *def = old_field->default_value; - if (*pstr != NULL && *pstr != def) do_free(allocator, *pstr); + if (*pstr != NULL && *pstr != def) + PaddleMobile__Framework__do_free(allocator, *pstr); break; } case PROTOBUF_C_TYPE_BYTES: { - ProtobufCBinaryData *bd = member; - const ProtobufCBinaryData *def_bd = old_field->default_value; + PaddleMobile__Framework__ProtobufCBinaryData *bd = member; + const PaddleMobile__Framework__ProtobufCBinaryData *def_bd = + old_field->default_value; if (bd->data != NULL && (def_bd == NULL || bd->data != def_bd->data)) { - do_free(allocator, bd->data); + PaddleMobile__Framework__do_free(allocator, bd->data); } break; } case PROTOBUF_C_TYPE_MESSAGE: { - ProtobufCMessage **pmessage = member; - const ProtobufCMessage *def_mess = old_field->default_value; + PaddleMobile__Framework__ProtobufCMessage **pmessage = member; + const PaddleMobile__Framework__ProtobufCMessage *def_mess = + old_field->default_value; if (*pmessage != NULL && *pmessage != def_mess) - protobuf_c_message_free_unpacked(*pmessage, allocator); + PaddleMobile__Framework__protobuf_c_message_free_unpacked(*pmessage, + allocator); break; } default: @@ -1377,18 +1448,20 @@ static protobuf_c_boolean parse_oneof_member(ScannedMember *scanned_member, memset(member, 0, el_size); } - if (!parse_required_member(scanned_member, member, allocator, TRUE)) + if (!PaddleMobile__Framework__parse_required_member(scanned_member, member, + allocator, TRUE)) return FALSE; *oneof_case = scanned_member->tag; return TRUE; } -static protobuf_c_boolean parse_optional_member(ScannedMember *scanned_member, - void *member, - ProtobufCMessage *message, - ProtobufCAllocator *allocator) { - if (!parse_required_member(scanned_member, member, allocator, TRUE)) +static protobuf_c_boolean PaddleMobile__Framework__parse_optional_member( + ScannedMember *scanned_member, void *member, + PaddleMobile__Framework__ProtobufCMessage *message, + PaddleMobile__Framework__ProtobufCAllocator *allocator) { + if (!PaddleMobile__Framework__parse_required_member(scanned_member, member, + allocator, TRUE)) return FALSE; if (scanned_member->field->quantifier_offset != 0) STRUCT_MEMBER(protobuf_c_boolean, message, @@ -1396,24 +1469,27 @@ static protobuf_c_boolean parse_optional_member(ScannedMember *scanned_member, return TRUE; } -static protobuf_c_boolean parse_repeated_member(ScannedMember *scanned_member, - void *member, - ProtobufCMessage *message, - ProtobufCAllocator *allocator) { - const ProtobufCFieldDescriptor *field = scanned_member->field; +static protobuf_c_boolean PaddleMobile__Framework__parse_repeated_member( + ScannedMember *scanned_member, void *member, + PaddleMobile__Framework__ProtobufCMessage *message, + PaddleMobile__Framework__ProtobufCAllocator *allocator) { + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field = + scanned_member->field; size_t *p_n = STRUCT_MEMBER_PTR(size_t, message, field->quantifier_offset); - size_t siz = sizeof_elt_in_repeated_array(field->type); + size_t siz = + PaddleMobile__Framework__sizeof_elt_in_repeated_array(field->type); char *array = *(char **)member; - if (!parse_required_member(scanned_member, array + siz * (*p_n), allocator, - FALSE)) { + if (!PaddleMobile__Framework__parse_required_member( + scanned_member, array + siz * (*p_n), allocator, FALSE)) { return FALSE; } *p_n += 1; return TRUE; } -static unsigned scan_varint(unsigned len, const uint8_t *data) { +static unsigned PaddleMobile__Framework__scan_varint(unsigned len, + const uint8_t *data) { unsigned i; if (len > 10) len = 10; for (i = 0; i < len; i++) @@ -1422,11 +1498,14 @@ static unsigned scan_varint(unsigned len, const uint8_t *data) { return i + 1; } -static protobuf_c_boolean parse_packed_repeated_member( - ScannedMember *scanned_member, void *member, ProtobufCMessage *message) { - const ProtobufCFieldDescriptor *field = scanned_member->field; +static protobuf_c_boolean PaddleMobile__Framework__parse_packed_repeated_member( + ScannedMember *scanned_member, void *member, + PaddleMobile__Framework__ProtobufCMessage *message) { + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field = + scanned_member->field; size_t *p_n = STRUCT_MEMBER_PTR(size_t, message, field->quantifier_offset); - size_t siz = sizeof_elt_in_repeated_array(field->type); + size_t siz = + PaddleMobile__Framework__sizeof_elt_in_repeated_array(field->type); void *array = *(char **)member + siz * (*p_n); const uint8_t *at = scanned_member->data + scanned_member->length_prefix_len; size_t rem = scanned_member->len - scanned_member->length_prefix_len; @@ -1442,7 +1521,8 @@ static protobuf_c_boolean parse_packed_repeated_member( goto no_unpacking_needed; #else for (i = 0; i < count; i++) { - ((uint32_t *)array)[i] = parse_fixed_uint32(at); + ((uint32_t *)array)[i] = + PaddleMobile__Framework__parse_fixed_uint32(at); at += 4; } break; @@ -1455,7 +1535,8 @@ static protobuf_c_boolean parse_packed_repeated_member( goto no_unpacking_needed; #else for (i = 0; i < count; i++) { - ((uint64_t *)array)[i] = parse_fixed_uint64(at); + ((uint64_t *)array)[i] = + PaddleMobile__Framework__parse_fixed_uint64(at); at += 8; } break; @@ -1463,36 +1544,39 @@ static protobuf_c_boolean parse_packed_repeated_member( case PROTOBUF_C_TYPE_ENUM: case PROTOBUF_C_TYPE_INT32: while (rem > 0) { - unsigned s = scan_varint(rem, at); + unsigned s = PaddleMobile__Framework__scan_varint(rem, at); if (s == 0) { PROTOBUF_C_UNPACK_ERROR("bad packed-repeated int32 value"); return FALSE; } - ((int32_t *)array)[count++] = parse_int32(s, at); + ((int32_t *)array)[count++] = + PaddleMobile__Framework__parse_int32(s, at); at += s; rem -= s; } break; case PROTOBUF_C_TYPE_SINT32: while (rem > 0) { - unsigned s = scan_varint(rem, at); + unsigned s = PaddleMobile__Framework__scan_varint(rem, at); if (s == 0) { PROTOBUF_C_UNPACK_ERROR("bad packed-repeated sint32 value"); return FALSE; } - ((int32_t *)array)[count++] = unzigzag32(parse_uint32(s, at)); + ((int32_t *)array)[count++] = + unzigzag32(PaddleMobile__Framework__parse_uint32(s, at)); at += s; rem -= s; } break; case PROTOBUF_C_TYPE_UINT32: while (rem > 0) { - unsigned s = scan_varint(rem, at); + unsigned s = PaddleMobile__Framework__scan_varint(rem, at); if (s == 0) { PROTOBUF_C_UNPACK_ERROR("bad packed-repeated enum or uint32 value"); return FALSE; } - ((uint32_t *)array)[count++] = parse_uint32(s, at); + ((uint32_t *)array)[count++] = + PaddleMobile__Framework__parse_uint32(s, at); at += s; rem -= s; } @@ -1500,12 +1584,13 @@ static protobuf_c_boolean parse_packed_repeated_member( case PROTOBUF_C_TYPE_SINT64: while (rem > 0) { - unsigned s = scan_varint(rem, at); + unsigned s = PaddleMobile__Framework__scan_varint(rem, at); if (s == 0) { PROTOBUF_C_UNPACK_ERROR("bad packed-repeated sint64 value"); return FALSE; } - ((int64_t *)array)[count++] = unzigzag64(parse_uint64(s, at)); + ((int64_t *)array)[count++] = PaddleMobile__Framework__unzigzag64( + PaddleMobile__Framework__parse_uint64(s, at)); at += s; rem -= s; } @@ -1513,12 +1598,13 @@ static protobuf_c_boolean parse_packed_repeated_member( case PROTOBUF_C_TYPE_INT64: case PROTOBUF_C_TYPE_UINT64: while (rem > 0) { - unsigned s = scan_varint(rem, at); + unsigned s = PaddleMobile__Framework__scan_varint(rem, at); if (s == 0) { PROTOBUF_C_UNPACK_ERROR("bad packed-repeated int64/uint64 value"); return FALSE; } - ((int64_t *)array)[count++] = parse_uint64(s, at); + ((int64_t *)array)[count++] = + PaddleMobile__Framework__parse_uint64(s, at); at += s; rem -= s; } @@ -1547,24 +1633,28 @@ no_unpacking_needed: #endif } -static protobuf_c_boolean is_packable_type(ProtobufCType type) { +static protobuf_c_boolean PaddleMobile__Framework__is_packable_type( + PaddleMobile__Framework__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, - ProtobufCAllocator *allocator) { - const ProtobufCFieldDescriptor *field = scanned_member->field; +static protobuf_c_boolean PaddleMobile__Framework__parse_member( + ScannedMember *scanned_member, + PaddleMobile__Framework__ProtobufCMessage *message, + PaddleMobile__Framework__ProtobufCAllocator *allocator) { + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field = + scanned_member->field; void *member; if (field == NULL) { - ProtobufCMessageUnknownField *ufield = + PaddleMobile__Framework__ProtobufCMessageUnknownField *ufield = message->unknown_fields + (message->n_unknown_fields++); ufield->tag = scanned_member->tag; ufield->wire_type = scanned_member->wire_type; ufield->len = scanned_member->len; - ufield->data = do_alloc(allocator, scanned_member->len); + ufield->data = + PaddleMobile__Framework__do_alloc(allocator, scanned_member->len); if (ufield->data == NULL) return FALSE; memcpy(ufield->data, scanned_member->data, ufield->len); return TRUE; @@ -1572,23 +1662,26 @@ static protobuf_c_boolean parse_member(ScannedMember *scanned_member, member = (char *)message + field->offset; switch (field->label) { case PROTOBUF_C_LABEL_REQUIRED: - return parse_required_member(scanned_member, member, allocator, TRUE); + return PaddleMobile__Framework__parse_required_member( + scanned_member, member, allocator, TRUE); case PROTOBUF_C_LABEL_OPTIONAL: case PROTOBUF_C_LABEL_NONE: if (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_ONEOF)) { - return parse_oneof_member(scanned_member, member, message, allocator); + return PaddleMobile__Framework__parse_oneof_member( + scanned_member, member, message, allocator); } else { - return parse_optional_member(scanned_member, member, message, - allocator); + return PaddleMobile__Framework__parse_optional_member( + scanned_member, member, message, allocator); } case PROTOBUF_C_LABEL_REPEATED: if (scanned_member->wire_type == PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED && (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_PACKED) || - is_packable_type(field->type))) { - return parse_packed_repeated_member(scanned_member, member, message); + PaddleMobile__Framework__is_packable_type(field->type))) { + return PaddleMobile__Framework__parse_packed_repeated_member( + scanned_member, member, message); } else { - return parse_repeated_member(scanned_member, member, message, - allocator); + return PaddleMobile__Framework__parse_repeated_member( + scanned_member, member, message, allocator); } } PROTOBUF_C__ASSERT_NOT_REACHED(); @@ -1602,8 +1695,9 @@ static protobuf_c_boolean parse_member(ScannedMember *scanned_member, * for old code, and which would be useful to support allocating * descriptors dynamically). */ -static void message_init_generic(const ProtobufCMessageDescriptor *desc, - ProtobufCMessage *message) { +static void PaddleMobile__Framework__message_init_generic( + const PaddleMobile__Framework__ProtobufCMessageDescriptor *desc, + PaddleMobile__Framework__ProtobufCMessage *message) { unsigned i; memset(message, 0, desc->sizeof_message); @@ -1636,7 +1730,8 @@ static void message_init_generic(const ProtobufCMessageDescriptor *desc, memcpy(field, dv, sizeof(protobuf_c_boolean)); break; case PROTOBUF_C_TYPE_BYTES: - memcpy(field, dv, sizeof(ProtobufCBinaryData)); + memcpy(field, dv, + sizeof(PaddleMobile__Framework__ProtobufCBinaryData)); break; case PROTOBUF_C_TYPE_STRING: @@ -1680,13 +1775,16 @@ static void message_init_generic(const ProtobufCMessageDescriptor *desc, #define REQUIRED_FIELD_BITMAP_IS_SET(index) \ (required_fields_bitmap[(index) / 8] & (1UL << ((index) % 8))) -ProtobufCMessage *protobuf_c_message_unpack( - const ProtobufCMessageDescriptor *desc, ProtobufCAllocator *allocator, - size_t len, const uint8_t *data) { - ProtobufCMessage *rv; +PaddleMobile__Framework__ProtobufCMessage * +PaddleMobile__Framework__protobuf_c_message_unpack( + const PaddleMobile__Framework__ProtobufCMessageDescriptor *desc, + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data) { + PaddleMobile__Framework__ProtobufCMessage *rv; size_t rem = len; const uint8_t *at = data; - const ProtobufCFieldDescriptor *last_field = desc->fields + 0; + const PaddleMobile__Framework__ProtobufCFieldDescriptor *last_field = + desc->fields + 0; ScannedMember first_member_slab[1UL << FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2]; /* @@ -1712,15 +1810,16 @@ ProtobufCMessage *protobuf_c_message_unpack( if (allocator == NULL) allocator = &protobuf_c__allocator; - rv = do_alloc(allocator, desc->sizeof_message); + rv = PaddleMobile__Framework__do_alloc(allocator, desc->sizeof_message); if (!rv) return (NULL); scanned_member_slabs[0] = first_member_slab; required_fields_bitmap_len = (desc->n_fields + 7) / 8; if (required_fields_bitmap_len > sizeof(required_fields_bitmap_stack)) { - required_fields_bitmap = do_alloc(allocator, required_fields_bitmap_len); + required_fields_bitmap = PaddleMobile__Framework__do_alloc( + allocator, required_fields_bitmap_len); if (!required_fields_bitmap) { - do_free(allocator, rv); + PaddleMobile__Framework__do_free(allocator, rv); return (NULL); } required_fields_bitmap_alloced = TRUE; @@ -1734,15 +1833,16 @@ ProtobufCMessage *protobuf_c_message_unpack( * source (most likely, direct construction from the .proto file). */ if (desc->message_init != NULL) - protobuf_c_message_init(desc, rv); + PaddleMobile__Framework__protobuf_c_message_init(desc, rv); else - message_init_generic(desc, rv); + PaddleMobile__Framework__message_init_generic(desc, rv); while (rem > 0) { uint32_t tag; - ProtobufCWireType wire_type; - size_t used = parse_tag_and_wiretype(rem, at, &tag, &wire_type); - const ProtobufCFieldDescriptor *field; + PaddleMobile__Framework__ProtobufCWireType wire_type; + size_t used = PaddleMobile__Framework__parse_tag_and_wiretype(rem, at, &tag, + &wire_type); + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field; ScannedMember tmp; if (used == 0) { @@ -1756,8 +1856,8 @@ ProtobufCMessage *protobuf_c_message_unpack( */ if (last_field == NULL || last_field->id != tag) { /* lookup field */ - int field_index = - int_range_lookup(desc->n_field_ranges, desc->field_ranges, tag); + int field_index = PaddleMobile__Framework__int_range_lookup( + desc->n_field_ranges, desc->field_ranges, tag); if (field_index < 0) { field = NULL; n_unknown++; @@ -1807,9 +1907,11 @@ ProtobufCMessage *protobuf_c_message_unpack( case PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED: { size_t pref_len; - tmp.len = scan_length_prefixed_data(rem, at, &pref_len); + tmp.len = PaddleMobile__Framework__scan_length_prefixed_data(rem, at, + &pref_len); if (tmp.len == 0) { - /* NOTE: scan_length_prefixed_data calls UNPACK_ERROR */ + /* NOTE: PaddleMobile__Framework__scan_length_prefixed_data calls + * UNPACK_ERROR */ goto error_cleanup_during_scan; } tmp.length_prefix_len = pref_len; @@ -1841,7 +1943,8 @@ ProtobufCMessage *protobuf_c_message_unpack( which_slab++; size = sizeof(ScannedMember) << (which_slab + FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2); - scanned_member_slabs[which_slab] = do_alloc(allocator, size); + scanned_member_slabs[which_slab] = + PaddleMobile__Framework__do_alloc(allocator, size); if (scanned_member_slabs[which_slab] == NULL) goto error_cleanup_during_scan; } @@ -1851,10 +1954,11 @@ ProtobufCMessage *protobuf_c_message_unpack( size_t *n = STRUCT_MEMBER_PTR(size_t, rv, field->quantifier_offset); if (wire_type == PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED && (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_PACKED) || - is_packable_type(field->type))) { + PaddleMobile__Framework__is_packable_type(field->type))) { size_t count; - if (!count_packed_elements(field->type, tmp.len - tmp.length_prefix_len, - tmp.data + tmp.length_prefix_len, &count)) { + if (!PaddleMobile__Framework__count_packed_elements( + field->type, tmp.len - tmp.length_prefix_len, + tmp.data + tmp.length_prefix_len, &count)) { PROTOBUF_C_UNPACK_ERROR("counting packed elements"); goto error_cleanup_during_scan; } @@ -1871,9 +1975,11 @@ ProtobufCMessage *protobuf_c_message_unpack( /* allocate space for repeated fields, also check that all required fields * have been set */ for (f = 0; f < desc->n_fields; f++) { - const ProtobufCFieldDescriptor *field = desc->fields + f; + const PaddleMobile__Framework__ProtobufCFieldDescriptor *field = + desc->fields + f; if (field->label == PROTOBUF_C_LABEL_REPEATED) { - size_t siz = sizeof_elt_in_repeated_array(field->type); + size_t siz = + PaddleMobile__Framework__sizeof_elt_in_repeated_array(field->type); size_t *n_ptr = STRUCT_MEMBER_PTR(size_t, rv, field->quantifier_offset); if (*n_ptr != 0) { unsigned n = *n_ptr; @@ -1886,7 +1992,7 @@ ProtobufCMessage *protobuf_c_message_unpack( if (field->label == PROTOBUF_C_LABEL_REPEATED) \ STRUCT_MEMBER(size_t, rv, field->quantifier_offset) = 0; \ } - a = do_alloc(allocator, siz * n); + a = PaddleMobile__Framework__do_alloc(allocator, siz * n); if (!a) { CLEAR_REMAINING_N_PTRS(); goto error_cleanup; @@ -1906,8 +2012,10 @@ ProtobufCMessage *protobuf_c_message_unpack( /* allocate space for unknown fields */ if (n_unknown) { - rv->unknown_fields = - do_alloc(allocator, n_unknown * sizeof(ProtobufCMessageUnknownField)); + rv->unknown_fields = PaddleMobile__Framework__do_alloc( + allocator, + n_unknown * + sizeof(PaddleMobile__Framework__ProtobufCMessageUnknownField)); if (rv->unknown_fields == NULL) goto error_cleanup; } @@ -1918,7 +2026,7 @@ ProtobufCMessage *protobuf_c_message_unpack( ScannedMember *slab = scanned_member_slabs[i_slab]; for (j = 0; j < max; j++) { - if (!parse_member(slab + j, rv, allocator)) { + if (!PaddleMobile__Framework__parse_member(slab + j, rv, allocator)) { PROTOBUF_C_UNPACK_ERROR( "error parsing member %s of %s", slab->field ? slab->field->name : "*unknown-field*", desc->name); @@ -1928,29 +2036,33 @@ ProtobufCMessage *protobuf_c_message_unpack( } /* cleanup */ - for (j = 1; j <= which_slab; j++) do_free(allocator, scanned_member_slabs[j]); + for (j = 1; j <= which_slab; j++) + PaddleMobile__Framework__do_free(allocator, scanned_member_slabs[j]); if (required_fields_bitmap_alloced) - do_free(allocator, required_fields_bitmap); + PaddleMobile__Framework__do_free(allocator, required_fields_bitmap); return rv; error_cleanup: - protobuf_c_message_free_unpacked(rv, allocator); - for (j = 1; j <= which_slab; j++) do_free(allocator, scanned_member_slabs[j]); + PaddleMobile__Framework__protobuf_c_message_free_unpacked(rv, allocator); + for (j = 1; j <= which_slab; j++) + PaddleMobile__Framework__do_free(allocator, scanned_member_slabs[j]); if (required_fields_bitmap_alloced) - do_free(allocator, required_fields_bitmap); + PaddleMobile__Framework__do_free(allocator, required_fields_bitmap); return NULL; error_cleanup_during_scan: - do_free(allocator, rv); - for (j = 1; j <= which_slab; j++) do_free(allocator, scanned_member_slabs[j]); + PaddleMobile__Framework__do_free(allocator, rv); + for (j = 1; j <= which_slab; j++) + PaddleMobile__Framework__do_free(allocator, scanned_member_slabs[j]); if (required_fields_bitmap_alloced) - do_free(allocator, required_fields_bitmap); + PaddleMobile__Framework__do_free(allocator, required_fields_bitmap); return NULL; } -void protobuf_c_message_free_unpacked(ProtobufCMessage *message, - ProtobufCAllocator *allocator) { - const ProtobufCMessageDescriptor *desc; +void PaddleMobile__Framework__protobuf_c_message_free_unpacked( + PaddleMobile__Framework__ProtobufCMessage *message, + PaddleMobile__Framework__ProtobufCAllocator *allocator) { + const PaddleMobile__Framework__ProtobufCMessageDescriptor *desc; unsigned f; if (message == NULL) return; @@ -1978,56 +2090,67 @@ void protobuf_c_message_free_unpacked(ProtobufCMessage *message, if (arr != NULL) { if (desc->fields[f].type == PROTOBUF_C_TYPE_STRING) { unsigned i; - for (i = 0; i < n; i++) do_free(allocator, ((char **)arr)[i]); + for (i = 0; i < n; i++) + PaddleMobile__Framework__do_free(allocator, ((char **)arr)[i]); } else if (desc->fields[f].type == PROTOBUF_C_TYPE_BYTES) { unsigned i; for (i = 0; i < n; i++) - do_free(allocator, ((ProtobufCBinaryData *)arr)[i].data); + PaddleMobile__Framework__do_free( + allocator, + ((PaddleMobile__Framework__ProtobufCBinaryData *)arr)[i].data); } else if (desc->fields[f].type == PROTOBUF_C_TYPE_MESSAGE) { unsigned i; for (i = 0; i < n; i++) - protobuf_c_message_free_unpacked(((ProtobufCMessage **)arr)[i], - allocator); + PaddleMobile__Framework__protobuf_c_message_free_unpacked( + ((PaddleMobile__Framework__ProtobufCMessage **)arr)[i], + allocator); } - do_free(allocator, arr); + PaddleMobile__Framework__do_free(allocator, arr); } } else if (desc->fields[f].type == PROTOBUF_C_TYPE_STRING) { char *str = STRUCT_MEMBER(char *, message, desc->fields[f].offset); - if (str && str != desc->fields[f].default_value) do_free(allocator, str); + if (str && str != desc->fields[f].default_value) + PaddleMobile__Framework__do_free(allocator, str); } else if (desc->fields[f].type == PROTOBUF_C_TYPE_BYTES) { - void *data = - STRUCT_MEMBER(ProtobufCBinaryData, message, desc->fields[f].offset) - .data; - const ProtobufCBinaryData *default_bd; + void *data = STRUCT_MEMBER(PaddleMobile__Framework__ProtobufCBinaryData, + message, desc->fields[f].offset) + .data; + const PaddleMobile__Framework__ProtobufCBinaryData *default_bd; default_bd = desc->fields[f].default_value; if (data != NULL && (default_bd == NULL || default_bd->data != data)) { - do_free(allocator, data); + PaddleMobile__Framework__do_free(allocator, data); } } else if (desc->fields[f].type == PROTOBUF_C_TYPE_MESSAGE) { - ProtobufCMessage *sm; + PaddleMobile__Framework__ProtobufCMessage *sm; - sm = STRUCT_MEMBER(ProtobufCMessage *, message, desc->fields[f].offset); + sm = STRUCT_MEMBER(PaddleMobile__Framework__ProtobufCMessage *, message, + desc->fields[f].offset); if (sm && sm != desc->fields[f].default_value) - protobuf_c_message_free_unpacked(sm, allocator); + PaddleMobile__Framework__protobuf_c_message_free_unpacked(sm, + allocator); } } for (f = 0; f < message->n_unknown_fields; f++) - do_free(allocator, message->unknown_fields[f].data); + PaddleMobile__Framework__do_free(allocator, + message->unknown_fields[f].data); if (message->unknown_fields != NULL) - do_free(allocator, message->unknown_fields); + PaddleMobile__Framework__do_free(allocator, message->unknown_fields); - do_free(allocator, message); + PaddleMobile__Framework__do_free(allocator, message); } -void protobuf_c_message_init(const ProtobufCMessageDescriptor *descriptor, - void *message) { - descriptor->message_init((ProtobufCMessage *)(message)); +void PaddleMobile__Framework__protobuf_c_message_init( + const PaddleMobile__Framework__ProtobufCMessageDescriptor *descriptor, + void *message) { + descriptor->message_init( + (PaddleMobile__Framework__ProtobufCMessage *)(message)); } -protobuf_c_boolean protobuf_c_message_check(const ProtobufCMessage *message) { +protobuf_c_boolean PaddleMobile__Framework__protobuf_c_message_check( + const PaddleMobile__Framework__ProtobufCMessage *message) { unsigned i; if (!message || !message->descriptor || @@ -2036,9 +2159,10 @@ protobuf_c_boolean protobuf_c_message_check(const ProtobufCMessage *message) { } for (i = 0; i < message->descriptor->n_fields; i++) { - const ProtobufCFieldDescriptor *f = message->descriptor->fields + i; - ProtobufCType type = f->type; - ProtobufCLabel label = f->label; + const PaddleMobile__Framework__ProtobufCFieldDescriptor *f = + message->descriptor->fields + i; + PaddleMobile__Framework__ProtobufCType type = f->type; + PaddleMobile__Framework__ProtobufCLabel label = f->label; void *field = STRUCT_MEMBER_P(message, f->offset); if (label == PROTOBUF_C_LABEL_REPEATED) { @@ -2049,10 +2173,12 @@ protobuf_c_boolean protobuf_c_message_check(const ProtobufCMessage *message) { } if (type == PROTOBUF_C_TYPE_MESSAGE) { - ProtobufCMessage **submessage = *(ProtobufCMessage ***)field; + PaddleMobile__Framework__ProtobufCMessage **submessage = + *(PaddleMobile__Framework__ProtobufCMessage ***)field; unsigned j; for (j = 0; j < *quantity; j++) { - if (!protobuf_c_message_check(submessage[j])) return FALSE; + if (!PaddleMobile__Framework__protobuf_c_message_check(submessage[j])) + return FALSE; } } else if (type == PROTOBUF_C_TYPE_STRING) { char **string = *(char ***)field; @@ -2061,7 +2187,8 @@ protobuf_c_boolean protobuf_c_message_check(const ProtobufCMessage *message) { if (!string[j]) return FALSE; } } else if (type == PROTOBUF_C_TYPE_BYTES) { - ProtobufCBinaryData *bd = *(ProtobufCBinaryData **)field; + PaddleMobile__Framework__ProtobufCBinaryData *bd = + *(PaddleMobile__Framework__ProtobufCBinaryData **)field; unsigned j; for (j = 0; j < *quantity; j++) { if (bd[j].len > 0 && bd[j].data == NULL) return FALSE; @@ -2071,9 +2198,11 @@ protobuf_c_boolean protobuf_c_message_check(const ProtobufCMessage *message) { } else { /* PROTOBUF_C_LABEL_REQUIRED or PROTOBUF_C_LABEL_OPTIONAL */ if (type == PROTOBUF_C_TYPE_MESSAGE) { - ProtobufCMessage *submessage = *(ProtobufCMessage **)field; + PaddleMobile__Framework__ProtobufCMessage *submessage = + *(PaddleMobile__Framework__ProtobufCMessage **)field; if (label == PROTOBUF_C_LABEL_REQUIRED || submessage != NULL) { - if (!protobuf_c_message_check(submessage)) return FALSE; + if (!PaddleMobile__Framework__protobuf_c_message_check(submessage)) + return FALSE; } } else if (type == PROTOBUF_C_TYPE_STRING) { char *string = *(char **)field; @@ -2081,7 +2210,7 @@ protobuf_c_boolean protobuf_c_message_check(const ProtobufCMessage *message) { } else if (type == PROTOBUF_C_TYPE_BYTES) { protobuf_c_boolean *has = STRUCT_MEMBER_P(message, f->quantifier_offset); - ProtobufCBinaryData *bd = field; + PaddleMobile__Framework__ProtobufCBinaryData *bd = field; if (label == PROTOBUF_C_LABEL_REQUIRED || *has == TRUE) { if (bd->len > 0 && bd->data == NULL) return FALSE; } @@ -2094,5 +2223,6 @@ protobuf_c_boolean protobuf_c_message_check(const ProtobufCMessage *message) { /* === services === */ -typedef void (*GenericHandler)(void *service, const ProtobufCMessage *input, - ProtobufCClosure closure, void *closure_data); +typedef void (*GenericHandler)( + void *service, const PaddleMobile__Framework__ProtobufCMessage *input, + ProtobufCClosure closure, void *closure_data); diff --git a/src/protobuf-c/protobuf-c.h b/src/protobuf-c/protobuf-c.h index bd85695b868af6c7b91590196339bc4f7826a256..ffb86e86121b685b316b21d0be0e16ef8c836966 100644 --- a/src/protobuf-c/protobuf-c.h +++ b/src/protobuf-c/protobuf-c.h @@ -52,7 +52,7 @@ * \page gencode Generated Code * * For each enum, we generate a C enum. For each message, we generate a C - * structure which can be cast to a `ProtobufCMessage`. + * structure which can be cast to a `PaddleMobile__Framework__ProtobufCMessage`. * * For each enum and message, we generate a descriptor object that allows us to * implement a kind of reflection on the structures. @@ -79,7 +79,7 @@ ~~~{.c} Foo__Bar__BazBah * foo__bar__baz_bah__unpack - (ProtobufCAllocator *allocator, + (PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, const uint8_t *data); ~~~ @@ -99,11 +99,14 @@ Foo__Bar__BazBah * * declared in the `.pb-c.h` files: * ~~~{.c} -extern const ProtobufCMessageDescriptor foo__bar__baz_bah__descriptor; +extern const PaddleMobile__Framework__ProtobufCMessageDescriptor +foo__bar__baz_bah__descriptor; ~~~ * - * The message structures all begin with `ProtobufCMessageDescriptor *` which is - * sufficient to allow them to be cast to `ProtobufCMessage`. + * The message structures all begin with +`PaddleMobile__Framework__ProtobufCMessageDescriptor *` which is + * sufficient to allow them to be cast to +`PaddleMobile__Framework__ProtobufCMessage`. * * For each message defined in a `.proto` file, we generate a number of * functions and macros. Each function name contains a prefix based on the @@ -133,7 +136,7 @@ void foo__bar__baz_bah__init ~~~{.c} Foo__Bar__BazBah * foo__bar__baz_bah__unpack - (ProtobufCAllocator *allocator, + (PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, const uint8_t *data); ~~~ @@ -144,7 +147,7 @@ Foo__Bar__BazBah * ~~~{.c} void foo__bar__baz_bah__free_unpacked (Foo__Bar__BazBah *message, - ProtobufCAllocator *allocator); + PaddleMobile__Framework__ProtobufCAllocator *allocator); ~~~ * * - `get_packed_size()`. Calculates the length in bytes of the serialized @@ -171,26 +174,29 @@ size_t foo__bar__baz_bah__pack ~~~{.c} size_t foo__bar__baz_bah__pack_to_buffer (const Foo__Bar__BazBah *message, - ProtobufCBuffer *buffer); + PaddleMobile__Framework__ProtobufCBuffer *buffer); ~~~ * * \page pack Packing and unpacking messages * * To pack a message, first compute the packed size of the message with - * protobuf_c_message_get_packed_size(), then allocate a buffer of at least + * PaddleMobile__Framework__protobuf_c_message_get_packed_size(), then allocate +a buffer of at least * that size, then call protobuf_c_message_pack(). * * Alternatively, a message can be serialized without calculating the final size * first. Use the protobuf_c_message_pack_to_buffer() function and provide a - * ProtobufCBuffer object which implements an "append" method that consumes + * PaddleMobile__Framework__ProtobufCBuffer object which implements an "append" +method that consumes * data. * - * To unpack a message, call the protobuf_c_message_unpack() function. The + * To unpack a message, call the +PaddleMobile__Framework__protobuf_c_message_unpack() function. The * result can be cast to an object of the type that matches the descriptor for * the message. * * The result of unpacking a message should be freed with - * protobuf_c_message_free_unpacked(). + * PaddleMobile__Framework__protobuf_c_message_free_unpacked(). */ #ifndef PROTOBUF_C_H @@ -238,7 +244,7 @@ PROTOBUF_C__BEGIN_DECLS #define PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC 0x114315af /* Empty string used for initializers */ -extern const char protobuf_c_empty_string[]; +extern const char PaddleMobile__Framework__protobuf_c_empty_string[]; /** * \defgroup api Public API @@ -250,7 +256,8 @@ extern const char protobuf_c_empty_string[]; */ /** - * Values for the `flags` word in `ProtobufCFieldDescriptor`. + * Values for the `flags` word in + * `PaddleMobile__Framework__ProtobufCFieldDescriptor`. */ typedef enum { /** Set if the field is repeated and marked with the `packed` option. */ @@ -261,7 +268,7 @@ typedef enum { /** Set if the field is a member of a oneof (union). */ PROTOBUF_C_FIELD_FLAG_ONEOF = (1 << 2), -} ProtobufCFieldFlag; +} PaddleMobile__Framework__ProtobufCFieldFlag; /** * Message field rules. @@ -293,7 +300,7 @@ typedef enum { * equivalent to OPTIONAL but no "has" quantifier will be consulted. */ PROTOBUF_C_LABEL_NONE, -} ProtobufCLabel; +} PaddleMobile__Framework__ProtobufCLabel; /** * Field value types. @@ -321,7 +328,7 @@ typedef enum { PROTOBUF_C_TYPE_STRING, /**< UTF-8 or ASCII string */ PROTOBUF_C_TYPE_BYTES, /**< arbitrary byte sequence */ PROTOBUF_C_TYPE_MESSAGE, /**< nested message */ -} ProtobufCType; +} PaddleMobile__Framework__ProtobufCType; /** * Field wire types. @@ -337,51 +344,69 @@ typedef enum { PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED = 2, /* "Start group" and "end group" wire types are unsupported. */ PROTOBUF_C_WIRE_TYPE_32BIT = 5, -} ProtobufCWireType; - -struct ProtobufCAllocator; -struct ProtobufCBinaryData; -struct ProtobufCBuffer; -struct ProtobufCBufferSimple; -struct ProtobufCEnumDescriptor; -struct ProtobufCEnumValue; -struct ProtobufCEnumValueIndex; -struct ProtobufCFieldDescriptor; -struct ProtobufCIntRange; -struct ProtobufCMessage; -struct ProtobufCMessageDescriptor; -struct ProtobufCMessageUnknownField; -struct ProtobufCMethodDescriptor; -struct ProtobufCService; -struct ProtobufCServiceDescriptor; - -typedef struct ProtobufCAllocator ProtobufCAllocator; -typedef struct ProtobufCBinaryData ProtobufCBinaryData; -typedef struct ProtobufCBuffer ProtobufCBuffer; -typedef struct ProtobufCBufferSimple ProtobufCBufferSimple; -typedef struct ProtobufCEnumDescriptor ProtobufCEnumDescriptor; -typedef struct ProtobufCEnumValue ProtobufCEnumValue; -typedef struct ProtobufCEnumValueIndex ProtobufCEnumValueIndex; -typedef struct ProtobufCFieldDescriptor ProtobufCFieldDescriptor; -typedef struct ProtobufCIntRange ProtobufCIntRange; -typedef struct ProtobufCMessage ProtobufCMessage; -typedef struct ProtobufCMessageDescriptor ProtobufCMessageDescriptor; -typedef struct ProtobufCMessageUnknownField ProtobufCMessageUnknownField; -typedef struct ProtobufCMethodDescriptor ProtobufCMethodDescriptor; -typedef struct ProtobufCService ProtobufCService; -typedef struct ProtobufCServiceDescriptor ProtobufCServiceDescriptor; +} PaddleMobile__Framework__ProtobufCWireType; + +struct PaddleMobile__Framework__ProtobufCAllocator; +struct PaddleMobile__Framework__ProtobufCBinaryData; +struct PaddleMobile__Framework__ProtobufCBuffer; +struct PaddleMobile__Framework__ProtobufCBufferSimple; +struct PaddleMobile__Framework__ProtobufCEnumDescriptor; +struct PaddleMobile__Framework__ProtobufCEnumValue; +struct PaddleMobile__Framework__ProtobufCEnumValueIndex; +struct PaddleMobile__Framework__ProtobufCFieldDescriptor; +struct PaddleMobile__Framework__ProtobufCIntRange; +struct PaddleMobile__Framework__ProtobufCMessage; +struct PaddleMobile__Framework__ProtobufCMessageDescriptor; +struct PaddleMobile__Framework__ProtobufCMessageUnknownField; +struct PaddleMobile__Framework__ProtobufCMethodDescriptor; +struct PaddleMobile__Framework__ProtobufCService; +struct PaddleMobile__Framework__ProtobufCServiceDescriptor; + +typedef struct PaddleMobile__Framework__ProtobufCAllocator + PaddleMobile__Framework__ProtobufCAllocator; +typedef struct PaddleMobile__Framework__ProtobufCBinaryData + PaddleMobile__Framework__ProtobufCBinaryData; +typedef struct PaddleMobile__Framework__ProtobufCBuffer + PaddleMobile__Framework__ProtobufCBuffer; +typedef struct PaddleMobile__Framework__ProtobufCBufferSimple + PaddleMobile__Framework__ProtobufCBufferSimple; +typedef struct PaddleMobile__Framework__ProtobufCEnumDescriptor + PaddleMobile__Framework__ProtobufCEnumDescriptor; +typedef struct PaddleMobile__Framework__ProtobufCEnumValue + PaddleMobile__Framework__ProtobufCEnumValue; +typedef struct PaddleMobile__Framework__ProtobufCEnumValueIndex + PaddleMobile__Framework__ProtobufCEnumValueIndex; +typedef struct PaddleMobile__Framework__ProtobufCFieldDescriptor + PaddleMobile__Framework__ProtobufCFieldDescriptor; +typedef struct PaddleMobile__Framework__ProtobufCIntRange + PaddleMobile__Framework__ProtobufCIntRange; +typedef struct PaddleMobile__Framework__ProtobufCMessage + PaddleMobile__Framework__ProtobufCMessage; +typedef struct PaddleMobile__Framework__ProtobufCMessageDescriptor + PaddleMobile__Framework__ProtobufCMessageDescriptor; +typedef struct PaddleMobile__Framework__ProtobufCMessageUnknownField + PaddleMobile__Framework__ProtobufCMessageUnknownField; +typedef struct PaddleMobile__Framework__ProtobufCMethodDescriptor + PaddleMobile__Framework__ProtobufCMethodDescriptor; +typedef struct PaddleMobile__Framework__ProtobufCService + PaddleMobile__Framework__ProtobufCService; +typedef struct PaddleMobile__Framework__ProtobufCServiceDescriptor + PaddleMobile__Framework__ProtobufCServiceDescriptor; /** Boolean type. */ typedef int protobuf_c_boolean; -typedef void (*ProtobufCClosure)(const ProtobufCMessage *, void *closure_data); -typedef void (*ProtobufCMessageInit)(ProtobufCMessage *); -typedef void (*ProtobufCServiceDestroy)(ProtobufCService *); +typedef void (*ProtobufCClosure)( + const PaddleMobile__Framework__ProtobufCMessage *, void *closure_data); +typedef void (*ProtobufCMessageInit)( + PaddleMobile__Framework__ProtobufCMessage *); +typedef void (*ProtobufCServiceDestroy)( + PaddleMobile__Framework__ProtobufCService *); /** * Structure for defining a custom memory allocator. */ -struct ProtobufCAllocator { +struct PaddleMobile__Framework__ProtobufCAllocator { /** Function to allocate memory. */ void *(*alloc)(void *allocator_data, size_t size); @@ -395,11 +420,11 @@ struct ProtobufCAllocator { /** * Structure for the protobuf `bytes` scalar type. * - * The data contained in a `ProtobufCBinaryData` is an arbitrary sequence of - * bytes. It may contain embedded `NUL` characters and is not required to be - * `NUL`-terminated. + * The data contained in a `PaddleMobile__Framework__ProtobufCBinaryData` is an + * arbitrary sequence of bytes. It may contain embedded `NUL` characters and is + * not required to be `NUL`-terminated. */ -struct ProtobufCBinaryData { +struct PaddleMobile__Framework__ProtobufCBinaryData { size_t len; /**< Number of bytes in the `data` field. */ uint8_t *data; /**< Data bytes. */ }; @@ -409,17 +434,18 @@ struct ProtobufCBinaryData { * protobuf_c_message_pack_to_buffer() to abstract the consumption of serialized * bytes. * - * `ProtobufCBuffer` "subclasses" may be defined on the stack. For example, to + * `PaddleMobile__Framework__ProtobufCBuffer` "subclasses" may be defined on the +stack. For example, to * write to a `FILE` object: * ~~~{.c} typedef struct { - ProtobufCBuffer base; + PaddleMobile__Framework__ProtobufCBuffer base; FILE *fp; } BufferAppendToFile; static void -my_buffer_file_append(ProtobufCBuffer *buffer, +my_buffer_file_append(PaddleMobile__Framework__ProtobufCBuffer *buffer, size_t len, const uint8_t *data) { @@ -428,7 +454,8 @@ my_buffer_file_append(ProtobufCBuffer *buffer, } ~~~ * - * To use this new type of ProtobufCBuffer, it could be called as follows: + * To use this new type of PaddleMobile__Framework__ProtobufCBuffer, it could be +called as follows: * ~~~{.c} ... @@ -439,30 +466,36 @@ protobuf_c_message_pack_to_buffer(&message, &tmp); ... ~~~ */ -struct ProtobufCBuffer { +struct PaddleMobile__Framework__ProtobufCBuffer { /** Append function. Consumes the `len` bytes stored at `data`. */ - void (*append)(ProtobufCBuffer *buffer, size_t len, const uint8_t *data); + void (*append)(PaddleMobile__Framework__ProtobufCBuffer *buffer, size_t len, + const uint8_t *data); }; /** - * Simple buffer "subclass" of `ProtobufCBuffer`. + * Simple buffer "subclass" of `PaddleMobile__Framework__ProtobufCBuffer`. * - * A `ProtobufCBufferSimple` object is declared on the stack and uses a + * A `PaddleMobile__Framework__ProtobufCBufferSimple` object is declared on the +stack and uses a * scratch buffer provided by the user for the initial allocation. It performs * exponential resizing, using dynamically allocated memory. A - * `ProtobufCBufferSimple` object can be created and used as follows: + * `PaddleMobile__Framework__ProtobufCBufferSimple` object can be created and +used as follows: * ~~~{.c} uint8_t pad[128]; -ProtobufCBufferSimple simple = PROTOBUF_C_BUFFER_SIMPLE_INIT(pad); -ProtobufCBuffer *buffer = (ProtobufCBuffer *) &simple; +PaddleMobile__Framework__ProtobufCBufferSimple simple = +PROTOBUF_C_BUFFER_SIMPLE_INIT(pad); PaddleMobile__Framework__ProtobufCBuffer +*buffer = (PaddleMobile__Framework__ProtobufCBuffer *) &simple; ~~~ * * `buffer` can now be used with `protobuf_c_message_pack_to_buffer()`. Once a - * message has been serialized to a `ProtobufCBufferSimple` object, the + * message has been serialized to a +`PaddleMobile__Framework__ProtobufCBufferSimple` object, the * serialized data bytes can be accessed from the `.data` field. * - * To free the memory allocated by a `ProtobufCBufferSimple` object, if any, + * To free the memory allocated by a +`PaddleMobile__Framework__ProtobufCBufferSimple` object, if any, * call PROTOBUF_C_BUFFER_SIMPLE_CLEAR() on the object, for example: * ~~~{.c} @@ -472,9 +505,9 @@ PROTOBUF_C_BUFFER_SIMPLE_CLEAR(&simple); * \see PROTOBUF_C_BUFFER_SIMPLE_INIT * \see PROTOBUF_C_BUFFER_SIMPLE_CLEAR */ -struct ProtobufCBufferSimple { +struct PaddleMobile__Framework__ProtobufCBufferSimple { /** "Base class". */ - ProtobufCBuffer base; + PaddleMobile__Framework__ProtobufCBuffer base; /** Number of bytes allocated in `data`. */ size_t alloced; /** Number of bytes currently stored in `data`. */ @@ -484,13 +517,13 @@ struct ProtobufCBufferSimple { /** Whether `data` must be freed. */ protobuf_c_boolean must_free_data; /** Allocator to use. May be NULL to indicate the system allocator. */ - ProtobufCAllocator *allocator; + PaddleMobile__Framework__ProtobufCAllocator *allocator; }; /** * Describes an enumeration as a whole, with all of its values. */ -struct ProtobufCEnumDescriptor { +struct PaddleMobile__Framework__ProtobufCEnumDescriptor { /** Magic value checked to ensure that the API is used correctly. */ uint32_t magic; @@ -506,17 +539,17 @@ struct ProtobufCEnumDescriptor { /** Number elements in `values`. */ unsigned n_values; /** Array of distinct values, sorted by numeric value. */ - const ProtobufCEnumValue *values; + const PaddleMobile__Framework__ProtobufCEnumValue *values; /** Number of elements in `values_by_name`. */ unsigned n_value_names; /** Array of named values, including aliases, sorted by name. */ - const ProtobufCEnumValueIndex *values_by_name; + const PaddleMobile__Framework__ProtobufCEnumValueIndex *values_by_name; /** Number of elements in `value_ranges`. */ unsigned n_value_ranges; /** Value ranges, for faster lookups by numeric value. */ - const ProtobufCIntRange *value_ranges; + const PaddleMobile__Framework__ProtobufCIntRange *value_ranges; /** Reserved for future use. */ void *reserved1; @@ -531,7 +564,7 @@ struct ProtobufCEnumDescriptor { /** * Represents a single value of an enumeration. */ -struct ProtobufCEnumValue { +struct PaddleMobile__Framework__ProtobufCEnumValue { /** The string identifying this value in the .proto file. */ const char *name; @@ -543,9 +576,10 @@ struct ProtobufCEnumValue { }; /** - * Used by `ProtobufCEnumDescriptor` to look up enum values. + * Used by `PaddleMobile__Framework__ProtobufCEnumDescriptor` to look up enum + * values. */ -struct ProtobufCEnumValueIndex { +struct PaddleMobile__Framework__ProtobufCEnumValueIndex { /** Name of the enum value. */ const char *name; /** Index into values[] array. */ @@ -555,7 +589,7 @@ struct ProtobufCEnumValueIndex { /** * Describes a single field in a message. */ -struct ProtobufCFieldDescriptor { +struct PaddleMobile__Framework__ProtobufCFieldDescriptor { /** Name of the field as given in the .proto file. */ const char *name; @@ -563,10 +597,10 @@ struct ProtobufCFieldDescriptor { uint32_t id; /** Whether the field is `REQUIRED`, `OPTIONAL`, or `REPEATED`. */ - ProtobufCLabel label; + PaddleMobile__Framework__ProtobufCLabel label; /** The type of the field. */ - ProtobufCType type; + PaddleMobile__Framework__ProtobufCType type; /** * The offset in bytes of the message's C structure's quantifier field @@ -585,10 +619,10 @@ struct ProtobufCFieldDescriptor { * A type-specific descriptor. * * If `type` is `PROTOBUF_C_TYPE_ENUM`, then `descriptor` points to the - * corresponding `ProtobufCEnumDescriptor`. + * corresponding `PaddleMobile__Framework__ProtobufCEnumDescriptor`. * * If `type` is `PROTOBUF_C_TYPE_MESSAGE`, then `descriptor` points to - * the corresponding `ProtobufCMessageDescriptor`. + * the corresponding `PaddleMobile__Framework__ProtobufCMessageDescriptor`. * * Otherwise this field is NULL. */ @@ -599,7 +633,7 @@ struct ProtobufCFieldDescriptor { /** * A flag word. Zero or more of the bits defined in the - * `ProtobufCFieldFlag` enum may be set. + * `PaddleMobile__Framework__ProtobufCFieldFlag` enum may be set. */ uint32_t flags; @@ -619,7 +653,7 @@ struct ProtobufCFieldDescriptor { * The data structures requires that the values in the original array are * sorted. */ -struct ProtobufCIntRange { +struct PaddleMobile__Framework__ProtobufCIntRange { int start_value; unsigned orig_index; /* @@ -632,31 +666,34 @@ struct ProtobufCIntRange { /** * An instance of a message. * - * `ProtobufCMessage` is a light-weight "base class" for all messages. + * `PaddleMobile__Framework__ProtobufCMessage` is a light-weight "base class" + * for all messages. * - * In particular, `ProtobufCMessage` doesn't have any allocation policy - * associated with it. That's because it's common to create `ProtobufCMessage` - * objects on the stack. In fact, that's what we recommend for sending messages. - * If the object is allocated from the stack, you can't really have a memory - * leak. + * In particular, `PaddleMobile__Framework__ProtobufCMessage` doesn't have any + * allocation policy associated with it. That's because it's common to create + * `PaddleMobile__Framework__ProtobufCMessage` objects on the stack. In fact, + * that's what we recommend for sending messages. If the object is allocated + * from the stack, you can't really have a memory leak. * - * This means that calls to functions like protobuf_c_message_unpack() which - * return a `ProtobufCMessage` must be paired with a call to a free function, - * like protobuf_c_message_free_unpacked(). + * This means that calls to functions like + * PaddleMobile__Framework__protobuf_c_message_unpack() which return a + * `PaddleMobile__Framework__ProtobufCMessage` must be paired with a call to a + * free function, like + * PaddleMobile__Framework__protobuf_c_message_free_unpacked(). */ -struct ProtobufCMessage { +struct PaddleMobile__Framework__ProtobufCMessage { /** The descriptor for this message type. */ - const ProtobufCMessageDescriptor *descriptor; + const PaddleMobile__Framework__ProtobufCMessageDescriptor *descriptor; /** The number of elements in `unknown_fields`. */ unsigned n_unknown_fields; /** The fields that weren't recognized by the parser. */ - ProtobufCMessageUnknownField *unknown_fields; + PaddleMobile__Framework__ProtobufCMessageUnknownField *unknown_fields; }; /** * Describes a message. */ -struct ProtobufCMessageDescriptor { +struct PaddleMobile__Framework__ProtobufCMessageDescriptor { /** Magic value checked to ensure that the API is used correctly. */ uint32_t magic; @@ -678,14 +715,14 @@ struct ProtobufCMessageDescriptor { /** Number of elements in `fields`. */ unsigned n_fields; /** Field descriptors, sorted by tag number. */ - const ProtobufCFieldDescriptor *fields; + const PaddleMobile__Framework__ProtobufCFieldDescriptor *fields; /** Used for looking up fields by name. */ const unsigned *fields_sorted_by_name; /** Number of elements in `field_ranges`. */ unsigned n_field_ranges; /** Used for looking up fields by id. */ - const ProtobufCIntRange *field_ranges; + const PaddleMobile__Framework__ProtobufCIntRange *field_ranges; /** Message initialisation function. */ ProtobufCMessageInit message_init; @@ -701,11 +738,11 @@ struct ProtobufCMessageDescriptor { /** * An unknown message field. */ -struct ProtobufCMessageUnknownField { +struct PaddleMobile__Framework__ProtobufCMessageUnknownField { /** The tag number. */ uint32_t tag; /** The wire type of the field. */ - ProtobufCWireType wire_type; + PaddleMobile__Framework__ProtobufCWireType wire_type; /** Number of bytes in `data`. */ size_t len; /** Field data. */ @@ -715,33 +752,34 @@ struct ProtobufCMessageUnknownField { /** * Method descriptor. */ -struct ProtobufCMethodDescriptor { +struct PaddleMobile__Framework__ProtobufCMethodDescriptor { /** Method name. */ const char *name; /** Input message descriptor. */ - const ProtobufCMessageDescriptor *input; + const PaddleMobile__Framework__ProtobufCMessageDescriptor *input; /** Output message descriptor. */ - const ProtobufCMessageDescriptor *output; + const PaddleMobile__Framework__ProtobufCMessageDescriptor *output; }; /** * Service. */ -struct ProtobufCService { +struct PaddleMobile__Framework__ProtobufCService { /** Service descriptor. */ - const ProtobufCServiceDescriptor *descriptor; + const PaddleMobile__Framework__ProtobufCServiceDescriptor *descriptor; /** Function to invoke the service. */ - void (*invoke)(ProtobufCService *service, unsigned method_index, - const ProtobufCMessage *input, ProtobufCClosure closure, - void *closure_data); + void (*invoke)(PaddleMobile__Framework__ProtobufCService *service, + unsigned method_index, + const PaddleMobile__Framework__ProtobufCMessage *input, + ProtobufCClosure closure, void *closure_data); /** Function to destroy the service. */ - void (*destroy)(ProtobufCService *service); + void (*destroy)(PaddleMobile__Framework__ProtobufCService *service); }; /** * Service descriptor. */ -struct ProtobufCServiceDescriptor { +struct PaddleMobile__Framework__ProtobufCServiceDescriptor { /** Magic value checked to ensure that the API is used correctly. */ uint32_t magic; @@ -756,7 +794,7 @@ struct ProtobufCServiceDescriptor { /** Number of elements in `methods`. */ unsigned n_methods; /** Method descriptors, in the order defined in the .proto file. */ - const ProtobufCMethodDescriptor *methods; + const PaddleMobile__Framework__ProtobufCMethodDescriptor *methods; /** Sort index of methods. */ const unsigned *method_indices_by_name; }; @@ -768,7 +806,7 @@ struct ProtobufCServiceDescriptor { * \return A string containing the version number of protobuf-c. */ PROTOBUF_C__API -const char *protobuf_c_version(void); +const char *PaddleMobile__Framework__protobuf_c_version(void); /** * Get the version of the protobuf-c library. Note that this is the version of @@ -778,17 +816,17 @@ const char *protobuf_c_version(void); * protobuf-c, represented in base-10 as (MAJOR*1E6) + (MINOR*1E3) + PATCH. */ PROTOBUF_C__API -uint32_t protobuf_c_version_number(void); +uint32_t PaddleMobile__Framework__protobuf_c_version_number(void); /** * The version of the protobuf-c headers, represented as a string using the same - * format as protobuf_c_version(). + * format as PaddleMobile__Framework__protobuf_c_version(). */ #define PROTOBUF_C_VERSION "1.3.0" /** * The version of the protobuf-c headers, represented as an integer using the - * same format as protobuf_c_version_number(). + * same format as PaddleMobile__Framework__protobuf_c_version_number(). */ #define PROTOBUF_C_VERSION_NUMBER 1003000 @@ -807,7 +845,8 @@ uint32_t protobuf_c_version_number(void); * Number of bytes. */ PROTOBUF_C__API -size_t protobuf_c_message_get_packed_size(const ProtobufCMessage *message); +size_t PaddleMobile__Framework__protobuf_c_message_get_packed_size( + const PaddleMobile__Framework__ProtobufCMessage *message); /** * Unpack a serialised message into an in-memory representation. @@ -815,37 +854,35 @@ size_t protobuf_c_message_get_packed_size(const ProtobufCMessage *message); * \param descriptor * The message descriptor. * \param allocator - * `ProtobufCAllocator` to use for memory allocation. May be NULL to - * specify the default allocator. - * \param len - * Length in bytes of the serialised message. - * \param data - * Pointer to the serialised message. - * \return - * An unpacked message object. - * \retval NULL - * If an error occurred during unpacking. + * `PaddleMobile__Framework__ProtobufCAllocator` to use for memory + * allocation. May be NULL to specify the default allocator. \param len Length + * in bytes of the serialised message. \param data Pointer to the + * serialised message. \return An unpacked message object. \retval NULL If + * an error occurred during unpacking. */ PROTOBUF_C__API -ProtobufCMessage *protobuf_c_message_unpack( - const ProtobufCMessageDescriptor *descriptor, ProtobufCAllocator *allocator, - size_t len, const uint8_t *data); +PaddleMobile__Framework__ProtobufCMessage * +PaddleMobile__Framework__protobuf_c_message_unpack( + const PaddleMobile__Framework__ProtobufCMessageDescriptor *descriptor, + PaddleMobile__Framework__ProtobufCAllocator *allocator, size_t len, + const uint8_t *data); /** * Free an unpacked message object. * * This function should be used to deallocate the memory used by a call to - * protobuf_c_message_unpack(). + * PaddleMobile__Framework__protobuf_c_message_unpack(). * * \param message * The message object to free. May be NULL. * \param allocator - * `ProtobufCAllocator` to use for memory deallocation. May be NULL to - * specify the default allocator. + * `PaddleMobile__Framework__ProtobufCAllocator` to use for memory + * deallocation. May be NULL to specify the default allocator. */ PROTOBUF_C__API -void protobuf_c_message_free_unpacked(ProtobufCMessage *message, - ProtobufCAllocator *allocator); +void PaddleMobile__Framework__protobuf_c_message_free_unpacked( + PaddleMobile__Framework__ProtobufCMessage *message, + PaddleMobile__Framework__ProtobufCAllocator *allocator); /** * Check the validity of a message object. @@ -859,7 +896,8 @@ void protobuf_c_message_free_unpacked(ProtobufCMessage *message, * Message is invalid. */ PROTOBUF_C__API -protobuf_c_boolean protobuf_c_message_check(const ProtobufCMessage *); +protobuf_c_boolean PaddleMobile__Framework__protobuf_c_message_check( + const PaddleMobile__Framework__ProtobufCMessage *); /** Message initialiser. */ #define PROTOBUF_C_MESSAGE_INIT(descriptor) \ @@ -874,20 +912,22 @@ protobuf_c_boolean protobuf_c_message_check(const ProtobufCMessage *); * Allocated block of memory of size `descriptor->sizeof_message`. */ PROTOBUF_C__API -void protobuf_c_message_init(const ProtobufCMessageDescriptor *descriptor, - void *message); +void PaddleMobile__Framework__protobuf_c_message_init( + const PaddleMobile__Framework__ProtobufCMessageDescriptor *descriptor, + void *message); /** - * Initialise a `ProtobufCBufferSimple` object. + * Initialise a `PaddleMobile__Framework__ProtobufCBufferSimple` object. */ -#define PROTOBUF_C_BUFFER_SIMPLE_INIT(array_of_bytes) \ - { \ - {protobuf_c_buffer_simple_append}, sizeof(array_of_bytes), 0, \ - (array_of_bytes), 0, NULL \ +#define PROTOBUF_C_BUFFER_SIMPLE_INIT(array_of_bytes) \ + { \ + {PaddleMobile__Framework__protobuf_c_buffer_simple_append}, \ + sizeof(array_of_bytes), 0, (array_of_bytes), 0, NULL \ } /** - * Clear a `ProtobufCBufferSimple` object, freeing any allocated memory. + * Clear a `PaddleMobile__Framework__ProtobufCBufferSimple` object, freeing any + * allocated memory. */ #define PROTOBUF_C_BUFFER_SIMPLE_CLEAR(simp_buf) \ do { \ @@ -900,19 +940,20 @@ void protobuf_c_message_init(const ProtobufCMessageDescriptor *descriptor, } while (0) /** - * The `append` method for `ProtobufCBufferSimple`. + * The `append` method for `PaddleMobile__Framework__ProtobufCBufferSimple`. * * \param buffer * The buffer object to append to. Must actually be a - * `ProtobufCBufferSimple` object. + * `PaddleMobile__Framework__ProtobufCBufferSimple` object. * \param len * Number of bytes in `data`. * \param data * Data to append. */ PROTOBUF_C__API -void protobuf_c_buffer_simple_append(ProtobufCBuffer *buffer, size_t len, - const unsigned char *data); +void PaddleMobile__Framework__protobuf_c_buffer_simple_append( + PaddleMobile__Framework__ProtobufCBuffer *buffer, size_t len, + const unsigned char *data); /**@}*/