Chromium Code Reviews| 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..c4133c791e79c28358462d58985c5fd041b09e83 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,22 @@ 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 positive |
| + // non-zero. |
|
hshi1
2014/03/19 17:33:27
nit: "positive non-zero" is redundant, just "posit
|
| + bool ExtractCurrentEntryToString( |
| + int max_read_bytes, |
|
hshi1
2014/03/19 17:33:27
question: this seems to assume that data size cann
João Eiras
2014/03/20 13:52:45
size_t would be better, yes, though I wonder would
|
| + 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 { |