Re: clanlib memset bugs.

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

 



On Sat, 2008-03-08 at 10:57 +0200, Gilboa Davara wrote:
> On Fri, 2008-03-07 at 21:02 -0500, Dave Jones wrote:
> > 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);
> >  }
> > 
> 
> OT side note:
> 
> Wouldn't it be easier (and cleaner) to do:
> char str[X]
> memset(str,0,sizeof(X));
> sprintf(str, sizeof(X), "%f", value);
> 
> - Gilboa

Naah. Missed the 0.9 rebase thing.
Please ignore me.

- Gilboa

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux