MCPcopy Create free account
hub / github.com/facebook/SoLoader / indexDepsBytes

Method indexDepsBytes

java/com/facebook/soloader/NativeDeps.java:258–288  ·  view source on GitHub ↗
(byte[] bytes, int offset)

Source from the content-addressed store, hash-verified

256 // offsets in which each library starts, and we hash each library name
257 // and map it to its offset.
258 private static void indexDepsBytes(byte[] bytes, int offset) {
259 boolean inLibName = true;
260 int byteOffset = offset;
261 int libHash = 0;
262 int libNameBegin = 0;
263 try {
264 while (true) {
265 if (inLibName) {
266 libNameBegin = byteOffset;
267 int nextByte;
268 libHash = INITIAL_HASH;
269 while ((nextByte = bytes[byteOffset]) > ' ') {
270 libHash = ((libHash << 5) + libHash) + nextByte;
271 ++byteOffset;
272 }
273 indexLib(libHash, libNameBegin);
274 inLibName = nextByte != ' ';
275 } else {
276 while (bytes[byteOffset] != '\n') {
277 ++byteOffset;
278 }
279 inLibName = true;
280 }
281 ++byteOffset;
282 }
283 } catch (IndexOutOfBoundsException e) {
284 if (inLibName && libNameBegin != bytes.length) {
285 indexLib(libHash, libNameBegin);
286 }
287 }
288 }
289
290 private static int verifyBytesAndGetOffset(@Nullable byte[] apkId, @Nullable byte[] bytes) {
291 if (apkId == null || apkId.length == 0) {

Callers 1

processDepsBytesMethod · 0.95

Calls 1

indexLibMethod · 0.95

Tested by

no test coverage detected