Skip to content

Commit

Permalink
A few more fixes for PHP and the 32-bit build
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 478530302
  • Loading branch information
haberman authored and copybara-github committed Oct 3, 2022
1 parent 0f585c6 commit 32c6e9b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion upb/internal/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions upb/test_cpp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -169,15 +169,15 @@ 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];
size_t size = upb_JsonEncode(timestamp_upb, md.ptr(), NULL, 0, json,
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);
Expand Down
2 changes: 1 addition & 1 deletion upbc/protoc-gen-upb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 32c6e9b

Please sign in to comment.