summaryrefslogtreecommitdiff
path: root/sal/systools
diff options
context:
space:
mode:
authorHennes Rohling <hro@openoffice.org>2002-12-10 15:16:10 +0000
committerHennes Rohling <hro@openoffice.org>2002-12-10 15:16:10 +0000
commit4015120a1878383df075c4ba87be9137d719a7ad (patch)
treedc10dd8deecb259e6d8e87357e3cbe43b87ce74b /sal/systools
parent785af3a40aea468a0a5cb326aab04faf49706619 (diff)
#106037# Changed emulation of _vsctprintf for MSVCRT.DLL versions below 7.0
Diffstat (limited to 'sal/systools')
-rw-r--r--sal/systools/win32/uwinapi/sntprintf.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/sal/systools/win32/uwinapi/sntprintf.c b/sal/systools/win32/uwinapi/sntprintf.c
index 7593e5830004..6d76da670790 100644
--- a/sal/systools/win32/uwinapi/sntprintf.c
+++ b/sal/systools/win32/uwinapi/sntprintf.c
@@ -8,21 +8,24 @@
#if _MSC_VER < 1300
-#include <limits.h>
-#define MAXSTR INT_MAX
-
/* The non-debug versions of _vscprintf/_scprintf are just calls
- to _vsprintf/_sprintf with string buffer pointer set to NULL */
+ to _vsprintf/_sprintf with string buffer pointer set to NULL,
+ requires MSVCRT version 7.0 */
static int __cdecl _vsctprintf( const _TXCHAR *format, va_list ap )
{
- FILE str = { 0 };
+ FILE *fp = _tfopen( _T("NUL"), _T("wb") );
+
+ if ( fp )
+ {
+ int retval = _vftprintf( fp, format, ap );
- str._cnt = MAXSTR;
- str._base = str._ptr = NULL;
- str._flag = _IOWRT|_IOSTRG;
+ fclose( fp );
+
+ return retval;
+ }
- return _vftprintf( &str, format, ap );
+ return -1;
}
#endif