mirror of
git://sourceware.org/git/glibc.git
synced 2025-04-06 14:10:30 +08:00
(_ISwxxx): Renamed from _ISxxx, all uses
changed. They are incompatible with the _ISxxx values from <ctype.h> on little endian machines. (_ISwbit) [__BYTE_ORDER == __LITTLE_ENDIAN]: Correctly transform bit number. This fixes the real bug and restores the integrity of the LC_CTYPE locale file.
This commit is contained in:
parent
49171bd797
commit
306b9df045
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1998 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -55,7 +55,7 @@ typedef unsigned long int wctype_t;
|
||||
#define WEOF (0xffffffffu)
|
||||
#endif
|
||||
|
||||
#ifndef _ISbit
|
||||
#ifndef _ISwbit
|
||||
/* These are all the characteristics of characters.
|
||||
If there get to be more than 16 distinct characteristics,
|
||||
many things must be changed that use `unsigned short int's.
|
||||
@ -66,27 +66,27 @@ typedef unsigned long int wctype_t;
|
||||
|
||||
#include <endian.h>
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define _ISbit(bit) (1 << bit)
|
||||
#define _ISwbit(bit) (1 << bit)
|
||||
#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
|
||||
#define _ISbit(bit) (bit < 8 ? ((1 << bit) << 8) : ((1 << bit) >> 8))
|
||||
#define _ISwbit(bit) (bit < 8 ? 1UL << 24 << bit : 1UL << 8 << bit)
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
_ISupper = _ISbit (0), /* UPPERCASE. */
|
||||
_ISlower = _ISbit (1), /* lowercase. */
|
||||
_ISalpha = _ISbit (2), /* Alphabetic. */
|
||||
_ISdigit = _ISbit (3), /* Numeric. */
|
||||
_ISxdigit = _ISbit (4), /* Hexadecimal numeric. */
|
||||
_ISspace = _ISbit (5), /* Whitespace. */
|
||||
_ISprint = _ISbit (6), /* Printing. */
|
||||
_ISgraph = _ISbit (7), /* Graphical. */
|
||||
_ISblank = _ISbit (8), /* Blank (usually SPC and TAB). */
|
||||
_IScntrl = _ISbit (9), /* Control character. */
|
||||
_ISpunct = _ISbit (10), /* Punctuation. */
|
||||
_ISalnum = _ISbit (11) /* Alphanumeric. */
|
||||
_ISwupper = _ISwbit (0), /* UPPERCASE. */
|
||||
_ISwlower = _ISwbit (1), /* lowercase. */
|
||||
_ISwalpha = _ISwbit (2), /* Alphabetic. */
|
||||
_ISwdigit = _ISwbit (3), /* Numeric. */
|
||||
_ISwxdigit = _ISwbit (4), /* Hexadecimal numeric. */
|
||||
_ISwspace = _ISwbit (5), /* Whitespace. */
|
||||
_ISwprint = _ISwbit (6), /* Printing. */
|
||||
_ISwgraph = _ISwbit (7), /* Graphical. */
|
||||
_ISwblank = _ISwbit (8), /* Blank (usually SPC and TAB). */
|
||||
_ISwcntrl = _ISwbit (9), /* Control character. */
|
||||
_ISwpunct = _ISwbit (10), /* Punctuation. */
|
||||
_ISwalnum = _ISwbit (11) /* Alphanumeric. */
|
||||
};
|
||||
#endif /* Not _ISbit */
|
||||
#endif /* Not _ISwbit */
|
||||
|
||||
|
||||
/*
|
||||
@ -180,20 +180,20 @@ extern wint_t towctrans __P ((wint_t __wc, wctrans_t __desc));
|
||||
|
||||
|
||||
#ifndef __NO_WCTYPE
|
||||
#define iswalnum(wc) __iswctype ((wc), _ISalnum)
|
||||
#define iswalpha(wc) __iswctype ((wc), _ISalpha)
|
||||
#define iswcntrl(wc) __iswctype ((wc), _IScntrl)
|
||||
#define iswdigit(wc) __iswctype ((wc), _ISdigit)
|
||||
#define iswlower(wc) __iswctype ((wc), _ISlower)
|
||||
#define iswgraph(wc) __iswctype ((wc), _ISgraph)
|
||||
#define iswprint(wc) __iswctype ((wc), _ISprint)
|
||||
#define iswpunct(wc) __iswctype ((wc), _ISpunct)
|
||||
#define iswspace(wc) __iswctype ((wc), _ISspace)
|
||||
#define iswupper(wc) __iswctype ((wc), _ISupper)
|
||||
#define iswxdigit(wc) __iswctype ((wc), _ISxdigit)
|
||||
#define iswalnum(wc) __iswctype ((wc), _ISwalnum)
|
||||
#define iswalpha(wc) __iswctype ((wc), _ISwalpha)
|
||||
#define iswcntrl(wc) __iswctype ((wc), _ISwcntrl)
|
||||
#define iswdigit(wc) __iswctype ((wc), _ISwdigit)
|
||||
#define iswlower(wc) __iswctype ((wc), _ISwlower)
|
||||
#define iswgraph(wc) __iswctype ((wc), _ISwgraph)
|
||||
#define iswprint(wc) __iswctype ((wc), _ISwprint)
|
||||
#define iswpunct(wc) __iswctype ((wc), _ISwpunct)
|
||||
#define iswspace(wc) __iswctype ((wc), _ISwspace)
|
||||
#define iswupper(wc) __iswctype ((wc), _ISwupper)
|
||||
#define iswxdigit(wc) __iswctype ((wc), _ISwxdigit)
|
||||
|
||||
#ifdef __USE_GNU
|
||||
#define iswblank(wc) __iswctype ((wc), _ISblank)
|
||||
#define iswblank(wc) __iswctype ((wc), _ISwblank)
|
||||
#endif
|
||||
|
||||
/* Pointer to conversion tables. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user