[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1668
Date       : Fri Aug  4 12:45:19 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/bmapprev.cpp
   M /Trunk/XaraLX/Kernel/document.cpp
   M /Trunk/XaraLX/Kernel/epsfiltr.cpp
   M /Trunk/XaraLX/Kernel/nativeps.cpp
   M /Trunk/XaraLX/Kernel/pagesize.cpp
   M /Trunk/XaraLX/wxOil/compatdef.h

Fix use of camSscanf with doubles and "%f" - change to "%lf". Fixes AI import bz #1377


Diff:
Index: Trunk/XaraLX/Kernel/bmapprev.cpp
===================================================================
--- Trunk/XaraLX/Kernel/bmapprev.cpp	(revision 1667)
+++ Trunk/XaraLX/Kernel/bmapprev.cpp	(revision 1668)
@@ -1952,8 +1952,8 @@
 
 		case MODEL_RGBPERCENT:
 		{
-			float t;
-			camSscanf(str, _T("%f"), &t);
+			double t;
+			camSscanf(str, _T("%lf"), &t);
 			double tt = t * (255.0 / 100.0); // convert from percent to 0-255
 			if (tt >= 0 && tt < 256)
 				*pColourWeAreChanging = UINT8(tt + 0.5); // adding 0.5 so number rounds to nearest INT32
@@ -1980,8 +1980,8 @@
 			}
 			else									// S & V components
 			{
-				float t;							// temp float variable (using float to keep sscanf happy)
-				camSscanf(str, _T("%f"), &t);				// read value as a float
+				double t;							// temp float variable (using float to keep sscanf happy)
+				camSscanf(str, _T("%lf"), &t);				// read value as a float
 				t *= (float)(255.0 / 100.0);		// convert from percent to 0-255
 				newValue = UINT8(t + 0.5);					// value to be set (check range before setting)
 			}
Index: Trunk/XaraLX/Kernel/pagesize.cpp
===================================================================
--- Trunk/XaraLX/Kernel/pagesize.cpp	(revision 1667)
+++ Trunk/XaraLX/Kernel/pagesize.cpp	(revision 1668)
@@ -954,7 +954,7 @@
 										}
 										else
 										{
-											//ok = (camSscanf(TokenBuf,"%g",pHeight) == 1);
+											//ok = (camSscanf(TokenBuf,"%lg",pHeight) == 1);
 											*pHeight = Number;
 										}
 									}
Index: Trunk/XaraLX/Kernel/epsfiltr.cpp
===================================================================
--- Trunk/XaraLX/Kernel/epsfiltr.cpp	(revision 1667)
+++ Trunk/XaraLX/Kernel/epsfiltr.cpp	(revision 1668)
@@ -1875,7 +1875,7 @@
 			// Floating point
 			Token = EPSC_Double;
 			TokenData.Double=0.0;
-			camSscanf(TokenBuf,_T("%f"),&TokenData.Double);
+			camSscanf(TokenBuf,_T("%lf"),&TokenData.Double);
 		}
 		else if (FoundDot)
 		{
Index: Trunk/XaraLX/Kernel/document.cpp
===================================================================
--- Trunk/XaraLX/Kernel/document.cpp	(revision 1667)
+++ Trunk/XaraLX/Kernel/document.cpp	(revision 1668)
@@ -3269,7 +3269,7 @@
 	{
 		// get the Number
 		*Number=0.0;
-		camSscanf(&(Comment[i]),_T("%f"),Number);
+		camSscanf(&(Comment[i]),_T("%lf"),Number);
 
 		// Skip to the next number
 		while (!camIsspace(Comment[i]))
Index: Trunk/XaraLX/Kernel/nativeps.cpp
===================================================================
--- Trunk/XaraLX/Kernel/nativeps.cpp	(revision 1667)
+++ Trunk/XaraLX/Kernel/nativeps.cpp	(revision 1668)
@@ -1330,7 +1330,7 @@
 	{
 		TCHAR* pVersion = &(((TCHAR*)TokenBuf)[15]);
 		double Version=0.0;
-		camSscanf(pVersion, _T("%f"), &Version);
+		camSscanf(pVersion, _T("%lf"), &Version);
 		TRACEUSER( "Neville", _T("Native file version = %f
"), Version);
 		FileVersionNumber = Version;
 		// Must stop later file versions loading back into this version.
@@ -1389,7 +1389,7 @@
 	{
 		TCHAR* pVersion = &(((TCHAR*)TokenBuf)[19]);
 		double CompVersion=0.0;
-		camSscanf(pVersion, _T("%f"), &CompVersion);
+		camSscanf(pVersion, _T("%lf"), &CompVersion);
 		TRACEUSER( "Neville", _T("Compression version = %f
"), CompVersion);
 		double StreamVersion = GZipFile::GetStreamVersionNo();
 		// If the version stored in the file is later than the one in the stream class
Index: Trunk/XaraLX/wxOil/compatdef.h
===================================================================
--- Trunk/XaraLX/wxOil/compatdef.h	(revision 1667)
+++ Trunk/XaraLX/wxOil/compatdef.h	(revision 1668)
@@ -692,7 +692,7 @@
 
 inline void Beep() {wxBell();}
 
-inline double camAtof(TCHAR * s) { double r=0.0; camSscanf(s, _T("%f"), &r); return r;}
+inline double camAtof(TCHAR * s) { double r=0.0; camSscanf(s, _T("%lf"), &r); return r;}
 inline INT32 camAtol(TCHAR * s) { INT32 r=0; camSscanf(s, _T("%d"), &r); return r;}
 
 // Macro to get rid of unused variable warnings


Xara