commit cf293044ca267487f0adf5a2381502618d90a836
parent 31cd72981b33a41297219c1249e065bc130da313
Author: tjachmann <tjachmann@gmx.de>
Date: Mon, 17 Jan 2022 22:04:10 +0100
Fix compilation on visual c++ (#1)
* Fix compilation on visual c++
Diffstat:
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/naett.c b/naett.c
@@ -5,6 +5,11 @@
#ifndef NAETT_INTERNAL_H
#define NAETT_INTERNAL_H
+#ifdef _MSC_VER
+ #define strcasecmp _stricmp
+ #define min(a,b) (((a)<(b))?(a):(b))
+#endif
+
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -1008,7 +1013,7 @@ static LPWSTR winFromUTF8(const char* source) {
}
static LPWSTR wcsndup(LPCWSTR str, size_t len) {
- LPWSTR result = calloc(1, sizeof(WCHAR) * (len + 1));
+ LPWSTR result = (LPWSTR)calloc(1, sizeof(WCHAR) * (len + 1));
wcsncpy(result, str, len);
return result;
}
diff --git a/src/naett_internal.h b/src/naett_internal.h
@@ -1,6 +1,11 @@
#ifndef NAETT_INTERNAL_H
#define NAETT_INTERNAL_H
+#ifdef _MSC_VER
+ #define strcasecmp _stricmp
+ #define min(a,b) (((a)<(b))?(a):(b))
+#endif
+
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>