diff options
author | Alex Zolotarev <deathbaba@gmail.com> | 2012-02-27 02:58:32 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:34:43 +0300 |
commit | d10d0e4ada0ab320761f4dc9b42191f889a242a1 (patch) | |
tree | eac72095e9a96dcbdfc7f6ece9ab777032b1268a /coding/zip_reader.cpp | |
parent | fb02b19b4c26d61dcaceb3b7e5daa68a4f24b8f6 (diff) |
[android] Used bind for ZipReader::UnzipFile callback impl
Diffstat (limited to 'coding/zip_reader.cpp')
-rw-r--r-- | coding/zip_reader.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/coding/zip_reader.cpp b/coding/zip_reader.cpp index fa22648bee..84d69f24ca 100644 --- a/coding/zip_reader.cpp +++ b/coding/zip_reader.cpp @@ -92,14 +92,15 @@ void ZipFileReader::UnzipFile(string const & zipContainer, string const & fileIn MY_SCOPE_GUARD(currentFileGuard, bind(&unzCloseCurrentFile, zip)); + static size_t const BUF_SIZE = 1024 * 50; + char * buf = new char[BUF_SIZE]; try { FileWriter outFile(outFilePath); int pos = 0; int readBytes; - static size_t const BUF_SIZE = 4096; - char buf[BUF_SIZE]; + while (true) { readBytes = unzReadCurrentFile(zip, buf, BUF_SIZE); @@ -118,9 +119,12 @@ void ZipFileReader::UnzipFile(string const & zipContainer, string const & fileIn } catch (Exception const & e) { + delete[] buf; // Delete unfinished output file FileWriter::DeleteFileX(outFilePath); // Rethrow exception - we've failed throw; } + + delete[] buf; } |