[ros-diffs] [gschneider] 37740: - Updated msvcrt winetests introduced new printf testcases and new failures - fixed: - Special qualifiers with short gG formats may even skip all decimal digits, but the separator is applied nonetheless - Padding spaces on the right caused problems in exponential format, because those are split into two parts, the padding was done in between - Failing fwprintf test was removed from the tests, so the printf test is passed completely now

gschneider at svn.reactos.org gschneider at svn.reactos.org
Sat Nov 29 20:39:54 CET 2008


Author: gschneider
Date: Sat Nov 29 13:39:53 2008
New Revision: 37740

URL: http://svn.reactos.org/svn/reactos?rev=37740&view=rev
Log:
- Updated msvcrt winetests introduced new printf testcases and new failures - fixed:
- Special qualifiers with short gG formats may even skip all decimal digits, but the separator is applied nonetheless
- Padding spaces on the right caused problems in exponential format, because those are split into two parts, the padding was done in between
- Failing fwprintf test was removed from the tests, so the printf test is passed completely now

Modified:
    trunk/reactos/lib/sdk/crt/stdio/lnx_sprintf.c

Modified: trunk/reactos/lib/sdk/crt/stdio/lnx_sprintf.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/lnx_sprintf.c?rev=37740&r1=37739&r2=37740&view=diff
==============================================================================
--- trunk/reactos/lib/sdk/crt/stdio/lnx_sprintf.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/stdio/lnx_sprintf.c [iso-8859-1] Sat Nov 29 13:39:53 2008
@@ -166,6 +166,7 @@
 	int i = 0;
 	int j = 0;
 	int ro = 0;
+	int isize;
 
 	double frac, intr;
 	double p;
@@ -194,6 +195,7 @@
 			exp_sign -= 2; // g -> e and G -> E
 		else
 			exp_sign = 'f';
+		if (type & SPECIAL) precision--;
 	}
 
 	if ( exp_sign == 'e' ||  exp_sign == 'E' )
@@ -210,6 +212,13 @@
 
 		/* size-5 because "e+abc" is going to follow */
 		buf = numberf(buf, end, num/pow(10.0L,(long double)e), 'f', size-5, precision, type);
+		isize = 4;
+		while(*(buf-1) == ' ')
+		{
+			isize++;
+			--buf;
+		}
+
 		if (buf <= end)
 			*buf = exp_sign;
 		++buf;
@@ -217,7 +226,7 @@
 
 		ie = (long)e;
 		type = LEFT | SIGN | PLUS;
-		buf = number(buf, end, ie, 10, 3, 3, type);
+		buf = number(buf, end, ie, 10, isize, 3, type);
 		return buf;
 	}
 
@@ -259,15 +268,16 @@
 				digits[i] = (int)p + '0';
 				i--;
 			}
+
 			i = precision;
 			size -= precision;
-
-			if ( precision >= 1 || type & SPECIAL)
-			{
-				digits[i++] = '.';
-				size--;
-			}
 		} 
+
+		if ( precision >= 1 || type & SPECIAL)
+		{
+			digits[i++] = '.';
+			size--;
+		}
 
 		ro = 0;
 		if ( frac > 0.5 )



More information about the Ros-diffs mailing list