basctl/source/basicide/baside2.cxx | 2 basctl/source/basicide/baside3.cxx | 2 basctl/source/basicide/basides1.cxx | 10 basctl/source/basicide/localizationmgr.cxx | 2 basctl/source/dlged/dlged.cxx | 4 basctl/source/dlged/propbrw.cxx | 2 basegfx/test/SvgPathImportExport.cxx | 16 basegfx/test/boxclipper.cxx | 2 basegfx/test/clipstate.cxx | 2 basic/source/basmgr/basmgr.cxx | 12 basic/source/classes/sbunoobj.cxx | 6 basic/source/runtime/runtime.cxx | 2 basic/source/uno/dlgcont.cxx | 4 chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx | 2 chart2/source/controller/main/ElementSelector.cxx | 3 chart2/source/model/filter/XMLFilter.cxx | 6 chart2/source/model/main/CartesianCoordinateSystem.cxx | 2 chart2/source/model/main/PolarCoordinateSystem.cxx | 3 chart2/source/tools/CachedDataSequence.cxx | 2 chart2/source/tools/ConfigColorScheme.cxx | 2 chart2/source/tools/ErrorBar.cxx | 2 chart2/source/tools/InternalDataProvider.cxx | 6 chart2/source/tools/ReferenceSizeProvider.cxx | 2 chart2/source/tools/Scaling.cxx | 8 chart2/source/tools/UncachedDataSequence.cxx | 2 chart2/source/view/axes/DateScaling.cxx | 5 comphelper/source/misc/numberedcollection.cxx | 2 compilerplugins/clang/stringliteralvar.cxx | 203 ++++++++++ compilerplugins/clang/test/stringliteralvar.cxx | 81 +++ configmgr/source/configurationprovider.cxx | 8 connectivity/source/commontools/conncleanup.cxx | 2 connectivity/source/commontools/dbtools2.cxx | 2 connectivity/source/cpool/ZConnectionPool.cxx | 2 connectivity/source/drivers/evoab2/NResultSetMetaData.cxx | 2 connectivity/source/drivers/file/FDatabaseMetaData.cxx | 2 connectivity/source/drivers/firebird/Driver.cxx | 6 connectivity/source/drivers/jdbc/JConnection.cxx | 3 connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx | 5 connectivity/source/parse/sqliterator.cxx | 2 cui/source/customize/acccfg.cxx | 4 cui/source/customize/cfgutil.cxx | 2 cui/source/dialogs/cuigaldlg.cxx | 2 cui/source/dialogs/hlinettp.cxx | 2 cui/source/inc/cfg.hxx | 8 cui/source/options/optasian.cxx | 4 cui/source/options/optgdlg.cxx | 10 cui/source/options/optinet2.cxx | 16 dbaccess/qa/unit/embeddeddb_performancetest.cxx | 5 dbaccess/source/core/api/FilteredContainer.cxx | 2 dbaccess/source/core/dataaccess/databasedocument.cxx | 2 dbaccess/source/core/dataaccess/datasource.cxx | 2 dbaccess/source/core/misc/DatabaseDataProvider.cxx | 2 dbaccess/source/core/recovery/dbdocrecovery.cxx | 4 dbaccess/source/core/recovery/storagetextstream.cxx | 2 dbaccess/source/core/recovery/subcomponentrecovery.cxx | 4 dbaccess/source/filter/hsqldb/hsqlimport.cxx | 2 dbaccess/source/filter/hsqldb/parseschema.cxx | 5 dbaccess/source/filter/hsqldb/utils.cxx | 7 dbaccess/source/ui/app/AppController.cxx | 2 dbaccess/source/ui/app/AppControllerGen.cxx | 2 dbaccess/source/ui/dlg/queryfilter.cxx | 4 dbaccess/source/ui/misc/indexcollection.cxx | 2 dbaccess/source/ui/querydesign/querycontroller.cxx | 4 desktop/source/app/app.cxx | 4 desktop/source/app/check_ext_deps.cxx | 2 desktop/source/app/cmdlinehelp.cxx | 8 desktop/source/deployment/misc/dp_dependencies.cxx | 8 desktop/source/migration/migration.cxx | 6 editeng/source/misc/svxacorr.cxx | 6 extensions/source/abpilot/admininvokationimpl.cxx | 2 extensions/source/abpilot/fieldmappingimpl.cxx | 2 extensions/source/bibliography/bibconfig.cxx | 2 extensions/source/dbpilots/gridwizard.cxx | 4 extensions/source/dbpilots/optiongrouplayouter.cxx | 2 filter/qa/unit/svg.cxx | 2 filter/qa/unit/textfilterdetect.cxx | 2 filter/source/svg/svgexport.cxx | 6 filter/source/svg/svgfilter.cxx | 4 forms/source/component/DatabaseForm.cxx | 2 forms/source/component/FormattedField.cxx | 4 framework/inc/taskcreatordefs.hxx | 17 framework/qa/cppunit/loadenv.cxx | 2 framework/source/accelerators/acceleratorconfiguration.cxx | 4 framework/source/fwe/xml/menudocumenthandler.cxx | 12 framework/source/fwe/xml/toolboxdocumenthandler.cxx | 10 framework/source/fwi/uielement/constitemcontainer.cxx | 2 framework/source/fwi/uielement/itemcontainer.cxx | 3 framework/source/fwi/uielement/rootitemcontainer.cxx | 5 framework/source/helper/statusindicatorfactory.cxx | 2 framework/source/helper/uiconfigelementwrapperbase.cxx | 16 framework/source/helper/uielementwrapperbase.cxx | 6 framework/source/inc/accelerators/acceleratorconfiguration.hxx | 6 framework/source/layoutmanager/layoutmanager.cxx | 2 framework/source/loadenv/loadenv.cxx | 4 framework/source/services/autorecovery.cxx | 52 +- framework/source/uiconfiguration/imagemanagerimpl.cxx | 4 framework/source/uielement/recentfilesmenucontroller.cxx | 6 framework/source/uielement/toolbarsmenucontroller.cxx | 4 framework/source/uielement/uicommanddescription.cxx | 2 i18npool/source/collator/chaptercollator.cxx | 2 i18npool/source/collator/collator_unicode.cxx | 2 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 2 i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx | 4 i18npool/source/nativenumber/nativenumbersupplier.cxx | 2 i18npool/source/ordinalsuffix/ordinalsuffix.cxx | 2 include/editeng/itemtype.hxx | 2 include/vcl/filter/PDFiumLibrary.hxx | 10 lotuswordpro/qa/cppunit/import_test.cxx | 2 lotuswordpro/source/filter/lwpsilverbullet.cxx | 6 oox/qa/unit/drawingml.cxx | 2 oox/qa/unit/mathml.cxx | 2 oox/qa/unit/shape.cxx | 2 oox/qa/unit/vml.cxx | 2 oox/source/ole/oleobjecthelper.cxx | 2 reportdesign/source/core/api/ReportDefinition.cxx | 2 reportdesign/source/core/api/ReportEngineJFree.cxx | 2 reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx | 2 reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx | 2 reportdesign/source/filter/xml/xmlfilter.cxx | 8 sal/qa/rtl/uri/rtl_testuri.cxx | 18 sc/qa/unit/helper/shared_test_impl.hxx | 4 sc/qa/unit/tiledrendering/tiledrendering.cxx | 2 sc/qa/unit/uicalc/uicalc.cxx | 2 sc/source/core/tool/autoform.cxx | 2 sc/source/ui/docshell/docsh.cxx | 14 sc/source/ui/docshell/impex.cxx | 2 sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx | 4 sc/source/ui/vba/vbaborders.cxx | 2 sc/source/ui/vba/vbainterior.cxx | 6 sc/source/ui/vba/vbarange.cxx | 6 sc/source/ui/vba/vbastyle.cxx | 2 scripting/source/dlgprov/dlgprov.cxx | 2 sd/qa/filter/eppt/eppt.cxx | 2 sd/qa/unit/tiledrendering/LOKitSearchTest.cxx | 2 sd/qa/unit/tiledrendering/tiledrendering.cxx | 2 sd/source/filter/html/htmlex.cxx | 4 sd/source/ui/framework/factories/PresentationFactory.cxx | 2 sd/source/ui/inc/unokywds.hxx | 99 ++-- sd/source/ui/sidebar/MasterPagesSelector.cxx | 2 sd/source/ui/tools/EventMultiplexer.cxx | 4 sd/source/ui/unoidl/DrawController.cxx | 2 sd/source/ui/unoidl/unopage.cxx | 2 sdext/source/pdfimport/test/tests.cxx | 7 sfx2/qa/cppunit/view.cxx | 2 sfx2/source/control/emojicontrol.cxx | 18 sfx2/source/dialog/backingwindow.cxx | 2 sfx2/source/doc/DocumentMetadataAccess.cxx | 6 sfx2/source/doc/SfxDocumentMetaData.cxx | 10 sfx2/source/doc/docfac.cxx | 3 sfx2/source/doc/guisaveas.cxx | 6 sfx2/source/doc/templatedlg.cxx | 8 sfx2/source/sidebar/SidebarController.cxx | 2 solenv/CompilerTest_compilerplugins_clang.mk | 1 starmath/source/mathmlexport.cxx | 4 stoc/source/security/access_controller.cxx | 2 svgio/source/svgreader/svgtoken.cxx | 4 svl/source/numbers/zformat.cxx | 2 svtools/source/config/fontsubstconfig.cxx | 12 svtools/source/misc/sampletext.cxx | 4 svtools/source/uno/toolboxcontroller.cxx | 2 svtools/source/uno/unoevent.cxx | 8 svx/qa/unit/unodraw.cxx | 2 svx/source/accessibility/AccessibleShape.cxx | 4 svx/source/fmcomp/fmgridcl.cxx | 2 svx/source/fmcomp/gridcell.cxx | 4 svx/source/form/fmobj.cxx | 2 svx/source/form/fmundo.cxx | 2 svx/source/form/formcontroller.cxx | 2 svx/source/gallery2/gallery1.cxx | 4 svx/source/sidebar/area/AreaPropertyPanelBase.cxx | 2 svx/source/sidebar/line/LinePropertyPanelBase.cxx | 2 svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 2 svx/source/svdraw/svdoole2.cxx | 2 svx/source/tbxctrls/extrusioncontrols.cxx | 10 svx/source/tbxctrls/tbunosearchcontrollers.cxx | 12 svx/source/toolbars/extrusionbar.cxx | 20 svx/source/toolbars/fontworkbar.cxx | 2 svx/source/unodraw/unoshape.cxx | 86 ++-- sw/qa/core/crsr/crsr.cxx | 2 sw/qa/core/doc/doc.cxx | 2 sw/qa/core/docnode/docnode.cxx | 2 sw/qa/core/draw/draw.cxx | 2 sw/qa/core/frmedt/frmedt.cxx | 2 sw/qa/core/layout/layout.cxx | 2 sw/qa/core/objectpositioning/objectpositioning.cxx | 2 sw/qa/core/text/text.cxx | 2 sw/qa/core/txtnode/txtnode.cxx | 2 sw/qa/core/undo/undo.cxx | 2 sw/qa/core/unocore/unocore.cxx | 2 sw/qa/core/uwriter.cxx | 2 sw/qa/extras/htmlexport/htmlexport.cxx | 2 sw/qa/extras/htmlimport/htmlimport.cxx | 2 sw/qa/extras/layout/layout.cxx | 2 sw/qa/extras/layout/layout2.cxx | 2 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 2 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 2 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 2 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 2 sw/qa/extras/tiledrendering/tiledrendering.cxx | 2 sw/qa/extras/uiwriter/uiwriter.cxx | 2 sw/qa/extras/uiwriter/uiwriter2.cxx | 5 sw/qa/extras/uiwriter/uiwriter3.cxx | 2 sw/qa/extras/unowriter/unowriter.cxx | 2 sw/qa/extras/ww8export/ww8export.cxx | 2 sw/qa/uibase/frmdlg/frmdlg.cxx | 2 sw/qa/uibase/shells/shells.cxx | 2 sw/qa/uibase/uiview/uiview.cxx | 2 sw/qa/uibase/uno/uno.cxx | 2 sw/source/core/access/acccell.cxx | 2 sw/source/core/access/acccontext.hxx | 2 sw/source/core/access/accdoc.cxx | 4 sw/source/core/access/accembedded.cxx | 2 sw/source/core/access/accfootnote.cxx | 6 sw/source/core/access/accheaderfooter.cxx | 6 sw/source/core/access/accpage.cxx | 2 sw/source/core/access/accpara.cxx | 4 sw/source/core/access/accpreview.cxx | 3 sw/source/core/access/acctable.cxx | 3 sw/source/core/crsr/crossrefbookmark.cxx | 2 sw/source/core/swg/SwXMLTextBlocks1.cxx | 2 sw/source/core/text/EnhancedPDFExportHelper.cxx | 8 sw/source/filter/ww8/wrtww8.cxx | 4 sw/source/filter/ww8/ww8glsy.cxx | 3 sw/source/filter/ww8/ww8par.cxx | 4 sw/source/filter/ww8/ww8scan.hxx | 16 sw/source/filter/ww8/ww8struc.hxx | 4 sw/source/filter/xml/XMLRedlineImportHelper.cxx | 6 sw/source/ui/vba/vbalisthelper.cxx | 12 sw/source/uibase/app/applab.cxx | 2 sw/source/uibase/dbui/mmconfigitem.cxx | 2 sw/source/uibase/utlui/unotools.cxx | 2 testtools/source/bridgetest/currentcontextchecker.cxx | 4 toolkit/source/controls/stdtabcontroller.cxx | 2 toolkit/source/controls/tabpagemodel.cxx | 2 toolkit/source/helper/formpdfexport.cxx | 28 - unotools/qa/unit/testGetEnglishSearchName.cxx | 11 unotools/source/config/historyoptions.cxx | 14 unotools/source/config/lingucfg.cxx | 2 unotools/source/config/saveopt.cxx | 2 vbahelper/source/vbahelper/vbacommandbarhelper.hxx | 10 vbahelper/source/vbahelper/vbahelper.cxx | 8 vcl/qa/cppunit/GraphicTest.cxx | 4 vcl/qa/cppunit/PDFDocumentTest.cxx | 2 vcl/qa/cppunit/TypeSerializerTest.cxx | 2 vcl/qa/cppunit/filter/igif/igif.cxx | 2 vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 2 vcl/qa/cppunit/pdfexport/pdfexport.cxx | 2 vcl/source/gdi/gdimtf.cxx | 2 writerfilter/qa/cppunittests/dmapper/CellColorHandler.cxx | 2 writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx | 2 writerfilter/qa/cppunittests/dmapper/DomainMapperTableHandler.cxx | 2 writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx | 2 writerfilter/qa/cppunittests/dmapper/GraphicImport.cxx | 2 writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx | 2 writerfilter/qa/cppunittests/dmapper/TextEffectsHandler.cxx | 2 writerfilter/qa/cppunittests/rtftok/rtfsdrimport.cxx | 2 writerfilter/qa/cppunittests/rtftok/rtfsprm.cxx | 2 writerfilter/source/dmapper/FormControlHelper.cxx | 2 writerfilter/source/dmapper/TextEffectsHandler.cxx | 2 writerperfect/qa/unit/DirectoryStreamTest.cxx | 6 writerperfect/qa/unit/EPUBExportTest.cxx | 2 writerperfect/qa/unit/WPXSvStreamTest.cxx | 4 xmloff/qa/unit/draw.cxx | 2 xmloff/qa/unit/style.cxx | 2 xmloff/qa/unit/text.cxx | 2 xmloff/source/chart/SchXMLTableContext.cxx | 2 xmloff/source/draw/sdxmlexp.cxx | 18 xmloff/source/forms/elementimport.cxx | 2 xmloff/source/meta/xmlversion.cxx | 2 xmloff/source/text/XMLTextFrameContext.cxx | 8 xmloff/source/text/XMLTextListBlockContext.cxx | 2 xmloff/source/text/XMLTextMarkImportContext.cxx | 2 xmloff/source/text/txtfldi.cxx | 57 +- xmloff/source/text/txtimp.cxx | 32 - xmloff/source/text/txtvfldi.cxx | 22 - xmlscript/source/xmllib_imexp/xmllib_export.cxx | 4 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx | 2 xmlsecurity/qa/unit/signing/signing.cxx | 2 xmlsecurity/qa/unit/signing/signing2.cxx | 2 279 files changed, 1018 insertions(+), 707 deletions(-)
New commits: commit a3d0091d185f39eddabf4d372ebe0ac3061dbb89 Author: Stephan Bergmann <[email protected]> AuthorDate: Wed Dec 23 13:16:31 2020 +0100 Commit: Stephan Bergmann <[email protected]> CommitDate: Sat Dec 26 14:51:15 2020 +0100 New loplugin:stringliteralvar See the comment at the top of compilerplugins/clang/stringliteralvar.cxx for details. (Turned some affected variables in included files into inline variables, to avoid GCC warnings about unused variables.) Change-Id: Ie77219e6adfdaaceaa8b4e590b08971f2f04c83a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 41c0ff4413f3..95768b0cfe54 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -93,7 +93,7 @@ short const ValidWindow = 0x1234; #if defined(OW) || defined(MTF) char const FilterMask_All[] = "*"; #else -char const FilterMask_All[] = "*.*"; +OUStringLiteral const FilterMask_All = u"*.*"; #endif } // end anonymous namespace diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 063828689a0f..32dfa80c2baf 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -71,7 +71,7 @@ using namespace ::com::sun::star::ui::dialogs; #ifdef _WIN32 char const FilterMask_All[] = "*.*"; #else -char const FilterMask_All[] = "*"; +OUStringLiteral const FilterMask_All = u"*"; #endif DialogWindow::DialogWindow(DialogWindowLayout* pParent, ScriptDocument const& rDocument, diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index d49060c0719d..7d931a70bad4 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -1209,10 +1209,12 @@ void Shell::SetCurWindow( BaseWindow* pNewWin, bool bUpdateTabBar, bool bRemembe void Shell::ManageToolbars() { - static const char aMacroBarResName[] = "private:resource/toolbar/macrobar"; - static const char aDialogBarResName[] = "private:resource/toolbar/dialogbar"; - static const char aInsertControlsBarResName[] = "private:resource/toolbar/insertcontrolsbar"; - static const char aFormControlsBarResName[] = "private:resource/toolbar/formcontrolsbar"; + static const OUStringLiteral aMacroBarResName = u"private:resource/toolbar/macrobar"; + static const OUStringLiteral aDialogBarResName = u"private:resource/toolbar/dialogbar"; + static const OUStringLiteral aInsertControlsBarResName + = u"private:resource/toolbar/insertcontrolsbar"; + static const OUStringLiteral aFormControlsBarResName + = u"private:resource/toolbar/formcontrolsbar"; if( !pCurWin ) return; diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx index 45c6239bc5c7..1e31f8a47d0f 100644 --- a/basctl/source/basicide/localizationmgr.cxx +++ b/basctl/source/basicide/localizationmgr.cxx @@ -74,7 +74,7 @@ bool LocalizationMgr::isLibraryLocalized () void LocalizationMgr::handleTranslationbar () { - static const char aToolBarResName[] = "private:resource/toolbar/translationbar"; + static const OUStringLiteral aToolBarResName = u"private:resource/toolbar/translationbar"; Reference< beans::XPropertySet > xFrameProps ( m_pShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 533e2381f3e7..ced23c5474bc 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -57,8 +57,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::io; -const char aResourceResolverPropName[] = "ResourceResolver"; -const char aDecorationPropName[] = "Decoration"; +const OUStringLiteral aResourceResolverPropName = u"ResourceResolver"; +const OUStringLiteral aDecorationPropName = u"Decoration"; // DlgEdHint diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx index 5ddf9ec154b1..73e90e2827ac 100644 --- a/basctl/source/dlged/propbrw.cxx +++ b/basctl/source/dlged/propbrw.cxx @@ -141,7 +141,7 @@ void PropBrw::ImplReCreateController() // create a property browser controller Reference< XMultiComponentFactory > xFactory( xInspectorContext->getServiceManager(), UNO_SET_THROW ); - static const char16_t s_sControllerServiceName[] = u"com.sun.star.awt.PropertyBrowserController"; + static const OUStringLiteral s_sControllerServiceName = u"com.sun.star.awt.PropertyBrowserController"; m_xBrowserController.set( xFactory->createInstanceWithContext( s_sControllerServiceName, xInspectorContext ), UNO_QUERY ); if ( !m_xBrowserController.is() ) { diff --git a/basegfx/test/SvgPathImportExport.cxx b/basegfx/test/SvgPathImportExport.cxx index 59f87e735815..7fa0468e7042 100644 --- a/basegfx/test/SvgPathImportExport.cxx +++ b/basegfx/test/SvgPathImportExport.cxx @@ -116,7 +116,7 @@ public: CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D", utils::importFromSvgD( aPoly, aPath0, false, nullptr )); aExport = utils::exportToSvgD( aPoly, true, true, false ); - const char sExportString[] = "m10 10h-20v-20h20z"; + static const OUStringLiteral sExportString = u"m10 10h-20v-20h20z"; CPPUNIT_ASSERT_EQUAL_MESSAGE("exporting rectangle to SVG-D", OUString(sExportString), aExport ); CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D (round-trip", @@ -143,8 +143,8 @@ public: // so for correct unit test i add the new exported string here as sExportStringSimpleBezier // and compare to it. - const char sExportStringSimpleBezier[] = - "m11430 0c-8890 3810 5715 6985 5715 6985" + static const OUStringLiteral sExportStringSimpleBezier = + u"m11430 0c-8890 3810 5715 6985 5715 6985" "l-17145-1905c0 0 22860-10160 16510 6350" "s-3810-11430-3810-11430z"; CPPUNIT_ASSERT_EQUAL_MESSAGE("exporting bezier polygon to SVG-D", OUString(sExportStringSimpleBezier), aExport); @@ -164,8 +164,8 @@ public: // same here, the corrected export with the corrected B2DPolygon is simply more efficient, // so i needed to change the compare string. Also adding the re-import comparison below. - const char sExportString1[] = - "m1917 1114c-89-189-233-284-430-284-167 0-306 91-419 273s-170 370-17" + static const OUStringLiteral sExportString1 = + u"m1917 1114c-89-189-233-284-430-284-167 0-306 91-419 273s-170 370-17" "0 564c0 145 33 259 98 342 65 84 150 126 257 126q115.5 0 231-57s147-97 210-176 99-143 109-190c38-199 76-398 114" "-598zm840 1646c-133 73-312 139-537 197-225 57-440 86-644 87-483-1-866-132-1150-392-284-261-426-619-426-1076 0-" "292 67-560 200-803s321-433 562-569 514-204 821-204c405 0 739 125 1003 374 264 250 396 550 396 899 0 313-88 576" @@ -187,8 +187,8 @@ public: CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D", utils::importFromSvgD( aPoly, aPath3, false, nullptr )); aExport = utils::exportToSvgD( aPoly, true, true, false ); - const char sExportString2[] = - "m1598 125h306v2334h-306v-1105h-1293v1105h-305v-2334h305v973h1293" + static const OUStringLiteral sExportString2 = + u"m1598 125h306v2334h-306v-1105h-1293v1105h-305v-2334h305v973h1293" "zm2159 1015 78-44 85 235-91 47-91 40-90 34-90 29-89 21-88 16-88 10-88 3-102-4-97" "-12-91-19-85-26-40-16-39-18-38-20-36-22-34-24-33-26-32-27-30-30-29-31-27-33-25-3" "3-23-36-21-36-19-38-18-40-16-40-26-86-18-91-11-97-4-103 3-98 11-94 17-89 24-84 3" @@ -220,7 +220,7 @@ public: utils::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) )); aExport = utils::exportToSvgD( B2DPolyPolygon(aRect), false, false, false ); - const char sExportStringRect[] = "M0 0H4000V4000H0Z"; + static const OUStringLiteral sExportStringRect = u"M0 0H4000V4000H0Z"; CPPUNIT_ASSERT_EQUAL_MESSAGE("exporting to rectangle svg-d string", OUString(sExportStringRect), aExport); } diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx index 47d3584df06e..cca5cabf3766 100644 --- a/basegfx/test/boxclipper.cxx +++ b/basegfx/test/boxclipper.cxx @@ -155,7 +155,7 @@ public: aRandomIntersections.appendElement( aRandomRange, B2VectorOrientation::Negative ); } #else - const char randomSvg[]="m394 783h404v57h-404zm-197-505h571v576h-571zm356-634h75v200h-75zm-40-113h403v588h-403zm93-811h111v494h-111zm-364-619h562v121h-562zm-134-8h292v27h-292zm110 356h621v486h-621zm78-386h228v25h-228zm475-345h201v201h-201zm-2-93h122v126h-122zm-417-243h567v524h-567zm-266-738h863v456h-863zm262-333h315v698h-315zm-328-826h43v393h-43zm830-219h120v664h-120zm-311-636h221v109h-221zm-500 137h628v19h-628zm681-94h211v493h-211zm-366-646h384v355h-384zm-189-199h715v247h-715zm165-459h563v601h-563zm258-479h98v606h-98zm270-517h65v218h-65zm-44-259h96v286h-96zm-599-202h705v468h-705zm216-803h450v494h-450zm-150-22h26v167h-26zm-55-599h50v260h-50zm190-278h490v387h-490zm-290-453h634v392h-634zm257 189h552v300h-552zm-151-690h136v455h-136zm12-597h488v432h-488zm501-459h48v39h-48zm-224-112h429v22h-429zm-281 102h492v621h-492zm519-158h208v17h-208zm-681-563h56v427h-56zm126-451h615v392h-615zm-47-410h598v522h-598zm-32 316h79v110h-79zm-71-129h18v127h-18zm126-993h743v589h-743zm211-430h428v750h- 428zm61-554h100v220h-100zm-353-49h658v157h-658zm778-383h115v272h-115zm-249-541h119v712h-119zm203 86h94v40h-94z"; + static const OUStringLiteral randomSvg=u"m394 783h404v57h-404zm-197-505h571v576h-571zm356-634h75v200h-75zm-40-113h403v588h-403zm93-811h111v494h-111zm-364-619h562v121h-562zm-134-8h292v27h-292zm110 356h621v486h-621zm78-386h228v25h-228zm475-345h201v201h-201zm-2-93h122v126h-122zm-417-243h567v524h-567zm-266-738h863v456h-863zm262-333h315v698h-315zm-328-826h43v393h-43zm830-219h120v664h-120zm-311-636h221v109h-221zm-500 137h628v19h-628zm681-94h211v493h-211zm-366-646h384v355h-384zm-189-199h715v247h-715zm165-459h563v601h-563zm258-479h98v606h-98zm270-517h65v218h-65zm-44-259h96v286h-96zm-599-202h705v468h-705zm216-803h450v494h-450zm-150-22h26v167h-26zm-55-599h50v260h-50zm190-278h490v387h-490zm-290-453h634v392h-634zm257 189h552v300h-552zm-151-690h136v455h-136zm12-597h488v432h-488zm501-459h48v39h-48zm-224-112h429v22h-429zm-281 102h492v621h-492zm519-158h208v17h-208zm-681-563h56v427h-56zm126-451h615v392h-615zm-47-410h598v522h-598zm-32 316h79v110h-79zm-71-129h18v127h-18zm126-993h743v589h-743zm 211-430h428v750h-428zm61-554h100v220h-100zm-353-49h658v157h-658zm778-383h115v272h-115zm-249-541h119v712h-119zm203 86h94v40h-94z"; B2DPolyPolygon randomPoly; CPPUNIT_ASSERT(utils::importFromSvgD(randomPoly, randomSvg, false, nullptr)); for (auto const& aPolygon : randomPoly) diff --git a/basegfx/test/clipstate.cxx b/basegfx/test/clipstate.cxx index 44e64b8c23d8..94c0246d8312 100644 --- a/basegfx/test/clipstate.cxx +++ b/basegfx/test/clipstate.cxx @@ -127,7 +127,7 @@ public: { utils::B2DClipState aMixedClip; - const char unionSvg[]="m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z"; + static const OUStringLiteral unionSvg=u"m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z"; B2DPolyPolygon aTmp1; CPPUNIT_ASSERT(utils::importFromSvgD(aTmp1, unionSvg, false, nullptr)); diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 77f5939cd9d0..a3cf5b9e3ccf 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -84,12 +84,12 @@ typedef WeakImplHelper< script::XStarBasicAccess > StarBasicAccessHelper; // Version 2 // + bool bReference -const char szStdLibName[] = "Standard"; -const char szBasicStorage[] = "StarBASIC"; -const char szOldManagerStream[] = "BasicManager"; -const char szManagerStream[] = "BasicManager2"; -const char szImbedded[] = "LIBIMBEDDED"; -const char szCryptingKey[] = "CryptedBasic"; +const OUStringLiteral szStdLibName = u"Standard"; +const OUStringLiteral szBasicStorage = u"StarBASIC"; +const OUStringLiteral szOldManagerStream = u"BasicManager"; +const OUStringLiteral szManagerStream = u"BasicManager2"; +const OUStringLiteral szImbedded = u"LIBIMBEDDED"; +const OStringLiteral szCryptingKey = "CryptedBasic"; const StreamMode eStreamReadMode = StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYALL; diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 3816d351302c..82ffb8c11699 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -99,9 +99,9 @@ using namespace cppu; // Identifiers for creating the strings for dbg_Properties -char16_t constexpr ID_DBG_SUPPORTEDINTERFACES[] = u"Dbg_SupportedInterfaces"; -char const ID_DBG_PROPERTIES[] = "Dbg_Properties"; -char const ID_DBG_METHODS[] = "Dbg_Methods"; +OUStringLiteral constexpr ID_DBG_SUPPORTEDINTERFACES = u"Dbg_SupportedInterfaces"; +OUStringLiteral const ID_DBG_PROPERTIES = u"Dbg_Properties"; +OUStringLiteral const ID_DBG_METHODS = u"Dbg_Methods"; char const aSeqLevelStr[] = "[]"; diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 5a64166b63a1..3ceaf38cafc7 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -1786,7 +1786,7 @@ void removeDimAsNewRecoverItem( SbxVariable* pVar ) // saving object variable // not-object variables will cause errors -const char pCollectionStr[] = "Collection"; +const OUStringLiteral pCollectionStr = u"Collection"; void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp ) { diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index b303349fa009..a8e124616910 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -342,8 +342,8 @@ SfxLibraryContainer* SfxDialogLibraryContainer::createInstanceImpl() return new SfxDialogLibraryContainer(); } -const char aResourceFileNameBase[] = "DialogStrings"; -const char aResourceFileCommentBase[] = "# Strings for Dialog Library "; +const OUStringLiteral aResourceFileNameBase = u"DialogStrings"; +const OUStringLiteral aResourceFileCommentBase = u"# Strings for Dialog Library "; // Resource handling Reference< css::resource::XStringResourcePersistence > diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx index 373fec6c8344..3b48c7907a4c 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx @@ -60,7 +60,7 @@ WrappedScaleTextProperty::WrappedScaleTextProperty(const std::shared_ptr<Chart2M void WrappedScaleTextProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const { - static const char aRefSizeName[] = "ReferencePageSize"; + static const OUStringLiteral aRefSizeName = u"ReferencePageSize"; if( !xInnerPropertySet.is() ) return; diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx index 2fa6fa360616..91e299d4906d 100644 --- a/chart2/source/controller/main/ElementSelector.cxx +++ b/chart2/source/controller/main/ElementSelector.cxx @@ -48,7 +48,8 @@ using ::com::sun::star::uno::Sequence; namespace { -const char lcl_aServiceName[] = "com.sun.star.comp.chart.ElementSelectorToolbarController"; +const OUStringLiteral lcl_aServiceName + = u"com.sun.star.comp.chart.ElementSelectorToolbarController"; } SelectorListBox::SelectorListBox(vcl::Window* pParent) diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx index ec1bf1f8b3a3..96b66e95e338 100644 --- a/chart2/source/model/filter/XMLFilter.cxx +++ b/chart2/source/model/filter/XMLFilter.cxx @@ -58,9 +58,9 @@ using ::osl::MutexGuard; namespace { -char const sXML_metaStreamName[] = "meta.xml"; -char const sXML_styleStreamName[] = "styles.xml"; -char const sXML_contentStreamName[] = "content.xml"; +OUStringLiteral const sXML_metaStreamName = u"meta.xml"; +OUStringLiteral const sXML_styleStreamName = u"styles.xml"; +OUStringLiteral const sXML_contentStreamName = u"content.xml"; uno::Reference< embed::XStorage > lcl_getWriteStorage( diff --git a/chart2/source/model/main/CartesianCoordinateSystem.cxx b/chart2/source/model/main/CartesianCoordinateSystem.cxx index dd0f77b40e58..f8cc8f17ad88 100644 --- a/chart2/source/model/main/CartesianCoordinateSystem.cxx +++ b/chart2/source/model/main/CartesianCoordinateSystem.cxx @@ -31,7 +31,7 @@ namespace com::sun::star::uno { class XComponentContext; } namespace { -const char CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME[] = "com.sun.star.chart2.CoordinateSystems.Cartesian"; +const OUStringLiteral CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME = u"com.sun.star.chart2.CoordinateSystems.Cartesian"; } diff --git a/chart2/source/model/main/PolarCoordinateSystem.cxx b/chart2/source/model/main/PolarCoordinateSystem.cxx index 5ec3252ae582..2d2497bc23c9 100644 --- a/chart2/source/model/main/PolarCoordinateSystem.cxx +++ b/chart2/source/model/main/PolarCoordinateSystem.cxx @@ -31,7 +31,8 @@ using ::com::sun::star::uno::Sequence; namespace { -const char CHART2_COOSYSTEM_POLAR_SERVICE_NAME[] = "com.sun.star.chart2.CoordinateSystems.Polar"; +const OUStringLiteral CHART2_COOSYSTEM_POLAR_SERVICE_NAME + = u"com.sun.star.chart2.CoordinateSystems.Polar"; } diff --git a/chart2/source/tools/CachedDataSequence.cxx b/chart2/source/tools/CachedDataSequence.cxx index 4eaf5d8f2743..dc44985589cc 100644 --- a/chart2/source/tools/CachedDataSequence.cxx +++ b/chart2/source/tools/CachedDataSequence.cxx @@ -42,7 +42,7 @@ using ::chart::impl::CachedDataSequence_Base; namespace { -const char lcl_aServiceName[] = "com.sun.star.comp.chart.CachedDataSequence"; +const OUStringLiteral lcl_aServiceName = u"com.sun.star.comp.chart.CachedDataSequence"; enum { diff --git a/chart2/source/tools/ConfigColorScheme.cxx b/chart2/source/tools/ConfigColorScheme.cxx index 5645fb22b68f..2aaf672800ac 100644 --- a/chart2/source/tools/ConfigColorScheme.cxx +++ b/chart2/source/tools/ConfigColorScheme.cxx @@ -34,7 +34,7 @@ using ::com::sun::star::uno::Sequence; namespace { -const char aSeriesPropName[] = "Series"; +const OUStringLiteral aSeriesPropName = u"Series"; } // anonymous namespace diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx index 91d6c003a067..6dd803093365 100644 --- a/chart2/source/tools/ErrorBar.cxx +++ b/chart2/source/tools/ErrorBar.cxx @@ -41,7 +41,7 @@ using namespace ::com::sun::star; namespace { -const char lcl_aServiceName[] = "com.sun.star.comp.chart2.ErrorBar"; +const OUStringLiteral lcl_aServiceName = u"com.sun.star.comp.chart2.ErrorBar"; bool lcl_isInternalData( const uno::Reference< chart2::data::XLabeledDataSequence > & xLSeq ) { diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index 94481ce9e5f8..abc3aea59d8f 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -57,12 +57,12 @@ namespace chart namespace { -const char lcl_aCategoriesRangeName[] = "categories"; +const OUStringLiteral lcl_aCategoriesRangeName = u"categories"; const char lcl_aCategoriesLevelRangeNamePrefix[] = "categoriesL "; //L <-> level const char lcl_aCategoriesPointRangeNamePrefix[] = "categoriesP "; //P <-> point -const char lcl_aCategoriesRoleName[] = "categories"; +const OUStringLiteral lcl_aCategoriesRoleName = u"categories"; const char lcl_aLabelRangePrefix[] = "label "; -const char lcl_aCompleteRange[] = "all"; +const OUStringLiteral lcl_aCompleteRange = u"all"; typedef std::multimap< OUString, uno::WeakReference< chart2::data::XDataSequence > > lcl_tSequenceMap; diff --git a/chart2/source/tools/ReferenceSizeProvider.cxx b/chart2/source/tools/ReferenceSizeProvider.cxx index 44109500552a..8e254903929e 100644 --- a/chart2/source/tools/ReferenceSizeProvider.cxx +++ b/chart2/source/tools/ReferenceSizeProvider.cxx @@ -131,7 +131,7 @@ void ReferenceSizeProvider::setValuesAtPropertySet( if( ! xProp.is()) return; - static const char aRefSizeName[] = "ReferencePageSize"; + static const OUStringLiteral aRefSizeName = u"ReferencePageSize"; try { diff --git a/chart2/source/tools/Scaling.cxx b/chart2/source/tools/Scaling.cxx index 27a9c51a7a44..212eadba54ee 100644 --- a/chart2/source/tools/Scaling.cxx +++ b/chart2/source/tools/Scaling.cxx @@ -27,10 +27,10 @@ namespace com::sun::star::uno { class XComponentContext; } namespace { -const char lcl_aServiceName_Logarithmic[] = "com.sun.star.chart2.LogarithmicScaling"; -const char lcl_aServiceName_Exponential[] = "com.sun.star.chart2.ExponentialScaling"; -const char lcl_aServiceName_Linear[] = "com.sun.star.chart2.LinearScaling"; -const char lcl_aServiceName_Power[] = "com.sun.star.chart2.PowerScaling"; +const OUStringLiteral lcl_aServiceName_Logarithmic = u"com.sun.star.chart2.LogarithmicScaling"; +const OUStringLiteral lcl_aServiceName_Exponential = u"com.sun.star.chart2.ExponentialScaling"; +const OUStringLiteral lcl_aServiceName_Linear = u"com.sun.star.chart2.LinearScaling"; +const OUStringLiteral lcl_aServiceName_Power = u"com.sun.star.chart2.PowerScaling"; } diff --git a/chart2/source/tools/UncachedDataSequence.cxx b/chart2/source/tools/UncachedDataSequence.cxx index 8851988b6d85..bdffa24a458d 100644 --- a/chart2/source/tools/UncachedDataSequence.cxx +++ b/chart2/source/tools/UncachedDataSequence.cxx @@ -41,7 +41,7 @@ using ::chart::impl::UncachedDataSequence_Base; namespace { -const char lcl_aServiceName[] = "com.sun.star.comp.chart.UncachedDataSequence"; +const OUStringLiteral lcl_aServiceName = u"com.sun.star.comp.chart.UncachedDataSequence"; enum { diff --git a/chart2/source/view/axes/DateScaling.cxx b/chart2/source/view/axes/DateScaling.cxx index 60ffc14bbfae..b5a690e203aa 100644 --- a/chart2/source/view/axes/DateScaling.cxx +++ b/chart2/source/view/axes/DateScaling.cxx @@ -25,8 +25,9 @@ namespace { -const char lcl_aServiceName_DateScaling[] = "com.sun.star.chart2.DateScaling"; -const char lcl_aServiceName_InverseDateScaling[] = "com.sun.star.chart2.InverseDateScaling"; +const OUStringLiteral lcl_aServiceName_DateScaling = u"com.sun.star.chart2.DateScaling"; +const OUStringLiteral lcl_aServiceName_InverseDateScaling + = u"com.sun.star.chart2.InverseDateScaling"; const double lcl_fNumberOfMonths = 12.0;//todo: this needs to be offered by basic tools Date class if it should be more generic } diff --git a/comphelper/source/misc/numberedcollection.cxx b/comphelper/source/misc/numberedcollection.cxx index 8252a306330b..20ed2cc43d9d 100644 --- a/comphelper/source/misc/numberedcollection.cxx +++ b/comphelper/source/misc/numberedcollection.cxx @@ -24,7 +24,7 @@ namespace comphelper{ -const char ERRMSG_INVALID_COMPONENT_PARAM[] = "NULL as component reference not allowed."; +const OUStringLiteral ERRMSG_INVALID_COMPONENT_PARAM = u"NULL as component reference not allowed."; NumberedCollection::NumberedCollection() diff --git a/compilerplugins/clang/stringliteralvar.cxx b/compilerplugins/clang/stringliteralvar.cxx new file mode 100644 index 000000000000..348193421a61 --- /dev/null +++ b/compilerplugins/clang/stringliteralvar.cxx @@ -0,0 +1,203 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +// Find constant character array variables that are passed into O[U]String constructors and should +// thus be turned into O[U]StringLiteral variables. +// +// Such a variable may have been used in multiple places, not all of which would be compatible with +// changing the variable's type to O[U]StringLiteral. However, this plugin is aggressive and +// ignores all but the first use of such a variable. In all cases of incompatible uses so far, it +// was possible to change to surrounding code (for the better) to make the changes work. +// +// The plugin also flags O[U]StringLiteral variables of automatic storage duration, and uses of such +// variables with sizeof---two likely errors that can occur once a variable has been changed from a +// character array to O[U]StringLiteral. +// +//TODO: In theory, we should not only look for variables, but also for non-static data members. In +// practice, those should be rare, though, as they should arguably have been static data members to +// begin with. + +#include <cassert> + +#include "check.hxx" +#include "plugin.hxx" + +namespace +{ +bool isAutomaticVariable(VarDecl const* decl) +{ + switch (cast<VarDecl>(decl)->getStorageDuration()) + { + case SD_Automatic: + return true; + case SD_Thread: + case SD_Static: + return false; + case SD_FullExpression: + case SD_Dynamic: + assert(false); + default: + llvm_unreachable("unknown StorageDuration"); + } +} + +class StringLiteralVar final : public loplugin::FilteringPlugin<StringLiteralVar> +{ +public: + explicit StringLiteralVar(loplugin::InstantiationData const& data) + : FilteringPlugin(data) + { + } + + bool TraverseInitListExpr(InitListExpr* expr, DataRecursionQueue* queue = nullptr) + { + return WalkUpFromInitListExpr(expr) + && TraverseSynOrSemInitListExpr( + expr->isSemanticForm() ? expr : expr->getSemanticForm(), queue); + } + + bool VisitCXXConstructExpr(CXXConstructExpr const* expr) + { + if (ignoreLocation(expr)) + { + return true; + } + loplugin::TypeCheck const tc(expr->getType()); + if (!(tc.Class("OString").Namespace("rtl").GlobalNamespace() + || tc.Class("OUString").Namespace("rtl").GlobalNamespace())) + { + return true; + } + switch (expr->getConstructor()->getNumParams()) + { + case 1: + { + auto const e = dyn_cast<DeclRefExpr>(expr->getArg(0)->IgnoreParenImpCasts()); + if (e == nullptr) + { + return true; + } + auto const tc = loplugin::TypeCheck(e->getType()); + if (!(tc.Class("OStringLiteral").Namespace("rtl").GlobalNamespace() + || tc.Class("OUStringLiteral").Namespace("rtl").GlobalNamespace())) + { + return true; + } + auto const d = e->getDecl(); + if (!isAutomaticVariable(cast<VarDecl>(d))) + { + return true; + } + if (!reportedAutomatic_.insert(d).second) + { + return true; + } + report(DiagnosticsEngine::Warning, + "variable %0 of type %1 with automatic storage duration most likely needs " + "to be static", + d->getLocation()) + << d << d->getType() << d->getSourceRange(); + report(DiagnosticsEngine::Note, "first converted to %0 here", expr->getLocation()) + << expr->getType() << expr->getSourceRange(); + } + break; + case 2: + { + auto const e1 = dyn_cast<DeclRefExpr>(expr->getArg(0)->IgnoreParenImpCasts()); + if (e1 == nullptr) + { + return true; + } + auto const t = e1->getType(); + if (!(t.isConstQualified() && t->isConstantArrayType())) + { + return true; + } + auto const e2 = expr->getArg(1); + if (!(isa<CXXDefaultArgExpr>(e2) + && loplugin::TypeCheck(e2->getType()) + .Struct("Dummy") + .Namespace("libreoffice_internal") + .Namespace("rtl") + .GlobalNamespace())) + { + return true; + } + auto const d = e1->getDecl(); + if (!reportedArray_.insert(d).second) + { + return true; + } + report(DiagnosticsEngine::Warning, + "change type of variable %0 from constant character array (%1) to " + "%select{OStringLiteral|OUStringLiteral}2%select{|, and make it static}3", + d->getLocation()) + << d << d->getType() + << (tc.Class("OString").Namespace("rtl").GlobalNamespace() ? 0 : 1) + << isAutomaticVariable(cast<VarDecl>(d)) << d->getSourceRange(); + report(DiagnosticsEngine::Note, "first passed into a %0 constructor here", + expr->getLocation()) + << expr->getType().getUnqualifiedType() << expr->getSourceRange(); + } + break; + } + return true; + } + + bool VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr const* expr) + { + if (ignoreLocation(expr)) + { + return true; + } + if (expr->getKind() != UETT_SizeOf) + { + return true; + } + if (expr->isArgumentType()) + { + return true; + } + auto const e = dyn_cast<DeclRefExpr>(expr->getArgumentExpr()->IgnoreParenImpCasts()); + if (e == nullptr) + { + return true; + } + auto const tc = loplugin::TypeCheck(e->getType()); + if (!(tc.Class("OStringLiteral").Namespace("rtl").GlobalNamespace() + || tc.Class("OUStringLiteral").Namespace("rtl").GlobalNamespace())) + { + return true; + } + auto const d = e->getDecl(); + report(DiagnosticsEngine::Warning, + "variable %0 of type %1 suspiciously used in a sizeof expression", e->getLocation()) + << d << d->getType() << expr->getSourceRange(); + return true; + } + + bool preRun() override { return compiler.getLangOpts().CPlusPlus; } + +private: + void run() override + { + if (preRun()) + { + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + } + } + + std::set<Decl const*> reportedAutomatic_; + std::set<Decl const*> reportedArray_; +}; + +static loplugin::Plugin::Registration<StringLiteralVar> reg("stringliteralvar"); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/compilerplugins/clang/test/stringliteralvar.cxx b/compilerplugins/clang/test/stringliteralvar.cxx new file mode 100644 index 000000000000..25a85f90a5a3 --- /dev/null +++ b/compilerplugins/clang/test/stringliteralvar.cxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <vector> + +#include <rtl/ustring.hxx> + +// expected-error@+1 {{change type of variable 'literal1' from constant character array ('const char [4]') to OStringLiteral [loplugin:stringliteralvar]}} +char const literal1[] = "foo"; +OString f1() +{ + // expected-note@+1 {{first passed into a 'rtl::OString' constructor here [loplugin:stringliteralvar]}} + return literal1; +} + +void f(OUString const&); +void f2() +{ + // expected-error@+1 {{change type of variable 'literal' from constant character array ('const char [4]') to OUStringLiteral, and make it static [loplugin:stringliteralvar]}} + char const literal[] = "foo"; + // expected-note@+1 {{first passed into a 'rtl::OUString' constructor here [loplugin:stringliteralvar]}} + f(literal); +} + +struct S3 +{ + // expected-error@+1 {{change type of variable 'literal' from constant character array ('const char16_t [4]') to OUStringLiteral [loplugin:stringliteralvar]}} + static constexpr char16_t literal[] = u"foo"; +}; +void f3() +{ + // expected-note@+1 {{first passed into a 'rtl::OUString' constructor here [loplugin:stringliteralvar]}} + f(S3::literal); +} + +std::vector<OUString> f4() +{ + // expected-error@+1 {{change type of variable 'literal' from constant character array ('const char16_t [4]') to OUStringLiteral [loplugin:stringliteralvar]}} + static constexpr char16_t literal[] = u"foo"; + // expected-note@+1 {{first passed into a 'rtl::OUString' constructor here [loplugin:stringliteralvar]}} + return { literal }; +} + +void f5() +{ + // expected-error@+1 {{variable 'literal' of type 'const rtl::OUStringLiteral<4>' with automatic storage duration most likely needs to be static [loplugin:stringliteralvar]}} + OUStringLiteral const literal = u"foo"; + // expected-note@+1 {{first converted to 'rtl::OUString' here [loplugin:stringliteralvar]}} + f(literal); +} + +void f6() +{ + // expected-error@+1 {{variable 'literal' of type 'const rtl::OUStringLiteral<4>' with automatic storage duration most likely needs to be static [loplugin:stringliteralvar]}} + constexpr OUStringLiteral literal = u"foo"; + // expected-note@+1 {{first converted to 'rtl::OUString' here [loplugin:stringliteralvar]}} + f(literal); +} + +void f7() +{ + static constexpr OUStringLiteral const literal = u"foo"; + f(literal); +} + +void f8() +{ + static constexpr OUStringLiteral const literal = u"foo"; + // expected-error@+1 {{variable 'literal' of type 'const rtl::OUStringLiteral<4>' suspiciously used in a sizeof expression [loplugin:stringliteralvar]}} + (void)sizeof literal; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx index d74019e6b05c..294791516862 100644 --- a/configmgr/source/configurationprovider.cxx +++ b/configmgr/source/configurationprovider.cxx @@ -60,10 +60,10 @@ namespace configmgr::configuration_provider { namespace { -char const accessServiceName[] = - "com.sun.star.configuration.ConfigurationAccess"; -char const updateAccessServiceName[] = - "com.sun.star.configuration.ConfigurationUpdateAccess"; +OUStringLiteral const accessServiceName = + u"com.sun.star.configuration.ConfigurationAccess"; +OUStringLiteral const updateAccessServiceName = + u"com.sun.star.configuration.ConfigurationUpdateAccess"; void badNodePath() { throw css::uno::Exception( diff --git a/connectivity/source/commontools/conncleanup.cxx b/connectivity/source/commontools/conncleanup.cxx index c33cc7289a65..f1d80581ff5a 100644 --- a/connectivity/source/commontools/conncleanup.cxx +++ b/connectivity/source/commontools/conncleanup.cxx @@ -35,7 +35,7 @@ namespace dbtools using namespace css::sdbc; using namespace css::lang; - const char ACTIVE_CONNECTION_PROPERTY_NAME[] = "ActiveConnection"; + const OUStringLiteral ACTIVE_CONNECTION_PROPERTY_NAME = u"ActiveConnection"; OAutoConnectionDisposer::OAutoConnectionDisposer(const Reference< XRowSet >& _rxRowSet, const Reference< XConnection >& _rxConnection) :m_xRowSet( _rxRowSet ) diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index 59f7dd50136e..db6e81a7400a 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -1014,7 +1014,7 @@ bool isAggregateColumn( const Reference< XPropertySet > &_xColumn ) { bool bAgg(false); - static const char sAgg[] = "AggregateFunction"; + static const OUStringLiteral sAgg = u"AggregateFunction"; if ( _xColumn->getPropertySetInfo()->hasPropertyByName(sAgg) ) _xColumn->getPropertyValue(sAgg) >>= bAgg; diff --git a/connectivity/source/cpool/ZConnectionPool.cxx b/connectivity/source/cpool/ZConnectionPool.cxx index 7d05b6e0236b..c0b034814deb 100644 --- a/connectivity/source/cpool/ZConnectionPool.cxx +++ b/connectivity/source/cpool/ZConnectionPool.cxx @@ -41,7 +41,7 @@ void SAL_CALL OPoolTimer::onShot() m_pPool->invalidatePooledConnections(); } -const char TIMEOUT_NODENAME[] = "Timeout"; +const OUStringLiteral TIMEOUT_NODENAME = u"Timeout"; OConnectionPool::OConnectionPool(const Reference< XDriver >& _xDriver, const Reference< XInterface >& _xDriverNode, diff --git a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx index 4982cc455665..4c9446348681 100644 --- a/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NResultSetMetaData.cxx @@ -40,7 +40,7 @@ OEvoabResultSetMetaData::~OEvoabResultSetMetaData() void OEvoabResultSetMetaData::setEvoabFields(const ::rtl::Reference<connectivity::OSQLColumns> &xColumns) { - static const char aName[] = "Name"; + static const OUStringLiteral aName = u"Name"; for (const auto& rxColumn : *xColumns) { diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx index c965367dab0e..6a247ee8f41e 100644 --- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx +++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx @@ -165,7 +165,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( // check if any type is given // when no types are given then we have to return all tables e.g. TABLE - static const char aTable[] = "TABLE"; + static const OUStringLiteral aTable = u"TABLE"; bool bTableFound = true; sal_Int32 nLength = types.getLength(); diff --git a/connectivity/source/drivers/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx index 3ad9576c11fb..04c65ba06860 100644 --- a/connectivity/source/drivers/firebird/Driver.cxx +++ b/connectivity/source/drivers/firebird/Driver.cxx @@ -45,9 +45,9 @@ using namespace connectivity::firebird; // Static const variables namespace { -const char our_sFirebirdTmpVar[] = "FIREBIRD_TMP"; -const char our_sFirebirdLockVar[] = "FIREBIRD_LOCK"; -const char our_sFirebirdMsgVar[] = "FIREBIRD_MSG"; +const OUStringLiteral our_sFirebirdTmpVar = u"FIREBIRD_TMP"; +const OUStringLiteral our_sFirebirdLockVar = u"FIREBIRD_LOCK"; +const OUStringLiteral our_sFirebirdMsgVar = u"FIREBIRD_MSG"; #ifdef MACOSX const char our_sFirebirdLibVar[] = "LIBREOFFICE_FIREBIRD_LIB"; #endif diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx index 1d33f2941316..cf0b549b11aa 100644 --- a/connectivity/source/drivers/jdbc/JConnection.cxx +++ b/connectivity/source/drivers/jdbc/JConnection.cxx @@ -699,7 +699,8 @@ void java_sql_Connection::loadDriverFromProperties( const OUString& _sDriverClas OUString java_sql_Connection::impl_getJavaDriverClassPath_nothrow(const OUString& _sDriverClass) { - static const char s_sNodeName[] = "org.openoffice.Office.DataAccess/JDBC/DriverClassPaths"; + static const OUStringLiteral s_sNodeName + = u"org.openoffice.Office.DataAccess/JDBC/DriverClassPaths"; ::utl::OConfigurationTreeRoot aNamesRoot = ::utl::OConfigurationTreeRoot::createWithComponentContext( m_pDriver->getContext(), s_sNodeName, -1, ::utl::OConfigurationTreeRoot::CM_READONLY); OUString sURL; diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx index a47758f31a5d..28cb14faa981 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx @@ -1090,8 +1090,9 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(bool _bRowVer,const Any& cat // E.g. psqlodbc up to at least version 09.01.0100 segfaults if (table.empty()) { - const char errMsg[] = "ODBC: Trying to get special columns of empty table name"; - const char SQLState[] = "HY009"; + static const OUStringLiteral errMsg + = u"ODBC: Trying to get special columns of empty table name"; + static const OUStringLiteral SQLState = u"HY009"; throw SQLException( errMsg, *this, SQLState, -1, Any() ); } diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index d7d7512b7acd..9f860327757c 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -264,7 +264,7 @@ namespace { OUString sComposedName; - static const char s_sWildcard[] = "%" ; + static const OUStringLiteral s_sWildcard = u"%" ; // we want all catalogues, all schemas, all tables Sequence< OUString > sTableTypes(3); diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index 014c8b09f328..e7aa9c83f29d 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -65,9 +65,9 @@ using namespace css; -const char FOLDERNAME_UICONFIG[] = "Configurations2"; +const OUStringLiteral FOLDERNAME_UICONFIG = u"Configurations2"; -const char MEDIATYPE_PROPNAME[] = "MediaType"; +const OUStringLiteral MEDIATYPE_PROPNAME = u"MediaType"; const sal_uInt16 KEYCODE_ARRAY[] = { KEY_F1, KEY_F2, diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index f694f26fd6bc..e538bc25bcee 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -74,7 +74,7 @@ const char CMDURL_STYLEPROT_ONLY[] = ".uno:StyleApply?"; const char CMDURL_SPART_ONLY [] = "Style:string="; const char CMDURL_FPART_ONLY [] = "FamilyName:string="; -const char STYLEPROP_UINAME[] = "DisplayName"; +const OUStringLiteral STYLEPROP_UINAME = u"DisplayName"; OUString SfxStylesInfo_Impl::generateCommand(const OUString& sFamily, const OUString& sStyle) { diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index 116dac39f0a6..76abb324b583 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -709,7 +709,7 @@ void TPGalleryThemeProperties::FillFilterList() #if HAVE_FEATURE_AVMEDIA // media filters - static const char aWildcard[] = "*."; + static const OUStringLiteral aWildcard = u"*."; ::avmedia::FilterNameVector aFilters= ::avmedia::MediaWindow::getMediaFilters(); for(const std::pair<OUString,OUString> & aFilter : aFilters) diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx index 140d2a59da3b..9c938e40ae66 100644 --- a/cui/source/dialogs/hlinettp.cxx +++ b/cui/source/dialogs/hlinettp.cxx @@ -23,7 +23,7 @@ #include <hlinettp.hxx> #include <hlmarkwn_def.hxx> -char const sAnonymous[] = "anonymous"; +OUStringLiteral const sAnonymous = u"anonymous"; char const sFTPScheme[] = INET_FTP_SCHEME; /************************************************************************* diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index 0bc2085178d2..4fd7fb801ebc 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -42,18 +42,18 @@ #define notebookbarTabScope "notebookbarTabScope" const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; -const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer"; +inline const OUStringLiteral ITEM_DESCRIPTOR_CONTAINER = u"ItemDescriptorContainer"; const char ITEM_DESCRIPTOR_LABEL[] = "Label"; const char ITEM_DESCRIPTOR_TYPE[] = "Type"; const char ITEM_DESCRIPTOR_STYLE[] = "Style"; const char ITEM_DESCRIPTOR_ISVISIBLE[] = "IsVisible"; const char ITEM_DESCRIPTOR_RESOURCEURL[] = "ResourceURL"; -const char ITEM_DESCRIPTOR_UINAME[] = "UIName"; +inline const OUStringLiteral ITEM_DESCRIPTOR_UINAME = u"UIName"; -const char ITEM_MENUBAR_URL[] = "private:resource/menubar/menubar"; +inline const OUStringLiteral ITEM_MENUBAR_URL = u"private:resource/menubar/menubar"; constexpr char16_t ITEM_TOOLBAR_URL[] = u"private:resource/toolbar/"; -const char CUSTOM_TOOLBAR_STR[] = "custom_toolbar_"; +inline const OUStringLiteral CUSTOM_TOOLBAR_STR = u"custom_toolbar_"; const char aMenuSeparatorStr[] = " | "; diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx index 1daf56dbb64b..c16a533bbf9e 100644 --- a/cui/source/options/optasian.cxx +++ b/cui/source/options/optasian.cxx @@ -43,8 +43,8 @@ using namespace com::sun::star::i18n; using namespace com::sun::star::frame; using namespace com::sun::star::beans; -const char cIsKernAsianPunctuation[] = "IsKernAsianPunctuation"; -const char cCharacterCompressionType[] = "CharacterCompressionType"; +const OUStringLiteral cIsKernAsianPunctuation = u"IsKernAsianPunctuation"; +const OUStringLiteral cCharacterCompressionType = u"CharacterCompressionType"; namespace { diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index a1b820b93585..21d46a879e36 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -1019,11 +1019,11 @@ struct LanguageConfig_Impl static bool bLanguageCurrentDoc_Impl = false; // some things we'll need... -const char sAccessSrvc[] = "com.sun.star.configuration.ConfigurationAccess"; -const char sAccessUpdSrvc[] = "com.sun.star.configuration.ConfigurationUpdateAccess"; -const char sInstalledLocalesPath[] = "org.openoffice.Setup/Office/InstalledLocales"; -const char sUserLocalePath[] = "org.openoffice.Office.Linguistic/General"; -const char sUserLocaleKey[] = "UILocale"; +const OUStringLiteral sAccessSrvc = u"com.sun.star.configuration.ConfigurationAccess"; +const OUStringLiteral sAccessUpdSrvc = u"com.sun.star.configuration.ConfigurationUpdateAccess"; +const OUStringLiteral sInstalledLocalesPath = u"org.openoffice.Setup/Office/InstalledLocales"; +const OUStringLiteral sUserLocalePath = u"org.openoffice.Office.Linguistic/General"; +const OUStringLiteral sUserLocaleKey = u"UILocale"; static Sequence< OUString > seqInstalledLanguages; static OUString lcl_getDatePatternsConfigString( const LocaleDataWrapper& rLocaleWrapper ) diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 3f7bad1d804a..5e2df9189d7a 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -93,14 +93,14 @@ IMPL_LINK(SvxProxyTabPage, PortChangedHdl, weld::Entry&, rEdit, void) } } -const char g_aProxyModePN[] = "ooInetProxyType"; -const char g_aHttpProxyPN[] = "ooInetHTTPProxyName"; -const char g_aHttpPortPN[] = "ooInetHTTPProxyPort"; -const char g_aHttpsProxyPN[] = "ooInetHTTPSProxyName"; -const char g_aHttpsPortPN[] = "ooInetHTTPSProxyPort"; -const char g_aFtpProxyPN[] = "ooInetFTPProxyName"; -const char g_aFtpPortPN[] = "ooInetFTPProxyPort"; -const char g_aNoProxyDescPN[] = "ooInetNoProxy"; +const OUStringLiteral g_aProxyModePN = u"ooInetProxyType"; +const OUStringLiteral g_aHttpProxyPN = u"ooInetHTTPProxyName"; +const OUStringLiteral g_aHttpPortPN = u"ooInetHTTPProxyPort"; +const OUStringLiteral g_aHttpsProxyPN = u"ooInetHTTPSProxyName"; +const OUStringLiteral g_aHttpsPortPN = u"ooInetHTTPSProxyPort"; +const OUStringLiteral g_aFtpProxyPN = u"ooInetFTPProxyName"; +const OUStringLiteral g_aFtpPortPN = u"ooInetFTPProxyPort"; +const OUStringLiteral g_aNoProxyDescPN = u"ooInetNoProxy"; IMPL_STATIC_LINK(SvxProxyTabPage, NumberOnlyTextFilterHdl, OUString&, rTest, bool) { diff --git a/dbaccess/qa/unit/embeddeddb_performancetest.cxx b/dbaccess/qa/unit/embeddeddb_performancetest.cxx index 0517a9fd170c..abd72db66fe4 100644 --- a/dbaccess/qa/unit/embeddeddb_performancetest.cxx +++ b/dbaccess/qa/unit/embeddeddb_performancetest.cxx @@ -82,7 +82,8 @@ class EmbeddedDBPerformanceTest : public DBTestBase { private: - static const char our_sEnableTestEnvVar[]; + static constexpr OUStringLiteral our_sEnableTestEnvVar = u"DBA_PERFTEST"; + // We store the results and print them at the end due to the amount of warning // noise present which otherwise obscures the results. @@ -140,8 +141,6 @@ void EmbeddedDBPerformanceTest::printTimes( .append("\n"); } -const char EmbeddedDBPerformanceTest::our_sEnableTestEnvVar[] = "DBA_PERFTEST"; - // TODO: we probably should create a document from scratch instead? void EmbeddedDBPerformanceTest::testPerformance() diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx index 0e8b2926c37e..74b522a4b459 100644 --- a/dbaccess/source/core/api/FilteredContainer.cxx +++ b/dbaccess/source/core/api/FilteredContainer.cxx @@ -343,7 +343,7 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: } } - static const char sAll[] = "%"; + static const OUStringLiteral sAll = u"%"; Reference< XResultSet > xTables = m_xMetaData->getTables( Any(), sAll, sAll, aTableTypeFilter ); Reference< XRow > xCurrentRow( xTables, UNO_QUERY_THROW ); diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index cf6753794800..b5a789fad212 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -311,7 +311,7 @@ namespace } } -const char sPictures[] = "Pictures"; +const OUStringLiteral sPictures = u"Pictures"; // base documents seem to have a different behaviour to other documents, the // root storage contents at least seem to be re-used over different saves, thus if there is a diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 891df4de9dc8..206b8e490e6e 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -644,7 +644,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString if (bNeedMigration) { // back up content xml file if migration was successful - constexpr char BACKUP_XML_NAME[] = "content_before_migration.xml"; + static constexpr OUStringLiteral BACKUP_XML_NAME = u"content_before_migration.xml"; try { if(xRootStorage->isStreamElement(BACKUP_XML_NAME)) diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index b6366e4482fb..f317bd474c38 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -266,7 +266,7 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL DatabaseDataProvider::cre osl::MutexGuard g(m_aMutex); uno::Reference< chart2::data::XDataSequence > xData = m_xInternal->createDataSequenceByRangeRepresentation(_sRangeRepresentation); uno::Reference<beans::XPropertySet> xProp(xData,uno::UNO_QUERY); - static const char s_sNumberFormatKey[] = "NumberFormatKey"; + static const OUStringLiteral s_sNumberFormatKey = u"NumberFormatKey"; if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(s_sNumberFormatKey) ) { xProp->setPropertyValue(s_sNumberFormatKey,impl_getNumberFormatKey_nothrow(_sRangeRepresentation)); diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx index ab5947d91261..d111aa86b6cf 100644 --- a/dbaccess/source/core/recovery/dbdocrecovery.cxx +++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx @@ -86,9 +86,9 @@ namespace dbaccess return true; } - const char sRecoveryDataSubStorageName[] = "recovery"; + const OUStringLiteral sRecoveryDataSubStorageName = u"recovery"; - const char sObjectMapStreamName[] = "storage-component-map.ini"; + const OUStringLiteral sObjectMapStreamName = u"storage-component-map.ini"; void lcl_writeObjectMap_throw( const Reference<XComponentContext> & i_rContext, const Reference< XStorage >& i_rStorage, const MapStringToCompDesc& i_mapStorageToCompDesc ) diff --git a/dbaccess/source/core/recovery/storagetextstream.cxx b/dbaccess/source/core/recovery/storagetextstream.cxx index 6ea4ef005320..1dd774bc8a31 100644 --- a/dbaccess/source/core/recovery/storagetextstream.cxx +++ b/dbaccess/source/core/recovery/storagetextstream.cxx @@ -36,7 +36,7 @@ namespace dbaccess Reference< XTextOutputStream2 > xTextOutput; }; - const char sLineFeed[] = "\n"; + const OUStringLiteral sLineFeed = u"\n"; // StorageTextOutputStream StorageTextOutputStream::StorageTextOutputStream( const Reference<XComponentContext>& i_rContext, diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.cxx b/dbaccess/source/core/recovery/subcomponentrecovery.cxx index ab16ee9e2c04..11dfa49d17ad 100644 --- a/dbaccess/source/core/recovery/subcomponentrecovery.cxx +++ b/dbaccess/source/core/recovery/subcomponentrecovery.cxx @@ -160,8 +160,8 @@ namespace dbaccess return xCommandProcessor; } - const char sSettingsStreamName[] = "settings.xml"; - const char sCurrentQueryDesignName[] = "ooo:current-query-design"; + const OUStringLiteral sSettingsStreamName = u"settings.xml"; + const OUStringLiteral sCurrentQueryDesignName = u"ooo:current-query-design"; } namespace { diff --git a/dbaccess/source/filter/hsqldb/hsqlimport.cxx b/dbaccess/source/filter/hsqldb/hsqlimport.cxx index a017d8dfa12e..f24ceb6f2ff0 100644 --- a/dbaccess/source/filter/hsqldb/hsqlimport.cxx +++ b/dbaccess/source/filter/hsqldb/hsqlimport.cxx @@ -266,7 +266,7 @@ void HsqlImporter::parseTableRows(const std::vector<sal_Int32>& rIndexes, const std::vector<ColumnDefinition>& rColTypes, const OUString& sTableName) { - constexpr char BINARY_FILENAME[] = "data"; + static constexpr OUStringLiteral BINARY_FILENAME = u"data"; if (!m_xStorage->hasByName(BINARY_FILENAME)) { diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx b/dbaccess/source/filter/hsqldb/parseschema.cxx index 6dfc59778bf0..e1d794cdca8b 100644 --- a/dbaccess/source/filter/hsqldb/parseschema.cxx +++ b/dbaccess/source/filter/hsqldb/parseschema.cxx @@ -111,7 +111,7 @@ void SchemaParser::parseSchema() { assert(m_rStorage); - constexpr char SCHEMA_FILENAME[] = "script"; + static constexpr OUStringLiteral SCHEMA_FILENAME = u"script"; if (!m_rStorage->hasByName(SCHEMA_FILENAME)) { SAL_WARN("dbaccess", "script file does not exist in storage during hsqldb import"); @@ -175,7 +175,8 @@ std::vector<ColumnDefinition> SchemaParser::getTableColumnTypes(const OUString& { if (m_ColumnTypes.count(sTableName) < 1) { - constexpr char NOT_EXIST[] = "Internal error while getting column information of table"; + static constexpr OUStringLiteral NOT_EXIST + = u"Internal error while getting column information of table"; SAL_WARN("dbaccess", NOT_EXIST << ". Table name is: " << sTableName); dbtools::throwGenericSQLException(NOT_EXIST, ::comphelper::getProcessComponentContext()); } diff --git a/dbaccess/source/filter/hsqldb/utils.cxx b/dbaccess/source/filter/hsqldb/utils.cxx index f2b2b517b8fc..041df17a700a 100644 --- a/dbaccess/source/filter/hsqldb/utils.cxx +++ b/dbaccess/source/filter/hsqldb/utils.cxx @@ -129,9 +129,10 @@ void utils::ensureFirebirdTableLength(const OUString& sName) { if (sName.getLength() > 30) // Firebird limitation { - constexpr char NAME_TOO_LONG[] = "Firebird 3 doesn't support object (table, field) names " - "of more than 30 characters; please shorten your object " - "names in the original file and try again."; + static constexpr OUStringLiteral NAME_TOO_LONG + = u"Firebird 3 doesn't support object (table, field) names " + "of more than 30 characters; please shorten your object " + "names in the original file and try again."; dbtools::throwGenericSQLException(NAME_TOO_LONG, ::comphelper::getProcessComponentContext()); } diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 987536261316..d75d557615a2 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -674,7 +674,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = xEnumAccess.is(); if ( aReturn.bEnabled ) { - static const char s_sReportDesign[] = "org.libreoffice.report.pentaho.SOReportJobFactory"; + static const OUStringLiteral s_sReportDesign = u"org.libreoffice.report.pentaho.SOReportJobFactory"; Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(s_sReportDesign); aReturn.bEnabled = xEnumDrivers.is() && xEnumDrivers->hasMoreElements(); } diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 1d7019a81b29..0ce728d7fa2a 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -639,7 +639,7 @@ void OApplicationController::onLoadedMenu(const Reference< css::frame::XLayoutMa if ( !_xLayoutManager.is() ) return; - static const char s_sStatusbar[] = "private:resource/statusbar/statusbar"; + static const OUStringLiteral s_sStatusbar = u"private:resource/statusbar/statusbar"; _xLayoutManager->createElement( s_sStatusbar ); _xLayoutManager->requestElement( s_sStatusbar ); diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx index 67df2db8ccdf..da4d61641936 100644 --- a/dbaccess/source/ui/dlg/queryfilter.cxx +++ b/dbaccess/source/ui/dlg/queryfilter.cxx @@ -304,10 +304,10 @@ bool DlgFilterCrit::getCondition(const weld::ComboBox& _rField,const weld::Combo } } xColumn->getPropertyValue(PROPERTY_REALNAME) >>= _rFilter.Name; - static const char sAgg[] = "AggregateFunction"; + static const OUStringLiteral sAgg = u"AggregateFunction"; if ( xInfo->hasPropertyByName(sAgg) ) xColumn->getPropertyValue(sAgg) >>= bHaving; - static const char sFunction[] = "Function"; + static const OUStringLiteral sFunction = u"Function"; if ( xInfo->hasPropertyByName(sFunction) ) xColumn->getPropertyValue(sFunction) >>= bFunction; } diff --git a/dbaccess/source/ui/misc/indexcollection.cxx b/dbaccess/source/ui/misc/indexcollection.cxx index fb83377f1740..046a41a000ea 100644 --- a/dbaccess/source/ui/misc/indexcollection.cxx +++ b/dbaccess/source/ui/misc/indexcollection.cxx @@ -122,7 +122,7 @@ namespace dbaui } // set the properties - static const char s_sNamePropertyName[] = "Name"; + static const OUStringLiteral s_sNamePropertyName = u"Name"; // the index' own props xIndexDescriptor->setPropertyValue("IsUnique", css::uno::makeAny(_rPos->bUnique)); xIndexDescriptor->setPropertyValue(s_sNamePropertyName, makeAny(_rPos->sName)); diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 6a77aa548855..5bab3d26f30b 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -149,8 +149,8 @@ namespace return; xLayoutManager->lock(); - static const char s_sDesignToolbar[] = "private:resource/toolbar/designobjectbar"; - static const char s_sSqlToolbar[] = "private:resource/toolbar/sqlobjectbar"; + static const OUStringLiteral s_sDesignToolbar = u"private:resource/toolbar/designobjectbar"; + static const OUStringLiteral s_sSqlToolbar = u"private:resource/toolbar/sqlobjectbar"; if ( _bDesign ) { xLayoutManager->destroyElement( s_sSqlToolbar ); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 112be4caf94d..596e83b14ebf 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -560,7 +560,7 @@ bool Desktop::QueryExit() { } - const char SUSPEND_QUICKSTARTVETO[] = "SuspendQuickstartVeto"; + static const OUStringLiteral SUSPEND_QUICKSTARTVETO = u"SuspendQuickstartVeto"; Reference< XDesktop2 > xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() ); Reference< XPropertySet > xPropertySet(xDesktop, UNO_QUERY_THROW); @@ -872,7 +872,7 @@ namespace { #if HAVE_FEATURE_BREAKPAD void handleCrashReport() { - static const char SERVICENAME_CRASHREPORT[] = "com.sun.star.comp.svx.CrashReportUI"; + static const OUStringLiteral SERVICENAME_CRASHREPORT = u"com.sun.star.comp.svx.CrashReportUI"; css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index 8af149f1f93b..2e667e0ad64c 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -207,7 +207,7 @@ void SilentCommandEnv::pop() } // end namespace -const char aAccessSrvc[] = "com.sun.star.configuration.ConfigurationUpdateAccess"; +const OUStringLiteral aAccessSrvc = u"com.sun.star.configuration.ConfigurationUpdateAccess"; static sal_Int16 impl_showExtensionDialog( uno::Reference< uno::XComponentContext > const &xContext ) { diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx index 1d7fe7613be7..03e45b7278c0 100644 --- a/desktop/source/app/cmdlinehelp.cxx +++ b/desktop/source/app/cmdlinehelp.cxx @@ -35,11 +35,11 @@ namespace desktop { - const char aCmdLineHelp_version[] = - "%PRODUCTNAME %PRODUCTVERSION%PRODUCTEXTENSION %BUILDID\n" + const OUStringLiteral aCmdLineHelp_version = + u"%PRODUCTNAME %PRODUCTVERSION%PRODUCTEXTENSION %BUILDID\n" "\n"; - const char aCmdLineHelp[] = - "Usage: %CMDNAME [argument...]\n" + const OUStringLiteral aCmdLineHelp = + u"Usage: %CMDNAME [argument...]\n" " argument - switches, switch parameters and document URIs (filenames). \n\n" "Using without special arguments: \n" "Opens the start center, if it is used without any arguments. \n" diff --git a/desktop/source/deployment/misc/dp_dependencies.cxx b/desktop/source/deployment/misc/dp_dependencies.cxx index eae5ca5cb7d8..732778e2bbd1 100644 --- a/desktop/source/deployment/misc/dp_dependencies.cxx +++ b/desktop/source/deployment/misc/dp_dependencies.cxx @@ -43,14 +43,14 @@ namespace { char const namespaceLibreOffice[] = "http://libreoffice.org/extensions/description/2011"; -char const namespaceOpenOfficeOrg[] = - "http://openoffice.org/extensions/description/2006"; +OUStringLiteral const namespaceOpenOfficeOrg = + u"http://openoffice.org/extensions/description/2006"; char const minimalVersionLibreOffice[] = "LibreOffice-minimal-version"; char const maximalVersionLibreOffice[] = "LibreOffice-maximal-version"; -char const minimalVersionOpenOfficeOrg[] = - "OpenOffice.org-minimal-version"; +OUStringLiteral const minimalVersionOpenOfficeOrg = + u"OpenOffice.org-minimal-version"; char const maximalVersionOpenOfficeOrg[] = "OpenOffice.org-maximal-version"; diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 1637a9d63ade..4955c279ec32 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -69,9 +69,9 @@ using namespace com::sun::star; namespace desktop { -const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; -const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer"; -const char ITEM_DESCRIPTOR_LABEL[] = "Label"; +const OUStringLiteral ITEM_DESCRIPTOR_COMMANDURL = u"CommandURL"; +const OUStringLiteral ITEM_DESCRIPTOR_CONTAINER = u"ItemDescriptorContainer"; +const OUStringLiteral ITEM_DESCRIPTOR_LABEL = u"Label"; static OUString mapModuleShortNameToIdentifier(std::u16string_view sShortName) { diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 3b9da426dc64..d04247c397f2 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -95,9 +95,9 @@ namespace o3tl { } const sal_Unicode cNonBreakingSpace = 0xA0; // UNICODE code for no break space -const char pXMLImplWrdStt_ExcptLstStr[] = "WordExceptList.xml"; -const char pXMLImplCplStt_ExcptLstStr[] = "SentenceExceptList.xml"; -const char pXMLImplAutocorr_ListStr[] = "DocumentList.xml"; +const OUStringLiteral pXMLImplWrdStt_ExcptLstStr = u"WordExceptList.xml"; +const OUStringLiteral pXMLImplCplStt_ExcptLstStr = u"SentenceExceptList.xml"; +const OUStringLiteral pXMLImplAutocorr_ListStr = u"DocumentList.xml"; const char /* also at these beginnings - Brackets and all kinds of begin characters */ diff --git a/extensions/source/abpilot/admininvokationimpl.cxx b/extensions/source/abpilot/admininvokationimpl.cxx index fe208e85b3ec..720ef26fb90c 100644 --- a/extensions/source/abpilot/admininvokationimpl.cxx +++ b/extensions/source/abpilot/admininvokationimpl.cxx @@ -62,7 +62,7 @@ namespace abp { // the service name of the administration dialog static const char16_t s_sAdministrationServiceName[] = u"com.sun.star.sdb.DatasourceAdministrationDialog"; - static const char s_sDataSourceTypeChangeDialog[] = "com.sun.star.sdb.DataSourceTypeChangeDialog"; + static const OUStringLiteral s_sDataSourceTypeChangeDialog = u"com.sun.star.sdb.DataSourceTypeChangeDialog"; // the parameters for the call Sequence<Any> aArguments(comphelper::InitAnyPropertySequence( diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx b/extensions/source/abpilot/fieldmappingimpl.cxx index 7a72f8475c4b..34d860cf3f49 100644 --- a/extensions/source/abpilot/fieldmappingimpl.cxx +++ b/extensions/source/abpilot/fieldmappingimpl.cxx @@ -50,7 +50,7 @@ namespace abp const char16_t sDriverSettingsNodeName[] = u"/org.openoffice.Office.DataAccess/DriverSettings/com.sun.star.comp.sdbc.MozabDriver"; - const char sAddressBookNodeName[] = "/org.openoffice.Office.DataAccess/AddressBook"; + const OUStringLiteral sAddressBookNodeName = u"/org.openoffice.Office.DataAccess/AddressBook"; namespace fieldmapping { diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index ee271f4cc898..f5a68212922d 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -33,7 +33,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdb; -constexpr char16_t cDataSourceHistory[] = u"DataSourceHistory"; +constexpr OUStringLiteral cDataSourceHistory = u"DataSourceHistory"; Sequence<OUString> const & BibConfig::GetPropertyNames() { diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx index 478a7b34ab51..43d6054cdfa3 100644 --- a/extensions/source/dbpilots/gridwizard.cxx +++ b/extensions/source/dbpilots/gridwizard.cxx @@ -93,8 +93,8 @@ namespace dbp if (!xColumnFactory.is() || !xColumnContainer.is()) return; - static const char s_sMouseWheelBehavior[] = "MouseWheelBehavior"; - static const char s_sEmptyString[] = ""; + static const OUStringLiteral s_sMouseWheelBehavior = u"MouseWheelBehavior"; + static const OUStringLiteral s_sEmptyString = u""; // collect "descriptors" for the to-be-created (grid)columns std::vector< OUString > aColumnServiceNames; // service names to be used with the XGridColumnFactory diff --git a/extensions/source/dbpilots/optiongrouplayouter.cxx b/extensions/source/dbpilots/optiongrouplayouter.cxx index 546fa9ca7a7d..bfd14727cfb1 100644 --- a/extensions/source/dbpilots/optiongrouplayouter.cxx +++ b/extensions/source/dbpilots/optiongrouplayouter.cxx @@ -189,7 +189,7 @@ namespace dbp void OOptionGroupLayouter::implAnchorShape(const Reference< XPropertySet >& _rxShapeProps) { - static const char s_sAnchorPropertyName[] = "AnchorType"; + static const OUStringLiteral s_sAnchorPropertyName = u"AnchorType"; Reference< XPropertySetInfo > xPropertyInfo; if (_rxShapeProps.is()) xPropertyInfo = _rxShapeProps->getPropertySetInfo(); diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 792964cb00d9..d870307a1c4d 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -20,7 +20,7 @@ using namespace ::com::sun::star; -char const DATA_DIRECTORY[] = "/filter/qa/unit/data/"; +OUStringLiteral const DATA_DIRECTORY = u"/filter/qa/unit/data/"; /// SVG filter tests. class SvgFilterTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools diff --git a/filter/qa/unit/textfilterdetect.cxx b/filter/qa/unit/textfilterdetect.cxx index fb1ff1d2ac7e..1efbebc47b93 100644 --- a/filter/qa/unit/textfilterdetect.cxx +++ b/filter/qa/unit/textfilterdetect.cxx @@ -54,7 +54,7 @@ void TextFilterDetectTest::tearDown() test::BootstrapFixture::tearDown(); } -char const DATA_DIRECTORY[] = "/filter/qa/unit/data/"; +OUStringLiteral const DATA_DIRECTORY = u"/filter/qa/unit/data/"; CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testTdf114428) { diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index bcf97a8b0678..a77457687076 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -83,7 +83,7 @@ using namespace ::xmloff::token; #define SVG_PROP_POSITIONED_CHARACTERS "UsePositionedCharacters" // ooo xml elements -constexpr char16_t aOOOElemTextField[] = u"" NSPREFIX "text_field"; +constexpr OUStringLiteral aOOOElemTextField = u"" NSPREFIX "text_field"; // ooo xml attributes for meta_slide @@ -93,13 +93,13 @@ const char aOOOAttrBackgroundVisibility[] = NSPREFIX "background-visibility"; const char aOOOAttrMasterObjectsVisibility[] = NSPREFIX "master-objects-visibility"; const char aOOOAttrSlideDuration[] = NSPREFIX "slide-duration"; const OUString aOOOAttrDateTimeField = NSPREFIX "date-time-field"; -const char aOOOAttrFooterField[] = NSPREFIX "footer-field"; +const OUStringLiteral aOOOAttrFooterField = u"" NSPREFIX "footer-field"; const char aOOOAttrHasTransition[] = NSPREFIX "has-transition"; // ooo xml attributes for pages and shapes const char aOOOAttrName[] = NSPREFIX "name"; -const char constSvgNamespace[] = "http://www.w3.org/2000/svg"; +const OUStringLiteral constSvgNamespace = u"http://www.w3.org/2000/svg"; /** Text Field Class Hierarchy diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx index 8025550b5837..a15dc12f53e6 100644 --- a/filter/source/svg/svgfilter.cxx +++ b/filter/source/svg/svgfilter.cxx @@ -63,8 +63,8 @@ using namespace ::com::sun::star; namespace { - const char constFilterNameDraw[] = "svg_Scalable_Vector_Graphics_Draw"; - const char constFilterName[] = "svg_Scalable_Vector_Graphics"; + const OUStringLiteral constFilterNameDraw = u"svg_Scalable_Vector_Graphics_Draw"; + const OUStringLiteral constFilterName = u"svg_Scalable_Vector_Graphics"; } SVGFilter::SVGFilter( const Reference< XComponentContext >& rxCtx ) : diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 97c76efb5eff..11b8bd14d352 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -1943,7 +1943,7 @@ void ODatabaseForm::reset_impl(bool _bApproveByListeners) if ( xColProps.is() ) xPSI = xColProps->getPropertySetInfo( ); - static const char PROPERTY_CONTROLDEFAULT[] = "ControlDefault"; + static const OUStringLiteral PROPERTY_CONTROLDEFAULT = u"ControlDefault"; if ( xPSI.is() && xPSI->hasPropertyByName( PROPERTY_CONTROLDEFAULT ) ) { Any aDefault = xColProps->getPropertyValue( PROPERTY_CONTROLDEFAULT ); diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index 18cb21882d6a..1e201c7b3858 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -649,7 +649,7 @@ void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream) Reference<XNumberFormats> xFormats = xSupplier->getNumberFormats(); OUString sFormatDescription; LanguageType eFormatLanguage = LANGUAGE_DONTKNOW; - static const char s_aLocaleProp[] = "Locale"; + static const OUStringLiteral s_aLocaleProp = u"Locale"; Reference<css::beans::XPropertySet> xFormat = xFormats->getByKey(nKey); if (hasProperty(s_aLocaleProp, xFormat)) { @@ -660,7 +660,7 @@ void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream) eFormatLanguage = LanguageTag::convertToLanguageType( *pLocale, false); } } - static const char s_aFormatStringProp[] = "FormatString"; + static const OUStringLiteral s_aFormatStringProp = u"FormatString"; if (hasProperty(s_aFormatStringProp, xFormat)) xFormat->getPropertyValue(s_aFormatStringProp) >>= sFormatDescription; _rxOutStream->writeUTF(sFormatDescription); diff --git a/framework/inc/taskcreatordefs.hxx b/framework/inc/taskcreatordefs.hxx index 1b63cd28105b..02b85221c801 100644 --- a/framework/inc/taskcreatordefs.hxx +++ b/framework/inc/taskcreatordefs.hxx @@ -21,37 +21,38 @@ #define INCLUDED_FRAMEWORK_INC_TASKCREATORDEFS_HXX /// [XFrame] if it's set, it will be used as parent frame for the new created frame. -const char ARGUMENT_PARENTFRAME[] = "ParentFrame"; // XFrame +const OUStringLiteral ARGUMENT_PARENTFRAME = u"ParentFrame"; // XFrame /** [OUString] if it's not a special name (beginning with "_" ... which are not allowed here!) it will be set as the API name of the new created frame. */ -const char ARGUMENT_FRAMENAME[] = "FrameName"; // OUString +const OUStringLiteral ARGUMENT_FRAMENAME = u"FrameName"; // OUString /// [sal_Bool] If it's set to sal_True we will make the new created frame visible. -const char ARGUMENT_MAKEVISIBLE[] = "MakeVisible"; // sal_Bool +const OUStringLiteral ARGUMENT_MAKEVISIBLE = u"MakeVisible"; // sal_Bool /** [sal_Bool] If not "ContainerWindow" property is set it force creation of a top level window as new container window. */ -const char ARGUMENT_CREATETOPWINDOW[] = "CreateTopWindow"; // sal_Bool +const OUStringLiteral ARGUMENT_CREATETOPWINDOW = u"CreateTopWindow"; // sal_Bool /// [Rectangle] Place the new created frame on this place and resize the container window. -const char ARGUMENT_POSSIZE[] = "PosSize"; // Rectangle +inline const OUStringLiteral ARGUMENT_POSSIZE = u"PosSize"; // Rectangle /// [XWindow] an outside created window, used as container window of the new created frame. -const char ARGUMENT_CONTAINERWINDOW[] = "ContainerWindow"; // XWindow +inline const OUStringLiteral ARGUMENT_CONTAINERWINDOW = u"ContainerWindow"; // XWindow /** [sal_Bool] enable/disable special mode, where this frame will be part of the persistent window state feature suitable for any office module window */ -const char ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE[] = "SupportPersistentWindowState"; // sal_Bool +const OUStringLiteral ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE + = u"SupportPersistentWindowState"; // sal_Bool /** [sal_Bool] enable/disable special mode, where the title bar of our the new created frame will be updated automatically. Default = ON ! */ -const char ARGUMENT_ENABLE_TITLEBARUPDATE[] = "EnableTitleBarUpdate"; // sal_Bool +inline const OUStringLiteral ARGUMENT_ENABLE_TITLEBARUPDATE = u"EnableTitleBarUpdate"; // sal_Bool #endif // INCLUDED_FRAMEWORK_INC_TASKCREATORDEFS_HXX diff --git a/framework/qa/cppunit/loadenv.cxx b/framework/qa/cppunit/loadenv.cxx index 96d28cd47396..5ce6826060d0 100644 --- a/framework/qa/cppunit/loadenv.cxx +++ b/framework/qa/cppunit/loadenv.cxx @@ -35,7 +35,7 @@ void Test::setUp() mxDesktop.set(frame::Desktop::create(mxComponentContext)); } -char const DATA_DIRECTORY[] = "/framework/qa/cppunit/data/"; +OUStringLiteral const DATA_DIRECTORY = u"/framework/qa/cppunit/data/"; class DocumentOpener { diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index d2df6e582c8f..e813213a92a0 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -57,8 +57,8 @@ namespace framework { - const char CFG_ENTRY_SECONDARY[] = "SecondaryKeys"; - const char CFG_PROP_COMMAND[] = "Command"; + const OUStringLiteral CFG_ENTRY_SECONDARY = u"SecondaryKeys"; + const OUStringLiteral CFG_PROP_COMMAND = u"Command"; static OUString lcl_getKeyString(const css::awt::KeyEvent& aKeyEvent) { diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index 4b5a7ff06f10..ad55be6dd213 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -72,12 +72,12 @@ #define ATTRIBUTE_ITEMSTYLE_RADIO "radio" // Property names of a menu/menu item ItemDescriptor -const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; -const char ITEM_DESCRIPTOR_HELPURL[] = "HelpURL"; -const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer"; -const char ITEM_DESCRIPTOR_LABEL[] = "Label"; -const char ITEM_DESCRIPTOR_TYPE[] = "Type"; -const char ITEM_DESCRIPTOR_STYLE[] = "Style"; +const OUStringLiteral ITEM_DESCRIPTOR_COMMANDURL = u"CommandURL"; +const OUStringLiteral ITEM_DESCRIPTOR_HELPURL = u"HelpURL"; +const OUStringLiteral ITEM_DESCRIPTOR_CONTAINER = u"ItemDescriptorContainer"; +const OUStringLiteral ITEM_DESCRIPTOR_LABEL = u"Label"; +const OUStringLiteral ITEM_DESCRIPTOR_TYPE = u"Type"; +const OUStringLiteral ITEM_DESCRIPTOR_STYLE = u"Style"; // using namespaces diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index 5ed0ee665405..a829e03ad20d 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -48,11 +48,11 @@ namespace framework { // Property names of a menu/menu item ItemDescriptor -const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; -const char ITEM_DESCRIPTOR_LABEL[] = "Label"; -const char ITEM_DESCRIPTOR_TYPE[] = "Type"; -const char ITEM_DESCRIPTOR_STYLE[] = "Style"; -const char ITEM_DESCRIPTOR_VISIBLE[] = "IsVisible"; +const OUStringLiteral ITEM_DESCRIPTOR_COMMANDURL = u"CommandURL"; +const OUStringLiteral ITEM_DESCRIPTOR_LABEL = u"Label"; +const OUStringLiteral ITEM_DESCRIPTOR_TYPE = u"Type"; +const OUStringLiteral ITEM_DESCRIPTOR_STYLE = u"Style"; +const OUStringLiteral ITEM_DESCRIPTOR_VISIBLE = u"IsVisible"; static void ExtractToolbarParameters( const Sequence< PropertyValue >& rProp, OUString& rCommandURL, diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx b/framework/source/fwi/uielement/constitemcontainer.cxx index d0a621babcd5..212f0a80e24b 100644 --- a/framework/source/fwi/uielement/constitemcontainer.cxx +++ b/framework/source/fwi/uielement/constitemcontainer.cxx @@ -33,7 +33,7 @@ using namespace com::sun::star::beans; using namespace com::sun::star::container; const int PROPHANDLE_UINAME = 1; -const char PROPNAME_UINAME[] = "UIName"; +const OUStringLiteral PROPNAME_UINAME = u"UIName"; namespace framework { diff --git a/framework/source/fwi/uielement/itemcontainer.cxx b/framework/source/fwi/uielement/itemcontainer.cxx index 79e5104e933f..55f6ccecfd50 100644 --- a/framework/source/fwi/uielement/itemcontainer.cxx +++ b/framework/source/fwi/uielement/itemcontainer.cxx @@ -30,7 +30,8 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::container; -const char WRONG_TYPE_EXCEPTION[] = "Type must be css::uno::Sequence< css::beans::PropertyValue >"; +const OUStringLiteral WRONG_TYPE_EXCEPTION + = u"Type must be css::uno::Sequence< css::beans::PropertyValue >"; namespace framework { diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx b/framework/source/fwi/uielement/rootitemcontainer.cxx index edf695135d1d..0016789d2da6 100644 --- a/framework/source/fwi/uielement/rootitemcontainer.cxx +++ b/framework/source/fwi/uielement/rootitemcontainer.cxx @@ -33,10 +33,11 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::container; -const char WRONG_TYPE_EXCEPTION[] = "Type must be css::uno::Sequence< css::beans::PropertyValue >"; +const OUStringLiteral WRONG_TYPE_EXCEPTION + = u"Type must be css::uno::Sequence< css::beans::PropertyValue >"; const int PROPHANDLE_UINAME = 1; -const char PROPNAME_UINAME[] = "UIName"; +const OUStringLiteral PROPNAME_UINAME = u"UIName"; namespace framework { diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index f525a1d2c1dd..ce923b2f9e55 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -48,7 +48,7 @@ struct RescheduleLock: public rtl::Static<osl::Mutex, RescheduleLock> {}; ///< m } -const char PROGRESS_RESOURCE[] = "private:resource/progressbar/progressbar"; +const OUStringLiteral PROGRESS_RESOURCE = u"private:resource/progressbar/progressbar"; StatusIndicatorFactory::StatusIndicatorFactory(const css::uno::Reference< css::uno::XComponentContext >& xContext) : m_xContext (xContext ) diff --git a/framework/source/helper/uiconfigelementwrapperbase.cxx b/framework/source/helper/uiconfigelementwrapperbase.cxx index b0138d04a77c..f27c51186f30 100644 --- a/framework/source/helper/uiconfigelementwrapperbase.cxx +++ b/framework/source/helper/uiconfigelementwrapperbase.cxx @@ -37,14 +37,14 @@ const int UIELEMENT_PROPHANDLE_TYPE = 5; const int UIELEMENT_PROPHANDLE_XMENUBAR = 6; const int UIELEMENT_PROPHANDLE_CONFIGLISTENER = 7; const int UIELEMENT_PROPHANDLE_NOCLOSE = 8; -const char UIELEMENT_PROPNAME_CONFIGLISTENER[] = "ConfigListener"; -const char UIELEMENT_PROPNAME_CONFIGSOURCE[] = "ConfigurationSource"; -const char UIELEMENT_PROPNAME_FRAME[] = "Frame"; -const char UIELEMENT_PROPNAME_PERSISTENT[] = "Persistent"; -const char UIELEMENT_PROPNAME_RESOURCEURL[] = "ResourceURL"; -const char UIELEMENT_PROPNAME_TYPE[] = "Type"; -const char UIELEMENT_PROPNAME_XMENUBAR[] = "XMenuBar"; -const char UIELEMENT_PROPNAME_NOCLOSE[] = "NoClose"; +const OUStringLiteral UIELEMENT_PROPNAME_CONFIGLISTENER = u"ConfigListener"; +const OUStringLiteral UIELEMENT_PROPNAME_CONFIGSOURCE = u"ConfigurationSource"; +const OUStringLiteral UIELEMENT_PROPNAME_FRAME = u"Frame"; +const OUStringLiteral UIELEMENT_PROPNAME_PERSISTENT = u"Persistent"; +const OUStringLiteral UIELEMENT_PROPNAME_RESOURCEURL = u"ResourceURL"; +const OUStringLiteral UIELEMENT_PROPNAME_TYPE = u"Type"; +const OUStringLiteral UIELEMENT_PROPNAME_XMENUBAR = u"XMenuBar"; +const OUStringLiteral UIELEMENT_PROPNAME_NOCLOSE = u"NoClose"; using namespace com::sun::star::beans; using namespace com::sun::star::uno; using namespace com::sun::star::frame; diff --git a/framework/source/helper/uielementwrapperbase.cxx b/framework/source/helper/uielementwrapperbase.cxx index 76cf234ff94f..06db2788beac 100644 --- a/framework/source/helper/uielementwrapperbase.cxx +++ b/framework/source/helper/uielementwrapperbase.cxx @@ -28,9 +28,9 @@ const int UIELEMENT_PROPHANDLE_RESOURCEURL = 1; const int UIELEMENT_PROPHANDLE_TYPE = 2; const int UIELEMENT_PROPHANDLE_FRAME = 3; -const char UIELEMENT_PROPNAME_RESOURCEURL[] = "ResourceURL"; -const char UIELEMENT_PROPNAME_TYPE[] = "Type"; -const char UIELEMENT_PROPNAME_FRAME[] = "Frame"; +const OUStringLiteral UIELEMENT_PROPNAME_RESOURCEURL = u"ResourceURL"; +const OUStringLiteral UIELEMENT_PROPNAME_TYPE = u"Type"; +const OUStringLiteral UIELEMENT_PROPNAME_FRAME = u"Frame"; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; diff --git a/framework/source/inc/accelerators/acceleratorconfiguration.hxx b/framework/source/inc/accelerators/acceleratorconfiguration.hxx index 8066a63ff760..6f9daa38b14b 100644 --- a/framework/source/inc/accelerators/acceleratorconfiguration.hxx +++ b/framework/source/inc/accelerators/acceleratorconfiguration.hxx @@ -40,9 +40,9 @@ namespace framework { -const char CFG_ENTRY_PRIMARY[] = "PrimaryKeys"; -const char CFG_ENTRY_GLOBAL[] = "Global"; -const char CFG_ENTRY_MODULES[] = "Modules"; +inline const OUStringLiteral CFG_ENTRY_PRIMARY = u"PrimaryKeys"; +inline const OUStringLiteral CFG_ENTRY_GLOBAL = u"Global"; +inline const OUStringLiteral CFG_ENTRY_MODULES = u"Modules"; /** implements a read/write access to the accelerator configuration. diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 67a40b89738c..6090cb0f9646 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -76,7 +76,7 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::ui; using namespace ::com::sun::star::frame; -const char STATUS_BAR_ALIAS[] = "private:resource/statusbar/statusbar"; +const OUStringLiteral STATUS_BAR_ALIAS = u"private:resource/statusbar/statusbar"; namespace framework { diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 59687abbeefb..c24e65959cfb 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -91,8 +91,8 @@ #include <classes/taskcreator.hxx> #include <tools/fileutil.hxx> -const char PROP_TYPES[] = "Types"; -const char PROP_NAME[] = "Name"; +const OUStringLiteral PROP_TYPES = u"Types"; +const OUStringLiteral PROP_NAME = u"Name"; namespace framework { diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index c7cdabb4e365..10b8574d6155 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -995,30 +995,30 @@ private: }; // recovery.xcu -const char CFG_PACKAGE_RECOVERY[] = "org.openoffice.Office.Recovery/"; +const OUStringLiteral CFG_PACKAGE_RECOVERY = u"org.openoffice.Office.Recovery/"; const char CFG_ENTRY_AUTOSAVE_ENABLED[] = "AutoSave/Enabled"; const char CFG_ENTRY_AUTOSAVE_TIMEINTERVALL[] = "AutoSave/TimeIntervall"; //sic! -const char CFG_ENTRY_REALDEFAULTFILTER[] = "ooSetupFactoryActualFilter"; +const OUStringLiteral CFG_ENTRY_REALDEFAULTFILTER = u"ooSetupFactoryActualFilter"; -const char CFG_ENTRY_PROP_TEMPURL[] = "TempURL"; -const char CFG_ENTRY_PROP_ORIGINALURL[] = "OriginalURL"; -const char CFG_ENTRY_PROP_TEMPLATEURL[] = "TemplateURL"; -const char CFG_ENTRY_PROP_FACTORYURL[] = "FactoryURL"; -const char CFG_ENTRY_PROP_MODULE[] = "Module"; -const char CFG_ENTRY_PROP_DOCUMENTSTATE[] = "DocumentState"; -const char CFG_ENTRY_PROP_FILTER[] = "Filter"; -const char CFG_ENTRY_PROP_TITLE[] = "Title"; -const char CFG_ENTRY_PROP_ID[] = "ID"; -const char CFG_ENTRY_PROP_VIEWNAMES[] = "ViewNames"; +const OUStringLiteral CFG_ENTRY_PROP_TEMPURL = u"TempURL"; +const OUStringLiteral CFG_ENTRY_PROP_ORIGINALURL = u"OriginalURL"; +const OUStringLiteral CFG_ENTRY_PROP_TEMPLATEURL = u"TemplateURL"; +const OUStringLiteral CFG_ENTRY_PROP_FACTORYURL = u"FactoryURL"; +const OUStringLiteral CFG_ENTRY_PROP_MODULE = u"Module"; +const OUStringLiteral CFG_ENTRY_PROP_DOCUMENTSTATE = u"DocumentState"; +const OUStringLiteral CFG_ENTRY_PROP_FILTER = u"Filter"; +const OUStringLiteral CFG_ENTRY_PROP_TITLE = u"Title"; +const OUStringLiteral CFG_ENTRY_PROP_ID = u"ID"; +const OUStringLiteral CFG_ENTRY_PROP_VIEWNAMES = u"ViewNames"; -const char FILTER_PROP_TYPE[] = "Type"; -const char TYPE_PROP_EXTENSIONS[] = "Extensions"; +const OUStringLiteral FILTER_PROP_TYPE = u"Type"; +const OUStringLiteral TYPE_PROP_EXTENSIONS = u"Extensions"; // setup.xcu -const char CFG_ENTRY_PROP_EMPTYDOCUMENTURL[] = "ooSetupFactoryEmptyDocumentURL"; -const char CFG_ENTRY_PROP_FACTORYSERVICE[] = "ooSetupFactoryDocumentService"; +const OUStringLiteral CFG_ENTRY_PROP_EMPTYDOCUMENTURL = u"ooSetupFactoryEmptyDocumentURL"; +const OUStringLiteral CFG_ENTRY_PROP_FACTORYSERVICE = u"ooSetupFactoryDocumentService"; const char EVENT_ON_NEW[] = "OnNew"; const char EVENT_ON_LOAD[] = "OnLoad"; @@ -1034,7 +1034,7 @@ const char EVENT_ON_SAVEFAILED[] = "OnSaveFailed"; const char EVENT_ON_SAVEASFAILED[] = "OnSaveAsFailed"; const char EVENT_ON_SAVETOFAILED[] = "OnCopyToFailed"; -const char RECOVERY_ITEM_BASE_IDENTIFIER[] = "recovery_item_"; +const OUStringLiteral RECOVERY_ITEM_BASE_IDENTIFIER = u"recovery_item_"; const char CMD_PROTOCOL[] = "vnd.sun.star.autorecovery:"; @@ -1050,17 +1050,17 @@ const char CMD_DO_SESSION_RESTORE[] = "/doSessionRestore"; // restore a saved const char CMD_DO_DISABLE_RECOVERY[] = "/disableRecovery"; // disable recovery and auto save (!) temp. for this office session const char CMD_DO_SET_AUTOSAVE_STATE[] = "/setAutoSaveState"; // disable/enable auto save (not crash save) for this office session -const char REFERRER_USER[] = "private:user"; +const OUStringLiteral REFERRER_USER = u"private:user"; -const char PROP_DISPATCH_ASYNCHRON[] = "DispatchAsynchron"; -const char PROP_PROGRESS[] = "StatusIndicator"; -const char PROP_SAVEPATH[] = "SavePath"; -const char PROP_ENTRY_ID[] = "EntryID"; -const char PROP_AUTOSAVE_STATE[] = "AutoSaveState"; +const OUStringLiteral PROP_DISPATCH_ASYNCHRON = u"DispatchAsynchron"; +const OUStringLiteral PROP_PROGRESS = u"StatusIndicator"; +const OUStringLiteral PROP_SAVEPATH = u"SavePath"; +const OUStringLiteral PROP_ENTRY_ID = u"EntryID"; +const OUStringLiteral PROP_AUTOSAVE_STATE = u"AutoSaveState"; -const char OPERATION_START[] = "start"; -const char OPERATION_STOP[] = "stop"; -const char OPERATION_UPDATE[] = "update"; +const OUStringLiteral OPERATION_START = u"start"; +const OUStringLiteral OPERATION_STOP = u"stop"; +const OUStringLiteral OPERATION_UPDATE = u"update"; const sal_Int32 MIN_DISCSPACE_DOCSAVE = 5; // [MB] const sal_Int32 MIN_DISCSPACE_CONFIGSAVE = 1; // [MB] diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index 681ce8a4a7ba..6206aa3864f5 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -64,8 +64,8 @@ using namespace ::cppu; const sal_Int16 MAX_IMAGETYPE_VALUE = css::ui::ImageType::SIZE_32; -const char IMAGE_FOLDER[] = "images"; -const char BITMAPS_FOLDER[] = "Bitmaps"; +const OUStringLiteral IMAGE_FOLDER = u"images"; +const OUStringLiteral BITMAPS_FOLDER = u"Bitmaps"; const o3tl::enumarray<vcl::ImageType, const char*> IMAGELIST_XML_FILE = { diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index 3d79087be85d..e0fd3d07f4d2 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -40,9 +40,9 @@ using namespace com::sun::star::util; namespace { -const char CMD_CLEAR_LIST[] = ".uno:ClearRecentFileList"; -const char CMD_OPEN_AS_TEMPLATE[] = ".uno:OpenTemplate"; -const char CMD_OPEN_REMOTE[] = ".uno:OpenRemote"; +const OUStringLiteral CMD_CLEAR_LIST = u".uno:ClearRecentFileList"; +const OUStringLiteral CMD_OPEN_AS_TEMPLATE = u".uno:OpenTemplate"; +const OUStringLiteral CMD_OPEN_REMOTE = u".uno:OpenRemote"; class RecentFilesMenuController : public svt::PopupMenuControllerBase { diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 7cce1b37d29c..0689cd39aff2 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -68,9 +68,9 @@ using namespace ::com::sun::star::util; using namespace ::com::sun::star::container; using namespace ::com::sun::star::ui; -const char CMD_RESTOREVISIBILITY[] = ".cmd:RestoreVisibility"; +const OUStringLiteral CMD_RESTOREVISIBILITY = u".cmd:RestoreVisibility"; -const char STATIC_CMD_PART[] = ".uno:AvailableToolbars?Toolbar:string="; +const OUStringLiteral STATIC_CMD_PART = u".uno:AvailableToolbars?Toolbar:string="; const char STATIC_INTERNAL_CMD_PART[] = ".cmd:"; namespace framework diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index 28c606ea96a4..23ef0b8654f4 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -50,7 +50,7 @@ using namespace ::com::sun::star::frame; const char CONFIGURATION_ROOT_ACCESS[] = "/org.openoffice.Office.UI."; // Special resource URLs to retrieve additional information -const char PRIVATE_RESOURCE_URL[] = "private:"; +const OUStringLiteral PRIVATE_RESOURCE_URL = u"private:"; const sal_Int32 COMMAND_PROPERTY_IMAGE = 1; const sal_Int32 COMMAND_PROPERTY_ROTATE = 2; diff --git a/i18npool/source/collator/chaptercollator.cxx b/i18npool/source/collator/chaptercollator.cxx index fb4128a6c7c3..153f5ff3d38d 100644 --- a/i18npool/source/collator/chaptercollator.cxx +++ b/i18npool/source/collator/chaptercollator.cxx @@ -72,7 +72,7 @@ ChapterCollator::compareSubstring( const OUString& str1, sal_Int32 off1, sal_Int return res1.Value == res2.Value ? 0 : res1.Value > res2.Value ? 1 : -1; } -const char cChapCollator[] = "com.sun.star.i18n.ChapterCollator"; +const OUStringLiteral cChapCollator = u"com.sun.star.i18n.ChapterCollator"; OUString SAL_CALL ChapterCollator::getImplementationName() diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx index dd273e687f21..f3ba3c062050 100644 --- a/i18npool/source/collator/collator_unicode.cxx +++ b/i18npool/source/collator/collator_unicode.cxx @@ -38,7 +38,7 @@ using namespace ::com::sun::star::uno; namespace i18npool { -const char implementationName[] = "com.sun.star.i18n.Collator_Unicode"; +const OUStringLiteral implementationName = u"com.sun.star.i18n.Collator_Unicode"; Collator_Unicode::Collator_Unicode() { diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index d352aec6f9de..fd98a6bc32e3 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -419,7 +419,7 @@ static void lcl_formatPersianWord( sal_Int32 nNumber, OUString& rsResult ) { OUStringBuffer aTemp(64); - static const sal_Unicode asPersianWord_conjunction_data[] = u" \u0648 "; + static const OUStringLiteral asPersianWord_conjunction_data = u" \u0648 "; OUString asPersianWord_conjunction( asPersianWord_conjunction_data ); unsigned char nSection = 0; diff --git a/i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx b/i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx index 214893a901d4..b4a9f3e0cda6 100644 --- a/i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx +++ b/i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx @@ -63,7 +63,7 @@ sal_Int16 SAL_CALL IndexEntrySupplier_ja_phonetic::compareIndexEntry( return result; } -const char first[] = "phonetic (alphanumeric first)"; +const OUStringLiteral first = u"phonetic (alphanumeric first)"; sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable::loadAlgorithm( const css::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/, sal_Int32 collatorOptions ) @@ -77,7 +77,7 @@ sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_consonant return collator->loadCollatorAlgorithm(first, rLocale, collatorOptions) == 0; } -const char last[] = "phonetic (alphanumeric last)"; +const OUStringLiteral last = u"phonetic (alphanumeric last)"; sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_syllable::loadAlgorithm( const css::lang::Locale& rLocale, const OUString& /*SortAlgorithm*/, sal_Int32 collatorOptions ) diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx index dbd3f77b7b4c..a745396782df 100644 --- a/i18npool/source/nativenumber/nativenumbersupplier.cxx +++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx @@ -1220,7 +1220,7 @@ OUString getCyrillicNativeNumberString(const OUString& aNumberString) return aNumberString; } -const char implementationName[] = "com.sun.star.i18n.NativeNumberSupplier"; +const OUStringLiteral implementationName = u"com.sun.star.i18n.NativeNumberSupplier"; OUString SAL_CALL NativeNumberSupplierService::getImplementationName() { ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
