Commit aa71b9fb authored by Lubomir Bulej's avatar Lubomir Bulej
Browse files

Update to protobuf-c 1.4.0 and Protobuf Java Lite 3.14.0

parent 9ad6195e
......@@ -12,7 +12,7 @@ asm.org=org.ow2.asm
log4j.rev=1.2.17
log4j.org=log4j
protobuf.rev=3.11.0
protobuf.rev=3.14.0
protobuf.org=com.google.protobuf
protobuf.lib=protobuf-javalite
......
......@@ -82,9 +82,10 @@ public final class DiSL {
}
private int sizesMemoizedSerializedSize = -1;
private void ensureSizesIsMutable() {
if (!sizes_.isModifiable()) {
com.google.protobuf.Internal.IntList tmp = sizes_;
if (!tmp.isModifiable()) {
sizes_ =
com.google.protobuf.GeneratedMessageLite.mutableCopy(sizes_);
com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
}
/**
......@@ -1220,9 +1221,10 @@ public final class DiSL {
return superTypes_.get(index);
}
private void ensureSuperTypesIsMutable() {
if (!superTypes_.isModifiable()) {
com.google.protobuf.Internal.ProtobufList<ch.usi.dag.dislre.protocol.DiSL.InstrClassInfo> tmp = superTypes_;
if (!tmp.isModifiable()) {
superTypes_ =
com.google.protobuf.GeneratedMessageLite.mutableCopy(superTypes_);
com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
}
......
......@@ -818,9 +818,10 @@ public final class Main {
return errors_.get(index);
}
private void ensureErrorsIsMutable() {
if (!errors_.isModifiable()) {
com.google.protobuf.Internal.ProtobufList<ch.usi.dag.dislre.protocol.Main.Error> tmp = errors_;
if (!tmp.isModifiable()) {
errors_ =
com.google.protobuf.GeneratedMessageLite.mutableCopy(errors_);
com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
}
......
......@@ -82,9 +82,10 @@ public final class DiSL {
}
private int sizesMemoizedSerializedSize = -1;
private void ensureSizesIsMutable() {
if (!sizes_.isModifiable()) {
com.google.protobuf.Internal.IntList tmp = sizes_;
if (!tmp.isModifiable()) {
sizes_ =
com.google.protobuf.GeneratedMessageLite.mutableCopy(sizes_);
com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
}
/**
......@@ -1220,9 +1221,10 @@ public final class DiSL {
return superTypes_.get(index);
}
private void ensureSuperTypesIsMutable() {
if (!superTypes_.isModifiable()) {
com.google.protobuf.Internal.ProtobufList<ch.usi.dag.dislre.protocol.DiSL.InstrClassInfo> tmp = superTypes_;
if (!tmp.isModifiable()) {
superTypes_ =
com.google.protobuf.GeneratedMessageLite.mutableCopy(superTypes_);
com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
}
......
......@@ -818,9 +818,10 @@ public final class Main {
return errors_.get(index);
}
private void ensureErrorsIsMutable() {
if (!errors_.isModifiable()) {
com.google.protobuf.Internal.ProtobufList<ch.usi.dag.dislre.protocol.Main.Error> tmp = errors_;
if (!tmp.isModifiable()) {
errors_ =
com.google.protobuf.GeneratedMessageLite.mutableCopy(errors_);
com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
}
......
......@@ -82,9 +82,10 @@ public final class DiSL {
}
private int sizesMemoizedSerializedSize = -1;
private void ensureSizesIsMutable() {
if (!sizes_.isModifiable()) {
com.google.protobuf.Internal.IntList tmp = sizes_;
if (!tmp.isModifiable()) {
sizes_ =
com.google.protobuf.GeneratedMessageLite.mutableCopy(sizes_);
com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
}
/**
......@@ -1220,9 +1221,10 @@ public final class DiSL {
return superTypes_.get(index);
}
private void ensureSuperTypesIsMutable() {
if (!superTypes_.isModifiable()) {
com.google.protobuf.Internal.ProtobufList<ch.usi.dag.dislre.protocol.DiSL.InstrClassInfo> tmp = superTypes_;
if (!tmp.isModifiable()) {
superTypes_ =
com.google.protobuf.GeneratedMessageLite.mutableCopy(superTypes_);
com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
}
......
......@@ -818,9 +818,10 @@ public final class Main {
return errors_.get(index);
}
private void ensureErrorsIsMutable() {
if (!errors_.isModifiable()) {
com.google.protobuf.Internal.ProtobufList<ch.usi.dag.dislre.protocol.Main.Error> tmp = errors_;
if (!tmp.isModifiable()) {
errors_ =
com.google.protobuf.GeneratedMessageLite.mutableCopy(errors_);
com.google.protobuf.GeneratedMessageLite.mutableCopy(tmp);
}
}
......
......@@ -84,7 +84,9 @@
# define PROTOBUF_C_UNPACK_ERROR(...)
#endif
#if !defined(_WIN32) || !defined(PROTOBUF_C_USE_SHARED_LIB)
const char protobuf_c_empty_string[] = "";
#endif
/**
* Internal `ProtobufCMessage` manipulation macro.
......@@ -148,12 +150,14 @@ protobuf_c_version_number(void)
static void *
system_alloc(void *allocator_data, size_t size)
{
(void)allocator_data;
return malloc(size);
}
static void
system_free(void *allocator_data, void *data)
{
(void)allocator_data;
free(data);
}
......@@ -312,10 +316,9 @@ int32_size(int32_t v)
static inline uint32_t
zigzag32(int32_t v)
{
if (v < 0)
return (-(uint32_t)v) * 2 - 1;
else
return (uint32_t)(v) * 2;
// Note: the right-shift must be arithmetic
// Note: left shift must be unsigned because of overflow
return ((uint32_t)(v) << 1) ^ (uint32_t)(v >> 31);
}
/**
......@@ -377,10 +380,9 @@ uint64_size(uint64_t v)
static inline uint64_t
zigzag64(int64_t v)
{
if (v < 0)
return (-(uint64_t)v) * 2 - 1;
else
return (uint64_t)(v) * 2;
// Note: the right-shift must be arithmetic
// Note: left shift must be unsigned because of overflow
return ((uint64_t)(v) << 1) ^ (uint64_t)(v >> 63);
}
/**
......@@ -1620,22 +1622,19 @@ required_field_pack_to_buffer(const ProtobufCFieldDescriptor *field,
break;
}
case PROTOBUF_C_TYPE_MESSAGE: {
uint8_t simple_buffer_scratch[256];
size_t sublen;
const ProtobufCMessage *msg = *(ProtobufCMessage * const *) member;
ProtobufCBufferSimple simple_buffer =
PROTOBUF_C_BUFFER_SIMPLE_INIT(simple_buffer_scratch);
scratch[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED;
if (msg == NULL)
sublen = 0;
else
sublen = protobuf_c_message_pack_to_buffer(msg, &simple_buffer.base);
rv += uint32_pack(sublen, scratch + rv);
buffer->append(buffer, rv, scratch);
buffer->append(buffer, sublen, simple_buffer.data);
rv += sublen;
PROTOBUF_C_BUFFER_SIMPLE_CLEAR(&simple_buffer);
if (msg == NULL) {
rv += uint32_pack(0, scratch + rv);
buffer->append(buffer, rv, scratch);
} else {
size_t sublen = protobuf_c_message_get_packed_size(msg);
rv += uint32_pack(sublen, scratch + rv);
buffer->append(buffer, rv, scratch);
protobuf_c_message_pack_to_buffer(msg, buffer);
rv += sublen;
}
break;
}
default:
......@@ -2065,7 +2064,7 @@ static size_t
parse_tag_and_wiretype(size_t len,
const uint8_t *data,
uint32_t *tag_out,
ProtobufCWireType *wiretype_out)
uint8_t *wiretype_out)
{
unsigned max_rv = len > 5 ? 5 : len;
uint32_t tag = (data[0] & 0x7f) >> 3;
......@@ -2097,9 +2096,9 @@ parse_tag_and_wiretype(size_t len,
/* sizeof(ScannedMember) must be <= (1UL<<BOUND_SIZEOF_SCANNED_MEMBER_LOG2) */
#define BOUND_SIZEOF_SCANNED_MEMBER_LOG2 5
typedef struct _ScannedMember ScannedMember;
typedef struct ScannedMember ScannedMember;
/** Field as it's being read. */
struct _ScannedMember {
struct ScannedMember {
uint32_t tag; /**< Field tag. */
uint8_t wire_type; /**< Field type. */
uint8_t length_prefix_len; /**< Prefix length. */
......@@ -2134,11 +2133,13 @@ scan_length_prefixed_data(size_t len, const uint8_t *data,
// Protobuf messages should always be less than 2 GiB in size.
// We also want to return early here so that hdr_len + val does
// not overflow on 32-bit systems.
PROTOBUF_C_UNPACK_ERROR("length prefix of %lu is too large", val);
PROTOBUF_C_UNPACK_ERROR("length prefix of %lu is too large",
(unsigned long int)val);
return 0;
}
if (hdr_len + val > len) {
PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %lu", val);
PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %lu",
(unsigned long int)val);
return 0;
}
return hdr_len + val;
......@@ -2423,10 +2424,8 @@ parse_int32(unsigned len, const uint8_t *data)
static inline int32_t
unzigzag32(uint32_t v)
{
if (v & 1)
return -(v >> 1) - 1;
else
return v >> 1;
// Note: Using unsigned types prevents undefined behavior
return (int32_t)((v >> 1) ^ (~(v & 1) + 1));
}
static inline uint32_t
......@@ -2467,10 +2466,8 @@ parse_uint64(unsigned len, const uint8_t *data)
static inline int64_t
unzigzag64(uint64_t v)
{
if (v & 1)
return -(v >> 1) - 1;
else
return v >> 1;
// Note: Using unsigned types prevents undefined behavior
return (int64_t)((v >> 1) ^ (~(v & 1) + 1));
}
static inline uint64_t
......@@ -2504,7 +2501,7 @@ parse_required_member(ScannedMember *scanned_member,
{
unsigned len = scanned_member->len;
const uint8_t *data = scanned_member->data;
ProtobufCWireType wire_type = scanned_member->wire_type;
uint8_t wire_type = scanned_member->wire_type;
switch (scanned_member->field->type) {
case PROTOBUF_C_TYPE_ENUM:
......@@ -2585,7 +2582,7 @@ parse_required_member(ScannedMember *scanned_member,
{
do_free(allocator, bd->data);
}
if (len - pref_len > 0) {
if (len > pref_len) {
bd->data = do_alloc(allocator, len - pref_len);
if (bd->data == NULL)
return FALSE;
......@@ -2753,7 +2750,9 @@ parse_packed_repeated_member(ScannedMember *scanned_member,
const uint8_t *at = scanned_member->data + scanned_member->length_prefix_len;
size_t rem = scanned_member->len - scanned_member->length_prefix_len;
size_t count = 0;
#if defined(WORDS_BIGENDIAN)
unsigned i;
#endif
switch (field->type) {
case PROTOBUF_C_TYPE_SFIXED32:
......@@ -2846,13 +2845,15 @@ parse_packed_repeated_member(ScannedMember *scanned_member,
}
break;
case PROTOBUF_C_TYPE_BOOL:
count = rem;
for (i = 0; i < count; i++) {
if (at[i] > 1) {
while (rem > 0) {
unsigned s = scan_varint(rem, at);
if (s == 0) {
PROTOBUF_C_UNPACK_ERROR("bad packed-repeated boolean value");
return FALSE;
}
((protobuf_c_boolean *) array)[i] = at[i];
((protobuf_c_boolean *) array)[count++] = parse_boolean(s, at);
at += s;
rem -= s;
}
break;
default:
......@@ -3086,7 +3087,7 @@ protobuf_c_message_unpack(const ProtobufCMessageDescriptor *desc,
while (rem > 0) {
uint32_t tag;
ProtobufCWireType wire_type;
uint8_t wire_type;
size_t used = parse_tag_and_wiretype(rem, at, &tag, &wire_type);
const ProtobufCFieldDescriptor *field;
ScannedMember tmp;
......
......@@ -238,7 +238,11 @@ PROTOBUF_C__BEGIN_DECLS
#define PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC 0x114315af
/* Empty string used for initializers */
#if defined(_WIN32) && defined(PROTOBUF_C_USE_SHARED_LIB)
static const char protobuf_c_empty_string[] = "";
#else
extern const char protobuf_c_empty_string[];
#endif
/**
* \defgroup api Public API
......@@ -790,13 +794,13 @@ protobuf_c_version_number(void);
* The version of the protobuf-c headers, represented as a string using the same
* format as protobuf_c_version().
*/
#define PROTOBUF_C_VERSION "1.3.2"
#define PROTOBUF_C_VERSION "1.4.0"
/**
* The version of the protobuf-c headers, represented as an integer using the
* same format as protobuf_c_version_number().
*/
#define PROTOBUF_C_VERSION_NUMBER 1003002
#define PROTOBUF_C_VERSION_NUMBER 1004000
/**
* The minimum protoc-c version which works with the current version of the
......
......@@ -84,7 +84,9 @@
# define PROTOBUF_C_UNPACK_ERROR(...)
#endif
#if !defined(_WIN32) || !defined(PROTOBUF_C_USE_SHARED_LIB)
const char protobuf_c_empty_string[] = "";
#endif
/**
* Internal `ProtobufCMessage` manipulation macro.
......@@ -148,12 +150,14 @@ protobuf_c_version_number(void)
static void *
system_alloc(void *allocator_data, size_t size)
{
(void)allocator_data;
return malloc(size);
}
static void
system_free(void *allocator_data, void *data)
{
(void)allocator_data;
free(data);
}
......@@ -312,10 +316,9 @@ int32_size(int32_t v)
static inline uint32_t
zigzag32(int32_t v)
{
if (v < 0)
return (-(uint32_t)v) * 2 - 1;
else
return (uint32_t)(v) * 2;
// Note: the right-shift must be arithmetic
// Note: left shift must be unsigned because of overflow
return ((uint32_t)(v) << 1) ^ (uint32_t)(v >> 31);
}
/**
......@@ -377,10 +380,9 @@ uint64_size(uint64_t v)
static inline uint64_t
zigzag64(int64_t v)
{
if (v < 0)
return (-(uint64_t)v) * 2 - 1;
else
return (uint64_t)(v) * 2;
// Note: the right-shift must be arithmetic
// Note: left shift must be unsigned because of overflow
return ((uint64_t)(v) << 1) ^ (uint64_t)(v >> 63);
}
/**
......@@ -1620,22 +1622,19 @@ required_field_pack_to_buffer(const ProtobufCFieldDescriptor *field,
break;
}
case PROTOBUF_C_TYPE_MESSAGE: {
uint8_t simple_buffer_scratch[256];
size_t sublen;
const ProtobufCMessage *msg = *(ProtobufCMessage * const *) member;
ProtobufCBufferSimple simple_buffer =
PROTOBUF_C_BUFFER_SIMPLE_INIT(simple_buffer_scratch);
scratch[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED;
if (msg == NULL)
sublen = 0;
else
sublen = protobuf_c_message_pack_to_buffer(msg, &simple_buffer.base);
rv += uint32_pack(sublen, scratch + rv);
buffer->append(buffer, rv, scratch);
buffer->append(buffer, sublen, simple_buffer.data);
rv += sublen;
PROTOBUF_C_BUFFER_SIMPLE_CLEAR(&simple_buffer);
if (msg == NULL) {
rv += uint32_pack(0, scratch + rv);
buffer->append(buffer, rv, scratch);
} else {
size_t sublen = protobuf_c_message_get_packed_size(msg);
rv += uint32_pack(sublen, scratch + rv);
buffer->append(buffer, rv, scratch);
protobuf_c_message_pack_to_buffer(msg, buffer);
rv += sublen;
}
break;
}
default:
......@@ -2065,7 +2064,7 @@ static size_t
parse_tag_and_wiretype(size_t len,
const uint8_t *data,
uint32_t *tag_out,
ProtobufCWireType *wiretype_out)
uint8_t *wiretype_out)
{
unsigned max_rv = len > 5 ? 5 : len;
uint32_t tag = (data[0] & 0x7f) >> 3;
......@@ -2097,9 +2096,9 @@ parse_tag_and_wiretype(size_t len,
/* sizeof(ScannedMember) must be <= (1UL<<BOUND_SIZEOF_SCANNED_MEMBER_LOG2) */
#define BOUND_SIZEOF_SCANNED_MEMBER_LOG2 5
typedef struct _ScannedMember ScannedMember;
typedef struct ScannedMember ScannedMember;
/** Field as it's being read. */
struct _ScannedMember {
struct ScannedMember {
uint32_t tag; /**< Field tag. */
uint8_t wire_type; /**< Field type. */
uint8_t length_prefix_len; /**< Prefix length. */
......@@ -2134,11 +2133,13 @@ scan_length_prefixed_data(size_t len, const uint8_t *data,
// Protobuf messages should always be less than 2 GiB in size.
// We also want to return early here so that hdr_len + val does
// not overflow on 32-bit systems.
PROTOBUF_C_UNPACK_ERROR("length prefix of %lu is too large", val);
PROTOBUF_C_UNPACK_ERROR("length prefix of %lu is too large",
(unsigned long int)val);
return 0;
}
if (hdr_len + val > len) {
PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %lu", val);
PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %lu",
(unsigned long int)val);
return 0;
}
return hdr_len + val;
......@@ -2423,10 +2424,8 @@ parse_int32(unsigned len, const uint8_t *data)
static inline int32_t
unzigzag32(uint32_t v)
{
if (v & 1)
return -(v >> 1) - 1;
else
return v >> 1;
// Note: Using unsigned types prevents undefined behavior
return (int32_t)((v >> 1) ^ (~(v & 1) + 1));
}
static inline uint32_t
......@@ -2467,10 +2466,8 @@ parse_uint64(unsigned len, const uint8_t *data)
static inline int64_t
unzigzag64(uint64_t v)
{
if (v & 1)
return -(v >> 1) - 1;
else
return v >> 1;
// Note: Using unsigned types prevents undefined behavior
return (int64_t)((v >> 1) ^ (~(v & 1) + 1));
}
static inline uint64_t
......@@ -2504,7 +2501,7 @@ parse_required_member(ScannedMember *scanned_member,
{
unsigned len = scanned_member->len;
const uint8_t *data = scanned_member->data;
ProtobufCWireType wire_type = scanned_member->wire_type;
uint8_t wire_type = scanned_member->wire_type;
switch (scanned_member->field->type) {
case PROTOBUF_C_TYPE_ENUM:
......@@ -2585,7 +2582,7 @@ parse_required_member(ScannedMember *scanned_member,
{
do_free(allocator, bd->data);
}
if (len - pref_len > 0) {
if (len > pref_len) {
bd->data = do_alloc(allocator, len - pref_len);
if (bd->data == NULL)
return FALSE;
......@@ -2753,7 +2750,9 @@ parse_packed_repeated_member(ScannedMember *scanned_member,
const uint8_t *at = scanned_member->data + scanned_member->length_prefix_len;
size_t rem = scanned_member->len - scanned_member->length_prefix_len;
size_t count = 0;
#if defined(WORDS_BIGENDIAN)
unsigned i;
#endif
switch (field->type) {
case PROTOBUF_C_TYPE_SFIXED32:
......@@ -2846,13 +2845,15 @@ parse_packed_repeated_member(ScannedMember *scanned_member,
}
break;
case PROTOBUF_C_TYPE_BOOL:
count = rem;
for (i = 0; i < count; i++) {
if (at[i] > 1) {
while (rem > 0) {
unsigned s = scan_varint(rem, at);
if (s == 0) {
PROTOBUF_C_UNPACK_ERROR("bad packed-repeated boolean value");
return FALSE;
}
((protobuf_c_boolean *) array)[i] = at[i];
((protobuf_c_boolean *) array)[count++] = parse_boolean(s, at);
at += s;
rem -= s;
}
break;
default:
......@@ -3086,7 +3087,7 @@ protobuf_c_message_unpack(const ProtobufCMessageDescriptor *desc,
while (rem > 0) {
uint32_t tag;
ProtobufCWireType wire_type;
uint8_t wire_type;
size_t used = parse_tag_and_wiretype(rem, at, &tag, &wire_type);
const ProtobufCFieldDescriptor *field;
ScannedMember tmp;
......
......@@ -238,7 +238,11 @@ PROTOBUF_C__BEGIN_DECLS
#define PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC 0x114315af
/* Empty string used for initializers */
#if defined(_WIN32) && defined(PROTOBUF_C_USE_SHARED_LIB)
static const char protobuf_c_empty_string[] = "";
#else
extern const char protobuf_c_empty_string[];
#endif
/**
* \defgroup api Public API
......@@ -790,13 +794,13 @@ protobuf_c_version_number(void);
* The version of the protobuf-c headers, represented as a string using the same
* format as protobuf_c_version().
*/
#define PROTOBUF_C_VERSION "1.3.2"
#define PROTOBUF_C_VERSION "1.4.0"
/**
* The version of the protobuf-c headers, represented as an integer using the
* same format as protobuf_c_version_number().
*/
#define PROTOBUF_C_VERSION_NUMBER 1003002
#define PROTOBUF_C_VERSION_NUMBER 1004000
/**
* The minimum protoc-c version which works with the current version of the
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment