Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/locale cast CHAR_MAX to (char) for unsigned charact...



details:   https://anonhg.NetBSD.org/src/rev/8c425db1367f
branches:  trunk
changeset: 778296:8c425db1367f
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 21 14:11:24 2012 +0000

description:
cast CHAR_MAX to (char) for unsigned character machines

diffstat:

 lib/libc/locale/fix_grouping.c  |   6 +++---
 lib/libc/locale/global_locale.c |  36 ++++++++++++++++++++----------------
 2 files changed, 23 insertions(+), 19 deletions(-)

diffs (91 lines):

diff -r 50c572638f44 -r 8c425db1367f lib/libc/locale/fix_grouping.c
--- a/lib/libc/locale/fix_grouping.c    Wed Mar 21 14:10:47 2012 +0000
+++ b/lib/libc/locale/fix_grouping.c    Wed Mar 21 14:11:24 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fix_grouping.c,v 1.5 2010/06/01 13:52:08 tnozaki Exp $ */
+/* $NetBSD: fix_grouping.c,v 1.6 2012/03/21 14:11:24 christos Exp $ */
 
 /*
  * Copyright (c) 2001 Alexey Zelkin <phantom%FreeBSD.org@localhost>
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fix_grouping.c,v 1.5 2010/06/01 13:52:08 tnozaki Exp $");
+__RCSID("$NetBSD: fix_grouping.c,v 1.6 2012/03/21 14:11:24 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <limits.h>
@@ -44,7 +44,7 @@
 #include "fix_grouping.h"
 
 #ifndef NBCHAR_MAX
-#define NBCHAR_MAX     CHAR_MAX
+#define NBCHAR_MAX     (char)CHAR_MAX
 #endif
 
 #ifndef __UNCONST
diff -r 50c572638f44 -r 8c425db1367f lib/libc/locale/global_locale.c
--- a/lib/libc/locale/global_locale.c   Wed Mar 21 14:10:47 2012 +0000
+++ b/lib/libc/locale/global_locale.c   Wed Mar 21 14:11:24 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: global_locale.c,v 1.12 2012/01/20 16:31:29 joerg Exp $ */
+/* $NetBSD: global_locale.c,v 1.13 2012/03/21 14:11:24 christos Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: global_locale.c,v 1.12 2012/01/20 16:31:29 joerg Exp $");
+__RCSID("$NetBSD: global_locale.c,v 1.13 2012/03/21 14:11:24 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -43,6 +43,10 @@
 #include "runetype_local.h"
 #include "setlocale_local.h"
 
+#ifndef NBCHAR_MAX
+#define NBCHAR_MAX (char)CHAR_MAX
+#endif
+
 static struct lconv _global_ldata = {
        .decimal_point          = __UNCONST("."),
        .thousands_sep          = __UNCONST(""),
@@ -54,20 +58,20 @@
        .mon_grouping           = __UNCONST(""),
        .positive_sign          = __UNCONST(""),
        .negative_sign          = __UNCONST(""),
-       .int_frac_digits        = CHAR_MAX,
-       .frac_digits            = CHAR_MAX,
-       .p_cs_precedes          = CHAR_MAX,
-       .p_sep_by_space         = CHAR_MAX,
-       .n_cs_precedes          = CHAR_MAX,
-       .n_sep_by_space         = CHAR_MAX,
-       .p_sign_posn            = CHAR_MAX,
-       .n_sign_posn            = CHAR_MAX,
-       .int_p_cs_precedes      = CHAR_MAX,
-       .int_n_cs_precedes      = CHAR_MAX,
-       .int_p_sep_by_space     = CHAR_MAX,
-       .int_n_sep_by_space     = CHAR_MAX,
-       .int_p_sign_posn        = CHAR_MAX,
-       .int_n_sign_posn        = CHAR_MAX,
+       .int_frac_digits        = NBCHAR_MAX,
+       .frac_digits            = NBCHAR_MAX,
+       .p_cs_precedes          = NBCHAR_MAX,
+       .p_sep_by_space         = NBCHAR_MAX,
+       .n_cs_precedes          = NBCHAR_MAX,
+       .n_sep_by_space         = NBCHAR_MAX,
+       .p_sign_posn            = NBCHAR_MAX,
+       .n_sign_posn            = NBCHAR_MAX,
+       .int_p_cs_precedes      = NBCHAR_MAX,
+       .int_n_cs_precedes      = NBCHAR_MAX,
+       .int_p_sep_by_space     = NBCHAR_MAX,
+       .int_n_sep_by_space     = NBCHAR_MAX,
+       .int_p_sign_posn        = NBCHAR_MAX,
+       .int_n_sign_posn        = NBCHAR_MAX,
 };
 
 static const char *_global_items[(size_t)ALT_DIGITS + 1] = {



Home | Main Index | Thread Index | Old Index