clanlib memset bugs.

Dave Jones davej at codemonkey.org.uk
Sat Mar 8 02:02:41 UTC 2008


Hans,
 0.8 of clanlib has swapped arguments to memset resulting in them
becoming no-ops.   The patch below fixes this.  We don't need to
push this upstream, because 0.9 seems to remove the affected file
altogether, so when we rebase after its release we get to just throw
the diff away.  In the meantime, we should probably add this:

	Dave

-- 
http://www.codemonkey.org.uk

--- ClanLib-0.8.0/Sources/Core/System/Generic/clanstring.cpp~	2008-03-07 20:23:48.000000000 -0500
+++ ClanLib-0.8.0/Sources/Core/System/Generic/clanstring.cpp	2008-03-07 20:25:20.000000000 -0500
@@ -87,7 +87,7 @@ void CL_String::arg(std::string &format,
 	char number[10];
 	std::string num_string = "%";
 	
-	memset(number, 10, 0);
+	memset(number, 0, 10);
 	snprintf(number, 10, "%d", num);
 	
 	num_string += number;
@@ -112,7 +112,7 @@ void CL_String::arg(std::string &format,
 {
 	char arg[10];
 	
-	memset(arg, 10, 0);
+	memset(arg, 0, 10);
 	snprintf(arg, 10, "%d", number);
 	
 	CL_String::arg(format, arg, num);
@@ -122,7 +122,7 @@ void CL_String::arg(std::string &format,
 {
 	char arg[32];
 
-	memset(arg, 32, 0);
+	memset(arg, 0, 32);
 	snprintf(arg, 32, "%f", number);
 	
 	CL_String::arg(format, arg, num);
@@ -132,7 +132,7 @@ void CL_String::arg(std::string &format,
 {
 	char arg[32];
 	
-	memset(arg, 32, 0);
+	memset(arg, 0, 32);
 	snprintf(arg, 32, "%#f", number);
 	
 	CL_String::arg(format, arg, num);
@@ -141,7 +141,7 @@ void CL_String::arg(std::string &format,
 std::string CL_String::from_int(int value)
 {
 	char str[32];
-	memset(str, 32, 0);
+	memset(str, 0, 32);
 	snprintf(str, 32, "%d", value);
 	return std::string(str);
 }
@@ -149,7 +149,7 @@ std::string CL_String::from_int(int valu
 std::string CL_String::from_float(float value)
 {
 	char str[32];
-	memset(str, 32, 0);
+	memset(str, 0, 32);
 	snprintf(str, 32, "%f", value);
 	return std::string(str);
 }
@@ -157,7 +157,7 @@ std::string CL_String::from_float(float 
 std::string CL_String::from_double(double value)
 {
 	char str[32];
-	memset(str, 32, 0);
+	memset(str, 0, 32);
 	snprintf(str, 32, "%#f", value);
 	return std::string(str);
 }




More information about the devel mailing list