mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
"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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user