From fd9dbb1279bd09886bbb8c47df05255003eeffae Mon Sep 17 00:00:00 2001 From: Igor Zinkovsky Date: Wed, 12 Oct 2011 21:46:06 -0700 Subject: [PATCH] fix mingw build --- src/win/fs.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/win/fs.c b/src/win/fs.c index 46833627c..f6a036adb 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -40,6 +40,7 @@ #define UV_FS_CLEANEDUP 0x0010 #define UV_FS_LAST_ERROR_SET 0x0020 + #define UTF8_TO_UTF16(s, t) \ size = uv_utf8_to_utf16(s, NULL, 0) * sizeof(wchar_t); \ t = (wchar_t*)malloc(size); \ @@ -400,10 +401,12 @@ void fs__readdir(uv_fs_t* req, const wchar_t* path, int flags) { if (!path2) { uv_fatal_error(ERROR_OUTOFMEMORY, "malloc"); } -#pragma warning(push) -#pragma warning(disable:4996) - _swprintf(path2, fmt, path); -#pragma warning(pop) + +#ifdef _MSC_VER + swprintf(path2, len + 3, fmt, path); +#else + swprintf(path2, fmt, path); +#endif dir = FindFirstFileW(path2, &ent); free(path2);