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

Function lpbD_map

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

Source from the content-addressed store, hash-verified

1816}
1817
1818static void lpbD_map(lpb_Env *e, const pb_Field *f) {
1819 lua_State *L = e->L;
1820 pb_Slice p, *s = e->s;
1821 int mask = 0, top = lua_gettop(L);
1822 uint32_t tag;
1823 lpb_readbytes(L, s, &p);
1824 if (f->type == NULL) return;
1825 lua_pushnil(L);
1826 lua_pushnil(L);
1827 while (pb_readvarint32(&p, &tag)) {
1828 int n = pb_gettag(tag);
1829 if (n == 1 || n == 2) {
1830 mask |= n;
1831 lpb_withinput(e, &p, lpbD_field(e, pb_field(f->type, n), tag));
1832 lua_replace(L, top+n);
1833 }
1834 }
1835 if (!(mask & 1) && lpb_pushdeffield(L, e->LS, pb_field(f->type, 1), 1))
1836 lua_replace(L, top + 1), mask |= 1;
1837 if (!(mask & 2) && lpb_pushdeffield(L, e->LS, pb_field(f->type, 2), 1))
1838 lua_replace(L, top + 2), mask |= 2;
1839 if (mask == 3) lua_rawset(L, -3); else lua_pop(L, 2);
1840}
1841
1842static void lpbD_repeated(lpb_Env *e, const pb_Field *f, uint32_t tag) {
1843 lua_State *L = e->L;

Callers 2

lpbD_messageFunction · 0.85
lpb_unpackfieldFunction · 0.85

Calls 8

lua_gettopFunction · 0.85
lpb_readbytesFunction · 0.85
lua_pushnilFunction · 0.85
pb_readvarint32Function · 0.85
lpbD_fieldFunction · 0.85
pb_fieldFunction · 0.85
lpb_pushdeffieldFunction · 0.85
lua_rawsetFunction · 0.85

Tested by

no test coverage detected