summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Kelman <tony@kelman.net>2015-03-19 07:25:25 -0700
committerTony Kelman <tony@kelman.net>2015-03-19 08:42:45 -0700
commitb631e0d96d4dfd3a254b9fc46aaf561428da7c9c (patch)
treea513298f1891db89605a18dd19ccb3ab1938b5de
parent7aa96593fa6dcbe4f976137bc105037257e5c26d (diff)
downloadlibgit2-b631e0d96d4dfd3a254b9fc46aaf561428da7c9c.tar.gz
Use swprintf_s everywhere except mingw.org
-rw-r--r--CMakeLists.txt3
-rw-r--r--src/transports/winhttp.c10
2 files changed, 8 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index facd68b8c..d64726e7f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -186,10 +186,9 @@ IF (WIN32 AND WINHTTP)
INCLUDE_DIRECTORIES(deps/winhttp)
LINK_DIRECTORIES(${LIBWINHTTP_PATH})
- LINK_LIBRARIES(crypt32)
ENDIF ()
- LINK_LIBRARIES(winhttp rpcrt4)
+ LINK_LIBRARIES(winhttp rpcrt4 crypt32)
ELSE ()
IF (NOT AMIGA AND USE_OPENSSL)
FIND_PACKAGE(OpenSSL)
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c
index d1eb32a65..f93a031f1 100644
--- a/src/transports/winhttp.c
+++ b/src/transports/winhttp.c
@@ -17,8 +17,9 @@
#include "repository.h"
#include <wincrypt.h>
-#pragma comment(lib, "crypt32")
#include <winhttp.h>
+
+/* For IInternetSecurityManager zone check */
#include <objbase.h>
#include <urlmon.h>
@@ -1006,8 +1007,11 @@ static int put_uuid_string(LPWSTR buffer, size_t buffer_len_cch)
return -1;
}
- result = wsprintfW(
- buffer,
+#if !defined(__MINGW32__) || defined(MINGW_HAS_SECURE_API)
+ result = swprintf_s(buffer, buffer_len_cch,
+#else
+ result = wsprintfW(buffer,
+#endif
L"%08x%04x%04x%02x%02x%02x%02x%02x%02x%02x%02x",
uuid.Data1, uuid.Data2, uuid.Data3,
uuid.Data4[0], uuid.Data4[1], uuid.Data4[2], uuid.Data4[3],