From 2ec698b43313c18522b45b28895cd5688a84a700 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Fri, 8 Dec 2017 18:57:27 +0100 Subject: cppcheck: fix some reports variableScope reports in comphelper/drawinglayer/editeng +filter/framework/l10ntools Change-Id: I4575428773e8b9b3efedabb44fdcd6d8175ac46a Reviewed-on: https://gerrit.libreoffice.org/46116 Tested-by: Jenkins Reviewed-by: Julien Nabet --- l10ntools/source/gConvXcu.cxx | 5 ++--- l10ntools/source/gConvXrm.cxx | 15 +++++---------- l10ntools/source/gL10nMem.cxx | 4 ++-- 3 files changed, 9 insertions(+), 15 deletions(-) (limited to 'l10ntools/source') diff --git a/l10ntools/source/gConvXcu.cxx b/l10ntools/source/gConvXcu.cxx index 58f22d78493c..cae480bb77e2 100644 --- a/l10ntools/source/gConvXcu.cxx +++ b/l10ntools/source/gConvXcu.cxx @@ -47,14 +47,13 @@ void convert_xcu::doExecute() void convert_xcu::pushKey(char *syyText) { string sKey, sTag = copySource(syyText); - int nL, nE; // find key in tag - nL = sTag.find("oor:name=\""); + int nL = sTag.find("oor:name=\""); if (nL != (int)string::npos) { // find end of key nL += 10; - nE = sTag.find("\"", nL); + int nE = sTag.find("\"", nL); if (nE != (int)string::npos) sKey = sTag.substr(nL, nE - nL); } diff --git a/l10ntools/source/gConvXrm.cxx b/l10ntools/source/gConvXrm.cxx index 1dcc558198f3..a42a90c10dad 100644 --- a/l10ntools/source/gConvXrm.cxx +++ b/l10ntools/source/gConvXrm.cxx @@ -49,12 +49,10 @@ void convert_xrm::doExecute() void convert_xrm::setId(char *yytext) { string& sText = copySource(yytext, mbNoCollectingData); - int nL, nE; - if (mbIsTag) { - nL = sText.find("\""); - nE = sText.find("\"", nL+1); + int nL = sText.find("\""); + int nE = sText.find("\"", nL+1); if (nL == (int)string::npos || nE == (int)string::npos) return; @@ -67,17 +65,14 @@ void convert_xrm::setId(char *yytext) void convert_xrm::setLang(char *yytext) { string& sText = copySource(yytext, mbNoCollectingData); - string sLang; - int nL, nE; - if (mbIsTag) { - nL = sText.find("\""); - nE = sText.find("\"", nL+1); + int nL = sText.find("\""); + int nE = sText.find("\"", nL+1); if (nL == (int)string::npos || nE == (int)string::npos) return; - sLang = sText.substr(nL+1, nE - nL -1); + string sLang = sText.substr(nL+1, nE - nL -1); if (sLang == "en-US") mbIsLang = true; else diff --git a/l10ntools/source/gL10nMem.cxx b/l10ntools/source/gL10nMem.cxx index b8668f854666..3a8647f2eb18 100644 --- a/l10ntools/source/gL10nMem.cxx +++ b/l10ntools/source/gL10nMem.cxx @@ -441,9 +441,9 @@ void l10nMem::convertToInetString(string& sText) static const int replacingLen[] = { 1, 1, 1, 1, 1, 0 }; static const char *newStr[] = { "&", "'", ">", "<", """, nullptr }; static const int newLen[] = { 5, 6, 4, 4, 6, 0 }; - int i, pos; + int pos; - for (i = 0; replacingStr[i]; i++) { + for (int i = 0; replacingStr[i]; i++) { pos = 0; while ((pos = sText.find(replacingStr[i], pos)) != (int)string::npos) { sText.replace(pos, replacingLen[i], newStr[i]); -- cgit v1.2.3