Browse Source

ERR: Attempt to fix more Curl warnings

Andy Cedilnik 22 years ago
parent
commit
bf91178565
3 changed files with 20 additions and 17 deletions
  1. 1 1
      Source/CTest/Curl/getdate.c
  2. 2 2
      Source/CTest/Curl/hostip.c
  3. 17 14
      Source/CTest/Curl/ldap.c

+ 1 - 1
Source/CTest/Curl/getdate.c

@@ -1796,7 +1796,7 @@ LookupWord (yylval, buff)
   /* Make it lowercase. */
   for (p = buff; *p; p++)
     if (ISUPPER ((unsigned int)(*p)))
-      *p = (char)tolower (*p);
+      *p = (char)tolower ((unsigned int)(*p));
 
   if (strcmp (buff, "am") == 0 || strcmp (buff, "a.m.") == 0)
     {

+ 2 - 2
Source/CTest/Curl/hostip.c

@@ -474,11 +474,11 @@ static struct hostent* pack_hostent(char** buf, struct hostent* orig)
 
   /* now, shrink the allocated buffer to the size we actually need, which
      most often is only a fraction of the original alloc */
-  newbuf=(struct hostent *)realloc(*buf, (int)bufptr-(int)(*buf));
+  newbuf=(struct hostent *)realloc(*buf, (int)(bufptr-*buf));
 
   /* if the alloc moved, we need to adjust things again */
   if((char*)newbuf != *buf)
-    hostcache_fixoffset((struct hostent*)newbuf, (int)newbuf-(int)*buf);
+    hostcache_fixoffset((struct hostent*)newbuf, (int)((char*)newbuf-*buf));
 
   /* setup the return */
   *buf = (char*)newbuf;

+ 17 - 14
Source/CTest/Curl/ldap.c

@@ -54,11 +54,14 @@
 #include <curl/mprintf.h>
 
 
-#define DYNA_GET_FUNCTION(type, fnc) \
-  (fnc) = (type)DynaGetFunction(#fnc); \
-  if ((fnc) == NULL) { \
-    return CURLE_FUNCTION_NOT_FOUND; \
-  } \
+#define DYNA_GET_FUNCTION(type, fnc)          \
+  {                                           \
+  void* dyna_get_res = DynaGetFunction(#fnc); \
+  (fnc) = *((type)&dyna_get_res);             \
+  if ((fnc) == NULL) {                        \
+    return CURLE_FUNCTION_NOT_FOUND;          \
+  }                                           \
+  }
 
 /***********************************************************************
  */
@@ -163,15 +166,15 @@ CURLcode Curl_ldap(struct connectdata *conn)
   /* The types are needed because ANSI C distinguishes between
    * pointer-to-object (data) and pointer-to-function.
    */
-  DYNA_GET_FUNCTION(void *(*)(char *, int), ldap_open);
-  DYNA_GET_FUNCTION(int (*)(void *, char *, char *), ldap_simple_bind_s);
-  DYNA_GET_FUNCTION(int (*)(void *), ldap_unbind_s);
-  DYNA_GET_FUNCTION(int (*)(void *, char *, int, void **), ldap_url_search_s);
-  DYNA_GET_FUNCTION(void *(*)(void *, void *), ldap_first_entry);
-  DYNA_GET_FUNCTION(void *(*)(void *, void *), ldap_next_entry);
-  DYNA_GET_FUNCTION(char *(*)(int), ldap_err2string);
-  DYNA_GET_FUNCTION(int (*)(void *, char *, void *, void *, char **, char **, int (*)(void *, char *, int), void *, char *, int, unsigned long), ldap_entry2text);
-  DYNA_GET_FUNCTION(int (*)(void *, char *, void *, void *, char **, char **, int (*)(void *, char *, int), void *, char *, int, unsigned long, char *, char *), ldap_entry2html);
+  DYNA_GET_FUNCTION(void *(**)(char *, int), ldap_open);
+  DYNA_GET_FUNCTION(int (**)(void *, char *, char *), ldap_simple_bind_s);
+  DYNA_GET_FUNCTION(int (**)(void *), ldap_unbind_s);
+  DYNA_GET_FUNCTION(int (**)(void *, char *, int, void **), ldap_url_search_s);
+  DYNA_GET_FUNCTION(void *(**)(void *, void *), ldap_first_entry);
+  DYNA_GET_FUNCTION(void *(**)(void *, void *), ldap_next_entry);
+  DYNA_GET_FUNCTION(char *(**)(int), ldap_err2string);
+  DYNA_GET_FUNCTION(int (**)(void *, char *, void *, void *, char **, char **, int (*)(void *, char *, int), void *, char *, int, unsigned long), ldap_entry2text);
+  DYNA_GET_FUNCTION(int (**)(void *, char *, void *, void *, char **, char **, int (*)(void *, char *, int), void *, char *, int, unsigned long, char *, char *), ldap_entry2html);
   
   server = ldap_open(conn->hostname, conn->port);
   if (server == NULL) {