diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2017-07-04 17:02:48 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2017-07-04 17:02:48 -0700 |
commit | 9cb10577fcefa3ed004e0bbdc61e6238e8137e3c (patch) | |
tree | e270ff7b0f782dadf2942f6816b071aa2a134e21 /upb/bindings/lua/msg.c | |
parent | 76fcdd2ee92e8f7852f96ccd49fe776236ae4e60 (diff) |
First version of a real C codegen for upb.
Also includes an implementation of the conformance tests
to display what the API usage will be like.
There is still a lot to do, and things that are broken (oneofs,
repeated fields, etc), but it's a good start.
Diffstat (limited to 'upb/bindings/lua/msg.c')
-rw-r--r-- | upb/bindings/lua/msg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/upb/bindings/lua/msg.c b/upb/bindings/lua/msg.c index 41163bc..dc8420f 100644 --- a/upb/bindings/lua/msg.c +++ b/upb/bindings/lua/msg.c @@ -434,7 +434,7 @@ static upb_msgval lupb_tomsgval(lua_State *L, upb_fieldtype_t type, int narg, case UPB_TYPE_BYTES: { size_t len; const char *ptr = lupb_checkstring(L, narg, &len); - return upb_msgval_str(ptr, len); + return upb_msgval_str(upb_stringview_make(ptr, len)); } case UPB_TYPE_MESSAGE: UPB_ASSERT(lmsgclass); @@ -1014,7 +1014,7 @@ static int lupb_msg_index(lua_State *L) { if (upb_msg_has(lmsg->msg, field_index, l)) { upb_msgval val = upb_msg_get(lmsg->msg, field_index, l); lua_pop(L, 1); - lua_pushlstring(L, val.str.ptr, val.str.len); + lua_pushlstring(L, val.str.data, val.str.size); lupb_uservalseti(L, 1, lupb_fieldindex(f), -1); } } |