Auto-generate files after cl/602785269

pull/15632/head
Protobuf Team Bot 1 year ago
parent f212cc23d7
commit 4df6e042ec
  1. 6
      php/ext/google/protobuf/php-upb.c
  2. 164
      php/ext/google/protobuf/php-upb.h
  3. 6
      ruby/ext/google/protobuf_c/ruby-upb.c
  4. 164
      ruby/ext/google/protobuf_c/ruby-upb.h

@ -5778,7 +5778,7 @@ upb_Message* _upb_Message_Copy(upb_Message* dst, const upb_Message* src,
return NULL;
}
} else {
upb_Array* msg_array = (upb_Array*)msg_ext->data.ptr;
upb_Array* msg_array = (upb_Array*)msg_ext->data.array_val;
UPB_ASSERT(msg_array);
upb_Array* cloned_array = upb_Array_DeepClone(
msg_array, upb_MiniTableField_CType(field),
@ -5786,7 +5786,7 @@ upb_Message* _upb_Message_Copy(upb_Message* dst, const upb_Message* src,
if (!cloned_array) {
return NULL;
}
dst_ext->data.ptr = (void*)cloned_array;
dst_ext->data.array_val = cloned_array;
}
}
@ -9036,7 +9036,7 @@ static void encode_field(upb_encstate* e, const upb_Message* msg,
static void encode_msgset_item(upb_encstate* e, const upb_Extension* ext) {
size_t size;
encode_tag(e, kUpb_MsgSet_Item, kUpb_WireType_EndGroup);
encode_message(e, ext->data.ptr,
encode_message(e, ext->data.msg_val,
upb_MiniTableExtension_GetSubMessage(ext->ext), &size);
encode_varint(e, size);
encode_tag(e, kUpb_MsgSet_Message, kUpb_WireType_Delimited);

@ -1841,86 +1841,9 @@ UPB_INLINE uint64_t upb_BigEndian64(uint64_t val) {
#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_
#define UPB_MESSAGE_INTERNAL_EXTENSION_H_
/*
** Our memory representation for parsing tables and messages themselves.
** Functions in this file are used by generated code and possibly reflection.
**
** The definitions in this file are internal to upb.
**/
#ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_
#define UPB_MESSAGE_INTERNAL_MESSAGE_H_
#include <stdlib.h>
#include <string.h>
// Must be last.
#ifdef __cplusplus
extern "C" {
#endif
extern const float kUpb_FltInfinity;
extern const double kUpb_Infinity;
extern const double kUpb_NaN;
// Internal members of a upb_Message that track unknown fields and/or
// extensions. We can change this without breaking binary compatibility.
typedef struct upb_Message_Internal {
// Total size of this structure, including the data that follows.
// Must be aligned to 8, which is alignof(upb_Extension)
uint32_t size;
/* Offsets relative to the beginning of this structure.
*
* Unknown data grows forward from the beginning to unknown_end.
* Extension data grows backward from size to ext_begin.
* When the two meet, we're out of data and have to realloc.
*
* If we imagine that the final member of this struct is:
* char data[size - overhead]; // overhead = sizeof(upb_Message_Internal)
*
* Then we have:
* unknown data: data[0 .. (unknown_end - overhead)]
* extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
uint32_t unknown_end;
uint32_t ext_begin;
// Data follows, as if there were an array:
// char data[size - sizeof(upb_Message_Internal)];
} upb_Message_Internal;
// Inline version upb_Message_New(), for internal use.
UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m,
upb_Arena* a) {
const int size = m->UPB_PRIVATE(size);
struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size);
if (UPB_UNLIKELY(!msg)) return NULL;
memset(msg, 0, size);
return msg;
}
// Discards the unknown fields for this message only.
void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg);
// Adds unknown data (serialized protobuf data) to the given message.
// The data is copied into the message instance.
bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg,
const char* data, size_t len,
upb_Arena* arena);
bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
upb_Arena* arena);
#ifdef __cplusplus
} /* extern "C" */
#endif
#include <stddef.h>
#endif /* UPB_MESSAGE_INTERNAL_MESSAGE_H_ */
#ifndef UPB_MINI_TABLE_EXTENSION_H_
#define UPB_MINI_TABLE_EXTENSION_H_
@ -2022,11 +1945,7 @@ UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage(
// the most common extension type.
typedef struct {
const upb_MiniTableExtension* ext;
union {
upb_StringView str;
void* ptr;
char scalar_data[8];
} data;
upb_MessageValue data;
} upb_Extension;
#ifdef __cplusplus
@ -2517,6 +2436,85 @@ struct upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size);
#endif /* UPB_MESSAGE_INTERNAL_MAP_H_ */
/*
** Our memory representation for parsing tables and messages themselves.
** Functions in this file are used by generated code and possibly reflection.
**
** The definitions in this file are internal to upb.
**/
#ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_
#define UPB_MESSAGE_INTERNAL_MESSAGE_H_
#include <stdlib.h>
#include <string.h>
// Must be last.
#ifdef __cplusplus
extern "C" {
#endif
extern const float kUpb_FltInfinity;
extern const double kUpb_Infinity;
extern const double kUpb_NaN;
// Internal members of a upb_Message that track unknown fields and/or
// extensions. We can change this without breaking binary compatibility.
typedef struct upb_Message_Internal {
// Total size of this structure, including the data that follows.
// Must be aligned to 8, which is alignof(upb_Extension)
uint32_t size;
/* Offsets relative to the beginning of this structure.
*
* Unknown data grows forward from the beginning to unknown_end.
* Extension data grows backward from size to ext_begin.
* When the two meet, we're out of data and have to realloc.
*
* If we imagine that the final member of this struct is:
* char data[size - overhead]; // overhead = sizeof(upb_Message_Internal)
*
* Then we have:
* unknown data: data[0 .. (unknown_end - overhead)]
* extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
uint32_t unknown_end;
uint32_t ext_begin;
// Data follows, as if there were an array:
// char data[size - sizeof(upb_Message_Internal)];
} upb_Message_Internal;
// Inline version upb_Message_New(), for internal use.
UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m,
upb_Arena* a) {
const int size = m->UPB_PRIVATE(size);
struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size);
if (UPB_UNLIKELY(!msg)) return NULL;
memset(msg, 0, size);
return msg;
}
// Discards the unknown fields for this message only.
void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg);
// Adds unknown data (serialized protobuf data) to the given message.
// The data is copied into the message instance.
bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg,
const char* data, size_t len,
upb_Arena* arena);
bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
upb_Arena* arena);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* UPB_MESSAGE_INTERNAL_MESSAGE_H_ */
#ifndef UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_
#define UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_

@ -5292,7 +5292,7 @@ upb_Message* _upb_Message_Copy(upb_Message* dst, const upb_Message* src,
return NULL;
}
} else {
upb_Array* msg_array = (upb_Array*)msg_ext->data.ptr;
upb_Array* msg_array = (upb_Array*)msg_ext->data.array_val;
UPB_ASSERT(msg_array);
upb_Array* cloned_array = upb_Array_DeepClone(
msg_array, upb_MiniTableField_CType(field),
@ -5300,7 +5300,7 @@ upb_Message* _upb_Message_Copy(upb_Message* dst, const upb_Message* src,
if (!cloned_array) {
return NULL;
}
dst_ext->data.ptr = (void*)cloned_array;
dst_ext->data.array_val = cloned_array;
}
}
@ -8550,7 +8550,7 @@ static void encode_field(upb_encstate* e, const upb_Message* msg,
static void encode_msgset_item(upb_encstate* e, const upb_Extension* ext) {
size_t size;
encode_tag(e, kUpb_MsgSet_Item, kUpb_WireType_EndGroup);
encode_message(e, ext->data.ptr,
encode_message(e, ext->data.msg_val,
upb_MiniTableExtension_GetSubMessage(ext->ext), &size);
encode_varint(e, size);
encode_tag(e, kUpb_MsgSet_Message, kUpb_WireType_Delimited);

@ -1843,86 +1843,9 @@ UPB_INLINE uint64_t upb_BigEndian64(uint64_t val) {
#ifndef UPB_MESSAGE_INTERNAL_EXTENSION_H_
#define UPB_MESSAGE_INTERNAL_EXTENSION_H_
/*
** Our memory representation for parsing tables and messages themselves.
** Functions in this file are used by generated code and possibly reflection.
**
** The definitions in this file are internal to upb.
**/
#ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_
#define UPB_MESSAGE_INTERNAL_MESSAGE_H_
#include <stdlib.h>
#include <string.h>
// Must be last.
#ifdef __cplusplus
extern "C" {
#endif
extern const float kUpb_FltInfinity;
extern const double kUpb_Infinity;
extern const double kUpb_NaN;
// Internal members of a upb_Message that track unknown fields and/or
// extensions. We can change this without breaking binary compatibility.
typedef struct upb_Message_Internal {
// Total size of this structure, including the data that follows.
// Must be aligned to 8, which is alignof(upb_Extension)
uint32_t size;
/* Offsets relative to the beginning of this structure.
*
* Unknown data grows forward from the beginning to unknown_end.
* Extension data grows backward from size to ext_begin.
* When the two meet, we're out of data and have to realloc.
*
* If we imagine that the final member of this struct is:
* char data[size - overhead]; // overhead = sizeof(upb_Message_Internal)
*
* Then we have:
* unknown data: data[0 .. (unknown_end - overhead)]
* extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
uint32_t unknown_end;
uint32_t ext_begin;
// Data follows, as if there were an array:
// char data[size - sizeof(upb_Message_Internal)];
} upb_Message_Internal;
// Inline version upb_Message_New(), for internal use.
UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m,
upb_Arena* a) {
const int size = m->UPB_PRIVATE(size);
struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size);
if (UPB_UNLIKELY(!msg)) return NULL;
memset(msg, 0, size);
return msg;
}
// Discards the unknown fields for this message only.
void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg);
// Adds unknown data (serialized protobuf data) to the given message.
// The data is copied into the message instance.
bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg,
const char* data, size_t len,
upb_Arena* arena);
bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
upb_Arena* arena);
#ifdef __cplusplus
} /* extern "C" */
#endif
#include <stddef.h>
#endif /* UPB_MESSAGE_INTERNAL_MESSAGE_H_ */
#ifndef UPB_MINI_TABLE_EXTENSION_H_
#define UPB_MINI_TABLE_EXTENSION_H_
@ -2024,11 +1947,7 @@ UPB_API_INLINE void upb_MiniTableExtension_SetSubMessage(
// the most common extension type.
typedef struct {
const upb_MiniTableExtension* ext;
union {
upb_StringView str;
void* ptr;
char scalar_data[8];
} data;
upb_MessageValue data;
} upb_Extension;
#ifdef __cplusplus
@ -2519,6 +2438,85 @@ struct upb_Map* _upb_Map_New(upb_Arena* a, size_t key_size, size_t value_size);
#endif /* UPB_MESSAGE_INTERNAL_MAP_H_ */
/*
** Our memory representation for parsing tables and messages themselves.
** Functions in this file are used by generated code and possibly reflection.
**
** The definitions in this file are internal to upb.
**/
#ifndef UPB_MESSAGE_INTERNAL_MESSAGE_H_
#define UPB_MESSAGE_INTERNAL_MESSAGE_H_
#include <stdlib.h>
#include <string.h>
// Must be last.
#ifdef __cplusplus
extern "C" {
#endif
extern const float kUpb_FltInfinity;
extern const double kUpb_Infinity;
extern const double kUpb_NaN;
// Internal members of a upb_Message that track unknown fields and/or
// extensions. We can change this without breaking binary compatibility.
typedef struct upb_Message_Internal {
// Total size of this structure, including the data that follows.
// Must be aligned to 8, which is alignof(upb_Extension)
uint32_t size;
/* Offsets relative to the beginning of this structure.
*
* Unknown data grows forward from the beginning to unknown_end.
* Extension data grows backward from size to ext_begin.
* When the two meet, we're out of data and have to realloc.
*
* If we imagine that the final member of this struct is:
* char data[size - overhead]; // overhead = sizeof(upb_Message_Internal)
*
* Then we have:
* unknown data: data[0 .. (unknown_end - overhead)]
* extensions data: data[(ext_begin - overhead) .. (size - overhead)] */
uint32_t unknown_end;
uint32_t ext_begin;
// Data follows, as if there were an array:
// char data[size - sizeof(upb_Message_Internal)];
} upb_Message_Internal;
// Inline version upb_Message_New(), for internal use.
UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m,
upb_Arena* a) {
const int size = m->UPB_PRIVATE(size);
struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size);
if (UPB_UNLIKELY(!msg)) return NULL;
memset(msg, 0, size);
return msg;
}
// Discards the unknown fields for this message only.
void _upb_Message_DiscardUnknown_shallow(struct upb_Message* msg);
// Adds unknown data (serialized protobuf data) to the given message.
// The data is copied into the message instance.
bool UPB_PRIVATE(_upb_Message_AddUnknown)(struct upb_Message* msg,
const char* data, size_t len,
upb_Arena* arena);
bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
upb_Arena* arena);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* UPB_MESSAGE_INTERNAL_MESSAGE_H_ */
#ifndef UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_
#define UPB_MINI_TABLE_INTERNAL_TAGGED_PTR_H_

Loading…
Cancel
Save