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

Function lpbE_repeated

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

Source from the content-addressed store, hash-verified

1606}
1607
1608static void lpbE_repeated(lpb_Env *e, const pb_Field *f, int idx) {
1609 lua_State *L = e->L;
1610 pb_Buffer *b = e->b;
1611 int i;
1612 lpb_checktable(L, f, idx);
1613
1614 if (f->packed) {
1615 unsigned len, bufflen = pb_bufflen(b);
1616 pb_addvarint32(b, pb_pair(f->number, PB_TBYTES));
1617 len = pb_bufflen(b);
1618 for (i = 1; lua53_rawgeti(L, idx, i) != LUA_TNIL; ++i) {
1619 lpbE_field(e, f, NULL, -1);
1620 lua_pop(L, 1);
1621 }
1622 if (i == 1 && !e->LS->encode_default_values)
1623 pb_bufflen(b) = bufflen;
1624 else
1625 lpb_addlength(L, b, len);
1626 } else {
1627 for (i = 1; lua53_rawgeti(L, idx, i) != LUA_TNIL; ++i) {
1628 lpbE_tagfield(e, f, 0, -1);
1629 lua_pop(L, 1);
1630 }
1631 }
1632 lua_pop(L, 1);
1633}
1634
1635static void lpb_encode_onefield(lpb_Env *e, const pb_Type *t, const pb_Field *f, int idx) {
1636 if (f->type && f->type->is_map)

Callers 1

lpb_encode_onefieldFunction · 0.85

Calls 6

lpb_checktableFunction · 0.85
pb_addvarint32Function · 0.85
lua53_rawgetiFunction · 0.85
lpbE_fieldFunction · 0.85
lpb_addlengthFunction · 0.85
lpbE_tagfieldFunction · 0.85

Tested by

no test coverage detected