Fixed some warnings
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6443 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
07183c43a9
commit
a7261be70c
7 changed files with 40 additions and 50 deletions
|
@ -500,12 +500,12 @@ DWORD CResourceEditor::Save(BYTE* pbBuf, DWORD &dwSize) {
|
|||
seeker += dwRsrcSizeAligned;
|
||||
|
||||
// Copy everything that comes after the resource section (other sections and tacked data)
|
||||
DWORD dwLeft = m_iSize - (oldSeeker - m_pbPE);
|
||||
if (dwLeft)
|
||||
CopyMemory(seeker, oldSeeker, dwLeft);
|
||||
size_t cbLeft = m_iSize - (oldSeeker - m_pbPE);
|
||||
if (cbLeft)
|
||||
CopyMemory(seeker, oldSeeker, cbLeft);
|
||||
|
||||
seeker += dwLeft;
|
||||
oldSeeker += dwLeft;
|
||||
seeker += cbLeft;
|
||||
oldSeeker += cbLeft;
|
||||
|
||||
/**********************************************************
|
||||
* To add checksum to the header use MapFileAndCheckSum
|
||||
|
|
|
@ -131,9 +131,8 @@ void CResourceVersionInfo::SetProductVersion(int HighPart, int LowPart)
|
|||
int GetVersionHeader (LPSTR &p, WORD &wLength, WORD &wValueLength, WORD &wType)
|
||||
{
|
||||
WINWCHAR *szKey;
|
||||
char * baseP;
|
||||
|
||||
baseP = p;
|
||||
char *baseP = p;
|
||||
|
||||
wLength = *(WORD*)p;
|
||||
p += sizeof(WORD);
|
||||
wValueLength = *(WORD*)p;
|
||||
|
@ -142,9 +141,9 @@ int GetVersionHeader (LPSTR &p, WORD &wLength, WORD &wValueLength, WORD &wType)
|
|||
p += sizeof(WORD);
|
||||
szKey = (WINWCHAR*)p;
|
||||
p += (WinWStrLen(szKey) + 1) * sizeof (WINWCHAR);
|
||||
while ( ((ULONG_PTR)p % 4) != 0 )
|
||||
p++;
|
||||
return p - baseP;
|
||||
while ( ((ULONG_PTR)p % 4) != 0 ) p++;
|
||||
|
||||
return (int)(p - baseP);
|
||||
}
|
||||
|
||||
DWORD ZEROS = 0;
|
||||
|
|
|
@ -532,7 +532,7 @@ char* convert_processed_string_to_ansi(char *out, const TCHAR *in, WORD codepage
|
|||
if (NS_IS_CODE(i)) // Note: this includes '\0'
|
||||
{
|
||||
// convert all character up to, and including this code
|
||||
int cb = WideCharToMultiByte(codepage, 0, in, p-in, out, (p-in)*2, NULL, NULL);
|
||||
int c = (int)(p-in), cb = WideCharToMultiByte(codepage, 0, in, c, out, c*2, NULL, NULL);
|
||||
if (!cb && i) return 0;
|
||||
out += cb;
|
||||
if (i == _T('\0'))
|
||||
|
@ -566,8 +566,8 @@ int CEXEBuild::preprocess_string(TCHAR *out, const TCHAR *in, WORD codepage/*=CP
|
|||
#endif
|
||||
if (np - p > 1) // multibyte TCHAR
|
||||
{
|
||||
int l = np - p;
|
||||
while (l--)
|
||||
size_t len = np - p;
|
||||
while (len--)
|
||||
{
|
||||
_TUCHAR i = (_TUCHAR)*p++;
|
||||
if (NS_IS_CODE(i)) {
|
||||
|
@ -605,7 +605,7 @@ int CEXEBuild::preprocess_string(TCHAR *out, const TCHAR *in, WORD codepage/*=CP
|
|||
|
||||
while (pUserVarName > p)
|
||||
{
|
||||
if (m_ShellConstants.get((TCHAR*)p, pUserVarName-p) >= 0)
|
||||
if (m_ShellConstants.get((TCHAR*)p, BUGBUG64TRUNCATE(int, pUserVarName-p)) >= 0)
|
||||
break; // Woops it's a shell constant
|
||||
|
||||
// Jim Park: The following line could be a source of bugs for
|
||||
|
@ -616,7 +616,7 @@ int CEXEBuild::preprocess_string(TCHAR *out, const TCHAR *in, WORD codepage/*=CP
|
|||
// TCHAR varname[NSIS_MAX_STRLEN];
|
||||
// _tcsncpy(varname, p, pUserVarName-p);
|
||||
// int idxUserVar = m_UserVarNames.get(varname);
|
||||
int idxUserVar = m_UserVarNames.get((TCHAR*)p, pUserVarName-p);
|
||||
int idxUserVar = m_UserVarNames.get((TCHAR*)p, BUGBUG64TRUNCATE(int, pUserVarName-p));
|
||||
if (idxUserVar >= 0)
|
||||
{
|
||||
// Well, using variables inside string formating doens't mean
|
||||
|
@ -644,7 +644,7 @@ int CEXEBuild::preprocess_string(TCHAR *out, const TCHAR *in, WORD codepage/*=CP
|
|||
while (pShellConstName > p)
|
||||
{
|
||||
// Look for the identifier in the shell constants list of strings.
|
||||
int idxConst = m_ShellConstants.get((TCHAR*)p, pShellConstName - p);
|
||||
int idxConst = m_ShellConstants.get((TCHAR*)p, BUGBUG64TRUNCATE(int, pShellConstName - p));
|
||||
|
||||
// If found...
|
||||
if (idxConst >= 0)
|
||||
|
@ -2999,12 +2999,12 @@ int CEXEBuild::deflateToFile(FILE *fp, char *buf, int len) // len==0 to flush
|
|||
ERROR_MSG(_T("Error: deflateToFile: deflate() failed(%") NPRIs _T(" [%d])\n"), compressor->GetErrStr(ret), ret);
|
||||
return 1;
|
||||
}
|
||||
int l=compressor->GetNextOut()-obuf;
|
||||
size_t l=compressor->GetNextOut()-obuf;
|
||||
if (l)
|
||||
{
|
||||
if (fwrite(obuf,1,l,fp) != (size_t)l)
|
||||
if (fwrite(obuf,1,l,fp) != l)
|
||||
{
|
||||
ERROR_MSG(_T("Error: deflateToFile fwrite(%d) failed\n"),l);
|
||||
ERROR_MSG(_T("Error: deflateToFile fwrite(%lu) failed\n"),(unsigned long)l);
|
||||
return 1;
|
||||
}
|
||||
fflush(fp);
|
||||
|
@ -3152,7 +3152,7 @@ int CEXEBuild::uninstall_generate()
|
|||
compressor->Compress(0);
|
||||
if (compressor->GetNextOut() - obuf > 0)
|
||||
{
|
||||
udata.add(obuf, compressor->GetNextOut() - obuf);
|
||||
udata.add(obuf, BUGBUG64TRUNCATE(int, compressor->GetNextOut() - obuf));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3169,7 +3169,7 @@ int CEXEBuild::uninstall_generate()
|
|||
compressor->SetNextOut(obuf, sizeof(obuf));
|
||||
compressor->Compress(0);
|
||||
if (compressor->GetNextOut() - obuf > 0)
|
||||
udata.add(obuf, compressor->GetNextOut() - obuf);
|
||||
udata.add(obuf, BUGBUG64TRUNCATE(int, compressor->GetNextOut() - obuf));
|
||||
}
|
||||
|
||||
ubuild_datablock.release();
|
||||
|
@ -3183,7 +3183,7 @@ int CEXEBuild::uninstall_generate()
|
|||
compressor->SetNextOut(obuf, sizeof(obuf));
|
||||
compressor->Compress(C_FINISH);
|
||||
if (compressor->GetNextOut() - obuf > 0)
|
||||
udata.add(obuf, compressor->GetNextOut() - obuf);
|
||||
udata.add(obuf, BUGBUG64TRUNCATE(int, compressor->GetNextOut() - obuf));
|
||||
else break;
|
||||
}
|
||||
compressor->End();
|
||||
|
|
|
@ -986,7 +986,7 @@ static INT_PTR CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
{
|
||||
static TCHAR bt[NSIS_MAX_STRLEN];
|
||||
BROWSEINFO bi = {0,};
|
||||
ITEMIDLIST *idlist;
|
||||
LPITEMIDLIST idlist;
|
||||
bi.hwndOwner = hwndDlg;
|
||||
bi.pszDisplayName = g_tmp;
|
||||
bi.lpfn = BrowseCallbackProc;
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace manifest
|
|||
m_list.deleteall();
|
||||
append(_T("Win7"));
|
||||
append(_T("Win8"));
|
||||
append(_T("Win8.1")); // In the default list because GetVersion(Ex) supposedly lies if this is not set in the manifest
|
||||
append(_T("Win8.1")); // In the default list because GetVersion[Ex] lies if this is not set in the manifest
|
||||
m_isdefaultlist = true;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -2188,11 +2188,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
}
|
||||
else
|
||||
{
|
||||
int v=_tcstoul(p,&p,16);
|
||||
build_header.license_bg=((v&0xff)<<16)|(v&0xff00)|((v&0xff0000)>>16);
|
||||
build_uninst.license_bg=build_header.license_bg;
|
||||
SCRIPT_MSG(_T("LicenseBkColor: %06X\n"),v);
|
||||
}
|
||||
int v=_tcstoul(p,&p,16);
|
||||
build_header.license_bg=((v&0xff)<<16)|(v&0xff00)|((v&0xff0000)>>16);
|
||||
build_uninst.license_bg=build_header.license_bg;
|
||||
SCRIPT_MSG(_T("LicenseBkColor: %06X\n"),v);
|
||||
}
|
||||
}
|
||||
return PS_OK;
|
||||
#else//!NSIS_CONFIG_LICENSEPAGE
|
||||
|
@ -2311,7 +2311,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
int k=line.gettoken_enum(1,rootkeys[0]);
|
||||
if (k == -1) k=line.gettoken_enum(1,rootkeys[1]);
|
||||
if (k == -1) PRINTHELP()
|
||||
build_header.install_reg_rootkey=(INT_PTR)rootkey_tab[k];
|
||||
build_header.install_reg_rootkey=(INT)rootkey_tab[k];
|
||||
if (!build_header.install_reg_rootkey) PRINTHELP() // SHCTX is invalid here
|
||||
build_header.install_reg_key_ptr = add_string(line.gettoken_str(2),0);
|
||||
if (line.gettoken_str(2)[0] == _T('\\'))
|
||||
|
@ -2327,10 +2327,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
return PS_OK;
|
||||
case TOK_INSTPROGRESSFLAGS:
|
||||
{
|
||||
int x;
|
||||
int smooth=0;
|
||||
build_header.flags&=~CH_FLAGS_PROGRESS_COLORED;
|
||||
for (x = 1; x < line.getnumtokens(); x ++)
|
||||
for (int x = 1; x < line.getnumtokens(); x ++)
|
||||
{
|
||||
if (!_tcsicmp(line.gettoken_str(x),_T("smooth"))) smooth=1;
|
||||
else if (!_tcsicmp(line.gettoken_str(x),_T("colored"))) build_header.flags|=CH_FLAGS_PROGRESS_COLORED;
|
||||
|
@ -2344,14 +2343,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
CDialogTemplate dt(dlg,build_unicode,uDefCodePage);
|
||||
res_editor->FreeResource(dlg);
|
||||
DialogItemTemplate* progress = dt.GetItem(IDC_PROGRESS);
|
||||
if (!progress) {
|
||||
throw runtime_error("IDC_PROGRESS doesn't exist!");
|
||||
}
|
||||
if (!progress) throw runtime_error("IDC_PROGRESS doesn't exist!");
|
||||
|
||||
if (smooth)
|
||||
progress->dwStyle |= PBS_SMOOTH;
|
||||
else
|
||||
progress->dwStyle &= ~PBS_SMOOTH;
|
||||
if (smooth) progress->dwStyle |= PBS_SMOOTH; else progress->dwStyle &= ~PBS_SMOOTH;
|
||||
|
||||
DWORD dwSize;
|
||||
dlg = dt.Save(dwSize);
|
||||
|
@ -2596,10 +2590,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
int k=line.gettoken_enum(1,_T("on\0off\0"));
|
||||
if (k == -1) PRINTHELP()
|
||||
SCRIPT_MSG(_T("XPStyle: %") NPRIs _T("\n"), line.gettoken_str(1));
|
||||
if (!k)
|
||||
manifest_comctl = manifest::comctl_xp;
|
||||
else
|
||||
manifest_comctl = manifest::comctl_old;
|
||||
manifest_comctl = !k ? manifest::comctl_xp : manifest::comctl_old;
|
||||
}
|
||||
return PS_OK;
|
||||
case TOK_CHANGEUI:
|
||||
|
@ -5471,7 +5462,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
int k=line.gettoken_enum(2,rootkeys[0]);
|
||||
if (k == -1) k=line.gettoken_enum(2,rootkeys[1]);
|
||||
if (ent.offsets[0] == -1 || k == -1) PRINTHELP()
|
||||
ent.offsets[1]=(INT_PTR)rootkey_tab[k];
|
||||
ent.offsets[1]=(INT)rootkey_tab[k];
|
||||
ent.offsets[2]=add_string(line.gettoken_str(3));
|
||||
ent.offsets[3]=add_string(line.gettoken_str(4));
|
||||
if (which_token == TOK_READREGDWORD) ent.offsets[4]=1;
|
||||
|
@ -5503,7 +5494,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
if (k == -1) k=line.gettoken_enum(a,rootkeys[1]);
|
||||
if (k == -1) PRINTHELP()
|
||||
ent.which=EW_DELREG;
|
||||
ent.offsets[1]=(INT_PTR)rootkey_tab[k];
|
||||
ent.offsets[1]=(INT)rootkey_tab[k];
|
||||
ent.offsets[2]=add_string(line.gettoken_str(a+1));
|
||||
ent.offsets[3]=(which_token==TOK_DELETEREGKEY)?0:add_string(line.gettoken_str(a+2));
|
||||
if (line.gettoken_str(a+1)[0] == _T('\\'))
|
||||
|
@ -5523,7 +5514,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
if (k == -1) k=line.gettoken_enum(1,rootkeys[1]);
|
||||
if (k == -1) PRINTHELP()
|
||||
ent.which=EW_WRITEREG;
|
||||
ent.offsets[0]=(INT_PTR)rootkey_tab[k];
|
||||
ent.offsets[0]=(INT)rootkey_tab[k];
|
||||
ent.offsets[1]=add_string(line.gettoken_str(2));
|
||||
if (line.gettoken_str(2)[0] == _T('\\'))
|
||||
warning_fl(_T("%") NPRIs _T(": registry path name begins with \'\\\', may cause problems"),line.gettoken_str(0));
|
||||
|
@ -5593,7 +5584,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
int k=line.gettoken_enum(2,rootkeys[0]);
|
||||
if (k == -1) k=line.gettoken_enum(2,rootkeys[1]);
|
||||
if (ent.offsets[0] == -1 || k == -1) PRINTHELP()
|
||||
ent.offsets[1]=(INT_PTR)rootkey_tab[k];
|
||||
ent.offsets[1]=(INT)rootkey_tab[k];
|
||||
ent.offsets[2]=add_string(line.gettoken_str(3));
|
||||
ent.offsets[3]=add_string(line.gettoken_str(4));
|
||||
ent.offsets[4]=which_token == TOK_ENUMREGKEY;
|
||||
|
@ -6801,7 +6792,7 @@ DefineList *CEXEBuild::searchParseString(const TCHAR *source_string, LineParser&
|
|||
{
|
||||
toklen = (int) _tcslen(tok);
|
||||
while (*source_string && (ignCase?_tcsnicmp(source_string,tok,toklen):_tcsncmp(source_string,tok,toklen))) source_string++;
|
||||
maxlen = source_string - src_start; // Length of previous string
|
||||
maxlen = (int)(source_string - src_start); // Length of previous string
|
||||
}
|
||||
if (defout && defout[0]) // We now know the start and length of the previous string, add it to the list
|
||||
{
|
||||
|
|
|
@ -114,7 +114,7 @@ unsigned int ExeHeadStringList::find(const void *ptr, unsigned int cchF, WORD co
|
|||
if (processed)
|
||||
{
|
||||
char *pTmp = convert_processed_string_to_ansi(bufMB,find,codepage);
|
||||
cbMB = pTmp ? pTmp - bufMB : 0;
|
||||
cbMB = (int)(pTmp ? pTmp - bufMB : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue