fix print float pretty
This commit is contained in:
parent
6e09035f46
commit
e7dd98f54d
10
SafeBuf.cpp
10
SafeBuf.cpp
@ -248,17 +248,21 @@ bool SafeBuf::printFloatPretty ( float f ) {
|
||||
|
||||
// hack off trailing zeros
|
||||
char *e = p + len - 1;
|
||||
int plen = len;
|
||||
|
||||
for ( ; e > p ; e-- ) {
|
||||
if ( e[0] == '.' ) {
|
||||
e[0] = '\0';
|
||||
//e[0] = '\0';
|
||||
plen--;
|
||||
break;
|
||||
}
|
||||
if ( e[0] != '0' ) break;
|
||||
e[0] = '\0';
|
||||
//e[0] = '\0';
|
||||
plen--;
|
||||
}
|
||||
|
||||
m_length += e - p;
|
||||
m_length += plen;//e - p;
|
||||
p[plen] = '\0';
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user