[pzstd] Changes to compile on VS2015
parent
4c202815c7
commit
378d12bb0c
|
@ -41,7 +41,7 @@ size_t pzstdMain(const Options& options, ErrorHolder& errorHolder) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
inputSize = file_size(options.inputFile, ec);
|
inputSize = static_cast<size_t>(file_size(options.inputFile, ec));
|
||||||
if (ec) {
|
if (ec) {
|
||||||
inputSize = 0;
|
inputSize = 0;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ static void compress(
|
||||||
ZSTD_parameters parameters) {
|
ZSTD_parameters parameters) {
|
||||||
auto guard = makeScopeGuard([&] { out->finish(); });
|
auto guard = makeScopeGuard([&] { out->finish(); });
|
||||||
// Initialize the CCtx
|
// Initialize the CCtx
|
||||||
std::unique_ptr<ZSTD_CStream, size_t (&)(ZSTD_CStream*)> ctx(
|
std::unique_ptr<ZSTD_CStream, size_t (*)(ZSTD_CStream*)> ctx(
|
||||||
ZSTD_createCStream(), ZSTD_freeCStream);
|
ZSTD_createCStream(), ZSTD_freeCStream);
|
||||||
if (!errorHolder.check(ctx != nullptr, "Failed to allocate ZSTD_CStream")) {
|
if (!errorHolder.check(ctx != nullptr, "Failed to allocate ZSTD_CStream")) {
|
||||||
return;
|
return;
|
||||||
|
@ -311,7 +311,7 @@ static void decompress(
|
||||||
std::shared_ptr<BufferWorkQueue> out) {
|
std::shared_ptr<BufferWorkQueue> out) {
|
||||||
auto guard = makeScopeGuard([&] { out->finish(); });
|
auto guard = makeScopeGuard([&] { out->finish(); });
|
||||||
// Initialize the DCtx
|
// Initialize the DCtx
|
||||||
std::unique_ptr<ZSTD_DStream, size_t (&)(ZSTD_DStream*)> ctx(
|
std::unique_ptr<ZSTD_DStream, size_t (*)(ZSTD_DStream*)> ctx(
|
||||||
ZSTD_createDStream(), ZSTD_freeDStream);
|
ZSTD_createDStream(), ZSTD_freeDStream);
|
||||||
if (!errorHolder.check(ctx != nullptr, "Failed to allocate ZSTD_DStream")) {
|
if (!errorHolder.check(ctx != nullptr, "Failed to allocate ZSTD_DStream")) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
namespace pzstd {
|
namespace pzstd {
|
||||||
|
|
||||||
using file_status = struct stat;
|
using file_status = struct ::stat;
|
||||||
|
|
||||||
/// http://en.cppreference.com/w/cpp/filesystem/status
|
/// http://en.cppreference.com/w/cpp/filesystem/status
|
||||||
inline file_status status(StringPiece path, std::error_code& ec) noexcept {
|
inline file_status status(StringPiece path, std::error_code& ec) noexcept {
|
||||||
|
@ -35,7 +35,13 @@ inline file_status status(StringPiece path, std::error_code& ec) noexcept {
|
||||||
|
|
||||||
/// http://en.cppreference.com/w/cpp/filesystem/is_regular_file
|
/// http://en.cppreference.com/w/cpp/filesystem/is_regular_file
|
||||||
inline bool is_regular_file(file_status status) noexcept {
|
inline bool is_regular_file(file_status status) noexcept {
|
||||||
|
#if defined(S_ISREG)
|
||||||
return S_ISREG(status.st_mode);
|
return S_ISREG(status.st_mode);
|
||||||
|
#elif !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
|
||||||
|
return (status.st_mode & S_IFMT) == S_IFREG;
|
||||||
|
#else
|
||||||
|
static_assert(false, "No POSIX stat() support.");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// http://en.cppreference.com/w/cpp/filesystem/is_regular_file
|
/// http://en.cppreference.com/w/cpp/filesystem/is_regular_file
|
||||||
|
|
Loading…
Reference in New Issue