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

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

Issue 2961373002: Improve Zip File Scanning on Mac (Closed)
Patch Set: addressing comments Created 3 years, 5 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..0a5105e1f5daa586a6fcc689ca7e754a0394d8e0 100644
--- a/third_party/zlib/google/zip_reader.h
+++ b/third_party/zlib/google/zip_reader.h
@@ -162,6 +162,11 @@ class ZipReader {
// Extracts the current entry in chunks to |delegate|.
bool ExtractCurrentEntry(WriterDelegate* delegate) const;
+ // Extracts part of the current entry to |delegate|, starting from the
+ // beginning of the entry.
+ bool ExtractPartOfCurrentEntry(WriterDelegate* delegate,
satorux1 2017/07/18 07:46:38 Part -> Head/Prefix/Beinning to make it clear that
mortonm 2017/07/18 19:58:49 Done.
mortonm 2017/07/18 19:58:49 Done.
+ size_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
// instead. Returns true on success. OpenCurrentEntryInZip() must be
@@ -217,6 +222,13 @@ class ZipReader {
size_t max_read_bytes,
std::string* output) const;
+ // Same as ExtractCurrentEntryToString(), except specifies the number of bytes
+ // to read into the string so that it is possible to only read a partial
+ // amount of the entry into a string. This is used to infer the type of
+ // MachO files on Mac by sniffing their magic number in the header.
+ bool ExtractPartOfCurrentEntryToString(size_t num_bytes_to_extract,
+ std::string* output) const;
+
// Returns the current entry info. Returns NULL if the current entry is
// not yet opened. OpenCurrentEntryInZip() must be called beforehand.
EntryInfo* current_entry_info() const {

Powered by Google App Engine
This is Rietveld 408576698