diff options
| author | Yang Tse <yangsita@gmail.com> | 2009-04-14 12:53:53 +0000 | 
|---|---|---|
| committer | Yang Tse <yangsita@gmail.com> | 2009-04-14 12:53:53 +0000 | 
| commit | c382c550e7d8ad54d2c35b0fea9d0eef09ff3a25 (patch) | |
| tree | 4a55cc0951de068e16c9e016bdb8b70fde9c6473 /lib | |
| parent | c663494c69e81f8d88ccf8dad7e4ae3ef726e9d8 (diff) | |
fix compiler warning: implicit conversion shortens 64-bit value into a 32-bit value
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/curl_addrinfo.c | 4 | ||||
| -rw-r--r-- | lib/netrc.c | 7 | ||||
| -rw-r--r-- | lib/qssl.c | 6 | ||||
| -rw-r--r-- | lib/ssluse.c | 17 | 
4 files changed, 23 insertions, 11 deletions
diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index f75145722..19f73c48c 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -259,7 +259,7 @@ Curl_he2ai(const struct hostent *he, int port)    for(i=0; (curr = he->h_addr_list[i]) != NULL; i++) { -    int ss_size; +    size_t ss_size;  #ifdef ENABLE_IPV6      if (he->h_addrtype == AF_INET6)        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! */      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 */ diff --git a/lib/netrc.c b/lib/netrc.c index 221d21506..4fefefc6e 100644 --- a/lib/netrc.c +++ b/lib/netrc.c @@ -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   * you should have received as part of this distribution. The terms @@ -144,8 +144,9 @@ int Curl_parsenetrc(const char *host,      char *tok_buf;      bool done=FALSE;      char netrcbuffer[256]; - -    while(!done && fgets(netrcbuffer, sizeof(netrcbuffer), file)) { +    int  netrcbuffsize = (int)sizeof(netrcbuffer); +     +    while(!done && fgets(netrcbuffer, netrcbuffsize, file)) {        tok=strtok_r(netrcbuffer, " \t\n", &tok_buf);        while(!done && tok) { diff --git a/lib/qssl.c b/lib/qssl.c index 2dd46c35c..bf4e5f798 100644 --- a/lib/qssl.c +++ b/lib/qssl.c @@ -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   * 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                               least 120 bytes long. */    unsigned long sslerror; +  int buffsize;    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;    if(nread < 0) { diff --git a/lib/ssluse.c b/lib/ssluse.c index 1617c8813..5d82691de 100644 --- a/lib/ssluse.c +++ b/lib/ssluse.c @@ -797,6 +797,7 @@ int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)                      to be at least 120 bytes long. */    unsigned long sslerror;    ssize_t nread; +  int buffsize;    int err;    int done = 0; @@ -809,6 +810,7 @@ int Curl_ossl_shutdown(struct connectdata *conn, int sockindex)        (void)SSL_shutdown(connssl->handle);    if(connssl->handle) { +    buffsize = (int)sizeof(buf);      while(!done) {        int what = Curl_socket_ready(conn->sock[sockindex],                               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             notify alert from the server */          nread = (ssize_t)SSL_read(conn->ssl[sockindex].handle, buf, -                                  sizeof(buf)); +                                  buffsize);          err = SSL_get_error(conn->ssl[sockindex].handle, (int)nread);          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                               bytes long. */    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) {      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                               least 120 bytes long. */    unsigned long sslerror; -  ssize_t nread = (ssize_t)SSL_read(conn->ssl[num].handle, buf, -                                    (int)buffersize); +  ssize_t nread; +  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;    if(nread < 0) {      /* failed SSL_read */  | 
