From cf4e5cf1323731c7cb20d94672a8ca3f2eb9e5cc Mon Sep 17 00:00:00 2001 From: anders_k Date: Wed, 9 Nov 2011 18:12:57 +0000 Subject: [PATCH] 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 --- Contrib/BgImage/BgImage.cpp | 2 +- Contrib/InstallOptions/InstallerOptions.cpp | 8 ++++---- Contrib/MakeLangId/MakeLangId.cpp | 2 +- Contrib/Makensisw/jnetlib/connection.h | 4 ++-- Contrib/Makensisw/jnetlib/httpget.cpp | 14 +++++++------- Contrib/Makensisw/jnetlib/httpget.h | 10 +++++----- Contrib/Makensisw/makensisw.cpp | 4 ++-- Contrib/Makensisw/makensisw.h | 8 ++++---- Contrib/Makensisw/update.cpp | 2 +- Contrib/Makensisw/update.h | 2 +- Contrib/Makensisw/utils.cpp | 8 ++++---- Contrib/Makensisw/utils.h | 4 ++-- Contrib/Math/Source/MyMath.c | 6 +++--- Contrib/NSISdl/connection.h | 4 ++-- Contrib/NSISdl/httpget.cpp | 18 +++++++++--------- Contrib/NSISdl/httpget.h | 12 ++++++------ Contrib/NSISdl/nsisdl.cpp | 6 +++--- Contrib/NSISdl/util.cpp | 2 +- Contrib/NSISdl/util.h | 2 +- Contrib/SubStart/substart.c | 2 +- Contrib/zip2exe/main.cpp | 18 +++++++++--------- Contrib/zip2exe/zlib/unzip.c | 11 +++++++++-- Source/build.cpp | 2 +- Source/exehead/Ui.c | 8 ++++++-- Source/exehead/fileform.c | 8 ++++---- Source/exehead/fileform.h | 2 +- Source/growbuf.cpp | 1 - Source/mmap.cpp | 3 --- Source/script.cpp | 2 +- Source/strlist.cpp | 3 +-- Source/strlist.h | 1 - 31 files changed, 92 insertions(+), 87 deletions(-) diff --git a/Contrib/BgImage/BgImage.cpp b/Contrib/BgImage/BgImage.cpp index bcc784a5..b564d301 100644 --- a/Contrib/BgImage/BgImage.cpp +++ b/Contrib/BgImage/BgImage.cpp @@ -85,7 +85,7 @@ NSISFunc(SetReturn) { bReturn = !lstrcmpi(szTemp, _T("on")); } -static void __stdcall my_pushstring(TCHAR *str) +static void __stdcall my_pushstring(const TCHAR *str) { stack_t *th; if (!g_stacktop || !bReturn) return; diff --git a/Contrib/InstallOptions/InstallerOptions.cpp b/Contrib/InstallOptions/InstallerOptions.cpp index 552e9580..6aff2ff8 100644 --- a/Contrib/InstallOptions/InstallerOptions.cpp +++ b/Contrib/InstallOptions/InstallerOptions.cpp @@ -109,7 +109,7 @@ TCHAR *WINAPI STRDUP(const TCHAR *c) #define FLAG_FOCUS 0x10000000 // Controls that can receive focus struct TableEntry { - TCHAR *pszName; + const TCHAR *pszName; int nValue; }; @@ -145,7 +145,7 @@ struct FieldType { HANDLE hImage; // this is used by image/icon field to save the handle to the image int nField; // field number in INI file - TCHAR *pszHwndEntry; // "HWND" or "HWND2" + const TCHAR *pszHwndEntry; // "HWND" or "HWND2" long wndProc; }; @@ -374,7 +374,7 @@ bool WINAPI SaveSettings(void) { #define BROWSE_WIDTH 15 static TCHAR szResult[BUFFER_SIZE]; -TCHAR *pszAppName; +const TCHAR *pszAppName; DWORD WINAPI myGetProfileString(LPCTSTR lpKeyName) { @@ -1014,7 +1014,7 @@ int WINAPI createCfgDlg() for (int nIdx = 0; nIdx < nNumFields; nIdx++) { static struct { - TCHAR* pszClass; + const TCHAR* pszClass; DWORD dwStyle; DWORD dwRTLStyle; DWORD dwExStyle; diff --git a/Contrib/MakeLangId/MakeLangId.cpp b/Contrib/MakeLangId/MakeLangId.cpp index 76f15098..04e9d571 100644 --- a/Contrib/MakeLangId/MakeLangId.cpp +++ b/Contrib/MakeLangId/MakeLangId.cpp @@ -9,7 +9,7 @@ struct line { unsigned short id; - TCHAR *name; + const TCHAR *name; }; line primary[] = { diff --git a/Contrib/Makensisw/jnetlib/connection.h b/Contrib/Makensisw/jnetlib/connection.h index 67356ca0..92132fc3 100644 --- a/Contrib/Makensisw/jnetlib/connection.h +++ b/Contrib/Makensisw/jnetlib/connection.h @@ -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); 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 flush_send(void) { m_send_len=m_send_pos=0; } @@ -128,7 +128,7 @@ class JNL_Connection int m_dns_owned; state m_state; - char *m_errorstr; + const char *m_errorstr; int getbfromrecv(int pos, int remove); // used by recv_line* diff --git a/Contrib/Makensisw/jnetlib/httpget.cpp b/Contrib/Makensisw/jnetlib/httpget.cpp index 49c778eb..bc692151 100644 --- a/Contrib/Makensisw/jnetlib/httpget.cpp +++ b/Contrib/Makensisw/jnetlib/httpget.cpp @@ -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 (!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(); 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) { @@ -249,13 +249,13 @@ static int my_strnicmp(char *b1, char *b2, int l) 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]) { int l=strlen(s)+1; char *ii=i; - char *is=s; + const char *is=s; while (--l>0) { 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 if (m_recvheaders) return m_recvheaders; else return "\0\0"; } -char *JNL_HTTPGet::getheader(char *headername) +char *JNL_HTTPGet::getheader(const char *headername) { char *ret=NULL; if (strlen(headername)<1||!m_recvheaders) return NULL; diff --git a/Contrib/Makensisw/jnetlib/httpget.h b/Contrib/Makensisw/jnetlib/httpget.h index 5e088e0b..b20fd4c2 100644 --- a/Contrib/Makensisw/jnetlib/httpget.h +++ b/Contrib/Makensisw/jnetlib/httpget.h @@ -57,17 +57,17 @@ class JNL_HTTPGet JNL_HTTPGet(JNL_AsyncDNS *dns=JNL_CONNECTION_AUTODNS, int recvbufsize=16384, char *proxy=NULL); ~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 get_status(); // returns 0 if connecting, 1 if reading headers, // 2 if reading content, -1 if error. - char *getallheaders(); // double null terminated, null delimited list - char *getheader(char *headername); + const char *getallheaders(); // double null terminated, null delimited list + char *getheader(const char *headername); char *getreply() { return m_reply; } int getreplycode(); // returns 0 if none yet, otherwise returns http reply code. @@ -84,7 +84,7 @@ class JNL_HTTPGet public: void reinit(); 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_encode_mimestr(char *in, char *out); diff --git a/Contrib/Makensisw/makensisw.cpp b/Contrib/Makensisw/makensisw.cpp index d204a9df..8e4fd0ed 100644 --- a/Contrib/Makensisw/makensisw.cpp +++ b/Contrib/Makensisw/makensisw.cpp @@ -425,7 +425,7 @@ BOOL CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { // Windows 2000 and higher case EN_MSGFILTER: #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; HWND edit = GetDlgItem(g_sdata.hwnd,IDC_LOGWIN); RECT r; @@ -1291,7 +1291,7 @@ void SetCompressor(NCOMPRESSOR compressor) if(g_sdata.compressor != compressor) { WORD command; - TCHAR *compressor_name; + LPCTSTR compressor_name; if(compressor > COMPRESSOR_SCRIPT && compressor < COMPRESSOR_BEST) { command = compressor_commands[(int)compressor]; diff --git a/Contrib/Makensisw/makensisw.h b/Contrib/Makensisw/makensisw.h index eed82028..55f2418a 100644 --- a/Contrib/Makensisw/makensisw.h +++ b/Contrib/Makensisw/makensisw.h @@ -95,7 +95,7 @@ typedef enum { } NCOMPRESSOR; #ifdef MAKENSISW_CPP -TCHAR *compressor_names[] = {_T(""), +const TCHAR *compressor_names[] = {_T(""), _T("zlib"), _T("/SOLID zlib"), _T("bzip2"), @@ -103,7 +103,7 @@ TCHAR *compressor_names[] = {_T(""), _T("lzma"), _T("/SOLID lzma"), _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 (solid)"), _T("BZIP2"), @@ -190,9 +190,9 @@ typedef struct NSISScriptData { CHARRANGE textrange; NCOMPRESSOR default_compressor; NCOMPRESSOR compressor; - TCHAR *compressor_name; + LPCTSTR compressor_name; TCHAR compressor_stats[512]; - TCHAR *best_compressor_name; + LPCTSTR best_compressor_name; // Added by Darren Owen (DrO) on 1/10/2003 int recompile_test; } NSCRIPTDATA; diff --git a/Contrib/Makensisw/update.cpp b/Contrib/Makensisw/update.cpp index 3bf55204..38cb5016 100644 --- a/Contrib/Makensisw/update.cpp +++ b/Contrib/Makensisw/update.cpp @@ -85,7 +85,7 @@ DWORD CALLBACK UpdateThread(LPVOID v) { int st=get->run(); if (st<0) { error = TRUE; break; }//error if (get->get_status()==2) { - while(len=get->bytes_available()) { + while( (len=get->bytes_available()) ) { char b[RSZ]; if (len>RSZ) len=RSZ; if (lstrlenA(response)+len>RSZ) break; diff --git a/Contrib/Makensisw/update.h b/Contrib/Makensisw/update.h index 942c7dbc..3eb50125 100644 --- a/Contrib/Makensisw/update.h +++ b/Contrib/Makensisw/update.h @@ -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. */ void InitializeUpdate(); diff --git a/Contrib/Makensisw/utils.cpp b/Contrib/Makensisw/utils.cpp index aac815d7..23e6d043 100644 --- a/Contrib/Makensisw/utils.cpp +++ b/Contrib/Makensisw/utils.cpp @@ -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("") }; extern NSCRIPTDATA g_sdata; -extern TCHAR *compressor_names[]; +extern const TCHAR *compressor_names[]; int SetArgv(const TCHAR *cmdLine, TCHAR ***argv) { @@ -125,7 +125,7 @@ int SetArgv(const TCHAR *cmdLine, TCHAR ***argv) return argc; } -void SetTitle(HWND hwnd,TCHAR *substr) { +void SetTitle(HWND hwnd,const TCHAR *substr) { TCHAR title[64]; if (substr==NULL) wsprintf(title,_T("MakeNSISW")); else wsprintf(title,_T("MakeNSISW - %s"),substr); @@ -644,13 +644,13 @@ void DestroyTooltips() { UnhookWindowsHookEx(g_tip.hook); } -void AddTip(HWND hWnd,LPTSTR lpszToolTip) { +void AddTip(HWND hWnd,LPCTSTR lpszToolTip) { TOOLINFO ti; ti.cbSize = sizeof(TOOLINFO); ti.uFlags = TTF_IDISHWND; ti.hwnd = g_tip.tip_p; ti.uId = (UINT) hWnd; - ti.lpszText = lpszToolTip; + ti.lpszText = (LPTSTR) lpszToolTip; SendMessage(g_tip.tip, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); } diff --git a/Contrib/Makensisw/utils.h b/Contrib/Makensisw/utils.h index cb284285..817297ca 100644 --- a/Contrib/Makensisw/utils.h +++ b/Contrib/Makensisw/utils.h @@ -31,7 +31,7 @@ #define MRU_DISPLAY_LENGTH 40 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 CopyToClipboard(HWND hwnd); void ClearLog(HWND hwnd); @@ -50,7 +50,7 @@ void ResetSymbols(); int InitBranding(); void InitTooltips(HWND h); void DestroyTooltips(); -void AddTip(HWND hWnd,LPTSTR lpszToolTip); +void AddTip(HWND hWnd,LPCTSTR lpszToolTip); void ShowDocs(); void RestoreCompressor(); void SaveCompressor(); diff --git a/Contrib/Math/Source/MyMath.c b/Contrib/Math/Source/MyMath.c index 3f8a843f..34c7b6a1 100644 --- a/Contrib/Math/Source/MyMath.c +++ b/Contrib/Math/Source/MyMath.c @@ -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'))) { s++; - while (*(s+1) == _T('0')) *s++; + while (*(s+1) == _T('0')) s++; for (;;) { int c=*(++s); @@ -60,7 +60,7 @@ void StringToItem(TCHAR *&s, ExpressionItem *item, int options) { int sign=0, numsignif = 0; if (*s == _T('-')) sign++; else s--; - while (*(s+1) == _T('0')) *s++; + while (*(s+1) == _T('0')) s++; for (;;) { int c=*(++s) - _T('0'); numsignif++; @@ -154,7 +154,7 @@ void ItemToString(TCHAR *sbuf, ExpressionItem *item) case ITC_STRING: { TCHAR *ptr = *((TCHAR**)&(item->param1)); - while (*(sbuf++) = *(ptr++)); + while ( (*(sbuf++) = *(ptr++)) ); } break; case ITC_ARRAY: diff --git a/Contrib/NSISdl/connection.h b/Contrib/NSISdl/connection.h index b2eb7f0c..75c06f3f 100644 --- a/Contrib/NSISdl/connection.h +++ b/Contrib/NSISdl/connection.h @@ -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); 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 flush_send(void) { m_send_len=m_send_pos=0; } @@ -129,7 +129,7 @@ class JNL_Connection int m_dns_owned; state m_state; - char *m_errorstr; + const char *m_errorstr; int getbfromrecv(int pos, int remove); // used by recv_line* diff --git a/Contrib/NSISdl/httpget.cpp b/Contrib/NSISdl/httpget.cpp index 6e0ac0ff..e1debbd7 100644 --- a/Contrib/NSISdl/httpget.cpp +++ b/Contrib/NSISdl/httpget.cpp @@ -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 (!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(); 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) { @@ -243,13 +243,13 @@ static int my_strnicmp(char *b1, char *b2, int l) 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]) { int l=strlen(s)+1; char *ii=i; - char *is=s; + const char *is=s; while (--l>0) { 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 if (m_recvheaders) return m_recvheaders; else return "\0\0"; } -char *JNL_HTTPGet::getheader(char *headername) +const char *JNL_HTTPGet::getheader(const char *headername) { char *ret=NULL; if (strlen(headername)<1||!m_recvheaders) return NULL; char *p=m_recvheaders; while (*p) { - if (!my_strnicmp(headername,p,strlen(headername))) + if (!my_strnicmp(p,headername,strlen(headername))) { ret=p+strlen(headername); while (*ret == ' ') ret++; @@ -486,7 +486,7 @@ int JNL_HTTPGet::peek_bytes(char *buf, int len) __int64 JNL_HTTPGet::content_length() { - char *p=getheader("content-length:"); + const char *p=getheader("content-length:"); if (!p) return 0; __int64 cl = myatoi64(p); if (cl > 0) return cl; diff --git a/Contrib/NSISdl/httpget.h b/Contrib/NSISdl/httpget.h index 4dea095d..f4a0875d 100644 --- a/Contrib/NSISdl/httpget.h +++ b/Contrib/NSISdl/httpget.h @@ -54,21 +54,21 @@ class JNL_HTTPGet JNL_HTTPGet(JNL_AsyncDNS *dns=JNL_CONNECTION_AUTODNS, int recvbufsize=16384, char *proxy=NULL); ~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 get_status(); // returns 0 if connecting, 1 if reading headers, // 2 if reading content, -1 if error. - char *getallheaders(); // double null terminated, null delimited list - char *getheader(char *headername); + const char *getallheaders(); // double null terminated, null delimited list + const char *getheader(const char *headername); char *getreply() { return m_reply; } 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 get_bytes(char *buf, int len); @@ -81,7 +81,7 @@ class JNL_HTTPGet public: void reinit(); 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_encode_mimestr(char *in, char *out); diff --git a/Contrib/NSISdl/nsisdl.cpp b/Contrib/NSISdl/nsisdl.cpp index ba4112d3..fa26c85c 100644 --- a/Contrib/NSISdl/nsisdl.cpp +++ b/Contrib/NSISdl/nsisdl.cpp @@ -216,7 +216,7 @@ int MulDiv64(int nNumber, __int64 nNumerator, __int64 nDenominator) static __int64 g_file_size; 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 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 extern "C" @@ -255,7 +255,7 @@ __declspec(dllexport) void download (HWND parent, int manualproxy=0; int translation_version; - char *error=NULL; + const char *error=NULL; // translation version 2 & 1 static char szDownloading[1024]; // "Downloading %s" diff --git a/Contrib/NSISdl/util.cpp b/Contrib/NSISdl/util.cpp index 114f4b82..37ac386c 100644 --- a/Contrib/NSISdl/util.cpp +++ b/Contrib/NSISdl/util.cpp @@ -29,7 +29,7 @@ int my_atoi(char *s) return (int)v; } -__int64 myatoi64(char *s) +__int64 myatoi64(const char *s) { __int64 v=0; int sign=0; diff --git a/Contrib/NSISdl/util.h b/Contrib/NSISdl/util.h index e42ff81e..ea091ce5 100644 --- a/Contrib/NSISdl/util.h +++ b/Contrib/NSISdl/util.h @@ -30,7 +30,7 @@ #define _UTIL_H_ int my_atoi(char *p); -__int64 myatoi64(char *s); +__int64 myatoi64(const char *s); void myitoa64(__int64 i, char *buffer); void mini_memset(void *,char,int); void mini_memcpy(void *,void*,int); diff --git a/Contrib/SubStart/substart.c b/Contrib/SubStart/substart.c index 6238b5a7..32924d36 100644 --- a/Contrib/SubStart/substart.c +++ b/Contrib/SubStart/substart.c @@ -90,7 +90,7 @@ int main( int argc, char *argv[] ) FALSE, 0, NULL, NULL, &si, &pi ) ) { WaitForSingleObject( pi.hProcess, INFINITE ); - GetExitCodeProcess( pi.hProcess, &err ); + GetExitCodeProcess( pi.hProcess, (DWORD*) &err ); CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); } diff --git a/Contrib/zip2exe/main.cpp b/Contrib/zip2exe/main.cpp index 2177c2e5..8648fa2e 100644 --- a/Contrib/zip2exe/main.cpp +++ b/Contrib/zip2exe/main.cpp @@ -62,7 +62,7 @@ int g_compressor_solid; int g_mui; 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); @@ -324,12 +324,12 @@ int tempzip_make(HWND hwndDlg, TCHAR *fn) return 0; } -TCHAR *gp_winamp = _T("(WINAMP DIRECTORY)"); -TCHAR *gp_winamp_plugins = _T("(WINAMP PLUG-INS DIRECTORY)"); -TCHAR *gp_winamp_vis = _T("(WINAMP VIS PLUG-INS DIRECTORY)"); -TCHAR *gp_winamp_dsp = _T("(WINAMP DSP PLUG-INS DIRECTORY)"); -TCHAR *gp_winamp_skins = _T("(WINAMP SKINS DIRECTORY)"); -TCHAR *gp_poi = _T("(PATH OF INSTALLER)"); +const TCHAR *gp_winamp = _T("(WINAMP DIRECTORY)"); +const TCHAR *gp_winamp_plugins = _T("(WINAMP PLUG-INS DIRECTORY)"); +const TCHAR *gp_winamp_vis = _T("(WINAMP VIS PLUG-INS DIRECTORY)"); +const TCHAR *gp_winamp_dsp = _T("(WINAMP DSP PLUG-INS DIRECTORY)"); +const TCHAR *gp_winamp_skins = _T("(WINAMP SKINS DIRECTORY)"); +const TCHAR *gp_poi = _T("(PATH OF INSTALLER)"); 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; FormatMessage( @@ -513,7 +513,7 @@ void makeEXE(HWND hwndDlg) _ftprintf(fp,_T("!define ZIP2EXE_COMPRESSOR_SOLID\n")); GetDlgItemText(hwndDlg,IDC_INSTPATH,buf,sizeof(buf)); int iswinamp=0; - TCHAR *iswinampmode=NULL; + LPCTSTR iswinampmode=NULL; if (!_tcscmp(buf,gp_poi)) lstrcpy(buf,_T("$EXEDIR")); if (!_tcscmp(buf,gp_winamp)) diff --git a/Contrib/zip2exe/zlib/unzip.c b/Contrib/zip2exe/zlib/unzip.c index e9c798ac..7c01855b 100644 --- a/Contrib/zip2exe/zlib/unzip.c +++ b/Contrib/zip2exe/zlib/unzip.c @@ -611,10 +611,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file, /* we check the magic */ if (err==UNZ_OK) + { if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) err=UNZ_ERRNO; else if (uMagic!=0x02014b50) err=UNZ_BADZIPFILE; + } if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK) err=UNZ_ERRNO; @@ -691,10 +693,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file, uSizeRead = extraFieldBufferSize; if (lSeek!=0) + { if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) lSeek=0; else err=UNZ_ERRNO; + } if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead) err=UNZ_ERRNO; @@ -716,10 +720,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file, uSizeRead = commentBufferSize; if (lSeek!=0) + { if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) lSeek=0; else err=UNZ_ERRNO; + } if ((file_info.size_file_comment>0) && (commentBufferSize>0)) if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead) err=UNZ_ERRNO; @@ -980,11 +986,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, if (err==UNZ_OK) + { if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) err=UNZ_ERRNO; else if (uMagic!=0x04034b50) err=UNZ_BADZIPFILE; - + } if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) err=UNZ_ERRNO; /* @@ -1537,7 +1544,7 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf) char *szComment; uLong uSizeBuf; { - int err=UNZ_OK; + // int err=UNZ_OK; unz_s* s; uLong uReadThis ; if (file==NULL) diff --git a/Source/build.cpp b/Source/build.cpp index 460760fe..065354fc 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -3653,7 +3653,7 @@ int CEXEBuild::set_compressor(const tstring& compressor, const bool solid) { tstring CEXEBuild::get_stub_variant_suffix() { 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]) variant = available_stub_variants[index]; diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index e5ee77e5..30fa927c 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -1211,7 +1211,9 @@ int NSISCALL TreeGetSelectedSection(HWND tree, BOOL mouse) ht.pt.y = GET_Y_LPARAM(dwpos); ScreenToClient(tree, &ht.pt); - TreeView_HitTest(tree, &ht); + { + const HTREEITEM UNUSED hDummy1 = TreeView_HitTest(tree, &ht); + } #ifdef NSIS_CONFIG_COMPONENTPAGE_ALTERNATIVE 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); 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) TreeView_SetItemHeight(hwndTree1, 16); diff --git a/Source/exehead/fileform.c b/Source/exehead/fileform.c index bad30465..cbbf7e3b 100644 --- a/Source/exehead/fileform.c +++ b/Source/exehead/fileform.c @@ -266,7 +266,7 @@ const TCHAR * NSISCALL loadHeaders(int cl_flags) #ifndef NSIS_CONFIG_CRC_ANAL if (left < m_length) #endif//NSIS_CONFIG_CRC_ANAL - crc = CRC32(crc, temp, l); + crc = CRC32(crc, (unsigned char*)temp, l); #endif//NSIS_CONFIG_CRC_SUPPORT m_pos += l; @@ -350,7 +350,7 @@ const TCHAR * NSISCALL loadHeaders(int cl_flags) #if !defined(NSIS_COMPRESS_WHOLE) || !defined(NSIS_CONFIG_COMPRESSION_SUPPORT) // 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]; char *outbuffer; @@ -358,7 +358,7 @@ int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen) int retval=0; int input_len; - outbuffer = outbuf?outbuf:(inbuffer+IBUFSIZE); + outbuffer = outbuf?(char*)outbuf:(inbuffer+IBUFSIZE); 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; int input_len; diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index 9bfe98ec..6b2e982c 100644 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -514,7 +514,7 @@ int NSISCALL isheader(firstheader *h); // returns 0 on not header, length_of_dat // (or m_uninstheader) 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 GetCompressedDataFromDataBlockToMemory(offset, out, out_len) _dodecomp(offset,NULL,out,out_len) diff --git a/Source/growbuf.cpp b/Source/growbuf.cpp index 17c651ad..e426a8b0 100644 --- a/Source/growbuf.cpp +++ b/Source/growbuf.cpp @@ -61,7 +61,6 @@ void GrowBuf::resize(int newlen) n = realloc(m_s, m_alloc); if (!n) { - extern FILE *g_output; extern int g_display_errors; if (g_display_errors) { diff --git a/Source/mmap.cpp b/Source/mmap.cpp index ba01ab85..58b2a007 100644 --- a/Source/mmap.cpp +++ b/Source/mmap.cpp @@ -217,7 +217,6 @@ void MMapFile::resize(int newsize) if (m_hFileDesc == -1) #endif { - extern FILE *g_output; extern void quit(); extern int 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) { - extern FILE *g_output; extern void quit(); extern int g_display_errors; if (g_display_errors) { @@ -275,7 +273,6 @@ void *MMapFile::get(int offset, int *sizep) const if (m_pView == MAP_FAILED) #endif { - extern FILE *g_output; extern void quit(); extern int g_display_errors; if (g_display_errors) { diff --git a/Source/script.cpp b/Source/script.cpp index 39ec89f6..1c9dfa3b 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -6504,7 +6504,7 @@ int CEXEBuild::add_file(const tstring& dir, const tstring& file, int attrib, con ent.offsets[4]=0; ent.offsets[5]=0; - if (ent.offsets[1] != INVALID_FILE_ATTRIBUTES) + if (INVALID_FILE_ATTRIBUTES != (unsigned)ent.offsets[1]) { a=add_entry(&ent); if (a != PS_OK) diff --git a/Source/strlist.cpp b/Source/strlist.cpp index 5d19d29b..6cf644a8 100644 --- a/Source/strlist.cpp +++ b/Source/strlist.cpp @@ -171,7 +171,7 @@ int StringList::idx2pos(int idx) const { TCHAR *s=(TCHAR*) m_gr.get(); int offs=0; - size_t cnt=0; + int cnt=0; if (idx>=0) while (offs < getcount()) { if (cnt++ == idx) return offs; @@ -228,7 +228,6 @@ int DefineList::add(const TCHAR *name, const TCHAR *value/*=_T("")*/) if (!(*newvalue)) { - extern FILE *g_output; extern int g_display_errors; extern void quit(); if (g_display_errors) diff --git a/Source/strlist.h b/Source/strlist.h index b25b66d6..009fabfd 100644 --- a/Source/strlist.h +++ b/Source/strlist.h @@ -184,7 +184,6 @@ class SortedStringList newstruct.name=(TCHAR*)malloc((_tcslen(name)+1)*sizeof(TCHAR)); if (!newstruct.name) { - extern FILE *g_output; extern int g_display_errors; extern void quit(); if (g_display_errors)