Update of /cvsroot/boost/boost/boost/spirit/tree/impl
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15044

Modified Files:
        tree_to_xml.ipp 
Log Message:
Fixed unicode problem in tree_to_xml.

Index: tree_to_xml.ipp
===================================================================
RCS file: /cvsroot/boost/boost/boost/spirit/tree/impl/tree_to_xml.ipp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- tree_to_xml.ipp     14 Mar 2007 20:48:54 -0000      1.16
+++ tree_to_xml.ipp     26 Jun 2007 14:57:44 -0000      1.17
@@ -47,35 +47,28 @@
     struct string_lit<char>
     {
         static char get(char c) { return c; }
-        static char const* get(char const* str = "") { return str; }
+        static std::string get(char const* str = "") { return str; }
     };
 
     template <> 
     struct string_lit<wchar_t>
     {
-        static wchar_t const *to_wchar_t(char const* source)
-        {
-            typedef std::ctype<wchar_t> ctype_t;
-            static wchar_t result[64];
-            
-            using namespace std;        // some systems have size_t in ns std
-            size_t len = strlen(source);
-            BOOST_ASSERT(len < sizeof(result)/sizeof(result[0]));
-
-            std::use_facet<ctype_t>(std::locale())
-                .widen(source, source + len, result);
-
-            return result;
-        }
-
         static wchar_t get(char c) 
         { 
             typedef std::ctype<wchar_t> ctype_t;
             return std::use_facet<ctype_t>(std::locale()).widen(c); 
         }
-        static wchar_t const* get(char const* str = "") 
+        static std::wstring get(char const* source = "") 
         { 
-            return to_wchar_t(str); 
+            typedef std::ctype<wchar_t> ctype_t;
+            
+            using namespace std;        // some systems have size_t in ns std
+            size_t len = strlen(source);
+            std::auto_ptr<wchar_t> result (new wchar_t[len+1]);
+            std::use_facet<ctype_t>(std::locale())
+                .widen(source, source + len, result.get());
+
+            return result.get();
         }
     };
 }


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to