Author: greatlrd
Date: Wed Jun 7 03:01:44 2006
New Revision: 22257
URL:
http://svn.reactos.ru/svn/reactos?rev=22257&view=rev
Log:
fixing some bugs for %c in the string version of printf
Modified:
trunk/reactos/lib/rtl/sprintf.c
trunk/reactos/lib/rtl/swprintf.c
Modified: trunk/reactos/lib/rtl/sprintf.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/lib/rtl/sprintf.c?rev=22257…
==============================================================================
--- trunk/reactos/lib/rtl/sprintf.c (original)
+++ trunk/reactos/lib/rtl/sprintf.c Wed Jun 7 03:01:44 2006
@@ -477,27 +477,20 @@
switch (*fmt) {
case 'c': /* finished */
- if (!(flags & LEFT))
- while (--field_width > 0) {
- if (str <= end)
- *str = ' ';
- ++str;
- }
- if (qualifier == 'l' || qualifier == 'w') {
- if (str <= end)
- *str = (unsigned char)(wchar_t) va_arg(args, int);
- ++str;
+ if (qualifier == 'l' || qualifier == 'w') {
+ wchar_t sw1[2];
+ /* print unicode string */
+ sw1[0] = (wchar_t) va_arg(args, int);
+ sw1[1] = 0;
+ str = stringw(str, end, (wchar_t *)&sw1, -1, field_width, precision, flags);
} else {
- if (str <= end)
- *str = (unsigned char) va_arg(args, int);
- ++str;
- }
- while (--field_width > 0) {
- if (str <= end)
- *str = ' ';
- ++str;
- }
- continue;
+ char s1[2];
+ /* print ascii string */
+ s1[0] = ( unsigned char) va_arg(args, int);
+ s1[1] = 0;
+ str = string(str, end, (char *)&s1, -1, field_width, precision, flags);
+ }
+ continue;
case 'C': /* finished */
if (!(flags & LEFT))
Modified: trunk/reactos/lib/rtl/swprintf.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/lib/rtl/swprintf.c?rev=2225…
==============================================================================
--- trunk/reactos/lib/rtl/swprintf.c (original)
+++ trunk/reactos/lib/rtl/swprintf.c Wed Jun 7 03:01:44 2006
@@ -475,26 +475,20 @@
switch (*fmt) {
case L'c':
- if (!(flags & LEFT))
- while (--field_width > 0) {
- if (str <= end)
- *str = L' ';
- ++str;
- }
- if (qualifier == 'h') {
- if (str <= end)
- *str = (wchar_t) va_arg(args, int);
- ++str;
+ if (qualifier == 'h' || qualifier == 'w') {
+ wchar_t sw1[2];
+ /* print unicode string */
+ sw1[0] = (wchar_t) va_arg(args, int);
+ sw1[1] = 0;
+ str = stringw(str, end, (wchar_t *)&sw1, -1, field_width, precision, flags);
} else {
- if (str <= end)
- *str = (wchar_t) va_arg(args, int);
- ++str;
- }
- while (--field_width > 0) {
- if (str <= end)
- *str = L' ';
- ++str;
- }
+ char s1[2];
+ /* print ascii string */
+ s1[0] = ( unsigned char) va_arg(args, int);
+ s1[1] = 0;
+ str = string(str, end, (char *)&s1, -1, field_width, precision, flags);
+ }
+
continue;
case L'C':