MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / FindProtoId

Method FindProtoId

Bcore/src/main/cpp/dex/dex_file.cc:388–422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386}
387
388const DexFile::ProtoId* DexFile::FindProtoId(dex::TypeIndex return_type_idx,
389 const dex::TypeIndex* signature_type_idxs,
390 uint32_t signature_length) const {
391 int32_t lo = 0;
392 int32_t hi = NumProtoIds() - 1;
393 while (hi >= lo) {
394 int32_t mid = (hi + lo) / 2;
395 const DexFile::ProtoId& proto = GetProtoId(mid);
396 int compare = return_type_idx.index_ - proto.return_type_idx_.index_;
397 if (compare == 0) {
398 DexFileParameterIterator it(*this, proto);
399 size_t i = 0;
400 while (it.HasNext() && i < signature_length && compare == 0) {
401 compare = signature_type_idxs[i].index_ - it.GetTypeIdx().index_;
402 it.Next();
403 i++;
404 }
405 if (compare == 0) {
406 if (it.HasNext()) {
407 compare = -1;
408 } else if (i < signature_length) {
409 compare = 1;
410 }
411 }
412 }
413 if (compare > 0) {
414 lo = mid + 1;
415 } else if (compare < 0) {
416 hi = mid - 1;
417 } else {
418 return &proto;
419 }
420 }
421 return nullptr;
422}
423
424// Given a signature place the type ids into the given vector
425bool DexFile::CreateTypeList(const StringPiece& signature,

Callers

nothing calls this directly

Calls 3

HasNextMethod · 0.45
GetTypeIdxMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected