A few more fixes for PHP and the 32-bit build

PiperOrigin-RevId: 478530302
pull/13171/head
Joshua Haberman 2 years ago committed by Copybara-Service
parent 0f585c69af
commit 32c6e9baab
  1. 2
      BUILD
  2. 1
      upb/internal/array.h
  3. 6
      upb/test_cpp.cc
  4. 2
      upbc/protoc-gen-upb.cc

@ -1020,10 +1020,12 @@ upb_amalgamation(
":port",
":reflection",
":table_internal",
":unicode_internal",
":upb",
],
prefix = "php-",
strip_import_prefix = ["src"],
visibility = ["@com_google_protobuf//php:__pkg__"],
)
cc_library(

@ -44,7 +44,6 @@ struct upb_Array {
uintptr_t data; /* Tagged ptr: low 3 bits of ptr are lg2(elem size). */
size_t size; /* The number of elements in the array. */
size_t capacity; /* Allocated storage. Measured in elements. */
uint64_t junk;
};
UPB_INLINE const void* _upb_array_constptr(const upb_Array* arr) {

@ -160,7 +160,7 @@ TEST(Cpp, TimestampEncoder) {
google_protobuf_Timestamp* timestamp_upb_decoded =
google_protobuf_Timestamp_new(arena.ptr());
long timestamps[] = {
int64_t timestamps[] = {
253402300799, // 9999-12-31T23:59:59Z
1641006000, // 2022-01-01T03:00:00Z
0, // 1970-01-01T00:00:00Z
@ -169,7 +169,7 @@ TEST(Cpp, TimestampEncoder) {
-62135596800, // 0000-01-01T00:00:00Z
};
for (long timestamp : timestamps) {
for (int64_t timestamp : timestamps) {
google_protobuf_Timestamp_set_seconds(timestamp_upb, timestamp);
char json[128];
@ -177,7 +177,7 @@ TEST(Cpp, TimestampEncoder) {
sizeof(json), NULL);
bool result = upb_JsonDecode(json, size, timestamp_upb_decoded, md.ptr(),
NULL, 0, arena.ptr(), NULL);
const long timestamp_decoded =
const int64_t timestamp_decoded =
google_protobuf_Timestamp_seconds(timestamp_upb_decoded);
ASSERT_TRUE(result);

@ -1143,7 +1143,7 @@ bool TryFillTableEntry(const FileLayout& layout,
// No hasbit/oneof-related fields.
}
if (field->real_containing_oneof()) {
size_t case_offset = ~mt_f->presence;
uint64_t case_offset = ~mt_f->presence;
if (case_offset > 0xffff) return false;
assert(field->number() < 256);
data |= field->number() << 24;

Loading…
Cancel
Save