diff --git a/upb/message/internal/message.c b/upb/message/internal/message.c index 5a1d44ea30554..9269570713898 100644 --- a/upb/message/internal/message.c +++ b/upb/message/internal/message.c @@ -49,7 +49,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); } @@ -59,7 +59,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; @@ -67,7 +67,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/upb/message/internal/message.h b/upb/message/internal/message.h index e01a71609f2dc..dea517958d24c 100644 --- a/upb/message/internal/message.h +++ b/upb/message/internal/message.h @@ -88,8 +88,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; @@ -200,7 +200,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/upb/message/message.c b/upb/message/message.c index c66c726b50b8a..7f480f860109c 100644 --- a/upb/message/message.c +++ b/upb/message/message.c @@ -87,7 +87,7 @@ 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; + uint32_t size = 0; for (size_t i = 0; i < in->size; i++) { upb_TaggedAuxPtr tagged_ptr = in->aux_data[i]; if (upb_TaggedAuxPtr_IsExtension(tagged_ptr)) { @@ -168,7 +168,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)) {