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 5f0a16785de3bb51b304eb8723521c1acb839d63..de330be1a122463e6354dfef2633903213c564b6 100644 |
--- a/third_party/zlib/google/zip_reader.h |
+++ b/third_party/zlib/google/zip_reader.h |
@@ -35,7 +35,7 @@ namespace zip { |
// reader.AdvanceToNextEntry(); |
// } |
// |
-// For simplicty, error checking is omitted in the example code above. The |
+// For simplicity, error checking is omitted in the example code above. The |
// production code should check return values from all of these functions. |
// |
// This calls can also be used for random access of contents in a zip file |
@@ -180,6 +180,21 @@ class ZipReader { |
bool ExtractCurrentEntryToFd(int fd); |
#endif |
+ // 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 that EntryInfo::original_size() can return a different value than the |
+ // real size of the uncompressed contents. Therefore, to prevent excessive |
+ // memory usage, the maximum amount of data to read has to be specified in |
+ // |max_read_bytes|. 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; |
+ |
// 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 { |