MCPcopy Create free account
hub / github.com/bcndev/bytecoin / load_array

Function load_array

src/seria/KVBinaryInputStream.cpp:156–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156JsonValue load_array(size_t level, common::IInputStream &stream, uint8_t item_type) {
157 JsonValue arr(JsonValue::ARRAY);
158 size_t count = read_kv_varint(stream);
159
160 while (count--) {
161 if (item_type == BIN_KV_SERIALIZE_TYPE_ARRAY) {
162 uint8_t type;
163 stream.read(&type, 1);
164 if ((type & BIN_KV_SERIALIZE_FLAG_ARRAY) == 0)
165 throw std::runtime_error("KVBinaryInputStream Incorrect array of array encoding");
166 type &= ~BIN_KV_SERIALIZE_FLAG_ARRAY;
167
168 arr.push_back(load_array(level + 1, stream, type));
169 } else
170 arr.push_back(load_value(level, stream, item_type));
171 }
172
173 return arr;
174}
175
176JsonValue parse_binary(common::IInputStream &stream) {
177 KVBinaryStorageBlockHeader hdr;

Callers 2

load_valueFunction · 0.85
load_entryFunction · 0.85

Calls 3

read_kv_varintFunction · 0.85
load_valueFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected