MCPcopy Create free account
hub / github.com/Tencent/UnLua / lpbD_rawfield

Function lpbD_rawfield

Plugins/UnLuaExtensions/LuaProtobuf/Source/src/pb.cpp:1769–1798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1767}
1768
1769static void lpbD_rawfield(lpb_Env *e, const pb_Field *f) {
1770 lua_State *L = e->L;
1771 pb_Slice sv, *s = e->s;
1772 const pb_Field *ev = NULL;
1773 uint64_t u64;
1774 switch (f->type_id) {
1775 case PB_Tenum:
1776 if (pb_readvarint64(s, &u64) == 0)
1777 luaL_error(L, "invalid varint value at offset %d", pb_pos(*s)+1);
1778 if (!lpb_lstate(L)->enum_as_value)
1779 ev = pb_field(f->type, (int32_t)u64);
1780 if (ev) lua_pushstring(L, (const char*)ev->name);
1781 else lpb_pushinteger(L, (lua_Integer)u64, 1, lpb_lstate(L)->int64_mode);
1782 if (e->LS->use_dec_hooks) lpb_usedechooks(L, e->LS, f->type);
1783 break;
1784
1785 case PB_Tmessage:
1786 lpb_readbytes(L, s, &sv);
1787 if (f->type == NULL || f->type->is_dead)
1788 lua_pushnil(L);
1789 else {
1790 lpb_pushtypetable(L, e->LS, f->type);
1791 lpb_withinput(e, &sv, lpbD_message(e, f->type));
1792 }
1793 break;
1794
1795 default:
1796 lpb_readtype(L, e->LS, f->type_id, s);
1797 }
1798}
1799
1800static void lpbD_checktype(lpb_Env *e, const pb_Field *f, uint32_t tag) {
1801 if (pb_wtypebytype(f->type_id) == (int)pb_gettype(tag)) return;

Callers 2

lpbD_fieldFunction · 0.85
lpbD_repeatedFunction · 0.85

Calls 13

pb_readvarint64Function · 0.85
luaL_errorFunction · 0.85
pb_posFunction · 0.85
lpb_lstateFunction · 0.85
pb_fieldFunction · 0.85
lua_pushstringFunction · 0.85
lpb_pushintegerFunction · 0.85
lpb_usedechooksFunction · 0.85
lpb_readbytesFunction · 0.85
lua_pushnilFunction · 0.85
lpb_pushtypetableFunction · 0.85
lpbD_messageFunction · 0.85

Tested by

no test coverage detected