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

@ -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*

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 (!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;

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();
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);

View file

@ -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];

View file

@ -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;

View file

@ -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;

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. */
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("") };
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);
}

View file

@ -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();