diff options
-rw-r--r-- | xsd-frontend/xml.hxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/xsd-frontend/xml.hxx b/xsd-frontend/xml.hxx index 1324a7f..7424b3e 100644 --- a/xsd-frontend/xml.hxx +++ b/xsd-frontend/xml.hxx @@ -22,13 +22,12 @@ namespace XSDFrontend inline String - transcode (XMLCh const* s) + transcode (XMLCh const* s, Size length) { if (sizeof (WideChar) == 4) { // UTF-32 // - Size length (Xerces::XMLString::stringLen (s)); XMLCh const* end (s + length); // Find what the resulting buffer size will be. @@ -79,22 +78,26 @@ namespace XSDFrontend { // UTF-16 // - return String (reinterpret_cast<const WideChar*> (s)); + return String (reinterpret_cast<const WideChar*> (s), length); } else return String (); } inline + String + transcode (XMLCh const* s) + { + return transcode (s, Xerces::XMLString::stringLen (s)); + } + + inline NarrowString transcode_to_narrow (XMLCh const* xs) { Char* s (Xerces::XMLString::transcode (xs)); - NarrowString r (s); - Xerces::XMLString::release (&s); - return r; } |