Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05f648e1 authored by Yusuke Sato's avatar Yusuke Sato
Browse files

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.

(cherry-pick of c796ad0a)

Change-Id: I0e2ac58de28020c2af8d8e569a97592b09596185
parent 957c2377
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -1545,7 +1545,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* 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<AssetDir::FileInfo>* 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;