From 3457da6abe0fd03efd19442e9790fbd1aa04c160 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 Aug 2020 10:55:58 +0200 Subject: loplugin:stringstatic also look for local statics Add some API to O*StringLiteral, to make it easier to use in some places that were using O*String Change-Id: I1fb93bd47ac2065c9220d509aad3f4320326d99e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100270 Tested-by: Jenkins Reviewed-by: Noel Grandin --- desktop/qa/desktop_lib/test_desktop_lib.cxx | 6 +++--- desktop/source/lib/init.cxx | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'desktop') diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 68ce00bdfe84..8a1d1c927c20 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2739,7 +2739,7 @@ void DesktopLOKTest::testComplexSelection() { // Start with a blank text file and add contents. LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); - static const OString aText("hello world"); + static const OStringLiteral aText("hello world"); // Certainly not complex. CPPUNIT_ASSERT_EQUAL(static_cast(LOK_SELTYPE_NONE), pDocument->pClass->getSelectionType(pDocument)); @@ -2764,7 +2764,7 @@ void DesktopLOKTest::testComplexSelection() // Export as plain text, we should get only the text part "hello". char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr); CPPUNIT_ASSERT(pText != nullptr); - CPPUNIT_ASSERT_EQUAL(aText, OString(pText)); + CPPUNIT_ASSERT_EQUAL(OString(aText), OString(pText)); free(pText); // Export as rtf, we should also get the image. @@ -2821,7 +2821,7 @@ void DesktopLOKTest::testCalcSaveAs() void DesktopLOKTest::testSpellcheckerMultiView() { - static const OUString aLangISO("en-US"); + static const OUStringLiteral aLangISO("en-US"); SvtSysLocaleOptions aSysLocaleOptions; aSysLocaleOptions.SetLocaleConfigString(aLangISO); aSysLocaleOptions.SetUILocaleConfigString(aLangISO); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 51a5e4bf28fe..30116199123c 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3699,13 +3699,13 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned long if (aMap.find("id") == aMap.end()) return; - static const OUString sClickAction("CLICK"); - static const OUString sSelectAction("SELECT"); - static const OUString sClearAction("CLEAR"); - static const OUString sTypeAction("TYPE"); - static const OUString sUpAction("UP"); - static const OUString sDownAction("DOWN"); - static const OUString sValue("VALUE"); + static const OUStringLiteral sClickAction("CLICK"); + static const OUStringLiteral sSelectAction("SELECT"); + static const OUStringLiteral sClearAction("CLEAR"); + static const OUStringLiteral sTypeAction("TYPE"); + static const OUStringLiteral sUpAction("UP"); + static const OUStringLiteral sDownAction("DOWN"); + static const OUStringLiteral sValue("VALUE"); bool bIsWeldedDialog = false; @@ -4880,10 +4880,10 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo SetLastExceptionMsg(); OString aCommand(pCommand); - static const OString aViewRowColumnHeaders(".uno:ViewRowColumnHeaders"); - static const OString aSheetGeometryData(".uno:SheetGeometryData"); - static const OString aCellCursor(".uno:CellCursor"); - static const OString aFontSubset(".uno:FontSubset&name="); + static const OStringLiteral aViewRowColumnHeaders(".uno:ViewRowColumnHeaders"); + static const OStringLiteral aSheetGeometryData(".uno:SheetGeometryData"); + static const OStringLiteral aCellCursor(".uno:CellCursor"); + static const OStringLiteral aFontSubset(".uno:FontSubset&name="); if (!strcmp(pCommand, ".uno:LanguageStatus")) { -- cgit