From c26ec47e907e3707bdc94f116c0fcb2ba10fdb8c Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 2 Feb 2007 17:16:06 +0000 Subject: [PATCH] compiler warning fix --- ares/ares_getnameinfo.c | 2 +- lib/hostip4.c | 6 ++++-- src/urlglob.c | 3 ++- tests/server/tftpd.c | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ares/ares_getnameinfo.c b/ares/ares_getnameinfo.c index 117c6c9a4..9c48e8f98 100644 --- a/ares/ares_getnameinfo.c +++ b/ares/ares_getnameinfo.c @@ -305,7 +305,7 @@ static char *lookup_service(unsigned short port, int flags, strcpy(tmpbuf, sep->s_name); else /* get port as a string */ - sprintf(tmpbuf, "%u", ntohs(port)); + sprintf(tmpbuf, "%u", (unsigned short)ntohs(port)); if (strlen(tmpbuf) < buflen) /* return it if buffer big enough */ strcpy(buf, tmpbuf); diff --git a/lib/hostip4.c b/lib/hostip4.c index 877baa2ca..273703de5 100644 --- a/lib/hostip4.c +++ b/lib/hostip4.c @@ -134,6 +134,10 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, *waitp = 0; /* don't wait, we act synchronously */ +#if defined(HAVE_GETHOSTBYNAME_R_3) || defined(HAVE_GETHOSTBYNAME_R_6) + int res = ERANGE; +#endif + if(1 == Curl_inet_pton(AF_INET, hostname, &in)) /* This is a dotted IP address 123.123.123.123-style */ return Curl_ip2addr(in, hostname, port); @@ -146,7 +150,6 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, */ else { int h_errnop; - int res=ERANGE; buf = (struct hostent *)calloc(CURL_HOSTENT_SIZE, 1); if(!buf) @@ -159,7 +162,6 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn, #ifdef HAVE_GETHOSTBYNAME_R_5 /* Solaris, IRIX and more */ - (void)res; /* prevent compiler warning */ h = gethostbyname_r(hostname, (struct hostent *)buf, (char *)buf + sizeof(struct hostent), diff --git a/src/urlglob.c b/src/urlglob.c index 214c5c984..4dbd2ba2c 100644 --- a/src/urlglob.c +++ b/src/urlglob.c @@ -422,7 +422,8 @@ char *glob_next_url(URLGlob *glob) } break; case UPTCharRange: - pat->content.CharRange.ptr_c += (char)(pat->content.CharRange.step); + pat->content.CharRange.ptr_c = (char)(pat->content.CharRange.step + + (int)((unsigned char)pat->content.CharRange.ptr_c)); if (pat->content.CharRange.ptr_c > pat->content.CharRange.max_c) { pat->content.CharRange.ptr_c = pat->content.CharRange.min_c; carry = TRUE; diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index 1b674a592..561f2f044 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -258,7 +258,7 @@ static void read_ahead(struct testcase *test, newline = 1; } } - *p++ = c; + *p++ = (char)c; } b->counter = (int)(p - dp->th_data); } @@ -611,7 +611,7 @@ again: for (cp = mode; *cp; cp++) if (isupper((int)*cp)) - *cp = tolower((int)*cp); + *cp = (char)tolower((int)*cp); /* store input protocol */ fprintf(test->server, "mode: %s\n", mode);