summaryrefslogtreecommitdiffstats
path: root/libs/utils/ZipFileRO.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Change assets to use 64-bit APIKenny Root2010-12-081-19/+19
| | | | | | | | | | | | | The asset system and supporting libraries were using off_t instead of off64_t to access files larger than 2GB (32-bit signed). This change replaces all off_t with off64_t and lseek64. There is a new utils/Compat.h added for Mac OS compatibility. Also fixed some size-related compiler warnings. Bug: 3205336 Change-Id: I9097b3cb7a602e811fe52f245939d8975da55e9e
* Initialized check in ZipFileRO::findEntryByNameKenny Root2010-10-211-1/+9
| | | | | | | | If a ZipFileRO object is uninitialized, the hash table will not have been initialized. This condition wasn't checked in findEntryByName. Bug: 3121109 Change-Id: Ib696e0e7e0cb4dd0fb2e456d6a847e5e8f4fe14e
* MinGW/Cygwin requires open() in O_BINARY mode.Raphael Moll2010-10-131-20/+37
| | | | | | Alsso printf %zd is not supported on MinGW/Cygwin. Change-Id: I03811dabb46e2b05dd1d8abcc0ff97b125c77d54
* Use pread() in ZipFileRO for LinuxKenny Root2010-10-041-1/+32
| | | | | | | | | | | | | | | | | AssetManager instances are created by zygote and passed to all its children so that they don't have to individually open frameworks-res.apk. This creates a problem for determining the current file offset when using lseek() on those files, because you can't guarantee the cross-process locking of a mutex. Luckily, Linux implements pread() to get around this suckiness. The problem is that only Linux implements this, so we have to keep the old locking for use on host builds with aapt and friends. aapt doesn't have this same problem of sharing file descriptors across forked processes, so we can keep the local AutoMutex to protect accesses of those files. Change-Id: Ibe9f11499a53fe345f50fbaea438815ec0fd363e
* ZipFileRO: moar logging and wrap closeKenny Root2010-10-011-7/+19
| | | | | | | | | | | | There is apparently still a race upon reading the entry Local File Header that can't be tracked down, so move the LFH check inside the mutex-protected block so we can call lseek again to see where we are when we log an error. Also, close() can fail so use TEMP_FAILURE_RETRY on it so we don't unwittingly leak file descriptors when Mean Mr. EINTR comes a-knocking. Change-Id: I753abad0bd882fe28f7281c406fa76f64393ef4c
* Revert "Revert "Free created FileMap when uncompressing files""Kenny Root2010-09-241-5/+9
| | | | This revert reverts commit a19ef306bd0a257c67b50f5e0e669e9fe52b0889.
* Add locking around ZIP seekingKenny Root2010-09-241-10/+17
| | | | | | | | Since we switched to seeking to the LFH to verify its existence instead of a huge mmap of the file, we have to guarantee that another seek doesn't happen before we finish our read on the LFH. Change-Id: If8135d9cb6f2f5cc4db734eafa4f6b5f6269c62a
* Revert "Free created FileMap when uncompressing files"Kenny Root2010-09-071-9/+5
| | | | | | | | | This reverts commit 52b8235238fb4d8cf141020cc1ae33880929dc3f. munmap() on a region that overlaps something else (e.g, the ZIP Central Directory in this case) unmaps those other regions as well making the ZipFileRO class unhappy. Revert this for now until we can have FileMap deal with this craziness.
* Add debugging to ZipFileROKenny Root2010-08-271-2/+2
| | | | | | | Some assets are failing to read from ZIP files. This adds a bit more debugging to figure out what's going on. Change-Id: Id90e10546c54c85069a34478fbc28bc2523bda5d
* Free created FileMap when uncompressing filesKenny Root2010-08-191-5/+9
| | | | Change-Id: Ice22c4ecb7c129b74bf60cd66ae79e110b017a4a
* Free scanBuf in ZipFileROKenny Root2010-08-041-6/+4
| | | | | | | | | In the success case, the 65kB scanBuf was not freed! Also, get rid of annoying complaints about ssize_t from printf in error cases. Change-Id: If154ac19bf47637f898b4ec8c8e27c9a073a7b81
* ZipUtilsRO rewrite based on Dalvik Zip rewriteKenny Root2010-05-121-166/+296
| | | | | | | | | | | | | | | | | | | | | Change the way zip archives are handled. This is necessary to deal with very large (~1GB) APK files, for which our current approach of mapping the entire file falls over. We now do the classic scavenger hunt for the End Of Central Directory magic on a buffer of data read from the file, instead of a memory-mapped section. We use what we find to create a map that covers the Central Directory only. If the caller is interested in unpacking the file contents, we have to do an additional file read to discover the size of the Local File Header section so we can skip past it. This is based on Change I745fb15abb in the dalvik tree. Both implementations share a common ancestry, but the cost of unifying them outweighs the benefits of wrapping C calls. Change-Id: Iddacb50fe913917c2845708a530872d65fdbe620
* rename a few files to camel-case, add copyright noticesMathias Agopian2009-06-041-3/+3
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+724
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-724/+0
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+724