Patch: libstdc++-v3 ctype 8-bit safety for irix through irix6.4

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Wed May 1 19:39:00 GMT 2002


This patch: http://gcc.gnu.org/ml/gcc-patches/2002-03/msg00740.html,
which added 8-bit safety to the ctype stuff, omitted the irix5.2
directory.  (Ben confirmed this via private email.)  Here's a patch to
correct that.

>>>>Note in libstdc++-v3/configure.target we use the irix5.2 directory
for irix up through irix6.4 (and my test platform is irix6.2)

Bootstrapped and testsuite done on mips-sgi-irix6.2 using the 3.1
branch dated 4/28/2002 (because of the recent unrelated irix6
bootstrap breakage I had to use a checkout from a few days old.)

I'd like to install it on the trunk and 3.1 branch also.  Ok?

		Thanks,
		--Kaveh


2002-05-01  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* config/os/irix/irix5.2/bits/ctype_inline.h: Cast to unsigned
	char.

diff -rup orig/egcc-3.1-CVS20020429/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_inline.h egcc-3.1-CVS20020429/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_inline.h
--- orig/egcc-3.1-CVS20020429/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_inline.h	Wed Mar  7 13:33:04 2001
+++ egcc-3.1-CVS20020429/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_inline.h	Tue Apr 30 11:24:01 2002
@@ -1,6 +1,6 @@
 // Locale support -*- C++ -*-
 
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002 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,14 +37,14 @@
   bool
   ctype<char>::
   is(mask __m, char __c) const
-  { return (_M_table)[__c] & __m; }
+  { return (_M_table)[static_cast<unsigned char>(__c)] & __m; }
 
   const char*
   ctype<char>::
   is(const char* __low, const char* __high, mask* __vec) const
   {
     while (__low < __high)
-      *__vec++ = (_M_table)[*__low++];
+      *__vec++ = (_M_table)[static_cast<unsigned char>(*__low++)];
     return __high;
   }
 
@@ -52,7 +52,8 @@
   ctype<char>::
   scan_is(mask __m, const char* __low, const char* __high) const
   {
-    while (__low < __high && !((_M_table)[*__low] & __m))
+    while (__low < __high 
+	   && !((_M_table)[static_cast<unsigned char>(*__low)] & __m))
       ++__low;
     return __low;
   }
@@ -61,12 +62,8 @@
   ctype<char>::
   scan_not(mask __m, const char* __low, const char* __high) const
   {
-    while (__low < __high && ((_M_table + 1)[*__low] & __m) != 0)
+    while (__low < __high 
+	   && ((_M_table + 1)[static_cast<unsigned char>(*__low)] & __m) != 0)
       ++__low;
     return __low;
   }
-
-
-
-
-



More information about the Gcc-patches mailing list