From 133829bd039ed7c6daedf959b2c968e99fdaab17 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 12 Oct 2016 14:13:04 +0300 Subject: [PATCH] Fixed working with passwords - when crc is calculated seekg won't work because eof bit is on - need to clear first. Another fix is zipfileinfo should be initialized because its contents are checked inside zipOpenNewFileInZip64 --- zipper/tools.cpp | 1 + zipper/zipper.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/zipper/tools.cpp b/zipper/tools.cpp index db5d2c2..fc9ab11 100644 --- a/zipper/tools.cpp +++ b/zipper/tools.cpp @@ -44,6 +44,7 @@ void getFileCrc(std::istream& input_stream, std::vector& buff, unsigned lo } while (size_read>0); + input_stream.clear(); input_stream.seekg(0); result_crc = calculate_crc; } diff --git a/zipper/zipper.cpp b/zipper/zipper.cpp index b31d101..ee920cc 100644 --- a/zipper/zipper.cpp +++ b/zipper/zipper.cpp @@ -95,7 +95,7 @@ namespace zipper { int err = ZIP_OK; unsigned long crcFile = 0; - zip_fileinfo zi; + zip_fileinfo zi = { 0 }; size_t size_read; std::vector buff;