diff options
-rw-r--r-- | sax/qa/cppunit/attributes.cxx | 10 | ||||
-rw-r--r-- | sax/qa/cppunit/xmlimport.cxx | 22 | ||||
-rw-r--r-- | sax/source/expatwrap/sax_expat.cxx | 10 | ||||
-rw-r--r-- | sax/source/expatwrap/saxwriter.cxx | 39 | ||||
-rw-r--r-- | sax/source/fastparser/fastparser.cxx | 10 | ||||
-rw-r--r-- | sax/source/fastparser/legacyfastparser.cxx | 4 |
6 files changed, 49 insertions, 46 deletions
diff --git a/sax/qa/cppunit/attributes.cxx b/sax/qa/cppunit/attributes.cxx index 899716d62f15..0ed5e5b48eb3 100644 --- a/sax/qa/cppunit/attributes.cxx +++ b/sax/qa/cppunit/attributes.cxx @@ -48,16 +48,16 @@ void AttributesTest::test() CPPUNIT_ASSERT( xAttributeList->hasAttribute(1) ); CPPUNIT_ASSERT( !xAttributeList->hasAttribute(5) ); - CPPUNIT_ASSERT_EQUAL( OUString("2"), xAttributeList->getOptionalValue(2) ); - CPPUNIT_ASSERT_EQUAL( OUString("3"), xAttributeList->getOptionalValue(3) ); - CPPUNIT_ASSERT_EQUAL( OUString("4"), xAttributeList->getOptionalValue(4) ); + CPPUNIT_ASSERT_EQUAL( u"2"_ustr, xAttributeList->getOptionalValue(2) ); + CPPUNIT_ASSERT_EQUAL( u"3"_ustr, xAttributeList->getOptionalValue(3) ); + CPPUNIT_ASSERT_EQUAL( u"4"_ustr, xAttributeList->getOptionalValue(4) ); CPPUNIT_ASSERT_EQUAL( OUString(), xAttributeList->getOptionalValue(5) ); - CPPUNIT_ASSERT_EQUAL( OUString("1"), xAttributeList->getValue(1) ); + CPPUNIT_ASSERT_EQUAL( u"1"_ustr, xAttributeList->getValue(1) ); CPPUNIT_ASSERT_THROW( xAttributeList->getValue(5), xml::sax::SAXException ); xAttributeList->addUnknown("a"_ostr, "a"_ostr); - xAttributeList->addUnknown("b", "b"_ostr, "b"_ostr); + xAttributeList->addUnknown(u"b"_ustr, "b"_ostr, "b"_ostr); xAttributeList->addUnknown("c"_ostr, "c"_ostr); CPPUNIT_ASSERT_EQUAL( sal_Int32(3), xAttributeList->getUnknownAttributes().getLength() ); diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx index 1eb872d50585..963fa97f6893 100644 --- a/sax/qa/cppunit/xmlimport.cxx +++ b/sax/qa/cppunit/xmlimport.cxx @@ -98,7 +98,7 @@ OUString TestDocumentHandler::canonicalform(const OUString &sName, const OUStrin { m_aCountStack.top() += 1; if ( nIndex < 0 ) - m_aNamespaceStack.emplace_back( OUString( "default" ), sValue ); + m_aNamespaceStack.emplace_back( u"default"_ustr, sValue ); else m_aNamespaceStack.emplace_back( sName.copy( nIndex + 1 ), sValue ); } @@ -136,7 +136,7 @@ void SAL_CALL TestDocumentHandler::startDocument() { m_aStr.clear(); m_aNamespaceStack.clear(); - m_aNamespaceStack.emplace_back( std::make_pair( OUString( "default" ), OUString() ) ); + m_aNamespaceStack.emplace_back( std::make_pair( u"default"_ustr, OUString() ) ); m_aCountStack = std::stack<sal_uInt16>(); m_aCountStack.emplace(0); } @@ -158,13 +158,13 @@ void SAL_CALL TestDocumentHandler::startElement( const OUString& aName, const Re if (!sAttrName.isEmpty()) sAttributes += sAttrName + sAttrValue; } - m_aStr += canonicalform(aName, "", true) + sAttributes; + m_aStr += canonicalform(aName, u""_ustr, true) + sAttributes; } void SAL_CALL TestDocumentHandler::endElement( const OUString& aName ) { - m_aStr += canonicalform(aName, "", true); + m_aStr += canonicalform(aName, u""_ustr, true); sal_uInt16 nPopQty = m_aCountStack.top(); for (sal_uInt16 i=0; i<nPopQty; i++) m_aNamespaceStack.pop_back(); @@ -351,7 +351,7 @@ void XMLImportTest::setUp() m_xParser = Parser::create( xContext ); m_xParser->setDocumentHandler( m_xDocumentHandler ); m_xLegacyFastParser.set( xContext->getServiceManager()->createInstanceWithContext - ( "com.sun.star.xml.sax.LegacyFastParser", xContext ), UNO_QUERY ); + ( u"com.sun.star.xml.sax.LegacyFastParser"_ustr, xContext ), UNO_QUERY ); m_xLegacyFastParser->setDocumentHandler( m_xDocumentHandler ); Reference< XFastTokenHandler > xTokenHandler; @@ -363,7 +363,7 @@ void XMLImportTest::setUp() sal_Int32 nNamespaceCount = SAL_N_ELEMENTS(DummyTokenHandler::namespaceURIs); uno::Sequence<uno::Any> namespaceArgs( nNamespaceCount + 1 ); auto p_namespaceArgs = namespaceArgs.getArray(); - p_namespaceArgs[0] <<= OUString( "registerNamespaces" ); + p_namespaceArgs[0] <<= u"registerNamespaces"_ustr; for (sal_Int32 i = 1; i <= nNamespaceCount; i++ ) { css::beans::Pair<OUString, sal_Int32> rPair( OUString(DummyTokenHandler::namespaceURIs[i - 1]), i << 16 ); @@ -376,9 +376,9 @@ void XMLImportTest::setUp() void XMLImportTest::parse() { - OUString fileNames[] = {"simple.xml", "defaultns.xml", "inlinens.xml", - "multiplens.xml", "multiplepfx.xml", - "nstoattributes.xml", "nestedns.xml", "testthreading.xml"}; + OUString fileNames[] = {u"simple.xml"_ustr, u"defaultns.xml"_ustr, u"inlinens.xml"_ustr, + u"multiplens.xml"_ustr, u"multiplepfx.xml"_ustr, + u"nstoattributes.xml"_ustr, u"nestedns.xml"_ustr, u"testthreading.xml"_ustr}; for (size_t i = 0; i < std::size( fileNames ); i++) { @@ -401,11 +401,11 @@ void XMLImportTest::parse() void XMLImportTest::testMissingNamespaceDeclaration() { - OUString fileNames[] = { "manifestwithnsdecl.xml", "manifestwithoutnsdecl.xml" }; + OUString fileNames[] = { u"manifestwithnsdecl.xml"_ustr, u"manifestwithoutnsdecl.xml"_ustr }; uno::Reference<lang::XInitialization> const xInit(m_xLegacyFastParser, uno::UNO_QUERY_THROW); - xInit->initialize({ uno::Any(OUString("IgnoreMissingNSDecl")) }); + xInit->initialize({ uno::Any(u"IgnoreMissingNSDecl"_ustr) }); for (sal_uInt16 i = 0; i < std::size( fileNames ); i++) { diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index f004b94eadcb..2ab32b99ec68 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -417,7 +417,7 @@ void SaxExpatParser::parseStream( const InputSource& structSource) if( ! entity.structSource.aInputStream.is() ) { - throw SAXException("No input source", + throw SAXException(u"No input source"_ustr, css::uno::Reference< css::uno::XInterface > () , css::uno::Any() ); } @@ -432,7 +432,7 @@ void SaxExpatParser::parseStream( const InputSource& structSource) entity.pParser = XML_ParserCreate( nullptr ); if( ! entity.pParser ) { - throw SAXException("Couldn't create parser", + throw SAXException(u"Couldn't create parser"_ustr, css::uno::Reference< css::uno::XInterface > (), css::uno::Any() ); } @@ -516,7 +516,7 @@ void SaxExpatParser::setLocale( const Locale & ) // XServiceInfo OUString SaxExpatParser::getImplementationName() { - return "com.sun.star.comp.extensions.xml.sax.ParserExpat"; + return u"com.sun.star.comp.extensions.xml.sax.ParserExpat"_ustr; } // XServiceInfo @@ -528,7 +528,7 @@ sal_Bool SaxExpatParser::supportsService(const OUString& ServiceName) // XServiceInfo css::uno::Sequence< OUString > SaxExpatParser::getSupportedServiceNames() { - return { "com.sun.star.xml.sax.Parser" }; + return { u"com.sun.star.xml.sax.Parser"_ustr }; } @@ -764,7 +764,7 @@ void SaxExpatParser_Impl::callbackEntityDecl( SAL_INFO("sax","SaxExpatParser: internal entity declaration, stopping"); XML_StopParser(pImpl->getEntity().pParser, XML_FALSE); pImpl->exception = SAXParseException( - "SaxExpatParser: internal entity declaration, stopping", + u"SaxExpatParser: internal entity declaration, stopping"_ustr, nullptr, css::uno::Any(), pImpl->rDocumentLocator->getPublicId(), pImpl->rDocumentLocator->getSystemId(), diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index c1f9db44330d..c4d56586c060 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -231,7 +231,7 @@ sal_uInt32 SaxWriterHelper::writeSequence() catch (const IOException&) { css::uno::Any anyEx = cppu::getCaughtException(); - throw SAXException("IO exception during writing", Reference<XInterface>(), anyEx); + throw SAXException(u"IO exception during writing"_ustr, Reference<XInterface>(), anyEx); } nLastLineFeedPos -= SEQUENCESIZE; return 0; @@ -1104,7 +1104,10 @@ sal_Int32 SAXWriter::getIndentPrefixLength(sal_Int32 nFirstLineBreakOccurrence) bool isFirstCharWhitespace(const sal_Unicode* p) noexcept { return *p == ' '; } // XServiceInfo -OUString SAXWriter::getImplementationName() { return "com.sun.star.extensions.xml.sax.Writer"; } +OUString SAXWriter::getImplementationName() +{ + return u"com.sun.star.extensions.xml.sax.Writer"_ustr; +} // XServiceInfo sal_Bool SAXWriter::supportsService(const OUString& ServiceName) @@ -1115,7 +1118,7 @@ sal_Bool SAXWriter::supportsService(const OUString& ServiceName) // XServiceInfo Sequence<OUString> SAXWriter::getSupportedServiceNames() { - return { "com.sun.star.xml.sax.Writer" }; + return { u"com.sun.star.xml.sax.Writer"_ustr }; } void SAXWriter::startDocument() @@ -1132,12 +1135,12 @@ void SAXWriter::endDocument() { if (!m_bDocStarted) { - throw SAXException("endDocument called before startDocument", Reference<XInterface>(), + throw SAXException(u"endDocument called before startDocument"_ustr, Reference<XInterface>(), Any()); } if (m_nLevel) { - throw SAXException("unexpected end of document", Reference<XInterface>(), Any()); + throw SAXException(u"unexpected end of document"_ustr, Reference<XInterface>(), Any()); } m_pSaxWriterHelper->endDocument(); try @@ -1147,8 +1150,8 @@ void SAXWriter::endDocument() catch (const IOException&) { css::uno::Any anyEx = cppu::getCaughtException(); - throw SAXException("IO exception during closing the IO Stream", Reference<XInterface>(), - anyEx); + throw SAXException(u"IO exception during closing the IO Stream"_ustr, + Reference<XInterface>(), anyEx); } } @@ -1156,11 +1159,11 @@ void SAXWriter::startElement(const OUString& aName, const Reference<XAttributeLi { if (!m_bDocStarted) { - throw SAXException("startElement called before startDocument", {}, {}); + throw SAXException(u"startElement called before startDocument"_ustr, {}, {}); } if (m_bIsCDATA) { - throw SAXException("startElement call not allowed with CDATA sections", {}, {}); + throw SAXException(u"startElement call not allowed with CDATA sections"_ustr, {}, {}); } sal_Int32 nLength(0); @@ -1205,11 +1208,11 @@ void SAXWriter::startElement(const OUString& aName, const Reference<XAttributeLi if (eRet == SAX_WARNING) { throw SAXInvalidCharacterException( - "Invalid character during XML-Export in an attribute value", {}, {}); + u"Invalid character during XML-Export in an attribute value"_ustr, {}, {}); } else if (eRet == SAX_ERROR) { - throw SAXException("Invalid character during XML-Export", {}, {}); + throw SAXException(u"Invalid character during XML-Export"_ustr, {}, {}); } } @@ -1253,7 +1256,7 @@ void SAXWriter::endElement(const OUString& aName) if (!bRet) { - throw SAXException("Invalid character during XML-Export", {}, {}); + throw SAXException(u"Invalid character during XML-Export"_ustr, {}, {}); } } @@ -1261,7 +1264,7 @@ void SAXWriter::characters(const OUString& aChars) { if (!m_bDocStarted) { - throw SAXException("characters method called before startDocument", {}, {}); + throw SAXException(u"characters method called before startDocument"_ustr, {}, {}); } bool bThrowException(false); @@ -1301,7 +1304,7 @@ void SAXWriter::characters(const OUString& aChars) } if (bThrowException) { - throw SAXInvalidCharacterException("Invalid character during XML-Export", {}, {}); + throw SAXInvalidCharacterException(u"Invalid character during XML-Export"_ustr, {}, {}); } } @@ -1342,7 +1345,7 @@ void SAXWriter::processingInstruction(const OUString& aTarget, const OUString& a if (!m_pSaxWriterHelper->processingInstruction(aTarget, aData)) { - throw SAXException("Invalid character during XML-Export", {}, {}); + throw SAXException(u"Invalid character during XML-Export"_ustr, {}, {}); } } @@ -1374,7 +1377,7 @@ void SAXWriter::endCDATA() { if (!m_bDocStarted || !m_bIsCDATA) { - throw SAXException("endCDATA was called without startCDATA", {}, {}); + throw SAXException(u"endCDATA was called without startCDATA"_ustr, {}, {}); } sal_Int32 nPrefix = getIndentPrefixLength(3); @@ -1408,7 +1411,7 @@ void SAXWriter::comment(const OUString& sComment) if (!m_pSaxWriterHelper->comment(sComment)) { - throw SAXException("Invalid character during XML-Export", {}, {}); + throw SAXException(u"Invalid character during XML-Export"_ustr, {}, {}); } } @@ -1446,7 +1449,7 @@ void SAXWriter::unknown(const OUString& sString) if (!m_pSaxWriterHelper->writeString(sString, false, false)) { - throw SAXException("Invalid character during XML-Export", {}, {}); + throw SAXException(u"Invalid character during XML-Export"_ustr, {}, {}); } } diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index e0338e053cf0..dd0240502c35 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -1038,7 +1038,7 @@ void FastSaxParserImpl::pushEntity(const ParserData& rEntityData, xml::sax::InputSource const& rSource) { if (!rSource.aInputStream.is()) - throw SAXException("No input source", Reference<XInterface>(), Any()); + throw SAXException(u"No input source"_ustr, Reference<XInterface>(), Any()); maEntities.emplace(rEntityData); mpTop = &maEntities.top(); @@ -1097,7 +1097,7 @@ void FastSaxParserImpl::parse() rEntity.mpParser = xmlCreatePushParserCtxt( &callbacks, this, reinterpret_cast<const char*>(seqOut.getConstArray()), nRead, nullptr ); if( !rEntity.mpParser ) - throw SAXException("Couldn't create parser", Reference< XInterface >(), Any() ); + throw SAXException(u"Couldn't create parser"_ustr, Reference< XInterface >(), Any() ); // Tell libxml2 parser to decode entities in attribute values. // Also allow XML attribute values which are larger than 10MB, because this used to work @@ -1136,7 +1136,7 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm if( rEntity.maNamespaceCount.empty() ) { rEntity.maNamespaceCount.push(0); - DefineNamespace( "xml"_ostr, "http://www.w3.org/XML/1998/namespace"); + DefineNamespace( "xml"_ostr, u"http://www.w3.org/XML/1998/namespace"_ustr); } else { @@ -1512,7 +1512,7 @@ void FastSaxParser::setNamespaceHandler( const uno::Reference< css::xml::sax::XF OUString FastSaxParser::getImplementationName() { - return "com.sun.star.comp.extensions.xml.sax.FastParser"; + return u"com.sun.star.comp.extensions.xml.sax.FastParser"_ustr; } void FastSaxParser::setCustomEntityNames( @@ -1528,7 +1528,7 @@ sal_Bool FastSaxParser::supportsService( const OUString& ServiceName ) uno::Sequence<OUString> FastSaxParser::getSupportedServiceNames() { - return { "com.sun.star.xml.sax.FastParser" }; + return { u"com.sun.star.xml.sax.FastParser"_ustr }; } } // namespace sax_fastparser diff --git a/sax/source/fastparser/legacyfastparser.cxx b/sax/source/fastparser/legacyfastparser.cxx index e7afc55d9327..38cc558973a4 100644 --- a/sax/source/fastparser/legacyfastparser.cxx +++ b/sax/source/fastparser/legacyfastparser.cxx @@ -349,7 +349,7 @@ void SaxLegacyFastParser::setLocale( const Locale &locale ) OUString SaxLegacyFastParser::getImplementationName() { - return "com.sun.star.comp.extensions.xml.sax.LegacyFastParser"; + return u"com.sun.star.comp.extensions.xml.sax.LegacyFastParser"_ustr; } sal_Bool SaxLegacyFastParser::supportsService(const OUString& ServiceName) @@ -359,7 +359,7 @@ sal_Bool SaxLegacyFastParser::supportsService(const OUString& ServiceName) Sequence< OUString > SaxLegacyFastParser::getSupportedServiceNames() { - return { "com.sun.star.xml.sax.LegacyFastParser" }; + return { u"com.sun.star.xml.sax.LegacyFastParser"_ustr }; } } //namespace |