mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
bb0b1004f8
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.
30 lines
853 B
Text
30 lines
853 B
Text
#
|
|
# SYNOPSIS
|
|
#
|
|
# TUKLIB_MBSTR
|
|
#
|
|
# DESCRIPTION
|
|
#
|
|
# Check if multibyte and wide character functionality is available
|
|
# for use by tuklib_mbstr_* functions. If not enough multibyte string
|
|
# support is available in the C library, the functions keep working
|
|
# with the assumption that all strings are a in single-byte character
|
|
# set without combining characters, e.g. US-ASCII or ISO-8859-*.
|
|
#
|
|
# This .m4 file and tuklib_mbstr.h are common to all tuklib_mbstr_*
|
|
# functions, but each function is put into a separate .c file so
|
|
# that it is possible to pick only what is strictly needed.
|
|
#
|
|
# COPYING
|
|
#
|
|
# Author: Lasse Collin
|
|
#
|
|
# This file has been put into the public domain.
|
|
# You can do whatever you want with this file.
|
|
#
|
|
|
|
AC_DEFUN_ONCE([TUKLIB_MBSTR], [
|
|
AC_REQUIRE([TUKLIB_COMMON])
|
|
AC_FUNC_MBRTOWC
|
|
AC_CHECK_FUNCS([wcwidth])
|
|
])dnl
|