Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: third_party/zlib/google/zip_reader.h

Issue 2961373002: Improve Zip File Scanning on Mac (Closed)
Patch Set: minor Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/zlib/google/zip_reader.h
diff --git a/third_party/zlib/google/zip_reader.h b/third_party/zlib/google/zip_reader.h
index c1b6fb3364abeba3c34231e9dd1fea500540029e..0464acdf3704e225096264d1bba7fcc04d284212 100644
--- a/third_party/zlib/google/zip_reader.h
+++ b/third_party/zlib/google/zip_reader.h
@@ -159,8 +159,11 @@ class ZipReader {
// success. On failure, current_entry_info() becomes NULL.
bool LocateAndOpenEntry(const base::FilePath& path_in_zip);
- // Extracts the current entry in chunks to |delegate|.
- bool ExtractCurrentEntry(WriterDelegate* delegate) const;
+ // Extracts |num_bytes_to_extract| bytes of the current entry to |delegate|,
+ // starting from the beginning of the entry. Return value specifies whether
+ // the entire file was extracted.
+ bool ExtractCurrentEntry(WriterDelegate* delegate,
+ uint64_t num_bytes_to_extract) const;
// Extracts the current entry to the given output file path. If the
// current file is a directory, just creates a directory
@@ -202,20 +205,20 @@ class ZipReader {
// Does not close the file. Returns true on success.
bool ExtractCurrentEntryToFile(base::File* file) const;
- // Extracts the current entry into memory. If the current entry is a directory
- // the |output| parameter is set to the empty string. If the current entry is
- // a file, the |output| parameter is filled with its contents. Returns true on
- // success. OpenCurrentEntryInZip() must be called beforehand.
- // Note: the |output| parameter can be filled with a big amount of data, avoid
- // passing it around by value, but by reference or pointer.
- // Note: the value returned by EntryInfo::original_size() cannot be
- // trusted, so the real size of the uncompressed contents can be different.
- // Use max_read_bytes to limit the ammount of memory used to carry the entry.
- // If the real size of the uncompressed data is bigger than max_read_bytes
- // then false is returned. |max_read_bytes| must be non-zero.
- bool ExtractCurrentEntryToString(
- size_t max_read_bytes,
- std::string* output) const;
+ // Extracts the current entry into memory. If the current entry is a
+ // directory, the |output| parameter is set to the empty string. If the
+ // current entry is a file, the |output| parameter is filled with its
+ // contents. OpenCurrentEntryInZip() must be called beforehand. Note: the
+ // |output| parameter can be filled with a big amount of data, avoid passing
+ // it around by value, but by reference or pointer. Note: the value returned
+ // by EntryInfo::original_size() cannot be trusted, so the real size of the
+ // uncompressed contents can be different. |max_read_bytes| limits the ammount
+ // of memory used to carry the entry. Returns true if the entire content is
+ // read. If the entry is bigger than |max_read_bytes|, returns false and
+ // |output| is filled with |max_read_bytes| of data. If an error occurs,
+ // returns false, and |output| is set to the empty string.
+ bool ExtractCurrentEntryToString(uint64_t max_read_bytes,
+ std::string* output) const;
// Returns the current entry info. Returns NULL if the current entry is
// not yet opened. OpenCurrentEntryInZip() must be called beforehand.
« no previous file with comments | « chrome/test/data/safe_browsing/mach_o/zipped-app-two-executables-one-signed.zip ('k') | third_party/zlib/google/zip_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698