1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 19:50:24 +02:00

Fix compilation of `libguile-i18n' on NetBSD.

* libguile/i18n.c (str_upcase, str_downcase, scm_char_locale_downcase,
  scm_char_locale_upcase): Cast chars to `int' when invoking `toupper ()'
  et al. to avoid "array subscript has type 'char'" on NetBSD.
  Reported by Greg Toxel <gdt@ir.bbn.com>.
This commit is contained in:
Ludovic Courtès 2008-09-02 23:01:47 +02:00
parent 37a5203955
commit 4e641322d3

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2006, 2007 Free Software Foundation, Inc. /* Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -769,7 +769,7 @@ static inline void
str_upcase (register char *dst, register const char *src) str_upcase (register char *dst, register const char *src)
{ {
for (; *src != '\0'; src++, dst++) for (; *src != '\0'; src++, dst++)
*dst = toupper (*src); *dst = toupper ((int) *src);
*dst = '\0'; *dst = '\0';
} }
@ -777,7 +777,7 @@ static inline void
str_downcase (register char *dst, register const char *src) str_downcase (register char *dst, register const char *src)
{ {
for (; *src != '\0'; src++, dst++) for (; *src != '\0'; src++, dst++)
*dst = tolower (*src); *dst = tolower ((int) *src);
*dst = '\0'; *dst = '\0';
} }
@ -1120,13 +1120,13 @@ SCM_DEFINE (scm_char_locale_downcase, "char-locale-downcase", 1, 1, 0,
if (c_locale != NULL) if (c_locale != NULL)
{ {
#ifdef USE_GNU_LOCALE_API #ifdef USE_GNU_LOCALE_API
c_result = tolower_l (c_chr, c_locale); c_result = tolower_l ((int) c_chr, c_locale);
#else #else
RUN_IN_LOCALE_SECTION (c_locale, c_result = tolower (c_chr)); RUN_IN_LOCALE_SECTION (c_locale, c_result = tolower ((int) c_chr));
#endif #endif
} }
else else
c_result = tolower (c_chr); c_result = tolower ((int) c_chr);
return (SCM_MAKE_CHAR (c_result)); return (SCM_MAKE_CHAR (c_result));
} }
@ -1150,13 +1150,13 @@ SCM_DEFINE (scm_char_locale_upcase, "char-locale-upcase", 1, 1, 0,
if (c_locale != NULL) if (c_locale != NULL)
{ {
#ifdef USE_GNU_LOCALE_API #ifdef USE_GNU_LOCALE_API
c_result = toupper_l (c_chr, c_locale); c_result = toupper_l ((int) c_chr, c_locale);
#else #else
RUN_IN_LOCALE_SECTION (c_locale, c_result = toupper (c_chr)); RUN_IN_LOCALE_SECTION (c_locale, c_result = toupper ((int) c_chr));
#endif #endif
} }
else else
c_result = toupper (c_chr); c_result = toupper ((int) c_chr);
return (SCM_MAKE_CHAR (c_result)); return (SCM_MAKE_CHAR (c_result));
} }