| 1 | // |
|---|---|
| 2 | // SkipCallback.cpp |
| 3 | // |
| 4 | // Library: Zip |
| 5 | // Package: Zip |
| 6 | // Module: SkipCallback |
| 7 | // |
| 8 | // Copyright (c) 2007, Applied Informatics Software Engineering GmbH. |
| 9 | // and Contributors. |
| 10 | // |
| 11 | // SPDX-License-Identifier: BSL-1.0 |
| 12 | // |
| 13 | |
| 14 | |
| 15 | #include "Poco/Zip/SkipCallback.h" |
| 16 | #include "Poco/Zip/ZipLocalFileHeader.h" |
| 17 | #include "Poco/Zip/ZipUtil.h" |
| 18 | #include "Poco/Exception.h" |
| 19 | |
| 20 | |
| 21 | namespace Poco { |
| 22 | namespace Zip { |
| 23 | |
| 24 | |
| 25 | SkipCallback::SkipCallback() |
| 26 | { |
| 27 | } |
| 28 | |
| 29 | |
| 30 | SkipCallback::~SkipCallback() |
| 31 | { |
| 32 | } |
| 33 | |
| 34 | |
| 35 | bool SkipCallback::handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr) |
| 36 | { |
| 37 | if (!hdr.searchCRCAndSizesAfterData()) |
| 38 | zipStream.seekg(hdr.getCompressedSize(), std::ios_base::cur); |
| 39 | else |
| 40 | ZipUtil::syncDataDescriptor(zipStream, hdr.needsZip64()); |
| 41 | if (!zipStream.good()) throw Poco::IOException("Failed to seek on input stream"); |
| 42 | return true; |
| 43 | } |
| 44 | |
| 45 | |
| 46 | } } // namespace Poco::Zip |
| 47 |