Fix a lot of MinGW/GCC warnings

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6168 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2011-11-09 18:12:57 +00:00
parent e918dd8a27
commit cf4e5cf132
31 changed files with 92 additions and 87 deletions

View file

@ -85,7 +85,7 @@ NSISFunc(SetReturn) {
bReturn = !lstrcmpi(szTemp, _T("on")); bReturn = !lstrcmpi(szTemp, _T("on"));
} }
static void __stdcall my_pushstring(TCHAR *str) static void __stdcall my_pushstring(const TCHAR *str)
{ {
stack_t *th; stack_t *th;
if (!g_stacktop || !bReturn) return; if (!g_stacktop || !bReturn) return;

View file

@ -109,7 +109,7 @@ TCHAR *WINAPI STRDUP(const TCHAR *c)
#define FLAG_FOCUS 0x10000000 // Controls that can receive focus #define FLAG_FOCUS 0x10000000 // Controls that can receive focus
struct TableEntry { struct TableEntry {
TCHAR *pszName; const TCHAR *pszName;
int nValue; int nValue;
}; };
@ -145,7 +145,7 @@ struct FieldType {
HANDLE hImage; // this is used by image/icon field to save the handle to the image HANDLE hImage; // this is used by image/icon field to save the handle to the image
int nField; // field number in INI file int nField; // field number in INI file
TCHAR *pszHwndEntry; // "HWND" or "HWND2" const TCHAR *pszHwndEntry; // "HWND" or "HWND2"
long wndProc; long wndProc;
}; };
@ -374,7 +374,7 @@ bool WINAPI SaveSettings(void) {
#define BROWSE_WIDTH 15 #define BROWSE_WIDTH 15
static TCHAR szResult[BUFFER_SIZE]; static TCHAR szResult[BUFFER_SIZE];
TCHAR *pszAppName; const TCHAR *pszAppName;
DWORD WINAPI myGetProfileString(LPCTSTR lpKeyName) DWORD WINAPI myGetProfileString(LPCTSTR lpKeyName)
{ {
@ -1014,7 +1014,7 @@ int WINAPI createCfgDlg()
for (int nIdx = 0; nIdx < nNumFields; nIdx++) { for (int nIdx = 0; nIdx < nNumFields; nIdx++) {
static struct { static struct {
TCHAR* pszClass; const TCHAR* pszClass;
DWORD dwStyle; DWORD dwStyle;
DWORD dwRTLStyle; DWORD dwRTLStyle;
DWORD dwExStyle; DWORD dwExStyle;

View file

@ -9,7 +9,7 @@
struct line { struct line {
unsigned short id; unsigned short id;
TCHAR *name; const TCHAR *name;
}; };
line primary[] = { line primary[] = {

View file

@ -83,7 +83,7 @@ class JNL_Connection
void run(int max_send_bytes=-1, int max_recv_bytes=-1, int *bytes_sent=NULL, int *bytes_rcvd=NULL); 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; } int get_state() { return m_state; }
char *get_errstr() { return m_errorstr; } const char *get_errstr() { return m_errorstr; }
void close(int quick=0); void close(int quick=0);
void flush_send(void) { m_send_len=m_send_pos=0; } void flush_send(void) { m_send_len=m_send_pos=0; }
@ -128,7 +128,7 @@ class JNL_Connection
int m_dns_owned; int m_dns_owned;
state m_state; state m_state;
char *m_errorstr; const char *m_errorstr;
int getbfromrecv(int pos, int remove); // used by recv_line* int getbfromrecv(int pos, int remove); // used by recv_line*

View file

@ -79,7 +79,7 @@ JNL_HTTPGet::~JNL_HTTPGet()
} }
void JNL_HTTPGet::addheader(char *header) void JNL_HTTPGet::addheader(const char *header)
{ {
//if (strstr(header,"\r") || strstr(header,"\n")) return; //if (strstr(header,"\r") || strstr(header,"\n")) return;
if (!m_sendheaders) if (!m_sendheaders)
@ -141,7 +141,7 @@ void JNL_HTTPGet::do_encode_mimestr(char *in, char *out)
} }
void JNL_HTTPGet::connect(char *url) void JNL_HTTPGet::connect(const char *url)
{ {
deinit(); deinit();
m_http_url=(char*)malloc(strlen(url)+1); m_http_url=(char*)malloc(strlen(url)+1);
@ -236,7 +236,7 @@ void JNL_HTTPGet::connect(char *url)
} }
static int my_strnicmp(char *b1, char *b2, int l) static int my_strnicmp(const char *b1, const char *b2, int l)
{ {
while (l-- && *b1 && *b2) while (l-- && *b1 && *b2)
{ {
@ -249,13 +249,13 @@ static int my_strnicmp(char *b1, char *b2, int l)
return 0; return 0;
} }
char *_strstr(char *i, char *s) char *_strstr(char *i, const char *s)
{ {
if (strlen(i)>=strlen(s)) while (i[strlen(s)-1]) if (strlen(i)>=strlen(s)) while (i[strlen(s)-1])
{ {
int l=strlen(s)+1; int l=strlen(s)+1;
char *ii=i; char *ii=i;
char *is=s; const char *is=s;
while (--l>0) while (--l>0)
{ {
if (*ii != *is) break; if (*ii != *is) break;
@ -318,13 +318,13 @@ void JNL_HTTPGet::do_parse_url(char *url, char **host, int *port, char **req, ch
} }
char *JNL_HTTPGet::getallheaders() const char *JNL_HTTPGet::getallheaders()
{ // double null terminated, null delimited list { // double null terminated, null delimited list
if (m_recvheaders) return m_recvheaders; if (m_recvheaders) return m_recvheaders;
else return "\0\0"; else return "\0\0";
} }
char *JNL_HTTPGet::getheader(char *headername) char *JNL_HTTPGet::getheader(const char *headername)
{ {
char *ret=NULL; char *ret=NULL;
if (strlen(headername)<1||!m_recvheaders) return NULL; if (strlen(headername)<1||!m_recvheaders) return NULL;

View file

@ -57,17 +57,17 @@ class JNL_HTTPGet
JNL_HTTPGet(JNL_AsyncDNS *dns=JNL_CONNECTION_AUTODNS, int recvbufsize=16384, char *proxy=NULL); JNL_HTTPGet(JNL_AsyncDNS *dns=JNL_CONNECTION_AUTODNS, int recvbufsize=16384, char *proxy=NULL);
~JNL_HTTPGet(); ~JNL_HTTPGet();
void addheader(char *header); void addheader(const char *header);
void connect(char *url); void connect(const char *url);
int run(); // returns: 0 if all is OK. -1 if error (call geterrorstr()). 1 if connection closed. int run(); // returns: 0 if all is OK. -1 if error (call geterrorstr()). 1 if connection closed.
int get_status(); // returns 0 if connecting, 1 if reading headers, int get_status(); // returns 0 if connecting, 1 if reading headers,
// 2 if reading content, -1 if error. // 2 if reading content, -1 if error.
char *getallheaders(); // double null terminated, null delimited list const char *getallheaders(); // double null terminated, null delimited list
char *getheader(char *headername); char *getheader(const char *headername);
char *getreply() { return m_reply; } char *getreply() { return m_reply; }
int getreplycode(); // returns 0 if none yet, otherwise returns http reply code. int getreplycode(); // returns 0 if none yet, otherwise returns http reply code.
@ -84,7 +84,7 @@ class JNL_HTTPGet
public: public:
void reinit(); void reinit();
void deinit(); void deinit();
void seterrstr(char *str) { if (m_errstr) free(m_errstr); m_errstr=(char*)malloc(strlen(str)+1); strcpy(m_errstr,str); } void seterrstr(const char *str) { if (m_errstr) free(m_errstr); m_errstr=(char*)malloc(strlen(str)+1); strcpy(m_errstr,str); }
void do_parse_url(char *url, char **host, int *port, char **req, char **lp); void do_parse_url(char *url, char **host, int *port, char **req, char **lp);
void do_encode_mimestr(char *in, char *out); void do_encode_mimestr(char *in, char *out);

View file

@ -425,7 +425,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
// Windows 2000 and higher // Windows 2000 and higher
case EN_MSGFILTER: case EN_MSGFILTER:
#define lpnmMsg ((MSGFILTER*)lParam) #define lpnmMsg ((MSGFILTER*)lParam)
if(WM_RBUTTONUP == lpnmMsg->msg || WM_KEYUP == lpnmMsg->msg && lpnmMsg->wParam == VK_APPS){ if(WM_RBUTTONUP == lpnmMsg->msg || (WM_KEYUP == lpnmMsg->msg && lpnmMsg->wParam == VK_APPS)){
POINT pt; POINT pt;
HWND edit = GetDlgItem(g_sdata.hwnd,IDC_LOGWIN); HWND edit = GetDlgItem(g_sdata.hwnd,IDC_LOGWIN);
RECT r; RECT r;
@ -1291,7 +1291,7 @@ void SetCompressor(NCOMPRESSOR compressor)
if(g_sdata.compressor != compressor) { if(g_sdata.compressor != compressor) {
WORD command; WORD command;
TCHAR *compressor_name; LPCTSTR compressor_name;
if(compressor > COMPRESSOR_SCRIPT && compressor < COMPRESSOR_BEST) { if(compressor > COMPRESSOR_SCRIPT && compressor < COMPRESSOR_BEST) {
command = compressor_commands[(int)compressor]; command = compressor_commands[(int)compressor];

View file

@ -95,7 +95,7 @@ typedef enum {
} NCOMPRESSOR; } NCOMPRESSOR;
#ifdef MAKENSISW_CPP #ifdef MAKENSISW_CPP
TCHAR *compressor_names[] = {_T(""), const TCHAR *compressor_names[] = {_T(""),
_T("zlib"), _T("zlib"),
_T("/SOLID zlib"), _T("/SOLID zlib"),
_T("bzip2"), _T("bzip2"),
@ -103,7 +103,7 @@ TCHAR *compressor_names[] = {_T(""),
_T("lzma"), _T("lzma"),
_T("/SOLID lzma"), _T("/SOLID lzma"),
_T("Best")}; _T("Best")};
TCHAR *compressor_display_names[] = {_T("Defined in Script/Compiler Default"), const TCHAR *compressor_display_names[] = {_T("Defined in Script/Compiler Default"),
_T("ZLIB"), _T("ZLIB"),
_T("ZLIB (solid)"), _T("ZLIB (solid)"),
_T("BZIP2"), _T("BZIP2"),
@ -190,9 +190,9 @@ typedef struct NSISScriptData {
CHARRANGE textrange; CHARRANGE textrange;
NCOMPRESSOR default_compressor; NCOMPRESSOR default_compressor;
NCOMPRESSOR compressor; NCOMPRESSOR compressor;
TCHAR *compressor_name; LPCTSTR compressor_name;
TCHAR compressor_stats[512]; TCHAR compressor_stats[512];
TCHAR *best_compressor_name; LPCTSTR best_compressor_name;
// Added by Darren Owen (DrO) on 1/10/2003 // Added by Darren Owen (DrO) on 1/10/2003
int recompile_test; int recompile_test;
} NSCRIPTDATA; } NSCRIPTDATA;

View file

@ -85,7 +85,7 @@ DWORD CALLBACK UpdateThread(LPVOID v) {
int st=get->run(); int st=get->run();
if (st<0) { error = TRUE; break; }//error if (st<0) { error = TRUE; break; }//error
if (get->get_status()==2) { if (get->get_status()==2) {
while(len=get->bytes_available()) { while( (len=get->bytes_available()) ) {
char b[RSZ]; char b[RSZ];
if (len>RSZ) len=RSZ; if (len>RSZ) len=RSZ;
if (lstrlenA(response)+len>RSZ) break; if (lstrlenA(response)+len>RSZ) break;

View file

@ -1,4 +1,4 @@
/* Reviewed for Unicode support by Jim Park -- 08/18/2007 /* Reviewed for Unicode support by Jim Park -- 08/18/2007 */
/* Initialize update objects. */ /* Initialize update objects. */
void InitializeUpdate(); void InitializeUpdate();

View file

@ -39,7 +39,7 @@ LRESULT CALLBACK TipHookProc(int nCode, WPARAM wParam, LPARAM lParam);
TCHAR g_mru_list[MRU_LIST_SIZE][MAX_PATH] = { _T(""), _T(""), _T(""), _T(""), _T("") }; TCHAR g_mru_list[MRU_LIST_SIZE][MAX_PATH] = { _T(""), _T(""), _T(""), _T(""), _T("") };
extern NSCRIPTDATA g_sdata; extern NSCRIPTDATA g_sdata;
extern TCHAR *compressor_names[]; extern const TCHAR *compressor_names[];
int SetArgv(const TCHAR *cmdLine, TCHAR ***argv) int SetArgv(const TCHAR *cmdLine, TCHAR ***argv)
{ {
@ -125,7 +125,7 @@ int SetArgv(const TCHAR *cmdLine, TCHAR ***argv)
return argc; return argc;
} }
void SetTitle(HWND hwnd,TCHAR *substr) { void SetTitle(HWND hwnd,const TCHAR *substr) {
TCHAR title[64]; TCHAR title[64];
if (substr==NULL) wsprintf(title,_T("MakeNSISW")); if (substr==NULL) wsprintf(title,_T("MakeNSISW"));
else wsprintf(title,_T("MakeNSISW - %s"),substr); else wsprintf(title,_T("MakeNSISW - %s"),substr);
@ -644,13 +644,13 @@ void DestroyTooltips() {
UnhookWindowsHookEx(g_tip.hook); UnhookWindowsHookEx(g_tip.hook);
} }
void AddTip(HWND hWnd,LPTSTR lpszToolTip) { void AddTip(HWND hWnd,LPCTSTR lpszToolTip) {
TOOLINFO ti; TOOLINFO ti;
ti.cbSize = sizeof(TOOLINFO); ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_IDISHWND; ti.uFlags = TTF_IDISHWND;
ti.hwnd = g_tip.tip_p; ti.hwnd = g_tip.tip_p;
ti.uId = (UINT) hWnd; ti.uId = (UINT) hWnd;
ti.lpszText = lpszToolTip; ti.lpszText = (LPTSTR) lpszToolTip;
SendMessage(g_tip.tip, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); SendMessage(g_tip.tip, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
} }

View file

@ -31,7 +31,7 @@
#define MRU_DISPLAY_LENGTH 40 #define MRU_DISPLAY_LENGTH 40
int SetArgv(const TCHAR *cmdLine, TCHAR ***argv); int SetArgv(const TCHAR *cmdLine, TCHAR ***argv);
void SetTitle(HWND hwnd,TCHAR *substr); void SetTitle(HWND hwnd,const TCHAR *substr);
void SetBranding(HWND hwnd); void SetBranding(HWND hwnd);
void CopyToClipboard(HWND hwnd); void CopyToClipboard(HWND hwnd);
void ClearLog(HWND hwnd); void ClearLog(HWND hwnd);
@ -50,7 +50,7 @@ void ResetSymbols();
int InitBranding(); int InitBranding();
void InitTooltips(HWND h); void InitTooltips(HWND h);
void DestroyTooltips(); void DestroyTooltips();
void AddTip(HWND hWnd,LPTSTR lpszToolTip); void AddTip(HWND hWnd,LPCTSTR lpszToolTip);
void ShowDocs(); void ShowDocs();
void RestoreCompressor(); void RestoreCompressor();
void SaveCompressor(); void SaveCompressor();

View file

@ -43,7 +43,7 @@ void StringToItem(TCHAR *&s, ExpressionItem *item, int options)
if ((options & STI_INT) && *s == _T('0') && (s[1] == _T('x') || s[1] == _T('X'))) if ((options & STI_INT) && *s == _T('0') && (s[1] == _T('x') || s[1] == _T('X')))
{ {
s++; s++;
while (*(s+1) == _T('0')) *s++; while (*(s+1) == _T('0')) s++;
for (;;) for (;;)
{ {
int c=*(++s); int c=*(++s);
@ -60,7 +60,7 @@ void StringToItem(TCHAR *&s, ExpressionItem *item, int options)
{ {
int sign=0, numsignif = 0; int sign=0, numsignif = 0;
if (*s == _T('-')) sign++; else s--; if (*s == _T('-')) sign++; else s--;
while (*(s+1) == _T('0')) *s++; while (*(s+1) == _T('0')) s++;
for (;;) for (;;)
{ {
int c=*(++s) - _T('0'); numsignif++; int c=*(++s) - _T('0'); numsignif++;
@ -154,7 +154,7 @@ void ItemToString(TCHAR *sbuf, ExpressionItem *item)
case ITC_STRING: case ITC_STRING:
{ {
TCHAR *ptr = *((TCHAR**)&(item->param1)); TCHAR *ptr = *((TCHAR**)&(item->param1));
while (*(sbuf++) = *(ptr++)); while ( (*(sbuf++) = *(ptr++)) );
} }
break; break;
case ITC_ARRAY: case ITC_ARRAY:

View file

@ -84,7 +84,7 @@ class JNL_Connection
void run(int max_send_bytes=-1, int max_recv_bytes=-1, int *bytes_sent=NULL, int *bytes_rcvd=NULL); 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; } int get_state() { return m_state; }
char *get_errstr() { return m_errorstr; } const char *get_errstr() { return m_errorstr; }
void close(int quick=0); void close(int quick=0);
void flush_send(void) { m_send_len=m_send_pos=0; } void flush_send(void) { m_send_len=m_send_pos=0; }
@ -129,7 +129,7 @@ class JNL_Connection
int m_dns_owned; int m_dns_owned;
state m_state; state m_state;
char *m_errorstr; const char *m_errorstr;
int getbfromrecv(int pos, int remove); // used by recv_line* int getbfromrecv(int pos, int remove); // used by recv_line*

View file

@ -73,7 +73,7 @@ JNL_HTTPGet::~JNL_HTTPGet()
} }
void JNL_HTTPGet::addheader(char *header) void JNL_HTTPGet::addheader(const char *header)
{ {
//if (strstr(header,"\r") || strstr(header,"\n")) return; //if (strstr(header,"\r") || strstr(header,"\n")) return;
if (!m_sendheaders) if (!m_sendheaders)
@ -135,7 +135,7 @@ void JNL_HTTPGet::do_encode_mimestr(char *in, char *out)
} }
void JNL_HTTPGet::connect(char *url) void JNL_HTTPGet::connect(const char *url)
{ {
deinit(); deinit();
m_http_url=(char*)malloc(strlen(url)+1); m_http_url=(char*)malloc(strlen(url)+1);
@ -230,7 +230,7 @@ void JNL_HTTPGet::connect(char *url)
} }
static int my_strnicmp(char *b1, char *b2, int l) static int my_strnicmp(char *b1, const char *b2, int l)
{ {
while (l-- && *b1 && *b2) while (l-- && *b1 && *b2)
{ {
@ -243,13 +243,13 @@ static int my_strnicmp(char *b1, char *b2, int l)
return 0; return 0;
} }
char *_strstr(char *i, char *s) char *_strstr(char *i, const char *s)
{ {
if (strlen(i)>=strlen(s)) while (i[strlen(s)-1]) if (strlen(i)>=strlen(s)) while (i[strlen(s)-1])
{ {
int l=strlen(s)+1; int l=strlen(s)+1;
char *ii=i; char *ii=i;
char *is=s; const char *is=s;
while (--l>0) while (--l>0)
{ {
if (*ii != *is) break; if (*ii != *is) break;
@ -312,20 +312,20 @@ void JNL_HTTPGet::do_parse_url(char *url, char **host, int *port, char **req, ch
} }
char *JNL_HTTPGet::getallheaders() const char *JNL_HTTPGet::getallheaders()
{ // double null terminated, null delimited list { // double null terminated, null delimited list
if (m_recvheaders) return m_recvheaders; if (m_recvheaders) return m_recvheaders;
else return "\0\0"; else return "\0\0";
} }
char *JNL_HTTPGet::getheader(char *headername) const char *JNL_HTTPGet::getheader(const char *headername)
{ {
char *ret=NULL; char *ret=NULL;
if (strlen(headername)<1||!m_recvheaders) return NULL; if (strlen(headername)<1||!m_recvheaders) return NULL;
char *p=m_recvheaders; char *p=m_recvheaders;
while (*p) while (*p)
{ {
if (!my_strnicmp(headername,p,strlen(headername))) if (!my_strnicmp(p,headername,strlen(headername)))
{ {
ret=p+strlen(headername); ret=p+strlen(headername);
while (*ret == ' ') ret++; while (*ret == ' ') ret++;
@ -486,7 +486,7 @@ int JNL_HTTPGet::peek_bytes(char *buf, int len)
__int64 JNL_HTTPGet::content_length() __int64 JNL_HTTPGet::content_length()
{ {
char *p=getheader("content-length:"); const char *p=getheader("content-length:");
if (!p) return 0; if (!p) return 0;
__int64 cl = myatoi64(p); __int64 cl = myatoi64(p);
if (cl > 0) return cl; if (cl > 0) return cl;

View file

@ -54,21 +54,21 @@ class JNL_HTTPGet
JNL_HTTPGet(JNL_AsyncDNS *dns=JNL_CONNECTION_AUTODNS, int recvbufsize=16384, char *proxy=NULL); JNL_HTTPGet(JNL_AsyncDNS *dns=JNL_CONNECTION_AUTODNS, int recvbufsize=16384, char *proxy=NULL);
~JNL_HTTPGet(); ~JNL_HTTPGet();
void addheader(char *header); void addheader(const char *header);
void connect(char *url); void connect(const char *url);
int run(); // returns: 0 if all is OK. -1 if error (call geterrorstr()). 1 if connection closed. int run(); // returns: 0 if all is OK. -1 if error (call geterrorstr()). 1 if connection closed.
int get_status(); // returns 0 if connecting, 1 if reading headers, int get_status(); // returns 0 if connecting, 1 if reading headers,
// 2 if reading content, -1 if error. // 2 if reading content, -1 if error.
char *getallheaders(); // double null terminated, null delimited list const char *getallheaders(); // double null terminated, null delimited list
char *getheader(char *headername); const char *getheader(const char *headername);
char *getreply() { return m_reply; } char *getreply() { return m_reply; }
int getreplycode(); // returns 0 if none yet, otherwise returns http reply code. int getreplycode(); // returns 0 if none yet, otherwise returns http reply code.
char *geterrorstr() { return m_errstr;} const char *geterrorstr() { return m_errstr;}
int bytes_available(); int bytes_available();
int get_bytes(char *buf, int len); int get_bytes(char *buf, int len);
@ -81,7 +81,7 @@ class JNL_HTTPGet
public: public:
void reinit(); void reinit();
void deinit(); void deinit();
void seterrstr(char *str) { if (m_errstr) free(m_errstr); m_errstr=(char*)malloc(strlen(str)+1); strcpy(m_errstr,str); } void seterrstr(const CHAR *str) { if (m_errstr) free(m_errstr); m_errstr=(char*)malloc(strlen(str)+1); strcpy(m_errstr,str); }
void do_parse_url(char *url, char **host, int *port, char **req, char **lp); void do_parse_url(char *url, char **host, int *port, char **req, char **lp);
void do_encode_mimestr(char *in, char *out); void do_encode_mimestr(char *in, char *out);

View file

@ -216,7 +216,7 @@ int MulDiv64(int nNumber, __int64 nNumerator, __int64 nDenominator)
static __int64 g_file_size; static __int64 g_file_size;
static DWORD g_dwLastTick = 0; static DWORD g_dwLastTick = 0;
void progress_callback(char *msg, __int64 read_bytes) void progress_callback(const char *msg, __int64 read_bytes)
{ {
// flicker reduction by A. Schiffler // flicker reduction by A. Schiffler
DWORD dwLastTick = g_dwLastTick; DWORD dwLastTick = g_dwLastTick;
@ -234,7 +234,7 @@ void progress_callback(char *msg, __int64 read_bytes)
} }
} }
extern char *_strstr(char *i, char *s); extern char *_strstr(char *i, const char *s);
#define strstr _strstr #define strstr _strstr
extern "C" extern "C"
@ -255,7 +255,7 @@ __declspec(dllexport) void download (HWND parent,
int manualproxy=0; int manualproxy=0;
int translation_version; int translation_version;
char *error=NULL; const char *error=NULL;
// translation version 2 & 1 // translation version 2 & 1
static char szDownloading[1024]; // "Downloading %s" static char szDownloading[1024]; // "Downloading %s"

View file

@ -29,7 +29,7 @@ int my_atoi(char *s)
return (int)v; return (int)v;
} }
__int64 myatoi64(char *s) __int64 myatoi64(const char *s)
{ {
__int64 v=0; __int64 v=0;
int sign=0; int sign=0;

View file

@ -30,7 +30,7 @@
#define _UTIL_H_ #define _UTIL_H_
int my_atoi(char *p); int my_atoi(char *p);
__int64 myatoi64(char *s); __int64 myatoi64(const char *s);
void myitoa64(__int64 i, char *buffer); void myitoa64(__int64 i, char *buffer);
void mini_memset(void *,char,int); void mini_memset(void *,char,int);
void mini_memcpy(void *,void*,int); void mini_memcpy(void *,void*,int);

View file

@ -90,7 +90,7 @@ int main( int argc, char *argv[] )
FALSE, 0, NULL, NULL, &si, &pi ) ) FALSE, 0, NULL, NULL, &si, &pi ) )
{ {
WaitForSingleObject( pi.hProcess, INFINITE ); WaitForSingleObject( pi.hProcess, INFINITE );
GetExitCodeProcess( pi.hProcess, &err ); GetExitCodeProcess( pi.hProcess, (DWORD*) &err );
CloseHandle( pi.hProcess ); CloseHandle( pi.hProcess );
CloseHandle( pi.hThread ); CloseHandle( pi.hThread );
} }

View file

@ -62,7 +62,7 @@ int g_compressor_solid;
int g_mui; int g_mui;
int g_zipfile_size; int g_zipfile_size;
TCHAR *g_options=_T("");//_T("/V3"); const TCHAR *g_options=_T("");//_T("/V3");
static BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); static BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
@ -324,12 +324,12 @@ int tempzip_make(HWND hwndDlg, TCHAR *fn)
return 0; return 0;
} }
TCHAR *gp_winamp = _T("(WINAMP DIRECTORY)"); const TCHAR *gp_winamp = _T("(WINAMP DIRECTORY)");
TCHAR *gp_winamp_plugins = _T("(WINAMP PLUG-INS DIRECTORY)"); const TCHAR *gp_winamp_plugins = _T("(WINAMP PLUG-INS DIRECTORY)");
TCHAR *gp_winamp_vis = _T("(WINAMP VIS PLUG-INS DIRECTORY)"); const TCHAR *gp_winamp_vis = _T("(WINAMP VIS PLUG-INS DIRECTORY)");
TCHAR *gp_winamp_dsp = _T("(WINAMP DSP PLUG-INS DIRECTORY)"); const TCHAR *gp_winamp_dsp = _T("(WINAMP DSP PLUG-INS DIRECTORY)");
TCHAR *gp_winamp_skins = _T("(WINAMP SKINS DIRECTORY)"); const TCHAR *gp_winamp_skins = _T("(WINAMP SKINS DIRECTORY)");
TCHAR *gp_poi = _T("(PATH OF INSTALLER)"); const TCHAR *gp_poi = _T("(PATH OF INSTALLER)");
void wnd_printf(const TCHAR *str) void wnd_printf(const TCHAR *str)
@ -366,7 +366,7 @@ void wnd_printf(const TCHAR *str)
} }
void ErrorMessage(TCHAR *str) //display detailed error info void ErrorMessage(const TCHAR *str) //display detailed error info
{ {
LPVOID msg; LPVOID msg;
FormatMessage( FormatMessage(
@ -513,7 +513,7 @@ void makeEXE(HWND hwndDlg)
_ftprintf(fp,_T("!define ZIP2EXE_COMPRESSOR_SOLID\n")); _ftprintf(fp,_T("!define ZIP2EXE_COMPRESSOR_SOLID\n"));
GetDlgItemText(hwndDlg,IDC_INSTPATH,buf,sizeof(buf)); GetDlgItemText(hwndDlg,IDC_INSTPATH,buf,sizeof(buf));
int iswinamp=0; int iswinamp=0;
TCHAR *iswinampmode=NULL; LPCTSTR iswinampmode=NULL;
if (!_tcscmp(buf,gp_poi)) lstrcpy(buf,_T("$EXEDIR")); if (!_tcscmp(buf,gp_poi)) lstrcpy(buf,_T("$EXEDIR"));
if (!_tcscmp(buf,gp_winamp)) if (!_tcscmp(buf,gp_winamp))

View file

@ -611,10 +611,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
/* we check the magic */ /* we check the magic */
if (err==UNZ_OK) if (err==UNZ_OK)
{
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
else if (uMagic!=0x02014b50) else if (uMagic!=0x02014b50)
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
}
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK) if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
@ -691,10 +693,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
uSizeRead = extraFieldBufferSize; uSizeRead = extraFieldBufferSize;
if (lSeek!=0) if (lSeek!=0)
{
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0; lSeek=0;
else else
err=UNZ_ERRNO; err=UNZ_ERRNO;
}
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead) if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO; err=UNZ_ERRNO;
@ -716,10 +720,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
uSizeRead = commentBufferSize; uSizeRead = commentBufferSize;
if (lSeek!=0) if (lSeek!=0)
{
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0; lSeek=0;
else else
err=UNZ_ERRNO; err=UNZ_ERRNO;
}
if ((file_info.size_file_comment>0) && (commentBufferSize>0)) if ((file_info.size_file_comment>0) && (commentBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead) if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO; err=UNZ_ERRNO;
@ -980,11 +986,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
if (err==UNZ_OK) if (err==UNZ_OK)
{
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
else if (uMagic!=0x04034b50) else if (uMagic!=0x04034b50)
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
}
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
/* /*
@ -1537,7 +1544,7 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
char *szComment; char *szComment;
uLong uSizeBuf; uLong uSizeBuf;
{ {
int err=UNZ_OK; // int err=UNZ_OK;
unz_s* s; unz_s* s;
uLong uReadThis ; uLong uReadThis ;
if (file==NULL) if (file==NULL)

View file

@ -3653,7 +3653,7 @@ int CEXEBuild::set_compressor(const tstring& compressor, const bool solid) {
tstring CEXEBuild::get_stub_variant_suffix() tstring CEXEBuild::get_stub_variant_suffix()
{ {
LONG variant = 0; LONG variant = 0;
for (int index = 0; index < COUNTOF(available_stub_variants); index++) for (unsigned int index = 0; index < COUNTOF(available_stub_variants); index++)
{ {
if (target_minimal_OS >= available_stub_variants[index]) if (target_minimal_OS >= available_stub_variants[index])
variant = available_stub_variants[index]; variant = available_stub_variants[index];

View file

@ -1211,7 +1211,9 @@ int NSISCALL TreeGetSelectedSection(HWND tree, BOOL mouse)
ht.pt.y = GET_Y_LPARAM(dwpos); ht.pt.y = GET_Y_LPARAM(dwpos);
ScreenToClient(tree, &ht.pt); ScreenToClient(tree, &ht.pt);
TreeView_HitTest(tree, &ht); {
const HTREEITEM UNUSED hDummy1 = TreeView_HitTest(tree, &ht);
}
#ifdef NSIS_CONFIG_COMPONENTPAGE_ALTERNATIVE #ifdef NSIS_CONFIG_COMPONENTPAGE_ALTERNATIVE
if (!(ht.flags & TVHT_ONITEMSTATEICON)) if (!(ht.flags & TVHT_ONITEMSTATEICON))
@ -1293,7 +1295,9 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
hImageList = ImageList_Create(16,16, ILC_COLOR32|ILC_MASK, 6, 0); hImageList = ImageList_Create(16,16, ILC_COLOR32|ILC_MASK, 6, 0);
ImageList_AddMasked(hImageList,hBMcheck1,RGB(255,0,255)); ImageList_AddMasked(hImageList,hBMcheck1,RGB(255,0,255));
TreeView_SetImageList(hwndTree1, hImageList, TVSIL_STATE); {
const HIMAGELIST UNUSED hDummy1 = TreeView_SetImageList(hwndTree1, hImageList, TVSIL_STATE);
}
if (TreeView_GetItemHeight(hwndTree1) < 16) if (TreeView_GetItemHeight(hwndTree1) < 16)
TreeView_SetItemHeight(hwndTree1, 16); TreeView_SetItemHeight(hwndTree1, 16);

View file

@ -266,7 +266,7 @@ const TCHAR * NSISCALL loadHeaders(int cl_flags)
#ifndef NSIS_CONFIG_CRC_ANAL #ifndef NSIS_CONFIG_CRC_ANAL
if (left < m_length) if (left < m_length)
#endif//NSIS_CONFIG_CRC_ANAL #endif//NSIS_CONFIG_CRC_ANAL
crc = CRC32(crc, temp, l); crc = CRC32(crc, (unsigned char*)temp, l);
#endif//NSIS_CONFIG_CRC_SUPPORT #endif//NSIS_CONFIG_CRC_SUPPORT
m_pos += l; m_pos += l;
@ -350,7 +350,7 @@ const TCHAR * NSISCALL loadHeaders(int cl_flags)
#if !defined(NSIS_COMPRESS_WHOLE) || !defined(NSIS_CONFIG_COMPRESSION_SUPPORT) #if !defined(NSIS_COMPRESS_WHOLE) || !defined(NSIS_CONFIG_COMPRESSION_SUPPORT)
// Decompress data. // Decompress data.
int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen) int NSISCALL _dodecomp(int offset, HANDLE hFileOut, unsigned char *outbuf, int outbuflen)
{ {
static char inbuffer[IBUFSIZE+OBUFSIZE]; static char inbuffer[IBUFSIZE+OBUFSIZE];
char *outbuffer; char *outbuffer;
@ -358,7 +358,7 @@ int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen)
int retval=0; int retval=0;
int input_len; int input_len;
outbuffer = outbuf?outbuf:(inbuffer+IBUFSIZE); outbuffer = outbuf?(char*)outbuf:(inbuffer+IBUFSIZE);
if (offset>=0) if (offset>=0)
{ {
@ -527,7 +527,7 @@ static int NSISCALL __ensuredata(int amount)
} }
int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen) int NSISCALL _dodecomp(int offset, HANDLE hFileOut, unsigned char *outbuf, int outbuflen)
{ {
DWORD r; DWORD r;
int input_len; int input_len;

View file

@ -514,7 +514,7 @@ int NSISCALL isheader(firstheader *h); // returns 0 on not header, length_of_dat
// (or m_uninstheader) // (or m_uninstheader)
const TCHAR * NSISCALL loadHeaders(int cl_flags); const TCHAR * NSISCALL loadHeaders(int cl_flags);
int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen); int NSISCALL _dodecomp(int offset, HANDLE hFileOut, unsigned char *outbuf, int outbuflen);
#define GetCompressedDataFromDataBlock(offset, hFileOut) _dodecomp(offset,hFileOut,NULL,0) #define GetCompressedDataFromDataBlock(offset, hFileOut) _dodecomp(offset,hFileOut,NULL,0)
#define GetCompressedDataFromDataBlockToMemory(offset, out, out_len) _dodecomp(offset,NULL,out,out_len) #define GetCompressedDataFromDataBlockToMemory(offset, out, out_len) _dodecomp(offset,NULL,out,out_len)

View file

@ -61,7 +61,6 @@ void GrowBuf::resize(int newlen)
n = realloc(m_s, m_alloc); n = realloc(m_s, m_alloc);
if (!n) if (!n)
{ {
extern FILE *g_output;
extern int g_display_errors; extern int g_display_errors;
if (g_display_errors) if (g_display_errors)
{ {

View file

@ -217,7 +217,6 @@ void MMapFile::resize(int newsize)
if (m_hFileDesc == -1) if (m_hFileDesc == -1)
#endif #endif
{ {
extern FILE *g_output;
extern void quit(); extern int g_display_errors; extern void quit(); extern int g_display_errors;
if (g_display_errors) if (g_display_errors)
{ {
@ -249,7 +248,6 @@ void *MMapFile::get(int offset, int *sizep) const
if (!m_iSize || offset + size > m_iSize) if (!m_iSize || offset + size > m_iSize)
{ {
extern FILE *g_output;
extern void quit(); extern int g_display_errors; extern void quit(); extern int g_display_errors;
if (g_display_errors) if (g_display_errors)
{ {
@ -275,7 +273,6 @@ void *MMapFile::get(int offset, int *sizep) const
if (m_pView == MAP_FAILED) if (m_pView == MAP_FAILED)
#endif #endif
{ {
extern FILE *g_output;
extern void quit(); extern int g_display_errors; extern void quit(); extern int g_display_errors;
if (g_display_errors) if (g_display_errors)
{ {

View file

@ -6504,7 +6504,7 @@ int CEXEBuild::add_file(const tstring& dir, const tstring& file, int attrib, con
ent.offsets[4]=0; ent.offsets[4]=0;
ent.offsets[5]=0; ent.offsets[5]=0;
if (ent.offsets[1] != INVALID_FILE_ATTRIBUTES) if (INVALID_FILE_ATTRIBUTES != (unsigned)ent.offsets[1])
{ {
a=add_entry(&ent); a=add_entry(&ent);
if (a != PS_OK) if (a != PS_OK)

View file

@ -171,7 +171,7 @@ int StringList::idx2pos(int idx) const
{ {
TCHAR *s=(TCHAR*) m_gr.get(); TCHAR *s=(TCHAR*) m_gr.get();
int offs=0; int offs=0;
size_t cnt=0; int cnt=0;
if (idx>=0) while (offs < getcount()) if (idx>=0) while (offs < getcount())
{ {
if (cnt++ == idx) return offs; if (cnt++ == idx) return offs;
@ -228,7 +228,6 @@ int DefineList::add(const TCHAR *name, const TCHAR *value/*=_T("")*/)
if (!(*newvalue)) if (!(*newvalue))
{ {
extern FILE *g_output;
extern int g_display_errors; extern int g_display_errors;
extern void quit(); extern void quit();
if (g_display_errors) if (g_display_errors)

View file

@ -184,7 +184,6 @@ class SortedStringList
newstruct.name=(TCHAR*)malloc((_tcslen(name)+1)*sizeof(TCHAR)); newstruct.name=(TCHAR*)malloc((_tcslen(name)+1)*sizeof(TCHAR));
if (!newstruct.name) if (!newstruct.name)
{ {
extern FILE *g_output;
extern int g_display_errors; extern int g_display_errors;
extern void quit(); extern void quit();
if (g_display_errors) if (g_display_errors)