diff options
author | Jiyong Park <jiyong@google.com> | 2017-06-30 17:23:33 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2017-07-02 11:46:53 +0900 |
commit | cd997e609405cfd6b1f82a1f849f98352b12ae72 (patch) | |
tree | db2d044e52fe9f8d4b3dc1d541f3a15d3b5cfd5b /include | |
parent | 22de50d35133c29c06bd8921937489e49d86900f (diff) | |
download | system_core-cd997e609405cfd6b1f82a1f849f98352b12ae72.tar.gz system_core-cd997e609405cfd6b1f82a1f849f98352b12ae72.tar.bz2 system_core-cd997e609405cfd6b1f82a1f849f98352b12ae72.zip |
Ran clang-format on libziparchive sources and headers
Test: build aosp_arm
Change-Id: I469b82b68f2c457f480fb9cd9da2026672985ce3
Diffstat (limited to 'include')
-rw-r--r-- | include/ziparchive/zip_archive.h | 31 | ||||
-rw-r--r-- | include/ziparchive/zip_writer.h | 11 |
2 files changed, 18 insertions, 24 deletions
diff --git a/include/ziparchive/zip_archive.h b/include/ziparchive/zip_archive.h index ece86931a..73ae68d3f 100644 --- a/include/ziparchive/zip_archive.h +++ b/include/ziparchive/zip_archive.h @@ -28,8 +28,8 @@ /* Zip compression methods we support */ enum { - kCompressStored = 0, // no compression - kCompressDeflated = 8, // standard deflate + kCompressStored = 0, // no compression + kCompressDeflated = 8, // standard deflate }; struct ZipString { @@ -44,19 +44,17 @@ 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 { return name && (name_length >= prefix.name_length) && - (memcmp(name, prefix.name, prefix.name_length) == 0); + (memcmp(name, prefix.name, prefix.name_length) == 0); } 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); } }; @@ -134,11 +132,11 @@ 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); + ZipArchiveHandle* handle); /* * Close archive, releasing resources associated with it. This will * unmap the central directory of the zipfile and free all internal @@ -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 @@ -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); /* @@ -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); @@ -230,9 +225,9 @@ typedef bool (*ProcessZipEntryFunction)(const uint8_t* buf, size_t buf_size, voi /* * Stream the uncompressed data through the supplied function, * passing cookie to it each time it gets called. -*/ + */ int32_t ProcessZipEntryContents(ZipArchiveHandle handle, ZipEntry* entry, - ProcessZipEntryFunction func, void* cookie); + ProcessZipEntryFunction func, void* cookie); #endif #endif // LIBZIPARCHIVE_ZIPARCHIVE_H_ diff --git a/include/ziparchive/zip_writer.h b/include/ziparchive/zip_writer.h index 08ead4845..94595143d 100644 --- a/include/ziparchive/zip_writer.h +++ b/include/ziparchive/zip_writer.h @@ -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> @@ -50,7 +50,7 @@ * fclose(file); */ class ZipWriter { -public: + public: enum { /** * Flag to compress the zip entry using deflate. @@ -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. @@ -156,7 +155,7 @@ public: */ int32_t Finish(); -private: + private: DISALLOW_COPY_AND_ASSIGN(ZipWriter); int32_t HandleError(int32_t error_code); @@ -179,7 +178,7 @@ private: std::vector<FileEntry> files_; FileEntry current_file_entry_; - std::unique_ptr<z_stream, void(*)(z_stream*)> z_stream_; + std::unique_ptr<z_stream, void (*)(z_stream*)> z_stream_; std::vector<uint8_t> buffer_; }; |