1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-30 22:23:13 +03:00

fixes for windows compilation

This commit is contained in:
Sen Huang
2019-09-06 13:20:50 -07:00
parent 30bff50e06
commit 62616c4d90
2 changed files with 10 additions and 2 deletions

View File

@ -20,6 +20,9 @@ extern "C" {
#include <errno.h>
#include <assert.h>
#if defined(_MSC_VER) || defined(__MINGW32__) || defined (__MSVCRT__)
#include <direct.h> /* needed for _mkdir in windows */
#endif
int UTIL_fileExist(const char* filename)
{
@ -93,7 +96,7 @@ int UTIL_createDir(const char* outDirName)
if (UTIL_isDirectory(outDirName))
return 0; /* no need to create if directory already exists */
#if defined(_MSC_VER)
#if defined(_MSC_VER) || defined(__MINGW32__) || defined (__MSVCRT__)
r = _mkdir(outDirName);
if (r || !UTIL_isDirectory(outDirName)) return 1;
#else
@ -112,7 +115,7 @@ void UTIL_createDestinationDirTable(const char** filenameTable, unsigned nbFiles
/* duplicate source file table */
for (u = 0; u < nbFiles; ++u) {
char* filename;
const char* filename;
size_t finalPathLen;
finalPathLen = strlen(outDirName);
filename = strrchr(filenameTable[u], c); /* filename is the last bit of string after '/' */

View File

@ -1181,6 +1181,8 @@ int main(int argCount, const char* argv[])
printf("ok\n");
dstFilenameTable = (char**)malloc(filenameIdx * sizeof(char*));
UTIL_processMultipleFilenameDestinationDir(dstFilenameTable, filenameTable, filenameIdx, outFileName, outDirName);
} else {
dstFilenameTable = NULL;
}
if ((filenameIdx==1) && outFileName)
@ -1205,7 +1207,10 @@ int main(int argCount, const char* argv[])
if (outDirName) {
dstFilenameTable = (char**)malloc(filenameIdx * sizeof(char*));
UTIL_processMultipleFilenameDestinationDir(dstFilenameTable, filenameTable, filenameIdx, outFileName, outDirName);
} else {
dstFilenameTable = NULL;
}
if (filenameIdx==1 && outFileName)
operationResult = FIO_decompressFilename(prefs, outFileName, filenameTable[0], dictFileName);
else