diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-08-27 11:40:59 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-08-28 08:07:09 +0200 |
commit | 33ecd0d5c4fff9511a8436513936a3f7044a775a (patch) | |
tree | c25809adda140ff89d9f2a2b6dfadba17e188fb0 /writerfilter | |
parent | 554834484a3323f73b5aeace246bcd9635368967 (diff) |
Change OUStringLiteral from char[] to char16_t[]
This is a prerequisite for making conversion from OUStringLiteral to OUString
more efficient at least for C++20 (by replacing its internals with a constexpr-
generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount,
conditionally for C++20 for now).
For a configure-wise bare-bones build on Linux, size reported by `du -bs
instdir` grew by 118792 bytes from 1155636636 to 1155755428.
In most places just a u"..." string literal prefix had to be added. In some
places
char const a[] = "...";
variables have been changed to char16_t, and a few places required even further
changes to code (which prompted the addition of include/o3tl/string_view.hxx
helper function o3tl::equalsIgnoreAsciiCase and the additional
OUString::createFromAscii overload).
For all uses of macros expanding to string literals, the relevant uses have been
rewritten as
u"" MACRO
instead of changing the macro definitions. It should be possible to change at
least some of those macro definitions (and drop the u"" from their call sites)
in follow-up commits.
Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'writerfilter')
6 files changed, 10 insertions, 10 deletions
diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx b/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx index ade216411c54..893db1607112 100644 --- a/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx @@ -86,7 +86,7 @@ CPPUNIT_TEST_FIXTURE(Test, testNumberingRestartStyleParent) uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); uno::Reference<beans::XPropertySet> xPara; - OUStringLiteral aProp("ListLabelString"); + OUStringLiteral aProp(u"ListLabelString"); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("A."), xPara->getPropertyValue(aProp).get<OUString>()); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 02baba345d58..8d8724f2241d 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -1323,7 +1323,7 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab if (!aMerges.empty()) { static const std::vector<OUStringLiteral> aBorderNames - = { "TopBorder", "LeftBorder", "BottomBorder", "RightBorder" }; + = { u"TopBorder", u"LeftBorder", u"BottomBorder", u"RightBorder" }; // Perform horizontal merges in reverse order, so the fact that merging changes the position of cells won't cause a problem for us. for (std::vector<HorizontallyMergedCell>::reverse_iterator it = aMerges.rbegin(); it != aMerges.rend(); ++it) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 453e73dc8d94..e699aa51b0ff 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3223,7 +3223,7 @@ static sal_Int16 lcl_ParseNumberingType( const OUString& rCommand ) // The command looks like: " PAGE \* Arabic " // tdf#132185: but may as well be "PAGE \* Arabic" OUString sNumber; - constexpr OUStringLiteral rSeparator("\\* "); + constexpr OUStringLiteral rSeparator(u"\\* "); if (sal_Int32 nStartIndex = rCommand.indexOf(rSeparator); nStartIndex >= 0) { nStartIndex += rSeparator.getLength(); diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx index d37b6b314e94..b2cb476e3623 100644 --- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx +++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx @@ -369,7 +369,7 @@ namespace writerfilter::dmapper { if (m_pCurrentInteropGrabBag) { beans::PropertyValue aValue; - aValue.Name = (nSprmId == NS_ooxml::LN_CT_TblPrBase_tblStyleRowBandSize ? OUStringLiteral("tblStyleRowBandSize") : OUStringLiteral("tblStyleColBandSize")); + aValue.Name = (nSprmId == NS_ooxml::LN_CT_TblPrBase_tblStyleRowBandSize ? OUStringLiteral(u"tblStyleRowBandSize") : OUStringLiteral(u"tblStyleColBandSize")); aValue.Value <<= nIntValue; m_pCurrentInteropGrabBag->push_back(aValue); } diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx index 7265d7c424a9..8797a08442d8 100644 --- a/writerfilter/source/rtftok/rtfdispatchflag.cxx +++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx @@ -1044,8 +1044,8 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) { beans::PropertyValue aPropertyValue; aPropertyValue.Name - = (nKeyword == RTF_DOBXMARGIN ? OUStringLiteral("HoriOrientRelation") - : OUStringLiteral("VertOrientRelation")); + = (nKeyword == RTF_DOBXMARGIN ? OUStringLiteral(u"HoriOrientRelation") + : OUStringLiteral(u"VertOrientRelation")); aPropertyValue.Value <<= text::RelOrientation::PAGE_PRINT_AREA; m_aStates.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue); } @@ -1055,8 +1055,8 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) { beans::PropertyValue aPropertyValue; aPropertyValue.Name - = (nKeyword == RTF_DOBXPAGE ? OUStringLiteral("HoriOrientRelation") - : OUStringLiteral("VertOrientRelation")); + = (nKeyword == RTF_DOBXPAGE ? OUStringLiteral(u"HoriOrientRelation") + : OUStringLiteral(u"VertOrientRelation")); aPropertyValue.Value <<= text::RelOrientation::PAGE_FRAME; m_aStates.top().getDrawingObject().getPendingProperties().push_back(aPropertyValue); } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 5971b8b8e96b..cf757dd58737 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2438,8 +2438,8 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState) OUString str(m_aStates.top().getCurrentDestinationText()->makeStringAndClear()); // dmapper expects this as a field, so let's fake something... auto const field((Destination::INDEXENTRY == rState.getDestination()) - ? OUStringLiteral("XE") - : OUStringLiteral("TC")); + ? OUStringLiteral(u"XE") + : OUStringLiteral(u"TC")); str = field + " \"" + str.replaceAll("\"", "\\\"") + "\""; singleChar(cFieldStart); Mapper().utext(reinterpret_cast<sal_uInt8 const*>(str.getStr()), str.getLength()); |