mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 13:00:06 +00:00
1d8e3a2c66
The handling of mon_decimal_point is incorrect when it comes to handling the empty "" value. The existing parser in monetary_read() will correctly handle setting the non-wide-character value and the wide-character value e.g. STR_ELEM_WC(mon_decimal_point) if they are set in the locale definition. However, in monetary_finish() we have conflicting TEST_ELEM() which sets a default value (if the locale definition doesn't include one), and subsequent code which looks for mon_decimal_point to be NULL to issue a specific error message and set the defaults. The latter is unused because TEST_ELEM() always sets a default. The simplest solution is to remove the TEST_ELEM() check, and allow the existing check to look to see if mon_decimal_point is NULL and set an appropriate default. The final fix is to move the setting of mon_decimal_point_wc so it occurs only when mon_decimal_point is being set to a default, keeping both values consistent. There is no way to tell the difference between mon_decimal_point_wc having been set to the empty string and not having been defined at all, for that distinction we must use mon_decimal_point being NULL or "", and so we must logically set the default together with mon_decimal_point. Lastly, there are more fixes similar to this that could be made to ld-monetary.c, but we avoid that in order to fix just the code required for mon_decimal_point, which impacts the ability for C.UTF-8 to set mon_decimal_point to "", since without this fix we end up with an inconsistent setting of mon_decimal_point set to "", but mon_decimal_point_wc set to "." which is incorrect. Tested on x86_64 and i686 without regression. Reviewed-by: Florian Weimer <fweimer@redhat.com> |
||
---|---|---|
.. | ||
3level.h | ||
charmap-dir.c | ||
charmap-dir.h | ||
charmap-kw.gperf | ||
charmap-kw.h | ||
charmap.c | ||
charmap.h | ||
config.h | ||
ld-address.c | ||
ld-collate.c | ||
ld-ctype.c | ||
ld-identification.c | ||
ld-measurement.c | ||
ld-messages.c | ||
ld-monetary.c | ||
ld-name.c | ||
ld-numeric.c | ||
ld-paper.c | ||
ld-telephone.c | ||
ld-time.c | ||
linereader.c | ||
linereader.h | ||
locale-spec.c | ||
locale.c | ||
localedef.c | ||
localedef.h | ||
locarchive.c | ||
locfile-kw.gperf | ||
locfile-kw.h | ||
locfile-token.h | ||
locfile.c | ||
locfile.h | ||
record-status.c | ||
record-status.h | ||
repertoire.c | ||
repertoire.h | ||
simple-hash.c | ||
simple-hash.h | ||
xasprintf.c | ||
xmalloc.c | ||
xstrdup.c |