1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Handle negative numbers in with_thousand_seps.

This commit is contained in:
hniksic 2005-06-26 15:18:01 -07:00
parent 39e4262d12
commit c9049f94d7
2 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2005-06-27 Hrvoje Niksic <hniksic@xemacs.org>
* utils.c (with_thousand_seps): Handle negative numbers.
2005-06-26 Hrvoje Niksic <hniksic@xemacs.org>
* progress.c (create_image): Mark the "eta" string for translation.

View File

@ -1192,7 +1192,6 @@ get_grouping_data (const char **sep, const char **grouping)
*grouping = cached_grouping;
}
/* Return a printed representation of N with thousand separators.
This should respect locale settings, with the exception of the "C"
locale which mandates no separator, but we use one anyway.
@ -1216,12 +1215,19 @@ with_thousand_seps (wgint n)
int i = 0, groupsize;
const char *atgroup;
bool negative = n < 0;
/* Initialize grouping data. */
get_grouping_data (&sep, &grouping);
seplen = strlen (sep);
atgroup = grouping;
groupsize = *atgroup++;
/* This will overflow on WGINT_MIN, but we're not using this to
print negative numbers anyway. */
if (negative)
n = -n;
/* Write the number into the buffer, backwards, inserting the
separators as necessary. */
*--p = '\0';
@ -1243,6 +1249,9 @@ with_thousand_seps (wgint n)
groupsize = *atgroup++;
}
}
if (negative)
*--p = '-';
return p;
}