Use the * precision specification in sprintf to allow format checks.

git-svn-id: http://yate.null.ro/svn/yate/trunk@3147 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2010-03-26 09:41:42 +00:00
parent c7fff8a612
commit a43d4619fc
1 changed files with 1 additions and 3 deletions

View File

@ -726,10 +726,8 @@ String& String::append(double value, unsigned int decimals)
{
if (decimals > 12)
decimals = 12;
char fmt[8];
::sprintf(fmt,"%%0.%uf",decimals);
char buf[80];
::sprintf(buf,fmt,value);
::sprintf(buf,"%0.*f",decimals,value);
return operator+=(buf);
}