summaryrefslogtreecommitdiff
path: root/upb
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2019-01-19 19:38:03 -0800
committerJoshua Haberman <jhaberman@gmail.com>2019-01-19 19:38:03 -0800
commit04923fc26e1ca9f935fe10fb0de0fa932f7aa8b4 (patch)
tree9527cd53025041b4c05952e44e5ab7c172681af2 /upb
parent8cd3b9dfa99764685727e065e43fb405ca5aa29f (diff)
Some fixes for PHP.
Diffstat (limited to 'upb')
-rw-r--r--upb/def.c21
-rw-r--r--upb/pb/encoder.c1
2 files changed, 14 insertions, 8 deletions
diff --git a/upb/def.c b/upb/def.c
index 5b239dd..f816c4f 100644
--- a/upb/def.c
+++ b/upb/def.c
@@ -818,7 +818,7 @@ bool upb_oneof_done(upb_oneof_iter *iter) {
}
upb_fielddef *upb_oneof_iter_field(const upb_oneof_iter *iter) {
- return (upb_fielddef*)upb_value_getptr(upb_inttable_iter_value(iter));
+ return (upb_fielddef *)upb_value_getconstptr(upb_inttable_iter_value(iter));
}
void upb_oneof_iter_setdone(upb_oneof_iter *iter) {
@@ -936,9 +936,6 @@ typedef struct {
} symtab_addctx;
static char* strviewdup(const symtab_addctx *ctx, upb_strview view) {
- if (view.size == 0) {
- return NULL;
- }
return upb_strdup2(view.data, view.size, ctx->alloc);
}
@@ -1329,6 +1326,8 @@ static bool create_enumdef(
}
}
+ upb_inttable_compact2(&e->iton, ctx->alloc);
+
return true;
}
@@ -1378,6 +1377,7 @@ static bool create_msgdef(const symtab_addctx *ctx, const char *prefix,
CHK(assign_msg_indices(m, ctx->status));
assign_msg_wellknowntype(m);
+ upb_inttable_compact2(&m->itof, ctx->alloc);
/* This message is built. Now build nested messages and enums. */
@@ -1571,10 +1571,15 @@ static bool build_filedef(
/* Read options. */
file_options_proto = google_protobuf_FileDescriptorProto_options(file_proto);
if (file_options_proto) {
- file->phpprefix = strviewdup(
- ctx, google_protobuf_FileOptions_php_class_prefix(file_options_proto));
- file->phpnamespace = strviewdup(
- ctx, google_protobuf_FileOptions_php_namespace(file_options_proto));
+ if (google_protobuf_FileOptions_has_php_class_prefix(file_options_proto)) {
+ file->phpprefix = strviewdup(
+ ctx,
+ google_protobuf_FileOptions_php_class_prefix(file_options_proto));
+ }
+ if (google_protobuf_FileOptions_has_php_namespace(file_options_proto)) {
+ file->phpnamespace = strviewdup(
+ ctx, google_protobuf_FileOptions_php_namespace(file_options_proto));
+ }
}
/* Verify dependencies. */
diff --git a/upb/pb/encoder.c b/upb/pb/encoder.c
index 2da34db..5f74010 100644
--- a/upb/pb/encoder.c
+++ b/upb/pb/encoder.c
@@ -433,6 +433,7 @@ T(sint64, int64_t, upb_zzenc_64, encode_varint)
/* code to build the handlers *************************************************/
+#include <stdio.h>
static void newhandlers_callback(const void *closure, upb_handlers *h) {
const upb_msgdef *m;
upb_msg_field_iter i;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback