MSVC support, Watcom is still recommended
This commit is contained in:
parent
46f95f8314
commit
c17f7a56cc
10 changed files with 87 additions and 23 deletions
31
include/sj4core/sj_compat.h
Normal file
31
include/sj4core/sj_compat.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef __SJ4_COMPAT_H__
|
||||
#define __SJ4_COMPAT_H__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
static int __inline sj4_snprintf(char* buffer, size_t count, const char* fmt, ...){
|
||||
int st;
|
||||
va_list va;
|
||||
|
||||
va_start(va, fmt);
|
||||
st = vsprintf(buffer, fmt, va);
|
||||
va_end(va);
|
||||
|
||||
return st;
|
||||
}
|
||||
#else
|
||||
#define sj4_snprintf snprintf
|
||||
#endif
|
||||
|
||||
#define sj4_strlcpy(x, y, z) strcpy((x), (y))
|
||||
#else
|
||||
#define sj4_snprintf snprintf
|
||||
#define sj4_strlcpy strlcpy
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -436,4 +436,6 @@
|
|||
|
||||
#define termtbl Jtermtbl
|
||||
|
||||
#include <sj_compat.h>
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue