summaryrefslogtreecommitdiffstats
path: root/runtime/zip_archive.h
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2013-09-19 09:25:34 -0700
committerKenny Root <kroot@google.com>2013-09-19 15:49:23 -0700
commit72fcca2477e02da2d3970aefc75465ba1f20ce9c (patch)
tree3ad90394d1483839cdaaf263afd90af95a516813 /runtime/zip_archive.h
parentab482f5eff21af748c906857f529a3c17df35964 (diff)
downloadart-72fcca2477e02da2d3970aefc75465ba1f20ce9c.tar.gz
art-72fcca2477e02da2d3970aefc75465ba1f20ce9c.tar.bz2
art-72fcca2477e02da2d3970aefc75465ba1f20ce9c.zip
Reconcile differences between zip implementations
Copy new behavior of ZipFileRO to art's zip_archive.cc Bug: 10424836 Change-Id: I0ec81425ab372d0884c684eab299449834c35e82
Diffstat (limited to 'runtime/zip_archive.h')
-rw-r--r--runtime/zip_archive.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/runtime/zip_archive.h b/runtime/zip_archive.h
index d648517aae..d9ccba2cce 100644
--- a/runtime/zip_archive.h
+++ b/runtime/zip_archive.h
@@ -58,7 +58,7 @@ class ZipEntry {
uint32_t GetCompressedLength();
// returns -1 on error
- off_t GetDataOffset();
+ off64_t GetDataOffset();
const ZipArchive* zip_archive_;
@@ -72,22 +72,28 @@ class ZipEntry {
class ZipArchive {
public:
// Zip file constants.
- static const uint32_t kEOCDSignature = 0x06054b50;
- static const int32_t kEOCDLen = 22;
- static const int32_t kEOCDNumEntries = 8; // offset to #of entries in file
- static const int32_t kEOCDSize = 12; // size of the central directory
- static const int32_t kEOCDFileOffset = 16; // offset to central directory
+ static const uint32_t kEOCDSignature = 0x06054b50;
+ static const int32_t kEOCDLen = 22;
+ static const int32_t kEOCDDiskNumber = 4; // number of the current disk
+ static const int32_t kEOCDDiskNumberForCD = 6; // disk number with the Central Directory
+ static const int32_t kEOCDNumEntries = 8; // offset to #of entries in file
+ static const int32_t kEOCDTotalNumEntries = 10; // offset to total #of entries in spanned archives
+ static const int32_t kEOCDSize = 12; // size of the central directory
+ static const int32_t kEOCDFileOffset = 16; // offset to central directory
+ static const int32_t kEOCDCommentSize = 20; // offset to the length of the file comment
static const int32_t kMaxCommentLen = 65535; // longest possible in uint16_t
static const int32_t kMaxEOCDSearch = (kMaxCommentLen + kEOCDLen);
static const uint32_t kLFHSignature = 0x04034b50;
static const int32_t kLFHLen = 30; // excluding variable-len fields
+ static const int32_t kLFHGPBFlags = 6; // offset to GPB flags
static const int32_t kLFHNameLen = 26; // offset to filename length
static const int32_t kLFHExtraLen = 28; // offset to extra length
static const uint32_t kCDESignature = 0x02014b50;
static const int32_t kCDELen = 46; // excluding variable-len fields
+ static const int32_t kCDEGPBFlags = 8; // offset to GPB flags
static const int32_t kCDEMethod = 10; // offset to compression method
static const int32_t kCDEModWhen = 12; // offset to modification timestamp
static const int32_t kCDECRC = 16; // offset to entry CRC
@@ -98,6 +104,10 @@ class ZipArchive {
static const int32_t kCDECommentLen = 32; // offset to comment length
static const int32_t kCDELocalOffset = 42; // offset to local hdr
+ // General Purpose Bit Flag
+ static const int32_t kGPFEncryptedFlag = (1 << 0);
+ static const int32_t kGPFUnsupportedMask = (kGPFEncryptedFlag);
+
// return new ZipArchive instance on success, NULL on error.
static ZipArchive* Open(const std::string& filename);
static ZipArchive* OpenFromFd(int fd);
@@ -117,7 +127,7 @@ class ZipArchive {
int fd_;
uint16_t num_entries_;
- off_t dir_offset_;
+ off64_t dir_offset_;
UniquePtr<MemMap> dir_map_;
typedef SafeMap<StringPiece, const byte*> DirEntries;
DirEntries dir_entries_;