X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Funicode.cpp;h=b54d1ed2ddfcf66583006218424663ba50ba2341;hb=1b63b1422645ba9fa856a28d31c3f8c238ffff4c;hp=b8deeb32912d14ae6bda0fab1e87c1aae43bf388;hpb=350a2015122af9f948c7bbf8932448cf1c2ff05b;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/unicode.cpp b/xmltooling/unicode.cpp index b8deeb3..b54d1ed 100644 --- a/xmltooling/unicode.cpp +++ b/xmltooling/unicode.cpp @@ -1,17 +1,21 @@ -/* - * Copyright 2001-2007 Internet2 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at +/** + * Licensed to the University Corporation for Advanced Internet + * Development, Inc. (UCAID) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. * - * http://www.apache.org/licenses/LICENSE-2.0 + * UCAID licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the + * License at * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. */ /** @@ -26,12 +30,14 @@ #include #include +using namespace xercesc; + static const XMLCh UTF8[]={ chLatin_U, chLatin_T, chLatin_F, chDigit_8, chNull }; char* xmltooling::toUTF8(const XMLCh* src, bool use_malloc) { - unsigned int eaten,factor=1,bufsize; - unsigned int srclen=XMLString::stringLen(src); + xsecsize_t eaten,factor=1,bufsize; + xsecsize_t srclen=XMLString::stringLen(src); XMLUTF8Transcoder t(UTF8, 4096); // block size isn't used any more anyway do { bufsize = factor*srclen + 10; @@ -63,8 +69,8 @@ char* xmltooling::toUTF8(const XMLCh* src, bool use_malloc) XMLCh* xmltooling::fromUTF8(const char* src, bool use_malloc) { - unsigned int eaten; - unsigned int srclen=strlen(src); + xsecsize_t eaten; + xsecsize_t srclen=strlen(src); XMLUTF8Transcoder t(UTF8, 4096); // block size isn't used any more anyway XMLCh* buf = use_malloc ? reinterpret_cast(malloc((srclen+1)*sizeof(XMLCh))) : new XMLCh[srclen + 1]; unsigned char* sizes=new unsigned char[srclen]; @@ -86,3 +92,8 @@ std::ostream& xmltooling::operator<<(std::ostream& ostr, const XMLCh* s) } return ostr; } + +std::ostream& xmltooling::operator<<(std::ostream& ostr, const xstring& s) +{ + return ostr << s.c_str(); +}