cURL / Mailing Lists / curl-library / Single Mail

curl-library

[libcurl 2/2] Fix build warnings.

From: Ben Greear <greearb_at_candelatech.com>
Date: Thu, 20 May 2010 11:15:52 -0700

Signed-off-by: Ben Greear <greearb_at_candelatech.com>

---
:100644 100644 8fa224b... f593976... M	lib/hmac.c
:100644 100644 01b2142... a00fefa... M	lib/hostares.c
:100644 100644 534ab49... 8c7b67a... M	lib/smtp.c
 lib/hmac.c     |    2 +-
 lib/hostares.c |    2 +-
 lib/smtp.c     |   29 +++++++++++++++--------------
 3 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/lib/hmac.c b/lib/hmac.c
index 8fa224b..f593976 100644
--- a/lib/hmac.c
+++ b/lib/hmac.c
@@ -46,7 +46,7 @@ Curl_HMAC_init(const HMAC_params * hashparams,
                const unsigned char * key,
                unsigned int keylen)
 {
-  unsigned int i;
+  size_t i;
   HMAC_context * ctxt;
   unsigned char * hkey;
   unsigned char b;
diff --git a/lib/hostares.c b/lib/hostares.c
index 01b2142..a00fefa 100644
--- a/lib/hostares.c
+++ b/lib/hostares.c
@@ -251,7 +251,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
        second is left, otherwise just use 1000ms to make sure the progress
        callback gets called frequent enough */
     if(!tvp->tv_sec)
-      timeout_ms = tvp->tv_usec/1000;
+      timeout_ms = (int)(tvp->tv_usec/1000);
     else
       timeout_ms = 1000;
 
diff --git a/lib/smtp.c b/lib/smtp.c
index 534ab49..8c7b67a 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -333,11 +333,11 @@ static CURLcode smtp_state_helo(struct connectdata *conn)
   return CURLE_OK;
 }
 
-static int smtp_auth_plain_data(struct connectdata * conn, char * * outptr)
+static size_t smtp_auth_plain_data(struct connectdata * conn, char * * outptr)
 {
   char plainauth[2 * MAX_CURL_USER_LENGTH + MAX_CURL_PASSWORD_LENGTH];
-  unsigned int ulen;
-  unsigned int plen;
+  size_t ulen;
+  size_t plen;
 
   ulen = strlen(conn->user);
   plen = strlen(conn->passwd);
@@ -353,9 +353,9 @@ static int smtp_auth_plain_data(struct connectdata * conn, char * * outptr)
   return Curl_base64_encode(conn->data, plainauth, 2 * ulen + plen + 2, outptr);
 }
 
-static int smtp_auth_login_user(struct connectdata * conn, char * * outptr)
+static size_t smtp_auth_login_user(struct connectdata * conn, char * * outptr)
 {
-  int ulen;
+  size_t ulen;
 
   ulen = strlen(conn->user);
 
@@ -373,7 +373,7 @@ static CURLcode smtp_authenticate(struct connectdata *conn)
   struct smtp_conn *smtpc = &conn->proto.smtpc;
   char * initresp;
   const char * mech;
-  int l;
+  size_t l;
   int state1;
   int state2;
 
@@ -527,7 +527,7 @@ static CURLcode smtp_state_authplain_resp(struct connectdata *conn,
 {
   CURLcode result = CURLE_OK;
   struct SessionHandle *data = conn->data;
-  int l;
+  size_t l;
   char * plainauth;
 
   (void)instate; /* no use for this yet */
@@ -560,7 +560,7 @@ static CURLcode smtp_state_authlogin_resp(struct connectdata *conn,
 {
   CURLcode result = CURLE_OK;
   struct SessionHandle *data = conn->data;
-  int l;
+  size_t l;
   char * authuser;
 
   (void)instate; /* no use for this yet */
@@ -593,8 +593,8 @@ static CURLcode smtp_state_authpasswd_resp(struct connectdata *conn,
 {
   CURLcode result = CURLE_OK;
   struct SessionHandle *data = conn->data;
-  int plen;
-  int l;
+  size_t plen;
+  size_t l;
   char * authpasswd;
 
   (void)instate; /* no use for this yet */
@@ -637,8 +637,8 @@ static CURLcode smtp_state_authcram_resp(struct connectdata *conn,
   struct SessionHandle *data = conn->data;
   char * chlg64 = data->state.buffer;
   unsigned char * chlg;
-  int chlglen;
-  int l;
+  size_t chlglen;
+  size_t l;
   char * rplyb64;
   HMAC_context * ctxt;
   unsigned char digest[16];
@@ -674,7 +674,8 @@ static CURLcode smtp_state_authcram_resp(struct connectdata *conn,
 
   /* Compute digest. */
   ctxt = Curl_HMAC_init(Curl_HMAC_MD5,
-   (const unsigned char *) conn->passwd, strlen(conn->passwd));
+                        (const unsigned char *) conn->passwd,
+                        (unsigned int)(strlen(conn->passwd)));
 
   if(!ctxt) {
     if(chlg)
@@ -684,7 +685,7 @@ static CURLcode smtp_state_authcram_resp(struct connectdata *conn,
   }
 
   if(chlglen > 0)
-    Curl_HMAC_update(ctxt, chlg, chlglen);
+    Curl_HMAC_update(ctxt, chlg, (unsigned int)(chlglen));
 
   if(chlg)
     free(chlg);
-- 
1.6.2.5
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-05-20