This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] libstdc++/22087


Hi,

I'm committing to mainline this patch that touches only the DJGPP config
files and has been approved in the audit trail by DJ Delorie.

Paolo.

///////////////
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.
Index: config/os/djgpp/ctype_noninline.h
===================================================================
--- config/os/djgpp/ctype_noninline.h	(revision 105994)
+++ config/os/djgpp/ctype_noninline.h	(working copy)
@@ -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;
Index: config/os/djgpp/ctype_inline.h
===================================================================
--- config/os/djgpp/ctype_inline.h	(revision 105994)
+++ config/os/djgpp/ctype_inline.h	(working copy)
@@ -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;
   }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]