xref: /reactos/dll/3rdparty/libxslt/win32config.h (revision 21ab4d93)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  * Summary: Windows configuration header
3c2c66affSColin Finck  * Description: Windows configuration header
4c2c66affSColin Finck  *
5c2c66affSColin Finck  * Copy: See Copyright for the status of this software.
6c2c66affSColin Finck  *
7c2c66affSColin Finck  * Author: Igor Zlatkovic
8c2c66affSColin Finck  */
9c2c66affSColin Finck #ifndef __LIBXSLT_WIN32_CONFIG__
10c2c66affSColin Finck #define __LIBXSLT_WIN32_CONFIG__
11c2c66affSColin Finck 
12*5c72e50fSThomas Faber /* snprintf emulation taken from http://stackoverflow.com/a/8712996/1956010 */
13*5c72e50fSThomas Faber #if defined(_MSC_VER) && _MSC_VER < 1900
14*5c72e50fSThomas Faber 
15*5c72e50fSThomas Faber #include <stdarg.h>
16*5c72e50fSThomas Faber #include <stdio.h>
17*5c72e50fSThomas Faber 
18*5c72e50fSThomas Faber #define snprintf c99_snprintf
19*5c72e50fSThomas Faber #define vsnprintf c99_vsnprintf
20*5c72e50fSThomas Faber 
c99_vsnprintf(char * outBuf,size_t size,const char * format,va_list ap)21*5c72e50fSThomas Faber __inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap)
22*5c72e50fSThomas Faber {
23*5c72e50fSThomas Faber     int count = -1;
24*5c72e50fSThomas Faber 
25*5c72e50fSThomas Faber     if (size != 0)
26*5c72e50fSThomas Faber         count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap);
27*5c72e50fSThomas Faber     if (count == -1)
28*5c72e50fSThomas Faber         count = _vscprintf(format, ap);
29*5c72e50fSThomas Faber 
30*5c72e50fSThomas Faber     return count;
31*5c72e50fSThomas Faber }
32*5c72e50fSThomas Faber 
c99_snprintf(char * outBuf,size_t size,const char * format,...)33*5c72e50fSThomas Faber __inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...)
34*5c72e50fSThomas Faber {
35*5c72e50fSThomas Faber     int count;
36*5c72e50fSThomas Faber     va_list ap;
37*5c72e50fSThomas Faber 
38*5c72e50fSThomas Faber     va_start(ap, format);
39*5c72e50fSThomas Faber     count = c99_vsnprintf(outBuf, size, format, ap);
40*5c72e50fSThomas Faber     va_end(ap);
41*5c72e50fSThomas Faber 
42*5c72e50fSThomas Faber     return count;
43*5c72e50fSThomas Faber }
44*5c72e50fSThomas Faber 
45*5c72e50fSThomas Faber #endif /* defined(_MSC_VER) && _MSC_VER < 1900 */
46c2c66affSColin Finck 
47c2c66affSColin Finck #define HAVE_SYS_STAT_H
48c2c66affSColin Finck #define HAVE__STAT
49c2c66affSColin Finck 
50c2c66affSColin Finck #endif /* __LIBXSLT_WIN32_CONFIG__ */
51c2c66affSColin Finck 
52