diff options
author | varshneydevansh <varshney.devansh614@gmail.com> | 2024-02-02 00:12:33 +0530 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2024-02-14 09:58:21 +0100 |
commit | 0859e497be07acceb0a950183d5997374783266f (patch) | |
tree | 8f47d0f80e74331bd99623bb54de7ba22e3b123e | |
parent | scp2: Take ENABLE_{KF,QT}6 into account (diff) | |
download | core-0859e497be07acceb0a950183d5997374783266f.tar.gz core-0859e497be07acceb0a950183d5997374783266f.zip |
tdf#145539 convert const char[] in files to constexpr OUStringLiteral
OStringLiteral represent read-only memory for string literal while
OUString is a dynamic string class with reference counting
hence use OUString when you need reference counting, string
manipulation along with _ustr suffix.
Change-Id: Ib566df156d81c7527f5650bcc6bd5db6509128cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162911
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
-rw-r--r-- | framework/source/services/autorecovery.cxx | 52 | ||||
-rw-r--r-- | sw/source/core/text/EnhancedPDFExportHelper.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLDocumentImpl.cxx | 16 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 14 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvread.cxx | 10 |
5 files changed, 52 insertions, 52 deletions
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 22bdb916a642..6852be6dc954 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -1066,35 +1066,35 @@ constexpr OUStringLiteral TYPE_PROP_EXTENSIONS = u"Extensions"; constexpr OUStringLiteral CFG_ENTRY_PROP_EMPTYDOCUMENTURL = u"ooSetupFactoryEmptyDocumentURL"; constexpr OUStringLiteral CFG_ENTRY_PROP_FACTORYSERVICE = u"ooSetupFactoryDocumentService"; -const char EVENT_ON_NEW[] = "OnNew"; -const char EVENT_ON_LOAD[] = "OnLoad"; -const char EVENT_ON_UNLOAD[] = "OnUnload"; -const char EVENT_ON_MODIFYCHANGED[] = "OnModifyChanged"; -const char EVENT_ON_SAVE[] = "OnSave"; -const char EVENT_ON_SAVEAS[] = "OnSaveAs"; -const char EVENT_ON_SAVETO[] = "OnCopyTo"; -const char EVENT_ON_SAVEDONE[] = "OnSaveDone"; -const char EVENT_ON_SAVEASDONE[] = "OnSaveAsDone"; -const char EVENT_ON_SAVETODONE[] = "OnCopyToDone"; -const char EVENT_ON_SAVEFAILED[] = "OnSaveFailed"; -const char EVENT_ON_SAVEASFAILED[] = "OnSaveAsFailed"; -const char EVENT_ON_SAVETOFAILED[] = "OnCopyToFailed"; +constexpr OUStringLiteral EVENT_ON_NEW = u"OnNew"; +constexpr OUStringLiteral EVENT_ON_LOAD = u"OnLoad"; +constexpr OUStringLiteral EVENT_ON_UNLOAD = u"OnUnload"; +constexpr OUStringLiteral EVENT_ON_MODIFYCHANGED = u"OnModifyChanged"; +constexpr OUStringLiteral EVENT_ON_SAVE = u"OnSave"; +constexpr OUStringLiteral EVENT_ON_SAVEAS = u"OnSaveAs"; +constexpr OUStringLiteral EVENT_ON_SAVETO = u"OnCopyTo"; +constexpr OUStringLiteral EVENT_ON_SAVEDONE = u"OnSaveDone"; +constexpr OUStringLiteral EVENT_ON_SAVEASDONE = u"OnSaveAsDone"; +constexpr OUStringLiteral EVENT_ON_SAVETODONE = u"OnCopyToDone"; +constexpr OUStringLiteral EVENT_ON_SAVEFAILED = u"OnSaveFailed"; +constexpr OUStringLiteral EVENT_ON_SAVEASFAILED = u"OnSaveAsFailed"; +constexpr OUStringLiteral EVENT_ON_SAVETOFAILED = u"OnCopyToFailed"; constexpr OUString RECOVERY_ITEM_BASE_IDENTIFIER = u"recovery_item_"_ustr; -const char CMD_PROTOCOL[] = "vnd.sun.star.autorecovery:"; - -const char CMD_DO_AUTO_SAVE[] = "/doAutoSave"; // force AutoSave ignoring the AutoSave timer -const char CMD_DO_PREPARE_EMERGENCY_SAVE[] = "/doPrepareEmergencySave"; // prepare the office for the following EmergencySave step (hide windows etcpp.) -const char CMD_DO_EMERGENCY_SAVE[] = "/doEmergencySave"; // do EmergencySave on crash -const char CMD_DO_RECOVERY[] = "/doAutoRecovery"; // recover all crashed documents -const char CMD_DO_ENTRY_BACKUP[] = "/doEntryBackup"; // try to store a temp or original file to a user defined location -const char CMD_DO_ENTRY_CLEANUP[] = "/doEntryCleanUp"; // remove the specified entry from the recovery cache -const char CMD_DO_SESSION_SAVE[] = "/doSessionSave"; // save all open documents if e.g. a window manager closes an user session -const char CMD_DO_SESSION_QUIET_QUIT[] = "/doSessionQuietQuit"; // let the current session be quietly closed ( the saving should be done using doSessionSave previously ) if e.g. a window manager closes an user session -const char CMD_DO_SESSION_RESTORE[] = "/doSessionRestore"; // restore a saved user session from disc -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 +constexpr OUString CMD_PROTOCOL = u"vnd.sun.star.autorecovery:"_ustr; + +constexpr OUString CMD_DO_AUTO_SAVE = u"/doAutoSave"_ustr; // force AutoSave ignoring the AutoSave timer +constexpr OUString CMD_DO_PREPARE_EMERGENCY_SAVE = u"/doPrepareEmergencySave"_ustr; // prepare the office for the following EmergencySave step (hide windows etcpp.) +constexpr OUString CMD_DO_EMERGENCY_SAVE = u"/doEmergencySave"_ustr; // do EmergencySave on crash +constexpr OUString CMD_DO_RECOVERY = u"/doAutoRecovery"_ustr; // recover all crashed documents +constexpr OUString CMD_DO_ENTRY_BACKUP = u"/doEntryBackup"_ustr; // try to store a temp or original file to a user defined location +constexpr OUString CMD_DO_ENTRY_CLEANUP = u"/doEntryCleanUp"_ustr; // remove the specified entry from the recovery cache +constexpr OUString CMD_DO_SESSION_SAVE = u"/doSessionSave"_ustr; // save all open documents if e.g. a window manager closes an user session +constexpr OUString CMD_DO_SESSION_QUIET_QUIT = u"/doSessionQuietQuit"_ustr; // let the current session be quietly closed ( the saving should be done using doSessionSave previously ) if e.g. a window manager closes an user session +constexpr OUString CMD_DO_SESSION_RESTORE = u"/doSessionRestore"_ustr; // restore a saved user session from disc +constexpr OUString CMD_DO_DISABLE_RECOVERY = u"/disableRecovery"_ustr; // disable recovery and auto save (!) temp. for this office session +constexpr OUString CMD_DO_SET_AUTOSAVE_STATE = u"/setAutoSaveState"_ustr; // disable/enable auto save (not crash save) for this office session constexpr OUStringLiteral REFERRER_USER = u"private:user"; diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 8ff764d92f3e..bbe216898f70 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -168,12 +168,12 @@ struct SwEnhancedPDFState namespace { // ODF Style Names: -const char aTableHeadingName[] = "Table Heading"; -const char aQuotations[] = "Quotations"; -const char aCaption[] = "Caption"; -const char aHeading[] = "Heading"; -const char aQuotation[] = "Quotation"; -const char aSourceText[] = "Source Text"; +constexpr OUString aTableHeadingName = u"Table Heading"_ustr; +constexpr OUString aQuotations = u"Quotations"_ustr; +constexpr OUString aCaption = u"Caption"_ustr; +constexpr OUString aHeading = u"Heading"_ustr; +constexpr OUString aQuotation = u"Quotation"_ustr; +constexpr OUString aSourceText = u"Source Text"_ustr; // PDF Tag Names: constexpr OUStringLiteral aDocumentString = u"Document"; diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index 682fe97dae98..0530969fbccc 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -608,14 +608,14 @@ void OOXMLDocumentImpl::resolveCustomXmlStream(Stream & rStream) namespace { -const char sSettingsType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"; -const char sStylesType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; -const char sFonttableType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"; -const char sWebSettings[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"; -const char sSettingsTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/settings"; -const char sStylesTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/styles"; -const char sFonttableTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/fontTable"; -const char sWebSettingsStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/webSettings"; +constexpr OUStringLiteral sSettingsType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"; +constexpr OUStringLiteral sStylesType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; +constexpr OUStringLiteral sFonttableType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"; +constexpr OUStringLiteral sWebSettings = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"; +constexpr OUStringLiteral sSettingsTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/settings"; +constexpr OUStringLiteral sStylesTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/styles"; +constexpr OUStringLiteral sFonttableTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/fontTable"; +constexpr OUStringLiteral sWebSettingsStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/webSettings"; constexpr OUString sId = u"Id"_ustr; constexpr OUStringLiteral sType = u"Type"; diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index cc05fb69ea29..2f20a2d75a73 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -123,13 +123,13 @@ OUString Databases::expandURL( const OUString& aURL, const Reference< uno::XComp return aRetURL; } -const char vendVersion[] = "%VENDORVERSION"; -const char vendName[] = "%VENDORNAME"; -const char prodVersion[] = "%PRODUCTVERSION"; -const char vendShort[] = "%VENDORSHORT"; -const char prodName[] = "%PRODUCTNAME"; -const char newProdVersion[] = "$[officeversion]"; -const char newProdName[] = "$[officename]"; +constexpr OUStringLiteral vendVersion = u"%VENDORVERSION"; +constexpr OUStringLiteral vendName = u"%VENDORNAME"; +constexpr OUStringLiteral prodVersion = u"%PRODUCTVERSION"; +constexpr OUStringLiteral vendShort = u"%VENDORSHORT"; +constexpr OUStringLiteral prodName = u"%PRODUCTNAME"; +constexpr OUStringLiteral newProdVersion = u"$[officeversion]"; +constexpr OUStringLiteral newProdName = u"$[officename]"; Databases::Databases( bool showBasic, const OUString& instPath, diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 7b1b1fd0713e..31f1815979ec 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -157,11 +157,11 @@ using namespace com::sun::star::util; using namespace com::sun::star::container; using namespace com::sun::star::deployment; -const char prodName[] = "%PRODUCTNAME"; -const char vendName[] = "%VENDORNAME"; -const char vendVersion[] = "%VENDORVERSION"; -const char vendShort[] = "%VENDORSHORT"; -const char prodVersion[] = "%PRODUCTVERSION"; +constexpr OUStringLiteral prodName = u"%PRODUCTNAME"; +constexpr OUStringLiteral vendName = u"%VENDORNAME"; +constexpr OUStringLiteral vendVersion = u"%VENDORVERSION"; +constexpr OUStringLiteral vendShort = u"%VENDORSHORT"; +constexpr OUStringLiteral prodVersion = u"%PRODUCTVERSION"; ConfigData::ConfigData() { |