From d5fe17eac91c5c0cefb2ab8093f41ddc68c2f724 Mon Sep 17 00:00:00 2001 From: Yi Kong Date: Tue, 1 Oct 2019 16:18:47 -0700 Subject: 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 --- runtime/class_loader_context.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/class_loader_context.cc') diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc index a4aaf131e2..7b571aab8e 100644 --- a/runtime/class_loader_context.cc +++ b/runtime/class_loader_context.cc @@ -356,7 +356,7 @@ ClassLoaderContext::ClassLoaderInfo* ClassLoaderContext::ParseInternal( // 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; -- cgit v1.2.3-59-g8ed1b