From 86a32589e90ee983159fb5b2c6a594428ab7d422 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 Mar 2014 15:29:08 +0200 Subject: Find places where OUString and OString are passed by value. It's not very efficient, because we generally end up copying it twice - once into the parameter and again into the destination OUString. So I create a clang plugin that finds such places and generates a warning so that we can convert them to pass-by-reference. Change-Id: I5341a6ea9e3190f4b4c05c42c85595e3dcd83361 --- l10ntools/source/lngmerge.cxx | 2 +- l10ntools/source/pocheck.cxx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'l10ntools') diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx index 2e3a4d68e12f..1ab50ac06f79 100644 --- a/l10ntools/source/lngmerge.cxx +++ b/l10ntools/source/lngmerge.cxx @@ -29,7 +29,7 @@ namespace { -OString getBracketedContent(OString text) { +OString getBracketedContent(const OString& text) { return text.getToken(1, '[').getToken(0, ']'); } diff --git a/l10ntools/source/pocheck.cxx b/l10ntools/source/pocheck.cxx index 6043156cc951..c7c61643bacd 100644 --- a/l10ntools/source/pocheck.cxx +++ b/l10ntools/source/pocheck.cxx @@ -17,7 +17,7 @@ #include "po.hxx" // Translated style names must be unique -static void checkStyleNames(OString aLanguage) +static void checkStyleNames(const OString& aLanguage) { std::map aLocalizedStyleNames; std::map aLocalizedNumStyleNames; @@ -130,7 +130,7 @@ static void checkStyleNames(OString aLanguage) } // Translated spreadsheet function names must be unique -static void checkFunctionNames(OString aLanguage) +static void checkFunctionNames(const OString& aLanguage) { std::map aLocalizedFunctionNames; std::map aLocalizedCoreFunctionNames; @@ -352,7 +352,7 @@ static void checkFunctionNames(OString aLanguage) // In instsetoo_native/inc_openoffice/windows/msi_languages.po // where an en-US string ends with '|', translation must end // with '|', too. -static void checkVerticalBar(OString aLanguage) +static void checkVerticalBar(const OString& aLanguage) { OString aPoPath = OString(getenv("SRC_ROOT")) + "/translations/source/" + @@ -400,7 +400,7 @@ static void checkVerticalBar(OString aLanguage) // In starmath/source.po Math symbol names (from symbol.src) // must not contain spaces -static void checkMathSymbolNames(OString aLanguage) +static void checkMathSymbolNames(const OString& aLanguage) { OString aPoPath = OString(getenv("SRC_ROOT")) + "/translations/source/" + -- cgit