MCPcopy Create free account
hub / github.com/CyanogenMod/android_frameworks_base / getEntryByName

Method getEntryByName

tools/aapt/ZipFile.cpp:211–235  ·  view source on GitHub ↗

* Find an entry by name. */

Source from the content-addressed store, hash-verified

209 * Find an entry by name.
210 */
211ZipEntry* ZipFile::getEntryByName(const char* fileName) const
212{
213 /*
214 * Do a stupid linear string-compare search.
215 *
216 * There are various ways to speed this up, especially since it's rare
217 * to intermingle changes to the archive with "get by name" calls. We
218 * don't want to sort the mEntries vector itself, however, because
219 * it's used to recreate the Central Directory.
220 *
221 * (Hash table works, parallel list of pointers in sorted order is good.)
222 */
223 int idx;
224
225 for (idx = mEntries.size()-1; idx >= 0; idx--) {
226 ZipEntry* pEntry = mEntries[idx];
227 if (!pEntry->getDeleted() &&
228 strcmp(fileName, pEntry->getFileName()) == 0)
229 {
230 return pEntry;
231 }
232 }
233
234 return NULL;
235}
236
237/*
238 * Empty the mEntries vector.

Callers 3

doRemoveFunction · 0.80
processFileFunction · 0.80
processOverlayFileFunction · 0.80

Calls 3

getDeletedMethod · 0.80
sizeMethod · 0.65
getFileNameMethod · 0.65

Tested by

no test coverage detected