summaryrefslogtreecommitdiff
path: root/upb
diff options
context:
space:
mode:
Diffstat (limited to 'upb')
-rw-r--r--upb/bindings/lua/def.c3
-rw-r--r--upb/bindings/lua/upb/pb.c3
-rw-r--r--upb/decode.c7
-rw-r--r--upb/decode.h3
-rw-r--r--upb/def.c3
5 files changed, 10 insertions, 9 deletions
diff --git a/upb/bindings/lua/def.c b/upb/bindings/lua/def.c
index 3868179..a9ab9a8 100644
--- a/upb/bindings/lua/def.c
+++ b/upb/bindings/lua/def.c
@@ -639,8 +639,7 @@ static int lupb_symtab_add(lua_State *L) {
lupb_arena_new(L);
arena = lupb_arena_check(L, -1);
- set = google_protobuf_FileDescriptorSet_parsenew(upb_strview_make(str, len),
- arena);
+ set = google_protobuf_FileDescriptorSet_parse(str, len, arena);
if (!set) {
luaL_argerror(L, 2, "failed to parse descriptor");
diff --git a/upb/bindings/lua/upb/pb.c b/upb/bindings/lua/upb/pb.c
index e60dcde..b02fa3e 100644
--- a/upb/bindings/lua/upb/pb.c
+++ b/upb/bindings/lua/upb/pb.c
@@ -16,9 +16,8 @@ static int lupb_pb_decode(lua_State *L) {
const upb_msglayout *layout;
upb_msg *msg = lupb_msg_checkmsg2(L, 1, &layout);
const char *pb = lua_tolstring(L, 2, &len);
- upb_strview buf = upb_strview_make(pb, len);
- upb_decode(buf, msg, layout);
+ upb_decode(pb, len, msg, layout);
/* TODO(haberman): check for error. */
return 0;
diff --git a/upb/decode.c b/upb/decode.c
index f43f18f..8ea0573 100644
--- a/upb/decode.c
+++ b/upb/decode.c
@@ -585,11 +585,12 @@ static bool upb_decode_message(upb_decstate *d, const char *limit,
return true;
}
-bool upb_decode(upb_strview buf, void *msg, const upb_msglayout *l) {
+bool upb_decode(const char *buf, size_t size, void *msg,
+ const upb_msglayout *l) {
upb_decstate state;
- state.ptr = buf.data;
+ state.ptr = buf;
- return upb_decode_message(&state, buf.data + buf.size, 0, msg, l);
+ return upb_decode_message(&state, buf + size, 0, msg, l);
}
#undef CHK
diff --git a/upb/decode.h b/upb/decode.h
index 275f138..d21b659 100644
--- a/upb/decode.h
+++ b/upb/decode.h
@@ -11,7 +11,8 @@
extern "C" {
#endif
-bool upb_decode(upb_strview buf, upb_msg *msg, const upb_msglayout *l);
+bool upb_decode(const char *buf, size_t size, upb_msg *msg,
+ const upb_msglayout *l);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/upb/def.c b/upb/def.c
index 6d653ca..8d40b8e 100644
--- a/upb/def.c
+++ b/upb/def.c
@@ -1743,7 +1743,8 @@ bool _upb_symtab_loaddefinit(upb_symtab *s, const upb_def_init *init) {
if (!_upb_symtab_loaddefinit(s, *deps)) goto err;
}
- file = google_protobuf_FileDescriptorProto_parsenew(init->descriptor, arena);
+ file = google_protobuf_FileDescriptorProto_parse(
+ init->descriptor.data, init->descriptor.size, arena);
if (!file) {
upb_status_seterrf(
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback