Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd997e60 authored by Jiyong Park's avatar Jiyong Park
Browse files

Ran clang-format on libziparchive sources and headers

Test: build aosp_arm
Change-Id: I469b82b68f2c457f480fb9cd9da2026672985ce3
parent 22de50d3
Loading
Loading
Loading
Loading
+13 −18
Original line number Diff line number Diff line
@@ -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 {
@@ -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);
  }
};

@@ -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);
@@ -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);

+5 −6
Original line number Diff line number Diff line
@@ -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>
@@ -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.
+0 −1
Original line number Diff line number Diff line
@@ -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_
+9 −10
Original line number Diff line number Diff line
@@ -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) {
+88 −116

File changed.

Preview size limit exceeded, changes collapsed.

Loading