re PR libstdc++/22087 (ctype<char> tables are offset by one on DJGPP)

2005-10-29  Carey Evans  <carey.evans@gmail.com>

	PR libstdc++/22087
	* config/os/djgpp/ctype_inline.h: Fix.
	* config/os/djgpp/ctype_noninline.h: Likewise.

From-SVN: r105999
This commit is contained in:
Carey Evans 2005-10-29 22:44:23 +00:00 committed by Paolo Carlini
parent 06bc79e0bb
commit f33e4b3d2e
3 changed files with 20 additions and 12 deletions

View File

@ -1,3 +1,9 @@
2005-10-29 Carey Evans <carey.evans@gmail.com>
PR libstdc++/22087
* config/os/djgpp/ctype_inline.h: Fix.
* config/os/djgpp/ctype_noninline.h: Likewise.
2005-10-28 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24559

View File

@ -1,6 +1,6 @@
// Locale support -*- C++ -*-
// Copyright (C) 2001 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -37,7 +37,7 @@
bool
ctype<char>::
is(mask __m, char __c) const
{ return _M_table[static_cast<unsigned char>(__c + 1)] & __m; }
{ return _M_table[static_cast<unsigned char>(__c)] & __m; }
const char*
ctype<char>::
@ -52,7 +52,8 @@
ctype<char>::
scan_is(mask __m, const char* __low, const char* __high) const
{
while (__low < __high && !this->is(__m, *__low))
while (__low < __high
&& !(_M_table[static_cast<unsigned char>(*__low)] & __m))
++__low;
return __low;
}
@ -61,7 +62,8 @@
ctype<char>::
scan_not(mask __m, const char* __low, const char* __high) const
{
while (__low < __high && this->is(__m, *__low) != 0)
while (__low < __high
&& (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
++__low;
return __low;
}

View File

@ -1,6 +1,6 @@
// Locale support -*- C++ -*-
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -35,13 +35,13 @@
const ctype_base::mask*
ctype<char>::classic_table() throw()
{ return 0; }
{ return __dj_ctype_flags+1; }
ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
size_t __refs)
: facet(__refs), _M_del(__table != 0 && __del),
_M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower),
_M_table(__table ? __table : __dj_ctype_flags)
_M_table(__table ? __table : classic_table())
{
memset(_M_widen, 0, sizeof(_M_widen));
_M_widen_ok = 0;
@ -52,7 +52,7 @@
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
: facet(__refs), _M_del(__table != 0 && __del),
_M_toupper(__dj_ctype_toupper), _M_tolower(__dj_ctype_tolower),
_M_table(__table ? __table : __dj_ctype_flags)
_M_table(__table ? __table : classic_table())
{
memset(_M_widen, 0, sizeof(_M_widen));
_M_widen_ok = 0;
@ -62,14 +62,14 @@
char
ctype<char>::do_toupper(char __c) const
{ return _M_toupper[static_cast<int>(__c)+1]; }
{ return _M_toupper[static_cast<unsigned char>(__c)]; }
const char*
ctype<char>::do_toupper(char* __low, const char* __high) const
{
while (__low < __high)
{
*__low = ::toupper(static_cast<int> (*__low));
*__low = _M_toupper[static_cast<unsigned char>(*__low)];
++__low;
}
return __high;
@ -77,14 +77,14 @@
char
ctype<char>::do_tolower(char __c) const
{ return _M_tolower[static_cast<int>(__c)+1]; }
{ return _M_tolower[static_cast<unsigned char>(__c)]; }
const char*
ctype<char>::do_tolower(char* __low, const char* __high) const
{
while (__low < __high)
{
*__low = ::tolower(static_cast<int> (*__low));
*__low = _M_tolower[static_cast<unsigned char>(*__low)];
++__low;
}
return __high;