aboutsummaryrefslogtreecommitdiff
path: root/src/xz/util.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2010-09-10 10:30:33 +0300
committerLasse Collin <lasse.collin@tukaani.org>2010-09-10 10:30:33 +0300
commitbb0b1004f83cdc4d309e1471c2ecaf9f95ce60c5 (patch)
treed21a6ca975dbd1ed4d6181281be92eb53c82423c /src/xz/util.h
parentUpdate the Czech translation. (diff)
downloadxz-bb0b1004f83cdc4d309e1471c2ecaf9f95ce60c5.tar.xz
xz: Multiple fixes.
The code assumed that printing numbers with thousand separators and decimal points would always produce only US-ASCII characters. This was used for buffer sizes (with snprintf(), no overflows) and aligning columns of the progress indicator and --list. That assumption was wrong (e.g. LC_ALL=fi_FI.UTF-8 with glibc), so multibyte character support was added in this commit. The old way is used if the operating system doesn't have enough multibyte support (e.g. lacks wcwidth()). The sizes of buffers were increased to accomodate multibyte characters. I don't know how big they should be exactly, but they aren't used for anything critical, so it's not too bad. If they still aren't big enough, I hopefully get a bug report. snprintf() takes care of avoiding buffer overflows. Some static buffers were replaced with buffers allocated on stack. double_to_str() was removed. uint64_to_str() and uint64_to_nicestr() now share the static buffer and test for thousand separator support. Integrity check names "None" and "Unknown-N" (2 <= N <= 15) were marked to be translated. I had forgot these, plus they wouldn't have worked correctly anyway before this commit, because printing tables with multibyte strings didn't work. Thanks to Marek Černocký for reporting the bug about misaligned table columns in --list output.
Diffstat (limited to '')
-rw-r--r--src/xz/util.h7
1 files changed, 0 insertions, 7 deletions
diff --git a/src/xz/util.h b/src/xz/util.h
index 2e08b4a8..fea8cc66 100644
--- a/src/xz/util.h
+++ b/src/xz/util.h
@@ -96,13 +96,6 @@ extern const char *uint64_to_nicestr(uint64_t value,
bool always_also_bytes, uint32_t slot);
-/// \brief Convert double to a string with one decimal place
-///
-/// This is like uint64_to_str() except that this converts a double and
-/// uses exactly one decimal place.
-extern const char *double_to_str(double value);
-
-
/// \brief Wrapper for snprintf() to help constructing a string in pieces
///
/// A maximum of *left bytes is written starting from *pos. *pos and *left