1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-20 18:50:08 +03:00

Remove occasional leading space in XPath number formatting

https://bugzilla.gnome.org/show_bug.cgi?id=704528

Somehow snprintf "%*.*e" can generate a leading space, remove it
This commit is contained in:
Daniel Veillard 2013-07-22 13:21:31 +08:00
parent 81b961788a
commit b9e4d5b639

View File

@ -2885,6 +2885,12 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize)
fraction_place, number);
}
/* Remove leading spaces sometimes inserted by snprintf */
while (work[0] == ' ') {
for (ptr = &work[0];(ptr[0] = ptr[1]);ptr++);
size--;
}
/* Remove fractional trailing zeroes */
after_fraction = work + size;
ptr = after_fraction;