Browse Source

activate LC_CTYPE for 8 bits locale.

Make sure tolower/toupper use the whole 8 bits.
okay deraadt@
thanks to everyone who tested
OPENBSD_3_8
espie 19 years ago
parent
commit
894a3cd7e9
4 changed files with 14 additions and 14 deletions
  1. +3
    -3
      src/include/ctype.h
  2. +3
    -3
      src/lib/libc/string/wcscmp.c
  3. +4
    -4
      src/lib/libc/string/wcsncmp.c
  4. +4
    -4
      src/lib/libc/string/wmemcmp.c

+ 3
- 3
src/include/ctype.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: ctype.h,v 1.17 2004/04/02 22:37:12 avsm Exp $ */
/* $OpenBSD: ctype.h,v 1.18 2005/08/08 05:53:00 espie Exp $ */
/* $NetBSD: ctype.h,v 1.14 1994/10/26 00:55:47 cgd Exp $ */
/*
@ -147,14 +147,14 @@ __CTYPE_INLINE int isxdigit(int c)
__CTYPE_INLINE int tolower(int c)
{
if ((unsigned int)c > 0177)
if ((unsigned int)c > 255)
return (c);
return ((_tolower_tab_ + 1)[c]);
}
__CTYPE_INLINE int toupper(int c)
{
if ((unsigned int)c > 0177)
if ((unsigned int)c > 255)
return (c);
return ((_toupper_tab_ + 1)[c]);
}


+ 3
- 3
src/lib/libc/string/wcscmp.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: wcscmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $ */
/* $OpenBSD: wcscmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $ */
/* $NetBSD: wcscmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $ */
/*-
@ -34,7 +34,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: wcscmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $";
static char *rcsid = "$OpenBSD: wcscmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $";
#endif /* LIBC_SCCS and not lint */
#include <wchar.h>
@ -51,5 +51,5 @@ wcscmp(const wchar_t *s1, const wchar_t *s2)
if (*s1++ == 0)
return (0);
/* XXX assumes wchar_t = int */
return (*(const __nbrune_t *)s1 - *(const __nbrune_t *)--s2);
return (*(const rune_t *)s1 - *(const rune_t *)--s2);
}

+ 4
- 4
src/lib/libc/string/wcsncmp.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: wcsncmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $ */
/* $OpenBSD: wcsncmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $ */
/* $NetBSD: wcsncmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $ */
/*
@ -31,7 +31,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: wcsncmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $";
static char *rcsid = "$OpenBSD: wcsncmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $";
#endif /* LIBC_SCCS and not lint */
#include <wchar.h>
@ -46,8 +46,8 @@ wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
do {
if (*s1 != *s2++) {
/* XXX assumes wchar_t = int */
return (*(const __nbrune_t *)s1 -
*(const __nbrune_t *)--s2);
return (*(const rune_t *)s1 -
*(const rune_t *)--s2);
}
if (*s1++ == 0)
break;


+ 4
- 4
src/lib/libc/string/wmemcmp.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: wmemcmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $ */
/* $OpenBSD: wmemcmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $ */
/* $NetBSD: wmemcmp.c,v 1.3 2003/04/06 18:33:23 tshiozak Exp $ */
/*-
@ -30,7 +30,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: wmemcmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $";
static char *rcsid = "$OpenBSD: wmemcmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $";
#endif /* LIBC_SCCS and not lint */
#include <wchar.h>
@ -44,8 +44,8 @@ wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)
for (i = 0; i < n; i++) {
if (*s1 != *s2) {
/* wchar might be unsigned */
return *(const __nbrune_t *)s1 >
*(const __nbrune_t *)s2 ? 1 : -1;
return *(const rune_t *)s1 >
*(const rune_t *)s2 ? 1 : -1;
}
s1++;
s2++;


Loading…
Cancel
Save