This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


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

char_traits


Hello,
Here is a patch which fixes parameter types for char_traits<> 
-- nearly all size_t's are currently int_type's. 


Regards,
Vadim Egorov

2000-04-28  Vadim Egorov  <egorovv@mailandnews.com>

	* bits/char_traits.h (assign): fix parameter types

Index: char_traits.h
===================================================================
RCS file: /cvs/libstdc++/libstdc++/bits/char_traits.h,v
retrieving revision 1.28
diff -c -r1.28 char_traits.h
*** char_traits.h	2000/03/21 06:24:04	1.28
--- char_traits.h	2000/04/28 15:48:32
***************
*** 79,87 ****
        { return __c1 < __c2; }
  
        static int 
!       compare(const char_type* __s1, const char_type* __s2, int_type __n)
        { 
! 	for (int_type __i = 0; __i < __n; ++__i)
  	  if (!eq(__s1[__i],__s2[__i]))
  	    return lt(__s1[__i],__s2[__i]) ? -1 : 1;
  	return 0; 
--- 79,87 ----
        { return __c1 < __c2; }
  
        static int 
!       compare(const char_type* __s1, const char_type* __s2, size_t __n)
        { 
! 	for (size_t __i = 0; __i < __n; ++__i)
  	  if (!eq(__s1[__i],__s2[__i]))
  	    return lt(__s1[__i],__s2[__i]) ? -1 : 1;
  	return 0; 
***************
*** 96,120 ****
        }
  
        static const char_type* 
!       find(const char_type* __s, int __n, const char_type& __a)
        { 
! 	for (const char_type* __p = __s; __p < __s+__n; ++__p)
  	  if (*__p == __a) return __p;
  	return 0;
        }
  
        static char_type* 
!       move(char_type* __s1, const char_type* __s2, int_type __n)
        { return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); }
  
        static char_type* 
!       copy(char_type* __s1, const char_type* __s2, int_type __n)
        { return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); }
  
        static char_type* 
!       assign(char_type* __s, int_type __n, char_type __a)
        { 
! 	for (char_type* __p = __s; __p - __s < __n; ++__p) 
  	  assign(*__p, __a);
          return __s; 
        }
--- 96,120 ----
        }
  
        static const char_type* 
!       find(const char_type* __s, size_t __n, const char_type& __a)
        { 
! 	for (const char_type* __p = __s; __p < __s +__n; ++__p)
  	  if (*__p == __a) return __p;
  	return 0;
        }
  
        static char_type* 
!       move(char_type* __s1, const char_type* __s2, size_t __n)
        { return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); }
  
        static char_type* 
!       copy(char_type* __s1, const char_type* __s2, size_t __n)
        { return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); }
  
        static char_type* 
!       assign(char_type* __s, size_t __n, char_type __a)
        { 
! 	for (char_type* __p = __s; __p < __s + __n; ++__p) 
  	  assign(*__p, __a);
          return __s; 
        }
***************
*** 167,173 ****
        { return __c1 < __c2; }
  
        static int 
!       compare(const char_type* __s1, const char_type* __s2, int_type __n)
        { return memcmp(__s1, __s2, __n); }
  
        static size_t
--- 167,173 ----
        { return __c1 < __c2; }
  
        static int 
!       compare(const char_type* __s1, const char_type* __s2, size_t __n)
        { return memcmp(__s1, __s2, __n); }
  
        static size_t
***************
*** 175,193 ****
        { return strlen(__s); }
  
        static const char_type* 
!       find(const char_type* __s, int __n, const char_type& __a)
        { return static_cast<char*>(memchr(__s, __a, __n)); }
  
        static char_type* 
!       move(char_type* __s1, const char_type* __s2, int_type __n)
        { return static_cast<char*>(memmove(__s1, __s2, __n)); }
  
        static char_type* 
!       copy(char_type* __s1, const char_type* __s2, int_type __n)
        {  return static_cast<char*>(memcpy(__s1, __s2, __n)); }
  
        static char_type* 
!       assign(char_type* __s, int_type __n, char_type __a)
        { return static_cast<char*>(memset(__s, __a, __n)); }
  
        static char_type 
--- 175,193 ----
        { return strlen(__s); }
  
        static const char_type* 
!       find(const char_type* __s, size_t __n, const char_type& __a)
        { return static_cast<char*>(memchr(__s, __a, __n)); }
  
        static char_type* 
!       move(char_type* __s1, const char_type* __s2, size_t __n)
        { return static_cast<char*>(memmove(__s1, __s2, __n)); }
  
        static char_type* 
!       copy(char_type* __s1, const char_type* __s2, size_t __n)
        {  return static_cast<char*>(memcpy(__s1, __s2, __n)); }
  
        static char_type* 
!       assign(char_type* __s, size_t __n, char_type __a)
        { return static_cast<char*>(memset(__s, __a, __n)); }
  
        static char_type 
***************
*** 240,246 ****
        { return __c1 < __c2; }
  
        static int 
!       compare(const char_type* __s1, const char_type* __s2, int_type __n)
        { 
  	for (int_type __i = 0; __i < __n; ++__i)
  	  if (!eq(__s1[__i], __s2[__i]))
--- 240,246 ----
        { return __c1 < __c2; }
  
        static int 
!       compare(const char_type* __s1, const char_type* __s2, size_t __n)
        { 
  	for (int_type __i = 0; __i < __n; ++__i)
  	  if (!eq(__s1[__i], __s2[__i]))
***************
*** 258,283 ****
        }
  
        static const char_type* 
!       find (const char_type* __s, int __n, const char_type& __a)
        { 
! 	for (const char_type* __p = __s; __p < __s+__n; ++__p)
  	  if (*__p == __a) 
  	    return __p;
  	return 0;
        }
  
        static char_type* 
!       move(char_type* __s1, const char_type* __s2, int_type __n)
        { return static_cast<wchar_t*>(memmove(__s1, __s2, 
  					     __n * sizeof(wchar_t))); }
  
        static char_type* 
!       copy(char_type* __s1, const char_type* __s2, int_type __n)
        { return static_cast<wchar_t*>(memcpy(__s1, __s2, 
  					    __n * sizeof(wchar_t))); }
  
        static char_type* 
!       assign(char_type* __s, int_type __n, char_type __a)
        { 
  	for (char_type* __p = __s; __p < __s + __n; ++__p) 
  	  assign(*__p, __a);
--- 258,283 ----
        }
  
        static const char_type* 
!       find (const char_type* __s, size_t __n, const char_type& __a)
        { 
! 	for (const char_type* __p = __s; __p < __s +__n; ++__p)
  	  if (*__p == __a) 
  	    return __p;
  	return 0;
        }
  
        static char_type* 
!       move(char_type* __s1, const char_type* __s2, size_t __n)
        { return static_cast<wchar_t*>(memmove(__s1, __s2, 
  					     __n * sizeof(wchar_t))); }
  
        static char_type* 
!       copy(char_type* __s1, const char_type* __s2, size_t __n)
        { return static_cast<wchar_t*>(memcpy(__s1, __s2, 
  					    __n * sizeof(wchar_t))); }
  
        static char_type* 
!       assign(char_type* __s, size_t __n, char_type __a)
        { 
  	for (char_type* __p = __s; __p < __s + __n; ++__p) 
  	  assign(*__p, __a);


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