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

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

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

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

View file

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

View file

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

View file

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