From 5be04ec2ceb1df77afbca4fcbf9e92a712612d6f Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:27:12 +0100 Subject: Sync with the latest Gnulib code (d4ec02b3cc) --- gl/localeconv.c | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) (limited to 'gl/localeconv.c') diff --git a/gl/localeconv.c b/gl/localeconv.c index 60c050f4..10fc7b74 100644 --- a/gl/localeconv.c +++ b/gl/localeconv.c @@ -1,5 +1,5 @@ /* Query locale dependent information for formatting numbers. - Copyright (C) 2012-2023 Free Software Foundation, Inc. + Copyright (C) 2012-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -19,10 +19,14 @@ /* Specification. */ #include +#include + #if HAVE_STRUCT_LCONV_DECIMAL_POINT +# define FIX_CHAR_VALUE(x) ((x) >= 0 ? (x) : CHAR_MAX) + /* Override for platforms where 'struct lconv' lacks the int_p_*, int_n_* - members. */ + members or where fields of type 'char' are set to -1 instead of CHAR_MAX. */ struct lconv * localeconv (void) @@ -41,21 +45,30 @@ localeconv (void) result.positive_sign = sys_result->positive_sign; result.negative_sign = sys_result->negative_sign; result.currency_symbol = sys_result->currency_symbol; - result.frac_digits = sys_result->frac_digits; - result.p_cs_precedes = sys_result->p_cs_precedes; - result.p_sign_posn = sys_result->p_sign_posn; - result.p_sep_by_space = sys_result->p_sep_by_space; - result.n_cs_precedes = sys_result->n_cs_precedes; - result.n_sign_posn = sys_result->n_sign_posn; - result.n_sep_by_space = sys_result->n_sep_by_space; + result.frac_digits = FIX_CHAR_VALUE (sys_result->frac_digits); + result.p_cs_precedes = FIX_CHAR_VALUE (sys_result->p_cs_precedes); + result.p_sign_posn = FIX_CHAR_VALUE (sys_result->p_sign_posn); + result.p_sep_by_space = FIX_CHAR_VALUE (sys_result->p_sep_by_space); + result.n_cs_precedes = FIX_CHAR_VALUE (sys_result->n_cs_precedes); + result.n_sign_posn = FIX_CHAR_VALUE (sys_result->n_sign_posn); + result.n_sep_by_space = FIX_CHAR_VALUE (sys_result->n_sep_by_space); result.int_curr_symbol = sys_result->int_curr_symbol; - result.int_frac_digits = sys_result->int_frac_digits; - result.int_p_cs_precedes = sys_result->p_cs_precedes; - result.int_p_sign_posn = sys_result->p_sign_posn; - result.int_p_sep_by_space = sys_result->p_sep_by_space; - result.int_n_cs_precedes = sys_result->n_cs_precedes; - result.int_n_sign_posn = sys_result->n_sign_posn; - result.int_n_sep_by_space = sys_result->n_sep_by_space; + result.int_frac_digits = FIX_CHAR_VALUE (sys_result->int_frac_digits); +# if HAVE_STRUCT_LCONV_INT_P_CS_PRECEDES + result.int_p_cs_precedes = FIX_CHAR_VALUE (sys_result->int_p_cs_precedes); + result.int_p_sign_posn = FIX_CHAR_VALUE (sys_result->int_p_sign_posn); + result.int_p_sep_by_space = FIX_CHAR_VALUE (sys_result->int_p_sep_by_space); + result.int_n_cs_precedes = FIX_CHAR_VALUE (sys_result->int_n_cs_precedes); + result.int_n_sign_posn = FIX_CHAR_VALUE (sys_result->int_n_sign_posn); + result.int_n_sep_by_space = FIX_CHAR_VALUE (sys_result->int_n_sep_by_space); +# else + result.int_p_cs_precedes = FIX_CHAR_VALUE (sys_result->p_cs_precedes); + result.int_p_sign_posn = FIX_CHAR_VALUE (sys_result->p_sign_posn); + result.int_p_sep_by_space = FIX_CHAR_VALUE (sys_result->p_sep_by_space); + result.int_n_cs_precedes = FIX_CHAR_VALUE (sys_result->n_cs_precedes); + result.int_n_sign_posn = FIX_CHAR_VALUE (sys_result->n_sign_posn); + result.int_n_sep_by_space = FIX_CHAR_VALUE (sys_result->n_sep_by_space); +# endif return &result; } @@ -64,8 +77,6 @@ localeconv (void) /* Override for platforms where 'struct lconv' is a dummy. */ -# include - struct lconv * localeconv (void) { -- cgit v1.2.3-74-g34f1