"sync up sprintf.c with swprintf.c. They both do the same except one is the wchar-version, so they shouldn't differ in other parts." by Elrond <elrond(at)samba(dash)tng(dot)org>

svn path=/trunk/; revision=19344
This commit is contained in:
Magnus Olsen
2005-11-19 14:23:33 +00:00
parent f5238f3c36
commit 6ea2d31a1e
2 changed files with 10 additions and 4 deletions
+7 -4
View File
@@ -2,6 +2,8 @@
* PROGRAMMERS: David Welch
* Eric Kohl
*
* TODO:
* - Verify the implementation of '%Z'.
*/
/*
@@ -14,6 +16,7 @@
/*
* Wirzenius wrote this portably, Torvalds fucked it up :-)
*/
#include <rtl.h>
#define ZEROPAD 1 /* pad with zero */
@@ -84,7 +87,7 @@ number(char * buf, char * end, long long num, int base, int size, int precision,
}
i = 0;
if (num == 0)
tmp[i++]='0';
tmp[i++] = '0';
else while (num != 0)
tmp[i++] = digits[do_div(&num,base)];
if (i > precision)
@@ -214,19 +217,19 @@ stringw(char* buf, char* end, const wchar_t* sw, int len, int field_width, int p
{
if (buf <= end)
*buf = ' ';
++buf;
buf++;
}
for (i = 0; i < len; ++i)
{
if (buf <= end)
*buf = (unsigned char)(*sw++);
++buf;
buf++;
}
while (len < field_width--)
{
if (buf <= end)
*buf = ' ';
++buf;
buf++;
}
return buf;
}
+3
View File
@@ -537,6 +537,9 @@ int _snwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, ...)
}
/*
* @implemented
*/
int vswprintf(wchar_t *buf, const wchar_t *fmt, va_list args)
{
return _vsnwprintf(buf,MAXLONG,fmt,args);