diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index facb63d11b82..f93d7facf545 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -4013,8 +4013,8 @@ void _upb_Message_DiscardUnknown_shallow(upb_Message* msg) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); if (!in) return; - size_t size = 0; - for (size_t i = 0; i < in->size; i++) { + uint32_t size = 0; + for (uint32_t i = 0; i < in->size; i++) { upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { in->aux_data[size++] = tagged_ptr; @@ -4094,7 +4094,7 @@ void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m) { // Extensions. upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); // TODO: b/376969853 - use iterator API - size_t size = in ? in->size : 0; + uint32_t size = in ? in->size : 0; for (size_t i = 0; i < size; i++) { upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; if (!upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { @@ -12491,7 +12491,7 @@ const float kUpb_FltInfinity = UPB_INFINITY; const double kUpb_Infinity = UPB_INFINITY; const double kUpb_NaN = UPB_NAN; -static size_t _upb_Message_SizeOfInternal(size_t count) { +static size_t _upb_Message_SizeOfInternal(uint32_t count) { return UPB_SIZEOF_FLEX(upb_Message_Internal, aux_data, count); } @@ -12501,7 +12501,7 @@ bool UPB_PRIVATE(_upb_Message_ReserveSlot)(struct upb_Message* msg, upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); if (!in) { // No internal data, allocate from scratch. - size_t capacity = 4; + uint32_t capacity = 4; in = upb_Arena_Malloc(a, _upb_Message_SizeOfInternal(capacity)); if (!in) return false; in->size = 0; @@ -12509,7 +12509,7 @@ bool UPB_PRIVATE(_upb_Message_ReserveSlot)(struct upb_Message* msg, UPB_PRIVATE(_upb_Message_SetInternal)(msg, in); } else if (in->capacity == in->size) { // Internal data is too small, reallocate. - size_t new_capacity = upb_RoundUpToPowerOfTwo(in->size + 1); + uint32_t new_capacity = upb_RoundUpToPowerOfTwo(in->size + 1); in = upb_Arena_Realloc(a, in, _upb_Message_SizeOfInternal(in->capacity), _upb_Message_SizeOfInternal(new_capacity)); if (!in) return false; diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h index def0094443a7..209d1ddefc20 100644 --- a/php/ext/google/protobuf/php-upb.h +++ b/php/ext/google/protobuf/php-upb.h @@ -3097,8 +3097,8 @@ upb_TaggedAuxPtr_MakeUnknownData(const upb_StringView* sv) { typedef struct upb_Message_Internal { // Total number of entries set in aux_data - size_t size; - size_t capacity; + uint32_t size; + uint32_t capacity; // Tagged pointers to upb_StringView or upb_Extension upb_TaggedAuxPtr aux_data[]; } upb_Message_Internal; @@ -3210,7 +3210,7 @@ UPB_INLINE bool UPB_PRIVATE(_upb_Message_NextExtensionReverse)( upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); if (!in) return false; uintptr_t i = *iter; - size_t size = in->size; + uint32_t size = in->size; while (i < size) { upb_TaggedAuxPtr tagged_ptr = in->aux_data[size - 1 - i]; i++; diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 870216df1520..16ac51b2728e 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -4013,8 +4013,8 @@ void _upb_Message_DiscardUnknown_shallow(upb_Message* msg) { UPB_ASSERT(!upb_Message_IsFrozen(msg)); upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); if (!in) return; - size_t size = 0; - for (size_t i = 0; i < in->size; i++) { + uint32_t size = 0; + for (uint32_t i = 0; i < in->size; i++) { upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { in->aux_data[size++] = tagged_ptr; @@ -4094,7 +4094,7 @@ void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m) { // Extensions. upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); // TODO: b/376969853 - use iterator API - size_t size = in ? in->size : 0; + uint32_t size = in ? in->size : 0; for (size_t i = 0; i < size; i++) { upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; if (!upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { @@ -11978,7 +11978,7 @@ const float kUpb_FltInfinity = UPB_INFINITY; const double kUpb_Infinity = UPB_INFINITY; const double kUpb_NaN = UPB_NAN; -static size_t _upb_Message_SizeOfInternal(size_t count) { +static size_t _upb_Message_SizeOfInternal(uint32_t count) { return UPB_SIZEOF_FLEX(upb_Message_Internal, aux_data, count); } @@ -11988,7 +11988,7 @@ bool UPB_PRIVATE(_upb_Message_ReserveSlot)(struct upb_Message* msg, upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); if (!in) { // No internal data, allocate from scratch. - size_t capacity = 4; + uint32_t capacity = 4; in = upb_Arena_Malloc(a, _upb_Message_SizeOfInternal(capacity)); if (!in) return false; in->size = 0; @@ -11996,7 +11996,7 @@ bool UPB_PRIVATE(_upb_Message_ReserveSlot)(struct upb_Message* msg, UPB_PRIVATE(_upb_Message_SetInternal)(msg, in); } else if (in->capacity == in->size) { // Internal data is too small, reallocate. - size_t new_capacity = upb_RoundUpToPowerOfTwo(in->size + 1); + uint32_t new_capacity = upb_RoundUpToPowerOfTwo(in->size + 1); in = upb_Arena_Realloc(a, in, _upb_Message_SizeOfInternal(in->capacity), _upb_Message_SizeOfInternal(new_capacity)); if (!in) return false; diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index 057409fb9ac9..f106ae5bbdef 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h @@ -3099,8 +3099,8 @@ upb_TaggedAuxPtr_MakeUnknownData(const upb_StringView* sv) { typedef struct upb_Message_Internal { // Total number of entries set in aux_data - size_t size; - size_t capacity; + uint32_t size; + uint32_t capacity; // Tagged pointers to upb_StringView or upb_Extension upb_TaggedAuxPtr aux_data[]; } upb_Message_Internal; @@ -3212,7 +3212,7 @@ UPB_INLINE bool UPB_PRIVATE(_upb_Message_NextExtensionReverse)( upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg); if (!in) return false; uintptr_t i = *iter; - size_t size = in->size; + uint32_t size = in->size; while (i < size) { upb_TaggedAuxPtr tagged_ptr = in->aux_data[size - 1 - i]; i++;