Author: tkreuzer
Date: Sun Nov 7 00:59:41 2010
New Revision: 49514
URL:
http://svn.reactos.org/svn/reactos?rev=49514&view=rev
Log:
[CRT]
In streamout() handle %%, negative fieldwidth and negative precision.
Modified:
trunk/reactos/lib/sdk/crt/printf/streamout.c
Modified: trunk/reactos/lib/sdk/crt/printf/streamout.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/printf/streamo…
==============================================================================
--- trunk/reactos/lib/sdk/crt/printf/streamout.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/printf/streamout.c [iso-8859-1] Sun Nov 7 00:59:41 2010
@@ -97,7 +97,8 @@
int num_digits, val32, base = 10;
__int64 val64;
- if (precision == -1) precision = 6;
+ if (precision < 0) precision = 6;
+ else if (precision > 512) precision = 512;
fpval = va_arg_ffp(*argptr, flags);
exponent = get_exp(fpval);
@@ -302,7 +303,15 @@
/* Write the character to the stream */
if ((written = streamout_char(stream, chr)) == -1) return -1;
written_all += written;
- /* Continue with next char */
+ continue;
+ }
+
+ /* Check for escaped % character */
+ if (*format == _T('%'))
+ {
+ /* Write % to the stream */
+ if ((written = streamout_char(stream, _T('%'))) == -1) return -1;
+ written_all += written;
continue;
}
@@ -323,6 +332,11 @@
if (chr == _T('*'))
{
fieldwidth = va_arg(argptr, int);
+ if (fieldwidth < 0)
+ {
+ flags |= FLAG_ALIGN_LEFT;
+ fieldwidth = -fieldwidth;
+ }
chr = *format++;
}
else