Fix minor GCC warnings

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7130 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2019-10-24 19:27:37 +00:00
parent f39c8f241d
commit 2bae3414ba
2 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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<TCHAR*>(searchstart), _T("%1"));) // While found, replace %1 with templatearg_pc1
for (; (arg = _tcsstr(const_cast<TCHAR*>(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));