Loading tools/zipalign/ZipFile.cpp +36 −67 Original line number Diff line number Diff line Loading @@ -359,8 +359,7 @@ bail: * safely written. Not really a concern for us. */ status_t ZipFile::addCommon(const char* fileName, const void* data, size_t size, const char* storageName, int sourceType, int compressionMethod, ZipEntry** ppEntry) const char* storageName, int compressionMethod, ZipEntry** ppEntry) { ZipEntry* pEntry = NULL; status_t result = NO_ERROR; Loading Loading @@ -414,7 +413,6 @@ status_t ZipFile::addCommon(const char* fileName, const void* data, size_t size, /* * Copy the data in, possibly compressing it as we go. */ if (sourceType == ZipEntry::kCompressStored) { if (compressionMethod == ZipEntry::kCompressDeflated) { bool failed = false; result = compressFpToFp(mZipFp, inputFp, data, size, &crc); Loading Loading @@ -459,35 +457,6 @@ status_t ZipFile::addCommon(const char* fileName, const void* data, size_t size, // currently seeked to end of file uncompressedLen = inputFp ? ftell(inputFp) : size; } else if (sourceType == ZipEntry::kCompressDeflated) { /* we should support uncompressed-from-compressed, but it's not * important right now */ assert(compressionMethod == ZipEntry::kCompressDeflated); bool scanResult; int method; long compressedLen; unsigned long longcrc; scanResult = ZipUtils::examineGzip(inputFp, &method, &uncompressedLen, &compressedLen, &longcrc); if (!scanResult || method != ZipEntry::kCompressDeflated) { ALOGD("this isn't a deflated gzip file?"); result = UNKNOWN_ERROR; goto bail; } crc = longcrc; result = copyPartialFpToFp(mZipFp, inputFp, compressedLen, NULL); if (result != NO_ERROR) { ALOGD("failed copying gzip data in\n"); goto bail; } } else { assert(false); result = UNKNOWN_ERROR; goto bail; } /* * We could write the "Data Descriptor", but there doesn't seem to Loading tools/zipalign/ZipFile.h +1 −17 Original line number Diff line number Diff line Loading @@ -86,23 +86,9 @@ public: int compressionMethod, ZipEntry** ppEntry) { return addCommon(fileName, NULL, 0, storageName, ZipEntry::kCompressStored, compressionMethod, ppEntry); } /* * Add a file that is already compressed with gzip. * * If "ppEntry" is non-NULL, a pointer to the new entry will be returned. */ status_t addGzip(const char* fileName, const char* storageName, ZipEntry** ppEntry) { return addCommon(fileName, NULL, 0, storageName, ZipEntry::kCompressDeflated, ZipEntry::kCompressDeflated, ppEntry); } /* * Add a file from an in-memory data buffer. * Loading @@ -112,7 +98,6 @@ public: int compressionMethod, ZipEntry** ppEntry) { return addCommon(NULL, data, size, storageName, ZipEntry::kCompressStored, compressionMethod, ppEntry); } Loading Loading @@ -231,8 +216,7 @@ private: /* common handler for all "add" functions */ status_t addCommon(const char* fileName, const void* data, size_t size, const char* storageName, int sourceType, int compressionMethod, ZipEntry** ppEntry); const char* storageName, int compressionMethod, ZipEntry** ppEntry); /* copy all of "srcFp" into "dstFp" */ status_t copyFpToFp(FILE* dstFp, FILE* srcFp, uint32_t* pCRC32); Loading Loading
tools/zipalign/ZipFile.cpp +36 −67 Original line number Diff line number Diff line Loading @@ -359,8 +359,7 @@ bail: * safely written. Not really a concern for us. */ status_t ZipFile::addCommon(const char* fileName, const void* data, size_t size, const char* storageName, int sourceType, int compressionMethod, ZipEntry** ppEntry) const char* storageName, int compressionMethod, ZipEntry** ppEntry) { ZipEntry* pEntry = NULL; status_t result = NO_ERROR; Loading Loading @@ -414,7 +413,6 @@ status_t ZipFile::addCommon(const char* fileName, const void* data, size_t size, /* * Copy the data in, possibly compressing it as we go. */ if (sourceType == ZipEntry::kCompressStored) { if (compressionMethod == ZipEntry::kCompressDeflated) { bool failed = false; result = compressFpToFp(mZipFp, inputFp, data, size, &crc); Loading Loading @@ -459,35 +457,6 @@ status_t ZipFile::addCommon(const char* fileName, const void* data, size_t size, // currently seeked to end of file uncompressedLen = inputFp ? ftell(inputFp) : size; } else if (sourceType == ZipEntry::kCompressDeflated) { /* we should support uncompressed-from-compressed, but it's not * important right now */ assert(compressionMethod == ZipEntry::kCompressDeflated); bool scanResult; int method; long compressedLen; unsigned long longcrc; scanResult = ZipUtils::examineGzip(inputFp, &method, &uncompressedLen, &compressedLen, &longcrc); if (!scanResult || method != ZipEntry::kCompressDeflated) { ALOGD("this isn't a deflated gzip file?"); result = UNKNOWN_ERROR; goto bail; } crc = longcrc; result = copyPartialFpToFp(mZipFp, inputFp, compressedLen, NULL); if (result != NO_ERROR) { ALOGD("failed copying gzip data in\n"); goto bail; } } else { assert(false); result = UNKNOWN_ERROR; goto bail; } /* * We could write the "Data Descriptor", but there doesn't seem to Loading
tools/zipalign/ZipFile.h +1 −17 Original line number Diff line number Diff line Loading @@ -86,23 +86,9 @@ public: int compressionMethod, ZipEntry** ppEntry) { return addCommon(fileName, NULL, 0, storageName, ZipEntry::kCompressStored, compressionMethod, ppEntry); } /* * Add a file that is already compressed with gzip. * * If "ppEntry" is non-NULL, a pointer to the new entry will be returned. */ status_t addGzip(const char* fileName, const char* storageName, ZipEntry** ppEntry) { return addCommon(fileName, NULL, 0, storageName, ZipEntry::kCompressDeflated, ZipEntry::kCompressDeflated, ppEntry); } /* * Add a file from an in-memory data buffer. * Loading @@ -112,7 +98,6 @@ public: int compressionMethod, ZipEntry** ppEntry) { return addCommon(NULL, data, size, storageName, ZipEntry::kCompressStored, compressionMethod, ppEntry); } Loading Loading @@ -231,8 +216,7 @@ private: /* common handler for all "add" functions */ status_t addCommon(const char* fileName, const void* data, size_t size, const char* storageName, int sourceType, int compressionMethod, ZipEntry** ppEntry); const char* storageName, int compressionMethod, ZipEntry** ppEntry); /* copy all of "srcFp" into "dstFp" */ status_t copyFpToFp(FILE* dstFp, FILE* srcFp, uint32_t* pCRC32); Loading