Skip to content

Commit

Permalink
Auto-generate files after cl/699248319
Browse files Browse the repository at this point in the history
  • Loading branch information
protobuf-team-bot committed Nov 22, 2024
1 parent ac5ce6e commit 736672c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
11 changes: 6 additions & 5 deletions php/ext/google/protobuf/php-upb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3921,7 +3921,7 @@ bool UPB_PRIVATE(_upb_Message_AddUnknown)(upb_Message* msg, const char* data,
UPB_ASSERT(!upb_Message_IsFrozen(msg));
// TODO: b/376969853 - Add debug check that the unknown field is an overall
// valid proto field
if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, len, arena)) return false;
if (!UPB_PRIVATE(_upb_Message_EnsureAvailable)(msg, len, arena)) return false;
upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
memcpy(UPB_PTR_AT(in, in->unknown_end, char), data, len);
in->unknown_end += len;
Expand All @@ -3938,7 +3938,8 @@ bool UPB_PRIVATE(_upb_Message_AddUnknownV)(struct upb_Message* msg,
for (size_t i = 0; i < count; i++) {
total_len += data[i].size;
}
if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, total_len, arena)) return false;
if (!UPB_PRIVATE(_upb_Message_EnsureAvailable)(msg, total_len, arena))
return false;

upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
for (size_t i = 0; i < count; i++) {
Expand Down Expand Up @@ -12385,7 +12386,7 @@ upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(
UPB_ASSERT(!upb_Message_IsFrozen(msg));
upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e);
if (ext) return ext;
if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, sizeof(upb_Extension), a))
if (!UPB_PRIVATE(_upb_Message_EnsureAvailable)(msg, sizeof(upb_Extension), a))
return NULL;
upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
in->ext_begin -= sizeof(upb_Extension);
Expand Down Expand Up @@ -12426,8 +12427,8 @@ const double kUpb_Infinity = INFINITY;

const double kUpb_NaN = UPB_NAN;

bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
upb_Arena* a) {
bool UPB_PRIVATE(_upb_Message_EnsureAvailable)(struct upb_Message* msg,
size_t need, upb_Arena* a) {
UPB_ASSERT(!upb_Message_IsFrozen(msg));
const size_t overhead = sizeof(upb_Message_Internal);

Expand Down
7 changes: 5 additions & 2 deletions php/ext/google/protobuf/php-upb.h
Original file line number Diff line number Diff line change
Expand Up @@ -2608,8 +2608,11 @@ bool UPB_PRIVATE(_upb_Message_AddUnknownV)(struct upb_Message* msg,
upb_Arena* arena,
upb_StringView data[], size_t count);

bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
upb_Arena* arena);
// Ensure at least `need` unused bytes are available for unknown fields or
// extensions. Returns false if a reallocation is needed to satisfy the request,
// and fails.
bool UPB_PRIVATE(_upb_Message_EnsureAvailable)(struct upb_Message* msg,
size_t need, upb_Arena* arena);

#define kUpb_Message_UnknownBegin 0
#define kUpb_Message_ExtensionBegin 0
Expand Down
11 changes: 6 additions & 5 deletions ruby/ext/google/protobuf_c/ruby-upb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3921,7 +3921,7 @@ bool UPB_PRIVATE(_upb_Message_AddUnknown)(upb_Message* msg, const char* data,
UPB_ASSERT(!upb_Message_IsFrozen(msg));
// TODO: b/376969853 - Add debug check that the unknown field is an overall
// valid proto field
if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, len, arena)) return false;
if (!UPB_PRIVATE(_upb_Message_EnsureAvailable)(msg, len, arena)) return false;
upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
memcpy(UPB_PTR_AT(in, in->unknown_end, char), data, len);
in->unknown_end += len;
Expand All @@ -3938,7 +3938,8 @@ bool UPB_PRIVATE(_upb_Message_AddUnknownV)(struct upb_Message* msg,
for (size_t i = 0; i < count; i++) {
total_len += data[i].size;
}
if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, total_len, arena)) return false;
if (!UPB_PRIVATE(_upb_Message_EnsureAvailable)(msg, total_len, arena))
return false;

upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
for (size_t i = 0; i < count; i++) {
Expand Down Expand Up @@ -11872,7 +11873,7 @@ upb_Extension* UPB_PRIVATE(_upb_Message_GetOrCreateExtension)(
UPB_ASSERT(!upb_Message_IsFrozen(msg));
upb_Extension* ext = (upb_Extension*)UPB_PRIVATE(_upb_Message_Getext)(msg, e);
if (ext) return ext;
if (!UPB_PRIVATE(_upb_Message_Realloc)(msg, sizeof(upb_Extension), a))
if (!UPB_PRIVATE(_upb_Message_EnsureAvailable)(msg, sizeof(upb_Extension), a))
return NULL;
upb_Message_Internal* in = UPB_PRIVATE(_upb_Message_GetInternal)(msg);
in->ext_begin -= sizeof(upb_Extension);
Expand Down Expand Up @@ -11913,8 +11914,8 @@ const double kUpb_Infinity = INFINITY;

const double kUpb_NaN = UPB_NAN;

bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
upb_Arena* a) {
bool UPB_PRIVATE(_upb_Message_EnsureAvailable)(struct upb_Message* msg,
size_t need, upb_Arena* a) {
UPB_ASSERT(!upb_Message_IsFrozen(msg));
const size_t overhead = sizeof(upb_Message_Internal);

Expand Down
7 changes: 5 additions & 2 deletions ruby/ext/google/protobuf_c/ruby-upb.h
Original file line number Diff line number Diff line change
Expand Up @@ -2610,8 +2610,11 @@ bool UPB_PRIVATE(_upb_Message_AddUnknownV)(struct upb_Message* msg,
upb_Arena* arena,
upb_StringView data[], size_t count);

bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
upb_Arena* arena);
// Ensure at least `need` unused bytes are available for unknown fields or
// extensions. Returns false if a reallocation is needed to satisfy the request,
// and fails.
bool UPB_PRIVATE(_upb_Message_EnsureAvailable)(struct upb_Message* msg,
size_t need, upb_Arena* arena);

#define kUpb_Message_UnknownBegin 0
#define kUpb_Message_ExtensionBegin 0
Expand Down

0 comments on commit 736672c

Please sign in to comment.