From 32c6e9baab03d584b85390fdba789118f20613fc Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 3 Oct 2022 09:49:03 -0700 Subject: [PATCH] A few more fixes for PHP and the 32-bit build PiperOrigin-RevId: 478530302 --- BUILD | 2 ++ upb/internal/array.h | 1 - upb/test_cpp.cc | 6 +++--- upbc/protoc-gen-upb.cc | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/BUILD b/BUILD index 64af96945a..d307d23d2d 100644 --- a/BUILD +++ b/BUILD @@ -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( diff --git a/upb/internal/array.h b/upb/internal/array.h index ef4fb1a7cb..1a1e26dda2 100644 --- a/upb/internal/array.h +++ b/upb/internal/array.h @@ -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) { diff --git a/upb/test_cpp.cc b/upb/test_cpp.cc index b7101f6d88..88a4e5d5da 100644 --- a/upb/test_cpp.cc +++ b/upb/test_cpp.cc @@ -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); diff --git a/upbc/protoc-gen-upb.cc b/upbc/protoc-gen-upb.cc index 11c60923ee..43f8e9be62 100644 --- a/upbc/protoc-gen-upb.cc +++ b/upbc/protoc-gen-upb.cc @@ -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;