merge the formfield patch from ooo-build
[ooovba.git] / sal / inc / systools / win32 / snprintf.h
blobe3751c8de45a6f5bd0d6290b814f01fa31f48cde
1 #ifndef _SNPRINTF_H
2 #define _SNPRINTF_H
4 #if !defined(_WIN32)
5 #error ERROR: Only Win32 target supported!
6 #endif
8 /* Macros for Unicode/ANSI support like in TCHAR.H */
10 #ifdef _UNICODE
11 #define sntprintf snwprintf
12 #define vsntprintf vsnwprintf
13 #else
14 #define sntprintf snprintf
15 #define vsntprintf vsnprintf
16 #endif
18 /* Define needed types if they are not yet defined */
20 #if 0
21 # ifndef _INC_STDARG
22 # include <stdarg.h>
23 # endif
24 #else
25 # ifndef _VA_LIST_DEFINED
26 typedef char * va_list;
27 # define _VA_LIST_DEFINED
28 # endif
29 #endif
31 #if 0
32 # ifndef _INC_WCHAR
33 # include <wchar.h>
34 # endif
35 #else
36 # ifndef _WCHAR_T_DEFINED
37 typedef unsigned short wchar_t;
38 # define _WCHAR_T_DEFINED
39 # endif
40 #endif
42 #ifndef _SNPRINTF_DLLIMPORT
43 #define _SNPRINTF_DLLIMPORT __declspec( dllimport )
44 #endif
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
51 /* Implementations of snprintf following the ISO/IEC 9899:1999 (ISO C99)
52 standard.
53 The difference compared to _snprintf is that the buffer always is zero
54 terminated (unless count is zero) and the return value is the number of
55 characters (not including terminating zero) that would have been written
56 even if the buffer wasn't large
57 enough to hold the string. */
61 /* UNICODE version */
62 _SNPRINTF_DLLIMPORT int __cdecl snwprintf( wchar_t *buffer, size_t count, const wchar_t *format, ... );
64 /* SBCS and MBCS version */
65 _SNPRINTF_DLLIMPORT int __cdecl snprintf( char *buffer, size_t count, const char *format, ... );
67 /* Conflict with STL_port inline implementation */
68 #if 0
69 /* UNICODE version */
70 _SNPRINTF_DLLIMPORT int __cdecl vsnwprintf( wchar_t *buffer, size_t count, const wchar_t *format, va_list ap );
72 /* SBCS and MBCS version */
73 _SNPRINTF_DLLIMPORT int __cdecl vsnprintf( char *buffer, size_t count, const char *format, va_list ap );
74 #endif
76 #ifdef __cplusplus
78 #endif
80 #endif /* _SNPRINTF_H */