Fixes#188.
Implements suggested fix from the issue:
The struct tag namespace is different from the type namespace. Use the
same symbol names (i.e. without leading underscores) in every namespace.
PACKAGE_DESCRIPTION is defined in configure.ac. PACKAGE_NAME,
PACKAGE_VERSION, and PACKAGE_URL come from AC_INIT.
This change will ensure that libprotobuf-c.pc.in could also be used by
CMake.
Issue #330 is a bug in proto3 behavior and the test case handling it
needs a 'syntax = "proto3";' line in its .proto file, which is not
supported by the protobuf 2 implementation.
Since we still support building against protobuf 2, this commit
conditionalizes the Issue #330 test case so that it is only built when
protobuf-c is being built against protobuf 3.
* allow compilation with -pedantic (thanks @Bun)
Can be reproduced with the following command:
$ make CFLAGS=-pedantic protobuf-c/protobuf-c.o
* put el-size on a separate line
The scan_length_prefixed_data() function returns the number of bytes
taken up by a varint length delimiter, plus the actual value of that
delimiter. Since it returns a uint32_t, a delimiter of 2^32 - 1 (or
close to that) could cause the return value to overflow and result in an
incorrect value.
At first I tried to fix it by making scan_length_prefixed_data() use a
size_t for its result, but I realized this would have no effect on
32-bit systems. To fix the problem for 32-bit, I changed the function to
return early if the length is 2 GiB or more (protobuf messages are not
allowed to be that large). I kept the size_t change anyway, since the
result will ultimately be stored in a size_t (ScannedMember.len) and we
might as well stay consistent with that.
Signed-off-by: Adam Cozzette <acozzette@google.com>
google::protobuf::Message::Reflection has been removed in newer versions
of protobuf. The replacement is google::protobuf::Reflection.
protobuf in commit 779f61c6a3ce02a119e28e802f229e61b69b9046 ("Integrate
recent changes from google3.", from August 2008) changed the following
in message.h:
@@ -336,7 +337,8 @@ class LIBPROTOBUF_EXPORT Message {
// Introspection ---------------------------------------------------
- class Reflection; // Defined below.
+ // Typedef for backwards-compatibility.
+ typedef google::protobuf::Reflection Reflection;
The "typedef for backwards-compatibility" apparently lasted ten years
until protobuf commit 6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3
("Down-integrate from google3.", from August 2018) which finally removed
the typedef:
@@ -327,8 +344,6 @@ class LIBPROTOBUF_EXPORT Message : public MessageLite {
// Introspection ---------------------------------------------------
- // Typedef for backwards-compatibility.
- typedef google::protobuf::Reflection Reflection;
This commit updates the only use of this typedef (in the test suite) to
directly refer to the replacement, google::protobuf::Reflection. This
fixes the build failure in the test suite.