| 1857 | } |
| 1858 | |
| 1859 | static int lpbD_message(lpb_Env *e, const pb_Type *t) { |
| 1860 | lua_State *L = e->L; |
| 1861 | pb_Slice *s = e->s; |
| 1862 | uint32_t tag; |
| 1863 | luaL_checkstack(L, t->field_count * 2, "not enough stack space for fields"); |
| 1864 | while (pb_readvarint32(s, &tag)) { |
| 1865 | const pb_Field *f = pb_field(t, pb_gettag(tag)); |
| 1866 | if (f == NULL) |
| 1867 | pb_skipvalue(s, tag); |
| 1868 | else if (f->type && f->type->is_map) { |
| 1869 | lpb_fetchtable(e, f); |
| 1870 | lpbD_checktype(e, f, tag); |
| 1871 | lpbD_map(e, f); |
| 1872 | lua_pop(L, 1); |
| 1873 | } else if (f->repeated) { |
| 1874 | lpb_fetchtable(e, f); |
| 1875 | lpbD_repeated(e, f, tag); |
| 1876 | lua_pop(L, 1); |
| 1877 | } else { |
| 1878 | lua_pushstring(L, (const char*)f->name); |
| 1879 | if (f->oneof_idx) { |
| 1880 | lua_pushstring(L, (const char*)pb_oneofname(t, f->oneof_idx)); |
| 1881 | lua_pushvalue(L, -2); |
| 1882 | lua_rawset(L, -4); |
| 1883 | } |
| 1884 | lpbD_field(e, f, tag); |
| 1885 | lua_rawset(L, -3); |
| 1886 | } |
| 1887 | } |
| 1888 | if (e->LS->use_dec_hooks) lpb_usedechooks(L, e->LS, t); |
| 1889 | return 1; |
| 1890 | } |
| 1891 | |
| 1892 | static int lpbD_decode(lua_State *L, pb_Slice s, int start) { |
| 1893 | lpb_State *LS = lpb_lstate(L); |
no test coverage detected