From 2a5cf576aecc7051ac374363fef2ba23cbbc4f7b Mon Sep 17 00:00:00 2001 From: LeadRDRK Date: Sat, 17 Apr 2021 21:04:01 +0700 Subject: [PATCH] fixed win32 compilation --- .gitignore | 1 + lib/error.cpp | 1 - lib/reader.cpp | 4 ++-- lib/zpack.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 5839ea8..408d893 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build/ +win32-build/ compile_commands.json .clangd/ .cache/ diff --git a/lib/error.cpp b/lib/error.cpp index 418326c..4a3d1d6 100644 --- a/lib/error.cpp +++ b/lib/error.cpp @@ -6,7 +6,6 @@ */ #include "zpack.h" -using namespace ZPack; const char* ZPack::getErrorMessage(int error) { diff --git a/lib/reader.cpp b/lib/reader.cpp index 0cbe7fc..71d125a 100644 --- a/lib/reader.cpp +++ b/lib/reader.cpp @@ -258,7 +258,7 @@ int Reader::unpackFileStream(const FileInfo *info, std::ostream &dst) char* charInBuf = (char*)inBuffer->src; char* charOutBuf = (char*)outBuffer->dst; - size_t toRead = std::min(info->compSize, ZSTD_DStreamInSize()); + size_t toRead = std::min(info->compSize, (uint64_t)ZSTD_DStreamInSize()); size_t lastRet = 0; size_t totalRead = 0; CRC32 crc; @@ -271,7 +271,7 @@ int Reader::unpackFileStream(const FileInfo *info, std::ostream &dst) outBuffer->pos = 0; // reduce reading size if needed - toRead = std::min(toRead, info->compSize - totalRead); + toRead = std::min(toRead, (size_t)(info->compSize - totalRead)); // read part of the file file.read(charInBuf, toRead); diff --git a/lib/zpack.h b/lib/zpack.h index 5609462..8088ad5 100644 --- a/lib/zpack.h +++ b/lib/zpack.h @@ -58,7 +58,7 @@ namespace ZPack * @param error The error code. * @return The error message corresponding to the error code. */ - const char* getErrorMessage(int error); + ZPACK_API const char* getErrorMessage(int error); // structs