Fix incorrect narrowing type cast
std::string::npos is greater than the maximum value of uint32_t type,
the narrowing cast will make this statement always false.
Found by Clang tautological-constant-out-of-range-compare warning.
Test: N/A
Bug: 72331526
Change-Id: I59b297360ab5672868f2cffc42ec02189275a152
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index a4aaf13..7b571aa 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -356,7 +356,7 @@
// The class loader spec contains shared libraries. Find the matching closing
// shared library marker for it.
- uint32_t shared_library_close =
+ size_t shared_library_close =
FindMatchingSharedLibraryCloseMarker(remaining, first_shared_library_open);
if (shared_library_close == std::string::npos) {
LOG(ERROR) << "Invalid class loader spec: " << class_loader_spec;