aboutsummaryrefslogtreecommitdiff
path: root/src/common/tuklib_mbstr_width.c (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2019-07-12Fix comment typos in tuklib_mbstr* files.Lasse Collin1-1/+1
2019-07-12Add missing include to tuklib_mbstr_width.c.Lasse Collin1-0/+1
It didn't matter in XZ Utils because sysdefs.h includes string.h anyway.
2019-06-23tuklib_mbstr_width: Fix a warning from -Wsign-conversion.Lasse Collin1-1/+1
2010-09-10xz: Multiple fixes.Lasse Collin1-0/+64
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.