fix compiler warning: implicit conversion shortens 64-bit value into a 32-bit value
This commit is contained in:
parent
c663494c69
commit
c382c550e7
@ -47,7 +47,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
|
|||||||
int status, linesize, end_at_hostname, naliases;
|
int status, linesize, end_at_hostname, naliases;
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
struct in6_addr addr6;
|
struct in6_addr addr6;
|
||||||
int addrlen = sizeof(struct in_addr);
|
size_t addrlen = sizeof(struct in_addr);
|
||||||
struct hostent *hostent = NULL;
|
struct hostent *hostent = NULL;
|
||||||
|
|
||||||
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
|
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
|
||||||
@ -162,7 +162,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
|
|||||||
hostent->h_aliases[naliases] = NULL;
|
hostent->h_aliases[naliases] = NULL;
|
||||||
|
|
||||||
hostent->h_addrtype = family;
|
hostent->h_addrtype = family;
|
||||||
hostent->h_length = addrlen;
|
hostent->h_length = (int)addrlen;
|
||||||
if (family == AF_INET)
|
if (family == AF_INET)
|
||||||
memcpy(hostent->h_addr_list[0], &addr, addrlen);
|
memcpy(hostent->h_addr_list[0], &addr, addrlen);
|
||||||
else if (family == AF_INET6)
|
else if (family == AF_INET6)
|
||||||
|
@ -145,16 +145,23 @@ static void addr_callback(void *arg, int status, int timeouts,
|
|||||||
{
|
{
|
||||||
struct addr_query *aquery = (struct addr_query *) arg;
|
struct addr_query *aquery = (struct addr_query *) arg;
|
||||||
struct hostent *host;
|
struct hostent *host;
|
||||||
|
size_t addrlen;
|
||||||
|
|
||||||
aquery->timeouts += timeouts;
|
aquery->timeouts += timeouts;
|
||||||
if (status == ARES_SUCCESS)
|
if (status == ARES_SUCCESS)
|
||||||
{
|
{
|
||||||
if (aquery->addr.family == AF_INET)
|
if (aquery->addr.family == AF_INET)
|
||||||
|
{
|
||||||
|
addrlen = sizeof(struct in_addr);
|
||||||
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV4,
|
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV4,
|
||||||
sizeof(struct in_addr), AF_INET, &host);
|
(int)addrlen, AF_INET, &host);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
addrlen = sizeof(struct in6_addr);
|
||||||
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV6,
|
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV6,
|
||||||
sizeof(struct in6_addr), AF_INET6, &host);
|
(int)addrlen, AF_INET6, &host);
|
||||||
|
}
|
||||||
end_aquery(aquery, status, host);
|
end_aquery(aquery, status, host);
|
||||||
}
|
}
|
||||||
else if (status == ARES_EDESTRUCTION)
|
else if (status == ARES_EDESTRUCTION)
|
||||||
|
@ -275,12 +275,12 @@ static int fake_hostent(const char *name, int family, ares_host_callback callbac
|
|||||||
|
|
||||||
if (family == AF_INET)
|
if (family == AF_INET)
|
||||||
{
|
{
|
||||||
hostent.h_length = sizeof(struct in_addr);
|
hostent.h_length = (int)sizeof(struct in_addr);
|
||||||
addrs[0] = (char *)∈
|
addrs[0] = (char *)∈
|
||||||
}
|
}
|
||||||
else if (family == AF_INET6)
|
else if (family == AF_INET6)
|
||||||
{
|
{
|
||||||
hostent.h_length = sizeof(struct in6_addr);
|
hostent.h_length = (int)sizeof(struct in6_addr);
|
||||||
addrs[0] = (char *)&in6;
|
addrs[0] = (char *)&in6;
|
||||||
}
|
}
|
||||||
/* Duplicate the name, to avoid a constness violation. */
|
/* Duplicate the name, to avoid a constness violation. */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
||||||
* Copyright (C) 2004-2008 by Daniel Stenberg
|
* Copyright (C) 2004-2009 by Daniel Stenberg
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this
|
* Permission to use, copy, modify, and distribute this
|
||||||
* software and its documentation for any purpose and without
|
* software and its documentation for any purpose and without
|
||||||
@ -104,7 +104,7 @@ static void end_query(ares_channel channel, struct query *query, int status,
|
|||||||
int ares__timedout(struct timeval *now,
|
int ares__timedout(struct timeval *now,
|
||||||
struct timeval *check)
|
struct timeval *check)
|
||||||
{
|
{
|
||||||
int secs = (now->tv_sec - check->tv_sec);
|
long secs = (now->tv_sec - check->tv_sec);
|
||||||
|
|
||||||
if(secs > 0)
|
if(secs > 0)
|
||||||
return 1; /* yes, timed out */
|
return 1; /* yes, timed out */
|
||||||
|
@ -259,7 +259,7 @@ Curl_he2ai(const struct hostent *he, int port)
|
|||||||
|
|
||||||
for(i=0; (curr = he->h_addr_list[i]) != NULL; i++) {
|
for(i=0; (curr = he->h_addr_list[i]) != NULL; i++) {
|
||||||
|
|
||||||
int ss_size;
|
size_t ss_size;
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
if (he->h_addrtype == AF_INET6)
|
if (he->h_addrtype == AF_INET6)
|
||||||
ss_size = sizeof (struct sockaddr_in6);
|
ss_size = sizeof (struct sockaddr_in6);
|
||||||
@ -297,7 +297,7 @@ Curl_he2ai(const struct hostent *he, int port)
|
|||||||
the type must be ignored and conn->socktype be used instead! */
|
the type must be ignored and conn->socktype be used instead! */
|
||||||
ai->ai_socktype = SOCK_STREAM;
|
ai->ai_socktype = SOCK_STREAM;
|
||||||
|
|
||||||
ai->ai_addrlen = ss_size;
|
ai->ai_addrlen = (int)ss_size;
|
||||||
|
|
||||||
/* leave the rest of the struct filled with zero */
|
/* leave the rest of the struct filled with zero */
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -144,8 +144,9 @@ int Curl_parsenetrc(const char *host,
|
|||||||
char *tok_buf;
|
char *tok_buf;
|
||||||
bool done=FALSE;
|
bool done=FALSE;
|
||||||
char netrcbuffer[256];
|
char netrcbuffer[256];
|
||||||
|
int netrcbuffsize = (int)sizeof(netrcbuffer);
|
||||||
|
|
||||||
while(!done && fgets(netrcbuffer, sizeof(netrcbuffer), file)) {
|
while(!done && fgets(netrcbuffer, netrcbuffsize, file)) {
|
||||||
tok=strtok_r(netrcbuffer, " \t\n", &tok_buf);
|
tok=strtok_r(netrcbuffer, " \t\n", &tok_buf);
|
||||||
while(!done && tok) {
|
while(!done && tok) {
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -419,9 +419,11 @@ ssize_t Curl_qsossl_recv(struct connectdata * conn, int num, char * buf,
|
|||||||
char error_buffer[120]; /* OpenSSL documents that this must be at
|
char error_buffer[120]; /* OpenSSL documents that this must be at
|
||||||
least 120 bytes long. */
|
least 120 bytes long. */
|
||||||
unsigned long sslerror;
|
unsigned long sslerror;
|
||||||
|
int buffsize;
|
||||||
int nread;
|
int nread;
|
||||||
|
|
||||||
nread = SSL_Read(conn->ssl[num].handle, buf, (int) buffersize);
|
buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize;
|
||||||
|
nread = SSL_Read(conn->ssl[num].handle, buf, buffsize);
|
||||||
*wouldblock = FALSE;
|
*wouldblock = FALSE;
|
||||||
|
|
||||||
if(nread < 0) {
|
if(nread < 0) {
|
||||||
|
17
lib/ssluse.c
17
lib/ssluse.c
@ -797,6 +797,7 @@ int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)
|
|||||||
to be at least 120 bytes long. */
|
to be at least 120 bytes long. */
|
||||||
unsigned long sslerror;
|
unsigned long sslerror;
|
||||||
ssize_t nread;
|
ssize_t nread;
|
||||||
|
int buffsize;
|
||||||
int err;
|
int err;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
|
||||||
@ -809,6 +810,7 @@ int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)
|
|||||||
(void)SSL_shutdown(connssl->handle);
|
(void)SSL_shutdown(connssl->handle);
|
||||||
|
|
||||||
if(connssl->handle) {
|
if(connssl->handle) {
|
||||||
|
buffsize = (int)sizeof(buf);
|
||||||
while(!done) {
|
while(!done) {
|
||||||
int what = Curl_socket_ready(conn->sock[sockindex],
|
int what = Curl_socket_ready(conn->sock[sockindex],
|
||||||
CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT);
|
CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT);
|
||||||
@ -816,7 +818,7 @@ int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)
|
|||||||
/* Something to read, let's do it and hope that it is the close
|
/* Something to read, let's do it and hope that it is the close
|
||||||
notify alert from the server */
|
notify alert from the server */
|
||||||
nread = (ssize_t)SSL_read(conn->ssl[sockindex].handle, buf,
|
nread = (ssize_t)SSL_read(conn->ssl[sockindex].handle, buf,
|
||||||
sizeof(buf));
|
buffsize);
|
||||||
err = SSL_get_error(conn->ssl[sockindex].handle, (int)nread);
|
err = SSL_get_error(conn->ssl[sockindex].handle, (int)nread);
|
||||||
|
|
||||||
switch(err) {
|
switch(err) {
|
||||||
@ -2374,7 +2376,11 @@ ssize_t Curl_ossl_send(struct connectdata *conn,
|
|||||||
char error_buffer[120]; /* OpenSSL documents that this must be at least 120
|
char error_buffer[120]; /* OpenSSL documents that this must be at least 120
|
||||||
bytes long. */
|
bytes long. */
|
||||||
unsigned long sslerror;
|
unsigned long sslerror;
|
||||||
int rc = SSL_write(conn->ssl[sockindex].handle, mem, (int)len);
|
int memlen;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
memlen = (len > (size_t)INT_MAX) ? INT_MAX : (int)len;
|
||||||
|
rc = SSL_write(conn->ssl[sockindex].handle, mem, memlen);
|
||||||
|
|
||||||
if(rc < 0) {
|
if(rc < 0) {
|
||||||
err = SSL_get_error(conn->ssl[sockindex].handle, rc);
|
err = SSL_get_error(conn->ssl[sockindex].handle, rc);
|
||||||
@ -2419,8 +2425,11 @@ ssize_t Curl_ossl_recv(struct connectdata *conn, /* connection data */
|
|||||||
char error_buffer[120]; /* OpenSSL documents that this must be at
|
char error_buffer[120]; /* OpenSSL documents that this must be at
|
||||||
least 120 bytes long. */
|
least 120 bytes long. */
|
||||||
unsigned long sslerror;
|
unsigned long sslerror;
|
||||||
ssize_t nread = (ssize_t)SSL_read(conn->ssl[num].handle, buf,
|
ssize_t nread;
|
||||||
(int)buffersize);
|
int buffsize;
|
||||||
|
|
||||||
|
buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize;
|
||||||
|
nread = (ssize_t)SSL_read(conn->ssl[num].handle, buf, buffsize);
|
||||||
*wouldblock = FALSE;
|
*wouldblock = FALSE;
|
||||||
if(nread < 0) {
|
if(nread < 0) {
|
||||||
/* failed SSL_read */
|
/* failed SSL_read */
|
||||||
|
@ -22,7 +22,8 @@ int test(char *URL)
|
|||||||
0x1d, 0x57, 0xe1};
|
0x1d, 0x57, 0xe1};
|
||||||
|
|
||||||
CURL* easy = curl_easy_init();
|
CURL* easy = curl_easy_init();
|
||||||
char* s = curl_easy_escape(easy, (char*)a, sizeof(a));
|
int asize = (int)sizeof(a);
|
||||||
|
char* s = curl_easy_escape(easy, (char*)a, asize);
|
||||||
(void)URL;
|
(void)URL;
|
||||||
|
|
||||||
printf("%s\n", s);
|
printf("%s\n", s);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user