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:
@ -20,6 +20,9 @@ extern "C" {
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.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)
|
int UTIL_fileExist(const char* filename)
|
||||||
{
|
{
|
||||||
@ -93,7 +96,7 @@ int UTIL_createDir(const char* outDirName)
|
|||||||
if (UTIL_isDirectory(outDirName))
|
if (UTIL_isDirectory(outDirName))
|
||||||
return 0; /* no need to create if directory already exists */
|
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);
|
r = _mkdir(outDirName);
|
||||||
if (r || !UTIL_isDirectory(outDirName)) return 1;
|
if (r || !UTIL_isDirectory(outDirName)) return 1;
|
||||||
#else
|
#else
|
||||||
@ -112,7 +115,7 @@ void UTIL_createDestinationDirTable(const char** filenameTable, unsigned nbFiles
|
|||||||
|
|
||||||
/* duplicate source file table */
|
/* duplicate source file table */
|
||||||
for (u = 0; u < nbFiles; ++u) {
|
for (u = 0; u < nbFiles; ++u) {
|
||||||
char* filename;
|
const char* filename;
|
||||||
size_t finalPathLen;
|
size_t finalPathLen;
|
||||||
finalPathLen = strlen(outDirName);
|
finalPathLen = strlen(outDirName);
|
||||||
filename = strrchr(filenameTable[u], c); /* filename is the last bit of string after '/' */
|
filename = strrchr(filenameTable[u], c); /* filename is the last bit of string after '/' */
|
||||||
|
@ -1181,6 +1181,8 @@ int main(int argCount, const char* argv[])
|
|||||||
printf("ok\n");
|
printf("ok\n");
|
||||||
dstFilenameTable = (char**)malloc(filenameIdx * sizeof(char*));
|
dstFilenameTable = (char**)malloc(filenameIdx * sizeof(char*));
|
||||||
UTIL_processMultipleFilenameDestinationDir(dstFilenameTable, filenameTable, filenameIdx, outFileName, outDirName);
|
UTIL_processMultipleFilenameDestinationDir(dstFilenameTable, filenameTable, filenameIdx, outFileName, outDirName);
|
||||||
|
} else {
|
||||||
|
dstFilenameTable = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((filenameIdx==1) && outFileName)
|
if ((filenameIdx==1) && outFileName)
|
||||||
@ -1205,7 +1207,10 @@ int main(int argCount, const char* argv[])
|
|||||||
if (outDirName) {
|
if (outDirName) {
|
||||||
dstFilenameTable = (char**)malloc(filenameIdx * sizeof(char*));
|
dstFilenameTable = (char**)malloc(filenameIdx * sizeof(char*));
|
||||||
UTIL_processMultipleFilenameDestinationDir(dstFilenameTable, filenameTable, filenameIdx, outFileName, outDirName);
|
UTIL_processMultipleFilenameDestinationDir(dstFilenameTable, filenameTable, filenameIdx, outFileName, outDirName);
|
||||||
|
} else {
|
||||||
|
dstFilenameTable = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filenameIdx==1 && outFileName)
|
if (filenameIdx==1 && outFileName)
|
||||||
operationResult = FIO_decompressFilename(prefs, outFileName, filenameTable[0], dictFileName);
|
operationResult = FIO_decompressFilename(prefs, outFileName, filenameTable[0], dictFileName);
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user