summaryrefslogtreecommitdiff
path: root/src/options.c
diff options
context:
space:
mode:
authordaan <daanl@outlook.com>2020-09-04 13:06:18 -0700
committerdaan <daanl@outlook.com>2020-09-04 13:06:18 -0700
commit032eb2a75a868534e8130ea8eb32914f8040d211 (patch)
tree86576973036dd82fbca2db2de87f239f13475de7 /src/options.c
parentd73d6beb71df5478f081be7fd1108a619ebba461 (diff)
use pragma warning only on msvc (issue #291)
Diffstat (limited to 'src/options.c')
-rw-r--r--src/options.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/options.c b/src/options.c
index a2432aa..baaef46 100644
--- a/src/options.c
+++ b/src/options.c
@@ -14,6 +14,11 @@ terms of the MIT license. A copy of the license can be found in the file
#include <ctype.h> // toupper
#include <stdarg.h>
+#ifdef _MSC_VER
+#pragma warning(disable:4996) // strncpy, strncat
+#endif
+
+
static uintptr_t mi_max_error_count = 16; // stop outputting errors after this
static void mi_add_stderr_output();
@@ -215,7 +220,6 @@ static void mi_out_buf_stderr(const char* msg, void* arg) {
// Should be atomic but gives errors on many platforms as generally we cannot cast a function pointer to a uintptr_t.
// For now, don't register output from multiple threads.
-#pragma warning(suppress:4180)
static mi_output_fun* volatile mi_out_default; // = NULL
static _Atomic(void*) mi_out_arg; // = NULL
@@ -389,13 +393,11 @@ void _mi_error_message(int err, const char* fmt, ...) {
static void mi_strlcpy(char* dest, const char* src, size_t dest_size) {
dest[0] = 0;
- #pragma warning(suppress:4996)
strncpy(dest, src, dest_size - 1);
dest[dest_size - 1] = 0;
}
static void mi_strlcat(char* dest, const char* src, size_t dest_size) {
- #pragma warning(suppress:4996)
strncat(dest, src, dest_size - 1);
dest[dest_size - 1] = 0;
}