From b09b32a3debc13e0e5775c71b7a5c9243acf0d2e Mon Sep 17 00:00:00 2001 From: Alex Fabijanic Date: Wed, 1 Nov 2017 20:00:46 -0500 Subject: [PATCH] fix relative path check, eliminate unused warnings --- Zip/src/ZipCommon.cpp | 2 +- Zip/src/ZipStream.cpp | 1 - Zip/testsuite/src/ZipTest.cpp | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Zip/src/ZipCommon.cpp b/Zip/src/ZipCommon.cpp index eb43c6372..75b692577 100644 --- a/Zip/src/ZipCommon.cpp +++ b/Zip/src/ZipCommon.cpp @@ -23,7 +23,7 @@ namespace Zip { bool ZipCommon::isValidPath(const std::string& path) { - if (!Path(path).isRelative()) + if (!Path(path).isRelative() || !Path(path, Path::PATH_WINDOWS).isRelative()) return false; if (path == "..") return false; diff --git a/Zip/src/ZipStream.cpp b/Zip/src/ZipStream.cpp index 33678c980..cc2c192e6 100644 --- a/Zip/src/ZipStream.cpp +++ b/Zip/src/ZipStream.cpp @@ -174,7 +174,6 @@ int ZipStreamBuf::readFromDevice(char* buffer, std::streamsize length) // now push back the header to the stream, so that the ZipLocalFileHeader can read it Poco::Int32 size = static_cast(nfo.getFullHeaderSize()); _expectedCrc32 = nfo.getCRC32(); - const char* rawHeader = nfo.getRawHeader(); _pIstr->seekg(-size, std::ios::cur); if (!_pIstr->good()) throw Poco::IOException("Failed to seek on input stream"); if (!crcValid()) diff --git a/Zip/testsuite/src/ZipTest.cpp b/Zip/testsuite/src/ZipTest.cpp index b8cda8a03..d1aa4ace6 100644 --- a/Zip/testsuite/src/ZipTest.cpp +++ b/Zip/testsuite/src/ZipTest.cpp @@ -52,16 +52,16 @@ void ZipTest::testSkipSingleFile() ZipLocalFileHeader hdr(inp, false, skip); assert (ZipCommon::HS_FAT == hdr.getHostSystem()); int major = hdr.getMajorVersionNumber(); - int minor = hdr.getMinorVersionNumber(); + int POCO_UNUSED minor = hdr.getMinorVersionNumber(); assert (major <= 2); std::size_t hdrSize = hdr.getHeaderSize(); assert (hdrSize > 30); - ZipCommon::CompressionMethod cm = hdr.getCompressionMethod(); + ZipCommon::CompressionMethod POCO_UNUSED cm = hdr.getCompressionMethod(); assert (!hdr.isEncrypted()); Poco::DateTime aDate = hdr.lastModifiedAt(); - Poco::UInt64 cS = hdr.getCompressedSize(); - Poco::UInt64 uS = hdr.getUncompressedSize(); - const std::string& fileName = hdr.getFileName(); + Poco::UInt64 POCO_UNUSED cS = hdr.getCompressedSize(); + Poco::UInt64 POCO_UNUSED uS = hdr.getUncompressedSize(); + const std::string& POCO_UNUSED fileName = hdr.getFileName(); }