all: fix compilation errors on non-windows clang

Thorvg couldn't be compiled on macos as non-portable microsoft calls used.
Changed definitions checking to Visual Studio only.
This commit is contained in:
Michal Maciola 2021-11-17 12:00:38 +01:00 committed by Hermet Park
parent 92f57a149f
commit 282b9288ab
2 changed files with 2 additions and 2 deletions

View file

@ -48,7 +48,7 @@ using namespace tvg;
#define TVG_FALLTHROUGH #define TVG_FALLTHROUGH
#endif #endif
#if defined(__clang__) && !defined(__EMSCRIPTEN__) #if defined(_MSC_VER) && defined(__clang__)
#define strncpy strncpy_s #define strncpy strncpy_s
#define strdup _strdup #define strdup _strdup
#endif #endif

View file

@ -32,7 +32,7 @@
static FILE* _fopen(const char* filename, const char* mode) static FILE* _fopen(const char* filename, const char* mode)
{ {
#if defined(__clang__) && !defined(__EMSCRIPTEN__) #if defined(_MSC_VER) && defined(__clang__)
FILE *fp; FILE *fp;
auto err = fopen_s(&fp, filename, mode); auto err = fopen_s(&fp, filename, mode);
if (err != 0) return nullptr; if (err != 0) return nullptr;