]> granicus.if.org Git - curl/commitdiff
use unsigned short better intead of mixing with ints to prevent compiler
authorDaniel Stenberg <daniel@haxx.se>
Thu, 20 Nov 2008 07:50:48 +0000 (07:50 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 20 Nov 2008 07:50:48 +0000 (07:50 +0000)
warnings

ares/ares_gethostbyname.c
ares/ares_init.c
ares/ares_private.h
ares/ares_query.c

index 9662db5aedf1b127f4787da8385e4b765536a5ba..53ca2d94aed44e1a79ad4f49579e4444d2ff7070 100644 (file)
@@ -245,8 +245,8 @@ static int fake_hostent(const char *name, int family, ares_host_callback callbac
             numdots++;
           }
         }
-    
-      /* if we don't have 3 dots, it is illegal 
+
+      /* if we don't have 3 dots, it is illegal
        * (although inet_addr doesn't think so).
        */
       if (numdots != 3)
@@ -293,6 +293,8 @@ static int fake_hostent(const char *name, int family, ares_host_callback callbac
 int ares_gethostbyname_file(ares_channel channel, const char *name,
                             int family, struct hostent **host)
 {
+  int result;
+
   /* We only take the channel to ensure that ares_init() been called. */
   if(channel == NULL)
     {
@@ -301,11 +303,11 @@ int ares_gethostbyname_file(ares_channel channel, const char *name,
       *host = NULL;
       return ARES_ENOTFOUND;
     }
-  
+
   /* Just chain to the internal implementation we use here; it's exactly
-   * what we want.  
+   * what we want.
    */
-  const int result = file_lookup(name, family, host);
+  result = file_lookup(name, family, host);
   if(result != ARES_SUCCESS)
     {
       /* We guarantee a NULL hostent on failure. */
index 4a147fc42f6efe4b7b8915ffa641aaa6c1631e2c..d4301f43cce4e21ecbd8fc4d01233ad433ab73e3 100644 (file)
@@ -1503,9 +1503,9 @@ static int init_id_key(rc4_key* key,int key_data_len)
   return ARES_SUCCESS;
 }
 
-short ares__generate_new_id(rc4_key* key)
+unsigned short ares__generate_new_id(rc4_key* key)
 {
-  short r=0;
+  unsigned short r=0;
   ares__rc4(key, (unsigned char *)&r, sizeof(r));
   return r;
 }
index 976fa9f10b5057ab6c0dc02a4d8465ae393f239f..a883e50f1676ede29fcc0afb0c37a12a2c98e16d 100644 (file)
@@ -302,7 +302,7 @@ void ares__close_sockets(ares_channel channel, struct server_state *server);
 int ares__get_hostent(FILE *fp, int family, struct hostent **host);
 int ares__read_line(FILE *fp, char **buf, int *bufsize);
 void ares__free_query(struct query *query);
-short ares__generate_new_id(rc4_key* key);
+unsigned short ares__generate_new_id(rc4_key* key);
 struct timeval ares__tvnow(void);
 #if 0 /* Not used */
 long ares__tvdiff(struct timeval t1, struct timeval t2);
index b316133eb23e9bce09c1a31c5ee023b0e850bdcf..14a0d66bca6acaa650f0660e9dbfbf061490716f 100644 (file)
@@ -67,7 +67,7 @@ void ares__rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len)
   key->y = y;
 }
 
-static struct query* find_query_by_id(ares_channel channel, int id)
+static struct query* find_query_by_id(ares_channel channel, unsigned short id)
 {
   unsigned short qid;
   struct list_node* list_head;
@@ -94,11 +94,11 @@ static struct query* find_query_by_id(ares_channel channel, int id)
 */
 static unsigned short generate_unique_id(ares_channel channel)
 {
-  short id;
+  unsigned short id;
 
   do {
-       id = ares__generate_new_id(&channel->id_key);
-  } while (find_query_by_id(channel,id));
+    id = ares__generate_new_id(&channel->id_key);
+  } while (find_query_by_id(channel, id));
 
   return (unsigned short)id;
 }