mirror of
https://github.com/facebook/zstd.git
synced 2025-08-01 09:47:01 +03:00
Fix Build for Windows
This commit is contained in:
@ -74,8 +74,12 @@
|
||||
|
||||
#define FNSPACE 30
|
||||
|
||||
#if !defined(_WIN32)
|
||||
/* Default file permissions 0666 (modulated by umask) */
|
||||
#define DEFAULT_FILE_PERMISSIONS (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
|
||||
#else
|
||||
#define DEFAULT_FILE_PERMISSIONS (0)
|
||||
#endif
|
||||
|
||||
/*-*************************************
|
||||
* Macros
|
||||
@ -692,7 +696,15 @@ FIO_openDstFile(FIO_ctx_t* fCtx, FIO_prefs_t* const prefs,
|
||||
FIO_removeFile(dstFileName);
|
||||
}
|
||||
|
||||
{ const int fd = open(dstFileName, O_WRONLY|O_CREAT|O_TRUNC, mode);
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
/* Windows requires opening the file as a "binary" file to avoid
|
||||
* mangling. This macro doesn't exist on unix. */
|
||||
const int openflags = O_WRONLY|O_CREAT|O_TRUNC|O_BINARY;
|
||||
#else
|
||||
const int openflags = O_WRONLY|O_CREAT|O_TRUNC;
|
||||
#endif
|
||||
const int fd = open(dstFileName, openflags, mode);
|
||||
FILE* f = NULL;
|
||||
if (fd != -1) {
|
||||
f = fdopen(fd, "wb");
|
||||
|
@ -22,6 +22,7 @@ extern "C" {
|
||||
****************************************/
|
||||
#if defined(_MSC_VER)
|
||||
# define _CRT_SECURE_NO_WARNINGS /* Disable Visual Studio warning messages for fopen, strncpy, strerror */
|
||||
# define _CRT_NONSTDC_NO_WARNINGS /* Disable C4996 complaining about posix function names */
|
||||
# if (_MSC_VER <= 1800) /* 1800 == Visual Studio 2013 */
|
||||
# define _CRT_SECURE_NO_DEPRECATE /* VS2005 - must be declared before <io.h> and <windows.h> */
|
||||
# define snprintf sprintf_s /* snprintf unsupported by Visual <= 2013 */
|
||||
|
Reference in New Issue
Block a user