Loading include/ziparchive/zip_archive.h +13 −18 Original line number Diff line number Diff line Loading @@ -44,8 +44,7 @@ struct ZipString { explicit ZipString(const char* entry_name); bool operator==(const ZipString& rhs) const { return name && (name_length == rhs.name_length) && (memcmp(name, rhs.name, name_length) == 0); return name && (name_length == rhs.name_length) && (memcmp(name, rhs.name, name_length) == 0); } bool StartsWith(const ZipString& prefix) const { Loading @@ -55,8 +54,7 @@ struct ZipString { bool EndsWith(const ZipString& suffix) const { return name && (name_length >= suffix.name_length) && (memcmp(name + name_length - suffix.name_length, suffix.name, suffix.name_length) == 0); (memcmp(name + name_length - suffix.name_length, suffix.name, suffix.name_length) == 0); } }; Loading Loading @@ -134,8 +132,8 @@ int32_t OpenArchive(const char* fileName, ZipArchiveHandle* handle); * * Returns 0 on success, and negative values on failure. */ int32_t OpenArchiveFd(const int fd, const char* debugFileName, ZipArchiveHandle *handle, bool assume_ownership = true); int32_t OpenArchiveFd(const int fd, const char* debugFileName, ZipArchiveHandle* handle, bool assume_ownership = true); int32_t OpenArchiveFromMemory(void* address, size_t length, const char* debugFileName, ZipArchiveHandle* handle); Loading Loading @@ -164,8 +162,7 @@ void CloseArchive(ZipArchiveHandle handle); * On non-Windows platforms this method does not modify internal state and * can be called concurrently. */ int32_t FindEntry(const ZipArchiveHandle handle, const ZipString& entryName, ZipEntry* data); int32_t FindEntry(const ZipArchiveHandle handle, const ZipString& entryName, ZipEntry* data); /* * Start iterating over all entries of a zip file. The order of iteration Loading @@ -180,8 +177,7 @@ int32_t FindEntry(const ZipArchiveHandle handle, const ZipString& entryName, * * Returns 0 on success and negative values on failure. */ int32_t StartIteration(ZipArchiveHandle handle, void** cookie_ptr, const ZipString* optional_prefix, int32_t StartIteration(ZipArchiveHandle handle, void** cookie_ptr, const ZipString* optional_prefix, const ZipString* optional_suffix); /* Loading Loading @@ -217,8 +213,7 @@ int32_t ExtractEntryToFile(ZipArchiveHandle handle, ZipEntry* entry, int fd); * * Returns 0 on success and negative values on failure. */ int32_t ExtractToMemory(ZipArchiveHandle handle, ZipEntry* entry, uint8_t* begin, uint32_t size); int32_t ExtractToMemory(ZipArchiveHandle handle, ZipEntry* entry, uint8_t* begin, uint32_t size); int GetFileDescriptor(const ZipArchiveHandle handle); Loading include/ziparchive/zip_writer.h +5 −6 Original line number Diff line number Diff line Loading @@ -17,9 +17,9 @@ #ifndef LIBZIPARCHIVE_ZIPWRITER_H_ #define LIBZIPARCHIVE_ZIPWRITER_H_ #include <zlib.h> #include <cstdio> #include <ctime> #include <zlib.h> #include <memory> #include <string> Loading Loading @@ -120,8 +120,7 @@ public: /** * Same as StartAlignedEntry(const char*, size_t), but sets a last modified time for the entry. */ int32_t StartAlignedEntryWithTime(const char* path, size_t flags, time_t time, uint32_t alignment); int32_t StartAlignedEntryWithTime(const char* path, size_t flags, time_t time, uint32_t alignment); /** * Writes bytes to the zip file for the previously started zip entry. Loading libziparchive/entry_name_utils-inl.h +0 −1 Original line number Diff line number Diff line Loading @@ -55,5 +55,4 @@ inline bool IsValidEntryName(const uint8_t* entry_name, const size_t length) { return true; } #endif // LIBZIPARCHIVE_ENTRY_NAME_UTILS_INL_H_ libziparchive/entry_name_utils_test.cc +9 −10 Original line number Diff line number Diff line Loading @@ -24,8 +24,7 @@ TEST(entry_name_utils, NullChars) { ASSERT_FALSE(IsValidEntryName(zeroes, sizeof(zeroes))); const uint8_t zeroes_continuation_chars[] = {0xc2, 0xa1, 0xc2, 0x00}; ASSERT_FALSE(IsValidEntryName(zeroes_continuation_chars, sizeof(zeroes_continuation_chars))); ASSERT_FALSE(IsValidEntryName(zeroes_continuation_chars, sizeof(zeroes_continuation_chars))); } TEST(entry_name_utils, InvalidSequence) { Loading libziparchive/zip_archive.cc +88 −116 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
include/ziparchive/zip_archive.h +13 −18 Original line number Diff line number Diff line Loading @@ -44,8 +44,7 @@ struct ZipString { explicit ZipString(const char* entry_name); bool operator==(const ZipString& rhs) const { return name && (name_length == rhs.name_length) && (memcmp(name, rhs.name, name_length) == 0); return name && (name_length == rhs.name_length) && (memcmp(name, rhs.name, name_length) == 0); } bool StartsWith(const ZipString& prefix) const { Loading @@ -55,8 +54,7 @@ struct ZipString { bool EndsWith(const ZipString& suffix) const { return name && (name_length >= suffix.name_length) && (memcmp(name + name_length - suffix.name_length, suffix.name, suffix.name_length) == 0); (memcmp(name + name_length - suffix.name_length, suffix.name, suffix.name_length) == 0); } }; Loading Loading @@ -134,8 +132,8 @@ int32_t OpenArchive(const char* fileName, ZipArchiveHandle* handle); * * Returns 0 on success, and negative values on failure. */ int32_t OpenArchiveFd(const int fd, const char* debugFileName, ZipArchiveHandle *handle, bool assume_ownership = true); int32_t OpenArchiveFd(const int fd, const char* debugFileName, ZipArchiveHandle* handle, bool assume_ownership = true); int32_t OpenArchiveFromMemory(void* address, size_t length, const char* debugFileName, ZipArchiveHandle* handle); Loading Loading @@ -164,8 +162,7 @@ void CloseArchive(ZipArchiveHandle handle); * On non-Windows platforms this method does not modify internal state and * can be called concurrently. */ int32_t FindEntry(const ZipArchiveHandle handle, const ZipString& entryName, ZipEntry* data); int32_t FindEntry(const ZipArchiveHandle handle, const ZipString& entryName, ZipEntry* data); /* * Start iterating over all entries of a zip file. The order of iteration Loading @@ -180,8 +177,7 @@ int32_t FindEntry(const ZipArchiveHandle handle, const ZipString& entryName, * * Returns 0 on success and negative values on failure. */ int32_t StartIteration(ZipArchiveHandle handle, void** cookie_ptr, const ZipString* optional_prefix, int32_t StartIteration(ZipArchiveHandle handle, void** cookie_ptr, const ZipString* optional_prefix, const ZipString* optional_suffix); /* Loading Loading @@ -217,8 +213,7 @@ int32_t ExtractEntryToFile(ZipArchiveHandle handle, ZipEntry* entry, int fd); * * Returns 0 on success and negative values on failure. */ int32_t ExtractToMemory(ZipArchiveHandle handle, ZipEntry* entry, uint8_t* begin, uint32_t size); int32_t ExtractToMemory(ZipArchiveHandle handle, ZipEntry* entry, uint8_t* begin, uint32_t size); int GetFileDescriptor(const ZipArchiveHandle handle); Loading
include/ziparchive/zip_writer.h +5 −6 Original line number Diff line number Diff line Loading @@ -17,9 +17,9 @@ #ifndef LIBZIPARCHIVE_ZIPWRITER_H_ #define LIBZIPARCHIVE_ZIPWRITER_H_ #include <zlib.h> #include <cstdio> #include <ctime> #include <zlib.h> #include <memory> #include <string> Loading Loading @@ -120,8 +120,7 @@ public: /** * Same as StartAlignedEntry(const char*, size_t), but sets a last modified time for the entry. */ int32_t StartAlignedEntryWithTime(const char* path, size_t flags, time_t time, uint32_t alignment); int32_t StartAlignedEntryWithTime(const char* path, size_t flags, time_t time, uint32_t alignment); /** * Writes bytes to the zip file for the previously started zip entry. Loading
libziparchive/entry_name_utils-inl.h +0 −1 Original line number Diff line number Diff line Loading @@ -55,5 +55,4 @@ inline bool IsValidEntryName(const uint8_t* entry_name, const size_t length) { return true; } #endif // LIBZIPARCHIVE_ENTRY_NAME_UTILS_INL_H_
libziparchive/entry_name_utils_test.cc +9 −10 Original line number Diff line number Diff line Loading @@ -24,8 +24,7 @@ TEST(entry_name_utils, NullChars) { ASSERT_FALSE(IsValidEntryName(zeroes, sizeof(zeroes))); const uint8_t zeroes_continuation_chars[] = {0xc2, 0xa1, 0xc2, 0x00}; ASSERT_FALSE(IsValidEntryName(zeroes_continuation_chars, sizeof(zeroes_continuation_chars))); ASSERT_FALSE(IsValidEntryName(zeroes_continuation_chars, sizeof(zeroes_continuation_chars))); } TEST(entry_name_utils, InvalidSequence) { Loading
libziparchive/zip_archive.cc +88 −116 File changed.Preview size limit exceeded, changes collapsed. Show changes