summaryrefslogtreecommitdiff
path: root/compatbits.h
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2025-10-10 23:37:31 +0100
committerDave Hibberd <hibby@debian.org>2025-10-10 23:37:31 +0100
commit96ac3e4a36e5a0a9d86c10442ed747a8a910b40c (patch)
tree17215eb22d64de32efda93c6d4bd6a02499cbefc /compatbits.h
parent7c796758d1b65d4d7585c90ba71b1fb339a4d283 (diff)
New upstream version 6.0.25.06+repackupstream/6.0.25.06+repack
Diffstat (limited to 'compatbits.h')
-rw-r--r--compatbits.h38
1 files changed, 34 insertions, 4 deletions
diff --git a/compatbits.h b/compatbits.h
index 8cdc714..9707771 100644
--- a/compatbits.h
+++ b/compatbits.h
@@ -49,7 +49,39 @@ Stuff to make compiling on WINDOWS and LINUX easier
int pthread_equal(pthread_t T1, pthread_t T2);
-uintptr_t _beginthread(void(__cdecl *start_address)(void *), unsigned stack_size, void *arglist);
+uintptr_t _beginthread(void(__cdecl start_address)(void *), unsigned stack_size, void *arglist);
+
+#if defined(_MSC_VER) && _MSC_VER < 1900
+
+#define snprintf c99_snprintf
+#define vsnprintf c99_vsnprintf
+
+__inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap)
+{
+ int count = -1;
+
+ if (size != 0)
+ count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap);
+ if (count == -1)
+ count = _vscprintf(format, ap);
+
+ return count;
+}
+
+__inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...)
+{
+ int count;
+ va_list ap;
+
+ va_start(ap, format);
+ count = c99_vsnprintf(outBuf, size, format, ap);
+ va_end(ap);
+
+ return count;
+}
+#endif
+
+
#else
@@ -152,9 +184,7 @@ int stricmp(const unsigned char * pStr1, const unsigned char *pStr2);
char * strupr(char* s);
char * strlwr(char* s);
-pthread_t _beginthread(void(*start_address)(), unsigned stack_size, VOID * arglist);
-
-
+pthread_t _beginthread(void(start_address)(void *), unsigned stack_size, VOID * arglist);
#define WSAGetLastError() errno
#define GetLastError() errno