MCPcopy Create free account
hub / github.com/MultiMC/Launcher / load

Method load

libraries/classparser/src/constants.h:180–204  ·  view source on GitHub ↗

* Load a java constant pool */

Source from the content-addressed store, hash-verified

178 * Load a java constant pool
179 */
180 void load(util::membuffer &buf)
181 {
182 // FIXME: @SANITY this should check for the end of buffer.
183 uint16_t length = 0;
184 buf.read_be(length);
185 length--;
186 const constant *last_constant = nullptr;
187 while (length)
188 {
189 const constant &cnst = constant(buf);
190 constants.push_back(cnst);
191 last_constant = &constants[constants.size() - 1];
192 if (last_constant->type == constant_type_t::j_double ||
193 last_constant->type == constant_type_t::j_long)
194 {
195 // push in a fake constant to preserve indexing
196 constants.push_back(constant(0));
197 length -= 2;
198 }
199 else
200 {
201 length--;
202 }
203 }
204 }
205 typedef std::vector<java::constant> container_type;
206 /**
207 * Access constants based on jar file index numbers (index of the first element is 1)

Callers 2

pixmapMethod · 0.45
classfileMethod · 0.45

Calls 3

constantClass · 0.85
read_beMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected