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

@ -153,8 +153,8 @@ int _tmain(int argc, TCHAR* argv[])
}
else
{
fprintf(fHdr, "!define LIBRARY_VERSION_HIGH %u\n", high);
fprintf(fHdr, "!define LIBRARY_VERSION_LOW %u\n", low);
fprintf(fHdr, "!define LIBRARY_VERSION_HIGH %lu\n", high);
fprintf(fHdr, "!define LIBRARY_VERSION_LOW %lu\n", low);
}
fclose(fHdr);

View file

@ -30,7 +30,7 @@ JNL_Connection::JNL_Connection(JNL_AsyncDNS *dns, int sendbufsize, int recvbufsi
m_send_buffer_len=sendbufsize;
m_recv_buffer=(char*)malloc(m_recv_buffer_len);
m_send_buffer=(char*)malloc(m_send_buffer_len);
m_socket=-1;
m_socket=INVALID_SOCKET;
memset(m_recv_buffer,0,recvbufsize);
memset(m_send_buffer,0,sendbufsize);
m_remote_port=0;
@ -41,7 +41,7 @@ JNL_Connection::JNL_Connection(JNL_AsyncDNS *dns, int sendbufsize, int recvbufsi
memset(&m_saddr,0,sizeof(m_saddr));
}
void JNL_Connection::connect(int s, struct sockaddr_in *loc)
void JNL_Connection::connect(PORTABLE_SOCKET s, struct sockaddr_in *loc)
{
close(1);
m_socket=s;
@ -49,7 +49,7 @@ void JNL_Connection::connect(int s, struct sockaddr_in *loc)
m_dns=NULL;
if (loc) m_saddr=*loc;
else memset(&m_saddr,0,sizeof(m_saddr));
if (m_socket != -1)
if (m_socket != INVALID_SOCKET)
{
SET_SOCK_BLOCK(m_socket,0);
m_state=STATE_CONNECTED;
@ -66,7 +66,7 @@ void JNL_Connection::connect(char *hostname, int port)
close(1);
m_remote_port=(short)port;
m_socket=::socket(AF_INET,SOCK_STREAM,0);
if (m_socket==-1)
if (m_socket==INVALID_SOCKET)
{
m_errorstr="creating socket";
m_state=STATE_ERROR;
@ -94,11 +94,11 @@ void JNL_Connection::connect(char *hostname, int port)
JNL_Connection::~JNL_Connection()
{
if (m_socket >= 0)
if (m_socket != INVALID_SOCKET)
{
::shutdown(m_socket, SHUT_RDWR);
::closesocket(m_socket);
m_socket=-1;
m_socket=INVALID_SOCKET;
}
free(m_recv_buffer);
free(m_send_buffer);
@ -280,12 +280,12 @@ void JNL_Connection::close(int quick)
if (quick || m_state == STATE_RESOLVING || m_state == STATE_CONNECTING)
{
m_state=STATE_CLOSED;
if (m_socket >= 0)
if (m_socket != INVALID_SOCKET)
{
::shutdown(m_socket, SHUT_RDWR);
::closesocket(m_socket);
}
m_socket=-1;
m_socket=INVALID_SOCKET;
memset(m_recv_buffer,0,m_recv_buffer_len);
memset(m_send_buffer,0,m_send_buffer_len);
m_remote_port=0;
@ -440,7 +440,7 @@ int JNL_Connection::recv_line(char *line, int maxlength)
unsigned long JNL_Connection::get_interface(void)
{
if (m_socket==-1) return 0;
if (m_socket==INVALID_SOCKET) return 0;
struct sockaddr_in sin;
memset(&sin,0,sizeof(sin));
socklen_t len=16;

View file

@ -58,6 +58,7 @@
#define _CONNECTION_H_
#include "asyncdns.h"
#include "netinc.h"
#define JNL_CONNECTION_AUTODNS ((JNL_AsyncDNS*)-1)
@ -79,7 +80,7 @@ class JNL_Connection
~JNL_Connection();
void connect(char *hostname, int port);
void connect(int sock, struct sockaddr_in *loc=NULL); // used by the listen object, usually not needed by users.
void connect(PORTABLE_SOCKET sock, struct sockaddr_in *loc=NULL); // used by the listen object, usually not needed by users.
void run(int max_send_bytes=-1, int max_recv_bytes=-1, int *bytes_sent=NULL, int *bytes_rcvd=NULL);
int get_state() { return m_state; }
@ -109,7 +110,7 @@ class JNL_Connection
short get_remote_port(void) { return m_remote_port; } // this returns the remote port of connection
protected:
int m_socket;
PORTABLE_SOCKET m_socket;
short m_remote_port;
char *m_recv_buffer;
char *m_send_buffer;

View file

@ -22,6 +22,7 @@
#include <time.h>
#define strcasecmp(x,y) stricmp(x,y)
#define ERRNO (WSAGetLastError())
#define PORTABLE_SOCKET SOCKET
#define SET_SOCK_BLOCK(s,block) { unsigned long __i=block?0:1; ioctlsocket(s,FIONBIO,&__i); }
#define EWOULDBLOCK WSAEWOULDBLOCK
#define EINPROGRESS WSAEWOULDBLOCK
@ -53,6 +54,7 @@ typedef int socklen_t;
#include <string.h>
#define ERRNO errno
#define PORTABLE_SOCKET int
#define closesocket(s) close(s)
#define SET_SOCK_BLOCK(s,block) { int __flags; if ((__flags = fcntl(s, F_GETFL, 0)) != -1) { if (!block) __flags |= O_NONBLOCK; else __flags &= ~O_NONBLOCK; fcntl(s, F_SETFL, __flags); } }
@ -74,6 +76,10 @@ typedef int socklen_t;
#define SHUT_RDWR 2
#endif
#ifndef INVALID_SOCKET
#define INVALID_SOCKET -1
#endif
extern void mini_memset(void *,char,int);
extern void mini_memcpy(void *,void*,int);
#define memset mini_memset

View file

@ -319,7 +319,6 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
}
else {
int this_compressor=0;
int last_compressor;
int i;
HANDLE hPrev, hThis;
DWORD prevSize=0, thisSize=0;
@ -328,7 +327,6 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
for(i=(int)COMPRESSOR_SCRIPT+2; i<(int)COMPRESSOR_BEST; i++) {
if(!lstrcmpi(g_sdata.compressor_name,compressor_names[i])) {
this_compressor = i;
last_compressor = i-1;
break;
}
}
@ -937,12 +935,11 @@ BOOL CALLBACK SettingsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_INITDIALOG:
{
int i = 0;
LRESULT rv;
for(i = (int)COMPRESSOR_SCRIPT; i <= (int)COMPRESSOR_BEST; i++) {
rv = SendDlgItemMessage(hwndDlg, IDC_COMPRESSOR, CB_ADDSTRING, 0, (LPARAM)compressor_display_names[i]);
SendDlgItemMessage(hwndDlg, IDC_COMPRESSOR, CB_ADDSTRING, 0, (LPARAM)compressor_display_names[i]);
}
rv = SendDlgItemMessage(hwndDlg, IDC_COMPRESSOR, CB_SETCURSEL, (WPARAM)g_sdata.default_compressor, (LPARAM)0);
SendDlgItemMessage(hwndDlg, IDC_COMPRESSOR, CB_SETCURSEL, (WPARAM)g_sdata.default_compressor, (LPARAM)0);
SetSymbols(hwndDlg, g_sdata.symbols);
SetFocus(GetDlgItem(hwndDlg, IDC_SYMBOL));
@ -1127,12 +1124,11 @@ BOOL CALLBACK CompressorProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
case WM_INITDIALOG:
{
int i=0;
LRESULT rv;
for(i=(int)COMPRESSOR_SCRIPT; i<= (int)COMPRESSOR_BEST; i++) {
rv = SendDlgItemMessage(hwndDlg, IDC_COMPRESSOR, CB_ADDSTRING, 0, (LPARAM)compressor_display_names[i]);
SendDlgItemMessage(hwndDlg, IDC_COMPRESSOR, CB_ADDSTRING, 0, (LPARAM)compressor_display_names[i]);
}
rv = SendDlgItemMessage(hwndDlg, IDC_COMPRESSOR, CB_SETCURSEL, (WPARAM)g_sdata.compressor, (LPARAM)0);
SendDlgItemMessage(hwndDlg, IDC_COMPRESSOR, CB_SETCURSEL, (WPARAM)g_sdata.compressor, (LPARAM)0);
SetFocus(GetDlgItem(hwndDlg, IDC_COMPRESSOR));
break;

View file

@ -27,7 +27,7 @@ JNL_AsyncDNS::~JNL_AsyncDNS()
wait_for_thread_death();
}
unsigned long WINAPI JNL_AsyncDNS::_threadfunc(LPVOID _d)
DWORD WINAPI JNL_AsyncDNS::_threadfunc(LPVOID _d)
{
JNL_AsyncDNS *_this=(JNL_AsyncDNS*)_d;
struct hostent *hostentry;

View file

@ -30,7 +30,7 @@ JNL_Connection::JNL_Connection(JNL_AsyncDNS *dns, int sendbufsize, int recvbufsi
m_send_buffer_len=sendbufsize;
m_recv_buffer=(char*)malloc(m_recv_buffer_len);
m_send_buffer=(char*)malloc(m_send_buffer_len);
m_socket=-1;
m_socket=INVALID_SOCKET;
m_remote_port=0;
m_state=STATE_NOCONNECTION;
m_recv_len=m_recv_pos=0;
@ -39,7 +39,7 @@ JNL_Connection::JNL_Connection(JNL_AsyncDNS *dns, int sendbufsize, int recvbufsi
memset(&m_saddr,0,sizeof(m_saddr));
}
void JNL_Connection::connect(int s, struct sockaddr_in *loc)
void JNL_Connection::connect(PORTABLE_SOCKET s, struct sockaddr_in *loc)
{
close(1);
m_socket=s;
@ -47,7 +47,7 @@ void JNL_Connection::connect(int s, struct sockaddr_in *loc)
m_dns=NULL;
if (loc) m_saddr=*loc;
else memset(&m_saddr,0,sizeof(m_saddr));
if (m_socket != -1)
if (m_socket != INVALID_SOCKET)
{
SET_SOCK_BLOCK(m_socket,0);
m_state=STATE_CONNECTED;
@ -64,7 +64,7 @@ void JNL_Connection::connect(char *hostname, int port)
close(1);
m_remote_port=(short)port;
m_socket=::socket(AF_INET,SOCK_STREAM,0);
if (m_socket==-1)
if (m_socket==INVALID_SOCKET)
{
m_errorstr="creating socket";
m_state=STATE_ERROR;
@ -83,7 +83,7 @@ void JNL_Connection::connect(char *hostname, int port)
else
{
m_state=STATE_RESOLVING;
m_saddr.sin_family=AF_INET;
m_saddr.sin_family=AF_INET;
m_saddr.sin_port=htons((unsigned short)port);
m_saddr.sin_addr.s_addr=inet_addr(hostname);
}
@ -92,11 +92,11 @@ void JNL_Connection::connect(char *hostname, int port)
JNL_Connection::~JNL_Connection()
{
if (m_socket >= 0)
if (m_socket != INVALID_SOCKET)
{
::shutdown(m_socket, SHUT_RDWR);
::closesocket(m_socket);
m_socket=-1;
m_socket=INVALID_SOCKET;
}
free(m_recv_buffer);
free(m_send_buffer);
@ -145,7 +145,7 @@ void JNL_Connection::run(int max_send_bytes, int max_recv_bytes, int *bytes_sent
else { m_state=STATE_CONNECTING; }
break;
case STATE_CONNECTING:
{
{
fd_set f[3];
FD_ZERO(&f[0]);
FD_ZERO(&f[1]);
@ -278,12 +278,12 @@ void JNL_Connection::close(int quick)
if (quick || m_state == STATE_RESOLVING || m_state == STATE_CONNECTING)
{
m_state=STATE_CLOSED;
if (m_socket >= 0)
if (m_socket != INVALID_SOCKET)
{
::shutdown(m_socket, SHUT_RDWR);
::closesocket(m_socket);
}
m_socket=-1;
m_socket=INVALID_SOCKET;
memset(m_recv_buffer,0,m_recv_buffer_len);
memset(m_send_buffer,0,m_send_buffer_len);
m_remote_port=0;
@ -438,7 +438,7 @@ int JNL_Connection::recv_line(char *line, int maxlength)
unsigned long JNL_Connection::get_interface(void)
{
if (m_socket==-1) return 0;
if (m_socket==INVALID_SOCKET) return 0;
struct sockaddr_in sin;
memset(&sin,0,sizeof(sin));
socklen_t len=16;

View file

@ -59,6 +59,7 @@
#define _CONNECTION_H_
#include "asyncdns.h"
#include "netinc.h"
#define JNL_CONNECTION_AUTODNS ((JNL_AsyncDNS*)-1)
@ -80,7 +81,7 @@ class JNL_Connection
~JNL_Connection();
void connect(char *hostname, int port);
void connect(int sock, struct sockaddr_in *loc=NULL); // used by the listen object, usually not needed by users.
void connect(PORTABLE_SOCKET sock, struct sockaddr_in *loc=NULL); // used by the listen object, usually not needed by users.
void run(int max_send_bytes=-1, int max_recv_bytes=-1, int *bytes_sent=NULL, int *bytes_rcvd=NULL);
int get_state() { return m_state; }
@ -110,7 +111,7 @@ class JNL_Connection
short get_remote_port(void) { return m_remote_port; } // this returns the remote port of connection
protected:
int m_socket;
PORTABLE_SOCKET m_socket;
short m_remote_port;
char *m_recv_buffer;
char *m_send_buffer;

View file

@ -43,4 +43,10 @@ typedef int socklen_t;
#define SHUT_RDWR 2
#endif
#ifndef INVALID_SOCKET
#define INVALID_SOCKET -1
#endif
#define PORTABLE_SOCKET SOCKET
#endif //_NETINC_H_

View file

@ -636,7 +636,14 @@ SystemProc *PrepareProc(BOOL NeedForCall)
case _T('0'): case _T('1'): case _T('2'): case _T('3'): case _T('4'):
case _T('5'): case _T('6'): case _T('7'): case _T('8'): case _T('9'):
// Numeric inline
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // temp3 is set to 0 when we start parsing a new parameter
#endif
if (temp3 == 0)
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
{
ib--;
// It's stupid, I know, but I'm too lazy to do another thing
@ -704,7 +711,14 @@ SystemProc *PrepareProc(BOOL NeedForCall)
if (temp3 == 1)
proc->Params[ParamIndex].Output = temp4;
// Next parameter is output or something else
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
temp3++;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}
ChangesDone = PCD_DONE;
@ -1156,9 +1170,10 @@ void CallStruct(SystemProc *proc)
// Special
size = (proc->Params[i].Option-1) * ByteSizeByType[proc->Params[i].Type];
ptr = NULL;
switch (proc->Params[i].Type)
{
case PAT_VOID: ptr = NULL; break;
case PAT_VOID: break;
case PAT_LONG:
// real structure size
proc->Params[i].Value = structsize;

View file

@ -102,7 +102,7 @@ public:
{
size_t cbio = fread(s, 1, n, m_File);
m_LastReadCount = cbio;
if (cbio != n)
if (cbio != (size_t)n)
{
m_state |= ferror(m_File) ? ios_base::badbit : (ios_base::eofbit|ios_base::failbit);
}
@ -126,7 +126,7 @@ public:
simplebfstream& write(const char* s, streamsize n)
{
size_t cbio = fwrite(s, 1, n, m_File);
if (cbio != n) m_state |= ios_base::badbit;
if (cbio != (size_t)n) m_state |= ios_base::badbit;
return *this;
}

View file

@ -1220,8 +1220,8 @@ HRESULT CEncoder::GetOptimumFast(UInt32 position, UInt32 &backRes, UInt32 &lenRe
if (repLens[repMaxIndex] >= 2)
{
if (repLens[repMaxIndex] + 1 >= lenMain ||
repLens[repMaxIndex] + 2 >= lenMain && (backMain > (1 << 9)) ||
repLens[repMaxIndex] + 3 >= lenMain && (backMain > (1 << 15)))
(repLens[repMaxIndex] + 2 >= lenMain && (backMain > (1 << 9))) ||
(repLens[repMaxIndex] + 3 >= lenMain && (backMain > (1 << 15))) )
{
backRes = repMaxIndex;
lenRes = repLens[repMaxIndex];
@ -1235,10 +1235,10 @@ HRESULT CEncoder::GetOptimumFast(UInt32 position, UInt32 &backRes, UInt32 &lenRe
if (_longestMatchLength >= 2)
{
UInt32 newDistance = matchDistances[_numDistancePairs - 1];
if (_longestMatchLength >= lenMain && newDistance < backMain ||
_longestMatchLength == lenMain + 1 && !ChangePair(backMain, newDistance) ||
_longestMatchLength > lenMain + 1 ||
_longestMatchLength + 1 >= lenMain && lenMain >= 3 && ChangePair(newDistance, backMain))
if ((_longestMatchLength >= lenMain && newDistance < backMain) ||
(_longestMatchLength == lenMain + 1 && !ChangePair(backMain, newDistance)) ||
(_longestMatchLength > lenMain + 1) ||
(_longestMatchLength + 1 >= lenMain && lenMain >= 3 && ChangePair(newDistance, backMain)))
{
_longestMatchWasFound = true;
backRes = UInt32(-1);

View file

@ -353,6 +353,12 @@ void CDialogTemplate::PixelsToDlgUnits(short& x, short& y) {
y = short(float(y) / (float(r.bottom)/10000));
}
void CDialogTemplate::PixelsToDlgUnits(SIZE& siz) {
short x = (short)siz.cx, y = (short)siz.cy;
PixelsToDlgUnits(x, y);
siz.cx = x, siz.cy = y;
}
// Converts pixels to this dialog's units
void CDialogTemplate::DlgUnitsToPixels(short& x, short& y) {
HWND hDlg = CreateDummyDialog();
@ -382,8 +388,8 @@ SIZE CDialogTemplate::GetStringSize(WORD id, TCHAR *str) {
DeleteObject(font);
DeleteDC(memDC);
PixelsToDlgUnits((short&)size.cx, (short&)size.cy);
PixelsToDlgUnits(size);
return size;
}

View file

@ -124,6 +124,7 @@ public:
void Resize(short x, short y);
#ifdef _WIN32
void PixelsToDlgUnits(short& x, short& y);
void PixelsToDlgUnits(SIZE& siz);
void DlgUnitsToPixels(short& x, short& y);
SIZE GetStringSize(WORD id, TCHAR *str);
void RTrimToString(WORD id, TCHAR *str, int margins);

View file

@ -85,7 +85,7 @@ void read_file(const tstring& filename, vector<unsigned char>& data) {
rewind(file);
data.resize(filesize);
size_t cbio = fread(reinterpret_cast<char*>(&data[0]), 1, filesize, file);
succ = cbio == filesize;
succ = cbio == (unsigned)filesize;
}
if (!succ) throw NSISException(_T("Couldn't read entire file '") + filename + _T("'"));
}

View file

@ -1820,7 +1820,7 @@ int CEXEBuild::ProcessPages()
int license_fsrb=0;
int license_fscb=0;
int selcom=0;
int dir=0, dir_used;
int dir=0;
int uninstconfirm=0;
int instlog=0, instlog_used;
int main=0;
@ -1829,7 +1829,6 @@ int CEXEBuild::ProcessPages()
again:
#endif
dir_used = 0;
instlog_used = 0;
#ifdef NSIS_CONFIG_SILENT_SUPPORT

View file

@ -520,7 +520,7 @@ static void NSISCALL unRLE_obuf_to_output_FAST ( DState* s )
Int32 c_k0 = s->k0;
UInt32 c_tPos = s->tPos;
char* cs_next_out = s->next_out;
char* cs_next_out = (char*) s->next_out;
unsigned int cs_avail_out = s->avail_out;
/* end restore */
@ -583,7 +583,7 @@ static void NSISCALL unRLE_obuf_to_output_FAST ( DState* s )
s->nblock_used = c_nblock_used;
s->k0 = c_k0;
s->tPos = c_tPos;
s->next_out = cs_next_out;
s->next_out = (unsigned char*) cs_next_out;
s->avail_out = cs_avail_out;
/* end save */
}

View file

@ -146,10 +146,10 @@ typedef unsigned short UInt16;
#define mini_memcpy memcpy
typedef struct {
char *next_in;
unsigned char *next_in;
unsigned int avail_in;
char *next_out;
unsigned char *next_out;
unsigned int avail_out;
void *state;
@ -325,10 +325,10 @@ typedef struct {
typedef struct {
/* pointer back to the struct bz_stream */
char *next_in;
unsigned char *next_in;
unsigned int avail_in;
char *next_out;
unsigned char *next_out;
unsigned int avail_out;
/* state indicator for this stream */

View file

@ -298,7 +298,7 @@ void sendMTFValues ( EState* s )
{
Int32 v, t, i, j, gs, ge, totc, bt, bc, iter;
Int32 nSelectors, alphaSize, minLen, maxLen, selCtr;
Int32 nGroups, nBytes;
Int32 nGroups;
/*--
UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
@ -539,7 +539,6 @@ void sendMTFValues ( EState* s )
if (s->inUse[i * 16 + j]) inUse16[i] = True;
}
nBytes = s->numZ;
for (i = 0; i < 16; i++)
if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0);
@ -552,7 +551,6 @@ void sendMTFValues ( EState* s )
}
/*--- Now the selectors. ---*/
nBytes = s->numZ;
bsW ( s, 3, nGroups );
bsW ( s, 15, nSelectors );
for (i = 0; i < nSelectors; i++) {
@ -561,8 +559,6 @@ void sendMTFValues ( EState* s )
}
/*--- Now the coding tables. ---*/
nBytes = s->numZ;
for (t = 0; t < nGroups; t++) {
Int32 curr = s->len[t][0];
bsW ( s, 5, curr );
@ -575,7 +571,6 @@ void sendMTFValues ( EState* s )
/*--- And finally, the block data proper ---*/
nBytes = s->numZ;
selCtr = 0;
gs = 0;
while (True) {

View file

@ -52,17 +52,17 @@ class CBzip2 : public ICompressor {
}
void SetNextIn(char *in, unsigned int size) {
stream->next_in = in;
stream->next_in = (unsigned char*) in;
stream->avail_in = size;
}
void SetNextOut(char *out, unsigned int size) {
stream->next_out = out;
stream->next_out = (unsigned char*) out;
stream->avail_out = size;
}
virtual char* GetNextOut() {
return stream->next_out;
return (char*) stream->next_out;
}
virtual unsigned int GetAvailIn() {

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)

View file

@ -648,13 +648,6 @@ int CEXEBuild::GenerateLangTable(LanguageTable *lt, int num_lang_tables) {
const TCHAR *name = _T("(unnamed)");
for (l = 0; l < langstring_num; l++)
{
int index;
if (!uninstall_mode)
index = lang_strings[l].index;
else
index = lang_strings[l].uindex;
if (lang_strings[l].index == j)
{
name = build_langstrings.offset2name(lang_strings[l].name);

View file

@ -1423,7 +1423,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
for (UINT i = 0; i < 4; ++i)
{
_stprintf(symbuf,_T("%s%u"), basesymname, i+1);
_stprintf(numbuf,_T("%u"), vals[i]);
_stprintf(numbuf,_T("%lu"), vals[i]);
definedlist.add(symbuf, numbuf);
}
}

View file

@ -477,7 +477,7 @@ int ZEXPORT inflate(z_streamp z)
{
uInt hn = 0; /* hufts used in space */
t = huft_build(s->sub.trees.t_blens, 19, 19, (short *)Z_NULL, (short*)Z_NULL,
t = huft_build(s->sub.trees.t_blens, 19, 19, (unsigned short*)Z_NULL, (unsigned short*)Z_NULL,
&s->sub.trees.tb, &s->sub.trees.bb, s->hufts, &hn);
if (t != Z_OK || !s->sub.trees.bb)
{