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