summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-08-13 11:48:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-08-13 14:02:29 +0200
commitf70e978f4bf223d7edbb4c3a981f46938a3b3ed1 (patch)
treef5af3e54af9a56c526321410dc611240b5f64c6b
parent0b133fdb67cc56fba46ec355283144e611e8bf83 (diff)
cppcheck: variableScope
Change-Id: I4dfbd80cf06acb4968556a78d3eaf394757073dc Reviewed-on: https://gerrit.libreoffice.org/41110 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--comphelper/source/windows/windows_process.cxx12
-rw-r--r--sw/source/uibase/app/docsh2.cxx50
2 files changed, 31 insertions, 31 deletions
diff --git a/comphelper/source/windows/windows_process.cxx b/comphelper/source/windows/windows_process.cxx
index 1c782d7a289f..ccebbd712bf0 100644
--- a/comphelper/source/windows/windows_process.cxx
+++ b/comphelper/source/windows/windows_process.cxx
@@ -19,7 +19,6 @@
*/
static int ArgStrLen(const wchar_t *s)
{
- int backslashes = 0;
int i = wcslen(s);
BOOL hasDoubleQuote = wcschr(s, L'"') != nullptr;
// Only add doublequotes if the string contains a space or a tab
@@ -32,6 +31,7 @@ static int ArgStrLen(const wchar_t *s)
if (hasDoubleQuote)
{
+ int backslashes = 0;
while (*s)
{
if (*s == '\\')
@@ -67,7 +67,6 @@ static int ArgStrLen(const wchar_t *s)
*/
static wchar_t* ArgToString(wchar_t *d, const wchar_t *s)
{
- int backslashes = 0;
BOOL hasDoubleQuote = wcschr(s, L'"') != nullptr;
// Only add doublequotes if the string contains a space or a tab
BOOL addDoubleQuotes = wcspbrk(s, L" \t") != nullptr;
@@ -80,7 +79,7 @@ static wchar_t* ArgToString(wchar_t *d, const wchar_t *s)
if (hasDoubleQuote)
{
- int i;
+ int backslashes = 0;
while (*s)
{
if (*s == '\\')
@@ -92,7 +91,7 @@ static wchar_t* ArgToString(wchar_t *d, const wchar_t *s)
if (*s == '"')
{
// Escape the doublequote and all backslashes preceding the doublequote
- for (i = 0; i <= backslashes; ++i)
+ for (int i = 0; i <= backslashes; ++i)
{
*d = '\\';
++d;
@@ -131,11 +130,10 @@ static wchar_t* ArgToString(wchar_t *d, const wchar_t *s)
wchar_t*
MakeCommandLine(int argc, wchar_t **argv)
{
- int i;
int len = 0;
// The + 1 of the last argument handles the allocation for null termination
- for (i = 0; i < argc; ++i)
+ for (int i = 0; i < argc; ++i)
len += ArgStrLen(argv[i]) + 1;
// Protect against callers that pass 0 arguments
@@ -147,7 +145,7 @@ MakeCommandLine(int argc, wchar_t **argv)
return nullptr;
wchar_t *c = s;
- for (i = 0; i < argc; ++i)
+ for (int i = 0; i < argc; ++i)
{
c = ArgToString(c, argv[i]);
if (i + 1 != argc)
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 7dc36f163a1e..c0c662b9d9aa 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -887,34 +887,36 @@ void SwDocShell::Execute(SfxRequest& rReq)
0
};
- const char* aHTMLHelpIds[] =
- {
- HID_SEND_HTML_CTRL_PUSHBUTTON_OK,
- HID_SEND_HTML_CTRL_PUSHBUTTON_CANCEL,
- HID_SEND_HTML_CTRL_LISTBOX_FILTER,
- HID_SEND_HTML_CTRL_CONTROL_FILEVIEW,
- HID_SEND_HTML_CTRL_EDIT_FILEURL,
- HID_SEND_HTML_CTRL_CHECKBOX_AUTOEXTENSION,
- HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE,
- ""
- };
-
- const char* aMasterHelpIds[] =
- {
- HID_SEND_MASTER_CTRL_PUSHBUTTON_OK,
- HID_SEND_MASTER_CTRL_PUSHBUTTON_CANCEL,
- HID_SEND_MASTER_CTRL_LISTBOX_FILTER,
- HID_SEND_MASTER_CTRL_CONTROL_FILEVIEW,
- HID_SEND_MASTER_CTRL_EDIT_FILEURL,
- HID_SEND_MASTER_CTRL_CHECKBOX_AUTOEXTENSION,
- HID_SEND_MASTER_CTRL_LISTBOX_TEMPLATE,
- ""
- };
-
if (bCreateHtml)
+ {
+ const char* aHTMLHelpIds[] =
+ {
+ HID_SEND_HTML_CTRL_PUSHBUTTON_OK,
+ HID_SEND_HTML_CTRL_PUSHBUTTON_CANCEL,
+ HID_SEND_HTML_CTRL_LISTBOX_FILTER,
+ HID_SEND_HTML_CTRL_CONTROL_FILEVIEW,
+ HID_SEND_HTML_CTRL_EDIT_FILEURL,
+ HID_SEND_HTML_CTRL_CHECKBOX_AUTOEXTENSION,
+ HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE,
+ ""
+ };
aDlgHelper.SetControlHelpIds( nControlIds, aHTMLHelpIds );
+ }
else
+ {
+ const char* aMasterHelpIds[] =
+ {
+ HID_SEND_MASTER_CTRL_PUSHBUTTON_OK,
+ HID_SEND_MASTER_CTRL_PUSHBUTTON_CANCEL,
+ HID_SEND_MASTER_CTRL_LISTBOX_FILTER,
+ HID_SEND_MASTER_CTRL_CONTROL_FILEVIEW,
+ HID_SEND_MASTER_CTRL_EDIT_FILEURL,
+ HID_SEND_MASTER_CTRL_CHECKBOX_AUTOEXTENSION,
+ HID_SEND_MASTER_CTRL_LISTBOX_TEMPLATE,
+ ""
+ };
aDlgHelper.SetControlHelpIds( nControlIds, aMasterHelpIds );
+ }
uno::Reference < XFilePicker2 > xFP = aDlgHelper.GetFilePicker();
std::shared_ptr<const SfxFilter> pFlt;