diff options
author | Adam Cozzette <acozzette@google.com> | 2016-12-09 10:48:11 -0800 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2016-12-09 11:20:51 -0800 |
commit | e19f3b5e3a32642073cd075e6b9ddabd7c0eedf5 (patch) | |
tree | 1caba6e766e1340e320e9f58166b35b0fdbbf85e /src | |
parent | e43f73e09906004a0ccd2644984dbbae07c595da (diff) | |
download | protobuf-e19f3b5e3a32642073cd075e6b9ddabd7c0eedf5.tar.gz protobuf-e19f3b5e3a32642073cd075e6b9ddabd7c0eedf5.tar.bz2 protobuf-e19f3b5e3a32642073cd075e6b9ddabd7c0eedf5.zip |
Use uint32 in GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET macro
There have been some reports that this necessary to prevent build
failures in some environments. It makes sense to do this anyway since
the result of this macro is ultimately assigned to uint32 in the
generated code.
Diffstat (limited to 'src')
-rw-r--r-- | src/google/protobuf/generated_message_reflection.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h index ea97a7c8..2633ab62 100644 --- a/src/google/protobuf/generated_message_reflection.h +++ b/src/google/protobuf/generated_message_reflection.h @@ -660,14 +660,14 @@ class LIBPROTOBUF_EXPORT GeneratedMessageReflection PROTOBUF_FINAL : public Refl // choose 16 rather than some other number just in case the compiler would // be confused by an unaligned pointer. #define GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TYPE, FIELD) \ - static_cast<int>( \ - reinterpret_cast<const char*>( \ - &reinterpret_cast<const TYPE*>(16)->FIELD) - \ + static_cast< ::google::protobuf::uint32>( \ + reinterpret_cast<const char*>( \ + &reinterpret_cast<const TYPE*>(16)->FIELD) - \ reinterpret_cast<const char*>(16)) #endif #define PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(ONEOF, FIELD) \ - static_cast< ::google::protobuf::uint32>( \ + static_cast< ::google::protobuf::uint32>( \ reinterpret_cast<const char*>(&(ONEOF->FIELD)) \ - reinterpret_cast<const char*>(ONEOF)) |