From 2bae3414ba06949b1b24158dcad0718b906c972d Mon Sep 17 00:00:00 2001 From: anders_k Date: Thu, 24 Oct 2019 19:27:37 +0000 Subject: [PATCH] Fix minor GCC warnings git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7130 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/nsExec/nsexec.c | 6 +++++- Source/build.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Contrib/nsExec/nsexec.c b/Contrib/nsExec/nsexec.c index 1fe07dbd..65a5b0c7 100644 --- a/Contrib/nsExec/nsexec.c +++ b/Contrib/nsExec/nsexec.c @@ -308,6 +308,10 @@ params: SIZE_T cbSrcTot = sizeof(bufSrc), cbSrc = 0, cbSrcFree; TCHAR *bufOutput = 0, *pNewAlloc, *pD; SIZE_T cchAlloc, cbAlloc, cchFree; +#ifndef _MSC_VER // Avoid GCC "may be used uninitialized in this function" warnings + pD = NULL; + cchAlloc = 0; +#endif pi.hProcess = pi.hThread = NULL; codepage = bOEM ? CP_OEMCP : CP_ACP; @@ -424,7 +428,7 @@ parseLines: if (isMb && cbSrc < ++cbSrcChar) { goto readMore; } - cchDstChar = MultiByteToWideChar(codepage, 0, pSrc, cbSrcChar, (WCHAR*) bufCh, 2); + cchDstChar = MultiByteToWideChar(codepage, 0, (CHAR*)pSrc, cbSrcChar, (WCHAR*) bufCh, 2); } else { // DBCS --> DBCS: bufCh[0] = ((CHAR*)pSrc)[0], cchDstChar = 1; // Note: OEM codepage will be converted by LogMessage diff --git a/Source/build.cpp b/Source/build.cpp index 1bb7fa4e..ee135325 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -4025,7 +4025,7 @@ int CEXEBuild::run_postbuild_cmds(const postbuild_cmd *cmds, const TCHAR *templa { const TCHAR *cmdstr = cmd->cmd, *searchstart = cmdstr; TCHAR *arg, *cmdstrbuf = NULL, *tmpbuf; - for (; arg = _tcsstr(const_cast(searchstart), _T("%1"));) // While found, replace %1 with templatearg_pc1 + for (; (arg = _tcsstr(const_cast(searchstart), _T("%1")));) // While found, replace %1 with templatearg_pc1 { const size_t cchtpc1 = _tcslen(templatearg_pc1); tmpbuf = (TCHAR*) malloc((_tcslen(cmdstr) + cchtpc1 + !0) * sizeof(TCHAR));