Merge 13511:13830 from trunk
[reactos.git] / reactos / lib / crt / stdio / vsprintf.c
index 628761e..d38bc6e 100644 (file)
@@ -1,71 +1,38 @@
 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <msvcrt/stdio.h>
-#include <msvcrt/stdarg.h>
+#include <stdio.h>
+#include <stdarg.h>
 #include <limits.h>
-#include <msvcrt/internal/file.h>
+#include <internal/file.h>
+#include <tchar.h>
 
 int
-crt_vsprintf(char *str, const char *fmt, va_list ap)
+crt_vsprintf(_TCHAR *str, const _TCHAR *fmt, va_list ap)
 {
-  FILE f;
-  int len;
-
-  f._flag = _IOWRT|_IOSTRG|_IOBINARY;
-  f._ptr = str;
-  f._cnt = INT_MAX;
-  f._file = -1;
-  len = vfprintf(&f,fmt, ap);
-  *f._ptr = 0;
-  return len;
-}
-
-/*
- * @implemented
- */
-int
-vswprintf(wchar_t *str, const wchar_t *fmt, va_list ap)
-{
-  FILE f;
+  FILE f = {0};
   int len;
 
   f._flag = _IOWRT|_IOSTRG|_IOBINARY;
   f._ptr = (char*)str;
   f._cnt = INT_MAX;
   f._file = -1;
-  len = vfwprintf(&f,fmt, ap);
-  *(wchar_t*)f._ptr = 0;
+  len = _vftprintf(&f,fmt, ap);
+  *(_TCHAR*)f._ptr = 0;
   return len;
 }
 
 
 int
-crt__vsnprintf(char *str, size_t maxlen, const char *fmt, va_list ap)
-{
-  FILE f;
-  int len;
-  f._flag = _IOWRT|_IOSTRG|_IOBINARY;
-  f._ptr = str;
-  f._cnt = maxlen;
-  f._file = -1;
-  len = vfprintf(&f,fmt, ap);
-  // what if the buffer is full ??
-  *f._ptr = 0;
-  return len;
-}
-
-int
-crt__vsnwprintf(wchar_t *str, size_t maxlen, const wchar_t *fmt, va_list ap)
+crt__vsnprintf(_TCHAR *str, size_t maxlen, const _TCHAR *fmt, va_list ap)
 {
-  FILE f;
+  FILE f = {0};
   int len;
+  
   f._flag = _IOWRT|_IOSTRG|_IOBINARY;
   f._ptr = (char*)str;
   f._cnt = maxlen;
   f._file = -1;
-  len = vfwprintf(&f,fmt, ap);
+  len = _vftprintf(&f,fmt, ap);
   // what if the buffer is full ??
-  *(wchar_t*)f._ptr = 0;
+  *(_TCHAR *)f._ptr = 0;
   return len;
 }
-
-