$NetBSD: patch-ab,v 1.1.1.1 2009/11/24 11:46:01 obache Exp $

--- src/scim_chartraits.cpp.orig	2008-11-02 06:42:37.000000000 +0000
+++ src/scim_chartraits.cpp
@@ -26,4 +26,5 @@
  */
 
+#if 0
 #include <string>
 #include "scim_types.h"
@@ -41,27 +42,33 @@ namespace std
   
 template<>
-void
-char_traits<ucs4_t>::assign(char_type& __c1, const char_type& __c2)
+struct char_traits<ucs4_t>
+{
+
+typedef ucs4_t char_type;
+typedef ucs4_t int_type;
+typedef streampos pos_type;
+typedef streamoff off_type;
+typedef mbstate_t state_type;
+
+static void
+assign(char_type& __c1, const char_type& __c2)
 {
     __c1 = __c2;
 }
 
-template<>
-bool 
-char_traits<ucs4_t>::eq(const char_type& __c1, const char_type& __c2)
+static bool 
+eq(const char_type& __c1, const char_type& __c2)
 {
     return __c1 == __c2;
 }
 
-template<>
-bool 
-char_traits<ucs4_t>::lt(const char_type& __c1, const char_type& __c2)
+static bool 
+lt(const char_type& __c1, const char_type& __c2)
 {
     return __c1 < __c2;
 }
 
-template<>
-char_traits<ucs4_t>::char_type*
-char_traits<ucs4_t>::assign(char_type* __s, size_t __n, char_type __a)
+static char_type*
+assign(char_type* __s, size_t __n, char_type __a)
 {
     char_type* dest = __s;
@@ -71,7 +78,6 @@ char_traits<ucs4_t>::assign(char_type* _
 }
 
-template<>
-char_traits<ucs4_t>::char_type*
-char_traits<ucs4_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
+static char_type*
+copy(char_type* __s1, const char_type* __s2, size_t __n)
 {
     char_type* dest = __s1;
@@ -82,13 +88,12 @@ char_traits<ucs4_t>::copy(char_type* __s
 }
 
-template<>
-char_traits<ucs4_t>::char_type*
-char_traits<ucs4_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
+static char_type*
+move(char_type* __s1, const char_type* __s2, size_t __n)
 {
-    if (__s1 + __n > __s2) {
+    if (__s1 > __s2) {
         char_type* dest = __s1 + __n - 1;
-        const char_type* from = __s2;
+        const char_type* from = __s2 + __n - 1;
         while (__n-- > 0)
-            *(dest--) = *(from++);
+            *(dest--) = *(from--);
         return __s1;
     } else {
@@ -97,7 +102,6 @@ char_traits<ucs4_t>::move(char_type* __s
 }
 
-template<>
-size_t
-char_traits<ucs4_t>::length(const char_type* __s)
+static size_t
+length(const char_type* __s)
 {
     size_t __result = 0;
@@ -107,7 +111,6 @@ char_traits<ucs4_t>::length(const char_t
 }
 
-template<>
-int
-char_traits<ucs4_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
+static int
+compare(const char_type* __s1, const char_type* __s2, size_t __n)
 {
     while ( (*__s1 == *__s2++) && __n-- > 0 )
@@ -118,7 +121,6 @@ char_traits<ucs4_t>::compare(const char_
 }
 
-template<>
-const char_traits<ucs4_t>::char_type*
-char_traits<ucs4_t>::find(const char_type* __s, size_t __n, const char_type& __a)
+static const char_type*
+find(const char_type* __s, size_t __n, const char_type& __a)
 {
     while (__n-- > 0) {
@@ -130,40 +132,38 @@ char_traits<ucs4_t>::find(const char_typ
 }
 
-template<>
-char_traits<ucs4_t>::char_type
-char_traits<ucs4_t>::to_char_type (const int_type& __c)
+static char_type
+to_char_type(const int_type& __c)
 {
     return static_cast<char_type>(__c);
 }
 
-template<>
-char_traits<ucs4_t>::int_type
-char_traits<ucs4_t>::to_int_type (const char_type& __c)
+static int_type
+to_int_type(const char_type& __c)
 {
     return static_cast<int_type>(__c);
 }
 
-template<>
-bool
-char_traits<ucs4_t>::eq_int_type(const int_type& __c1, const int_type& __c2)
+static bool
+eq_int_type(const int_type& __c1, const int_type& __c2)
 {
     return __c1 == __c2;
 }
 
-template<>
-char_traits<ucs4_t>::int_type
-char_traits<ucs4_t>::eof ()
+static int_type
+eof()
 {
-    return static_cast<int_type>(EOF);
+    return static_cast<int_type>(-1);
 }
 
-template<>
-char_traits<ucs4_t>::int_type
-char_traits<ucs4_t>::not_eof (const int_type& __c)
+static int_type
+not_eof(const int_type& __c)
 {
-    return (__c == eof()) ? 0 : __c;
+    return eq_int_type(__c, eof()) ? static_cast<int_type>(0) : __c;
 }
 
-}
+}; //struct char_traits<ucs4_t>
+
+} //namespace std
+#endif
 #endif
 
