Removed unused variables and fixed GCC warnings

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6259 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2012-09-08 02:50:09 +00:00
parent c6fdb4436d
commit 2d99d7ad3e
26 changed files with 124 additions and 96 deletions

View file

@ -1104,8 +1104,15 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
total = (unsigned) sumsecsfield(size_kb);
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // available_set is checked first so available is initialized
#endif
if (available_set && available < total)
error = NSIS_INSTDIR_NOT_ENOUGH_SPACE;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
if (LANG_STR_TAB(LANG_SPACE_REQ)) {
SetSizeText(IDC_SPACEREQUIRED,LANG_SPACE_REQ,total);
@ -1283,7 +1290,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
int doLines=0;
HTREEITEM Par;
HBITMAP hBMcheck1;
int x, lastGoodX, i, noCombo=2;
int x, i, noCombo=2;
g_SectionHack=hwndDlg;
@ -1322,7 +1329,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
Par=NULL;
for (lastGoodX = x = 0; x < num_sections; x ++)
for (x = 0; x < num_sections; x ++)
{
section *sec=sections+x;
@ -1352,7 +1359,6 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
else
{
lastGoodX = x;
hTreeItems[x] = TreeView_InsertItem(hwndTree1, &tv);
}
}

View file

@ -114,17 +114,17 @@ int NSISCALL ExecuteCallbackFunction(int num)
#endif
static TCHAR bufs[5][NSIS_MAX_STRLEN];
static int *parms;
static TCHAR g_bufs[5][NSIS_MAX_STRLEN];
static int *g_parms;
void NSISCALL update_status_text_buf1(int strtab)
{
update_status_text(strtab, bufs[1]);
update_status_text(strtab, g_bufs[1]);
}
static int NSISCALL GetIntFromParm(int id_)
{
return myatoi(GetNSISStringTT(parms[id_]));
return myatoi(GetNSISStringTT(g_parms[id_]));
}
// NB - USE CAUTION when rearranging code to make use of the new return value of
@ -133,11 +133,11 @@ static int NSISCALL GetIntFromParm(int id_)
// Note: Calling GetNSISString has the side effect that the buffer holding
// the string to expand gets modified.
// When calling this function with numbers like 0x13, it means create the string
// from the string ID found in entry.offset[3] and put it into bufs[0].
// from the string ID found in entry.offset[3] and put it into g_bufs[1].
static TCHAR * NSISCALL GetStringFromParm(int id_)
{
int id = id_ < 0 ? -id_ : id_;
TCHAR *result = GetNSISString(bufs[id >> 4], parms[id & 0xF]);
TCHAR *result = GetNSISString(g_bufs[id >> 4], g_parms[id & 0xF]);
if (id_ < 0) validate_filename(result);
return result;
}
@ -193,7 +193,7 @@ static HKEY NSISCALL GetRegRootKey(int hRootKey)
static HKEY NSISCALL myRegOpenKey(REGSAM samDesired)
{
HKEY hKey;
if (RegOpenKeyEx(GetRegRootKey(parms[1]), GetStringFromParm(0x22), 0, AlterRegistrySAM(samDesired), &hKey) == ERROR_SUCCESS)
if (RegOpenKeyEx(GetRegRootKey(g_parms[1]), GetStringFromParm(0x22), 0, AlterRegistrySAM(samDesired), &hKey) == ERROR_SUCCESS)
{
return hKey;
}
@ -206,11 +206,11 @@ static HKEY NSISCALL myRegOpenKey(REGSAM samDesired)
// otherwise, returns new_position+1
static int NSISCALL ExecuteEntry(entry *entry_)
{
TCHAR *buf0 = bufs[0];
TCHAR *buf1 = bufs[1];
TCHAR *buf2 = bufs[2];
TCHAR *buf3 = bufs[3];
//char *buf4 = bufs[4];
TCHAR *buf0 = g_bufs[0];
TCHAR *buf1 = g_bufs[1];
TCHAR *buf2 = g_bufs[2];
TCHAR *buf3 = g_bufs[3];
//char *buf4 = g_bufs[4];
TCHAR *var0;
TCHAR *var1;
@ -245,7 +245,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
//var4 = g_usrvars[parm4];
//var5 = g_usrvars[parm5];
parms = lent.offsets;
g_parms = lent.offsets;
switch (which)
{
@ -385,7 +385,10 @@ static int NSISCALL ExecuteEntry(entry *entry_)
{
TCHAR *buf3=GetStringFromParm(-0x30);
TCHAR *buf2=GetStringFromParm(-0x21);
TCHAR *buf1=GetStringFromParm(0x13);
#ifdef NSIS_CONFIG_LOG
TCHAR *buf1=
#endif
GetStringFromParm(0x13); // For update_status_text_buf1 and log_printf
log_printf2(_T("Rename: %s"),buf1);
if (MoveFile(buf3,buf2))
{
@ -859,7 +862,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
TCHAR *buf0=GetStringFromParm(0x00);
TCHAR *buf3=GetStringFromParm(0x31);
TCHAR *buf2=GetStringFromParm(0x22);
TCHAR *buf1=GetStringFromParm(0x15);
GetStringFromParm(0x15); // For update_status_text_buf1
update_status_text_buf1(LANG_EXECSHELL);
x=(int)ShellExecute(g_hwnd,buf0[0]?buf0:NULL,buf3,buf2[0]?buf2:NULL,state_output_directory,parm3);
if (x < 33)

View file

@ -385,7 +385,7 @@ int NSISCALL _dodecomp(int offset, HANDLE hFileOut, unsigned char *outbuf, int o
if (!ReadSelfFile((LPVOID)inbuffer,l))
return -3;
g_inflate_stream.next_in = inbuffer;
g_inflate_stream.next_in = (unsigned char*) inbuffer;
g_inflate_stream.avail_in = l;
input_len-=l;
@ -393,7 +393,7 @@ int NSISCALL _dodecomp(int offset, HANDLE hFileOut, unsigned char *outbuf, int o
{
int u;
g_inflate_stream.next_out = outbuffer;
g_inflate_stream.next_out = (unsigned char*) outbuffer;
g_inflate_stream.avail_out = (unsigned int)outbuffer_len;
err=inflate(&g_inflate_stream);
@ -424,7 +424,7 @@ int NSISCALL _dodecomp(int offset, HANDLE hFileOut, unsigned char *outbuf, int o
{
retval+=u;
outbuffer_len-=u;
outbuffer=g_inflate_stream.next_out;
outbuffer=(char*)g_inflate_stream.next_out;
}
if (err==Z_STREAM_END) return retval;
}
@ -480,7 +480,7 @@ static int NSISCALL __ensuredata(int amount)
int l=min(IBUFSIZE,dbd_fulllen-dbd_srcpos);
if (!ReadSelfFile((LPVOID)_inbuffer,l)) return -1;
dbd_srcpos+=l;
g_inflate_stream.next_in=_inbuffer;
g_inflate_stream.next_in=(unsigned char*)_inbuffer;
g_inflate_stream.avail_in=l;
do
{
@ -496,7 +496,7 @@ static int NSISCALL __ensuredata(int amount)
handle_ver_dlg(FALSE);
}
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
g_inflate_stream.next_out=_outbuffer;
g_inflate_stream.next_out=(unsigned char*)_outbuffer;
g_inflate_stream.avail_out=OBUFSIZE;
err=inflate(&g_inflate_stream);
if (err<0)