From c796ad0a8be6df4a3b354690dfe5ce1df8136c09 Mon Sep 17 00:00:00 2001 From: Yusuke Sato Date: Thu, 25 Jun 2015 17:47:35 -0700 Subject: [PATCH] Clean up AssetManager::scanAndMergeZipLocked Now that ZipFileRO::startIteration supports prefix/suffix matching, we can pass dirName to the function for simpler code and slightly better performance. Change-Id: Ia93c3ab3fa688ce013dd9febbf0f4bd3ee1f3e5e --- libs/androidfw/AssetManager.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index 2dc1c96259c0a..1c39ffef6fd41 100644 --- a/libs/androidfw/AssetManager.cpp +++ b/libs/androidfw/AssetManager.cpp @@ -1545,7 +1545,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector* pMerg */ int dirNameLen = dirName.length(); void *iterationCookie; - if (!pZip->startIteration(&iterationCookie)) { + if (!pZip->startIteration(&iterationCookie, dirName.string(), NULL)) { ALOGW("ZipFileRO::startIteration returned false"); return false; } @@ -1560,9 +1560,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector* pMerg continue; } //printf("Comparing %s in %s?\n", nameBuf, dirName.string()); - if (dirNameLen == 0 || - (strncmp(nameBuf, dirName.string(), dirNameLen) == 0 && - nameBuf[dirNameLen] == '/')) + if (dirNameLen == 0 || nameBuf[dirNameLen] == '/') { const char* cp; const char* nextSlash;