Browse Source

COMP: Remove warnings on borland build

Andy Cedilnik 21 năm trước cách đây
mục cha
commit
68c3550faa

+ 1 - 0
Source/CTest/Curl/dict.c

@@ -215,6 +215,7 @@ CURLcode Curl_dict(struct connectdata *conn)
         return result;
     }
   }
+  (void)nthdef;
 
   return CURLE_OK;
 }

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

@@ -374,7 +374,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
   FormInfo *first_form, *current_form, *form = NULL;
   CURLFORMcode return_value = CURL_FORMADD_OK;
   const char *prevtype = NULL;
-  struct curl_httppost *post = NULL;
+  struct curl_httppost *post;
   CURLformoption option;
   struct curl_forms *forms = NULL;
   char *array_value=NULL; /* value read from an array */

+ 13 - 10
Source/CTest/Curl/ftp.c

@@ -276,7 +276,6 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */
 
   *nreadp=0;
   perline=0;
-  keepon=TRUE;
 
   while((*nreadp<BUFSIZE) && (keepon && !result)) {
     /* check and reset timeout value every lap */
@@ -913,7 +912,7 @@ CURLcode ftp_sendquote(struct connectdata *conn, struct curl_slist *quote)
 static
 CURLcode ftp_getfiletime(struct connectdata *conn, char *file)
 {
-  CURLcode result=CURLE_OK;
+  CURLcode result;
   int ftpcode; /* for ftp status */
   ssize_t nread;
   char *buf = conn->data->state.buffer;
@@ -1050,7 +1049,7 @@ static
 CURLcode ftp_use_port(struct connectdata *conn)
 {
   struct SessionHandle *data=conn->data;
-  curl_socket_t portsock= CURL_SOCKET_BAD;
+  curl_socket_t portsock;
   ssize_t nread;
   int ftpcode; /* receive FTP response codes in this */
   CURLcode result;
@@ -1306,6 +1305,7 @@ CURLcode ftp_use_port(struct connectdata *conn)
         int rc = Curl_resolv(conn, myhost, 0, &h);
         if(rc == CURLRESOLV_PENDING)
           rc = Curl_wait_for_resolv(conn, &h);
+        (void)rc;
         if(h) {
           addr = h->addr;
           /* when we return from this function, we can forget about this entry
@@ -1625,6 +1625,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
   }
 #endif   /* CURL_DISABLE_HTTP */
 
+  (void)rc;
   return CURLE_OK;
 }
 
@@ -1724,6 +1725,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
 
             /* no data to transfer */
             result=Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
+            (void)result;
 
             /* Set no_transfer so that we won't get any error in
              * Curl_ftp_done() because we didn't transfer anything! */
@@ -1791,7 +1793,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
 
     if(conn->bits.use_range && conn->range) {
       curl_off_t from, to;
-      curl_off_t totalsize=-1;
+      curl_off_t totalsize;
       char *ptr;
       char *ptr2;
 
@@ -1924,6 +1926,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
         if (downloadsize == 0) {
           /* no data to transfer */
           result=Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
+          (void)result;
           infof(data, "File already completely downloaded\n");
 
           /* Set no_transfer so that we won't get any error in Curl_ftp_done()
@@ -2253,7 +2256,7 @@ CURLcode ftp_perform(struct connectdata *conn,
  */
 CURLcode Curl_ftp(struct connectdata *conn)
 {
-  CURLcode retcode = CURLE_OK;
+  CURLcode retcode;
 
   if (conn->sec_conn) /* 3rd party transfer */
     retcode = ftp_3rdparty(conn);
@@ -2279,7 +2282,7 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
   char s[256];
   size_t write_len;
   char *sptr=s;
-  CURLcode res = CURLE_OK;
+  CURLcode res;
 
   va_list ap;
   va_start(ap, fmt);
@@ -2381,7 +2384,7 @@ CURLcode Curl_ftp_disconnect(struct connectdata *conn)
  */
 static CURLcode ftp_mkd(struct connectdata *conn, char *path)
 {
-  CURLcode result=CURLE_OK;
+  CURLcode result;
   int ftpcode; /* for ftp status */
   ssize_t nread;
 
@@ -2477,7 +2480,7 @@ static CURLcode ftp_cwd_and_mkd(struct connectdata *conn, char *path)
  */
 static CURLcode ftp_3rdparty_pretransfer(struct connectdata *conn)
 {
-  CURLcode result = CURLE_OK;
+  CURLcode result;
   struct SessionHandle *data = conn->data;
   struct connectdata *sec_conn = conn->sec_conn;
 
@@ -2512,7 +2515,7 @@ static CURLcode ftp_3rdparty_pretransfer(struct connectdata *conn)
  */
 static CURLcode ftp_3rdparty_transfer(struct connectdata *conn)
 {
-  CURLcode result = CURLE_OK;
+  CURLcode result;
   ssize_t nread;
   int ftpcode, ip[4], port[2];
   struct SessionHandle *data = conn->data;
@@ -2756,7 +2759,7 @@ CURLcode ftp_regular_transfer(struct connectdata *conn)
  */
 static CURLcode ftp_3rdparty(struct connectdata *conn)
 {
-  CURLcode retcode = CURLE_OK;
+  CURLcode retcode;
 
   conn->proto.ftp->ctl_valid = conn->sec_conn->proto.ftp->ctl_valid = TRUE;
   conn->size = conn->sec_conn->size = -1;

+ 2 - 0
Source/CTest/Curl/getdate.c

@@ -428,6 +428,7 @@ union yyalloc
         Stack = &yyptr->Stack;                                          \
         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
         yyptr += yynewbytes / sizeof (*yyptr);                          \
+        (void)yyptr;                                                    \
       }                                                                 \
     while (0)
 
@@ -1767,6 +1768,7 @@ yyerrlab:
 #endif /* YYERROR_VERBOSE */
         yyerror ("syntax error");
     }
+  (void)yynerrs;
 
 
 

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

@@ -385,7 +385,7 @@ int Curl_resolv(struct connectdata *conn,
                 int port,
                 struct Curl_dns_entry **entry)
 {
-  char *entry_id = NULL;
+  char *entry_id;
   struct Curl_dns_entry *dns = NULL;
   size_t entry_len;
   int wait;

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

@@ -443,7 +443,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
                                 int port,
                                 int *waitp)
 {
-  struct hostent *h = NULL;
+  struct hostent *h;
   struct SessionHandle *data = conn->data;
   in_addr_t in;
 

+ 2 - 3
Source/CTest/Curl/http.c

@@ -916,7 +916,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
   bool keepon=TRUE;
   ssize_t gotbytes;
   char *ptr;
-  long timeout = 3600; /* default timeout in seconds */
+  long timeout; /* default timeout in seconds */
   struct timeval interval;
   fd_set rkeepfd;
   fd_set readfd;
@@ -979,7 +979,6 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
 
     nread=0;
     perline=0;
-    keepon=TRUE;
 
     while((nread<BUFSIZE) && (keepon && !error)) {
       readfd = rkeepfd;     /* set every lap */
@@ -1230,7 +1229,7 @@ CURLcode Curl_http(struct connectdata *conn)
 {
   struct SessionHandle *data=conn->data;
   char *buf = data->state.buffer; /* this is a short cut to the buffer */
-  CURLcode result=CURLE_OK;
+  CURLcode result;
   struct HTTP *http;
   char *ppath = conn->path;
   char *host = conn->host.name;

+ 4 - 4
Source/CTest/Curl/http_digest.c

@@ -59,8 +59,8 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
                                               header */
 {
   bool more = TRUE;
-  char *token = NULL;
-  char *tmp = NULL;
+  char *token;
+  char *tmp;
   bool foundAuth = FALSE;
   bool foundAuthInt = FALSE;
   struct SessionHandle *data=conn->data;
@@ -91,7 +91,7 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
     while(more) {
       char value[32];
       char content[128];
-      size_t totlen=0;
+      size_t totlen;
 
       while(*header && isspace((int)*header))
         header++;
@@ -224,7 +224,7 @@ CURLcode Curl_output_digest(struct connectdata *conn,
   unsigned char ha2[33];/* 32 digits and 1 zero byte */
   char cnoncebuf[7];
   char *cnonce;
-  char *tmp = NULL;
+  char *tmp;
   struct timeval now;
 
   char **allocuserpwd;

+ 1 - 0
Source/CTest/Curl/mprintf.c

@@ -933,6 +933,7 @@ static int dprintf_formatf(
           fptr += len;
           left -= len;
         }
+        (void)left;
         if (p->flags & FLAGS_LONG)
           *fptr++ = 'l';
 

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

@@ -309,7 +309,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
   struct Curl_one_easy *easy;
   bool done;
   CURLMcode result=CURLM_OK;
-  struct Curl_message *msg = NULL;
+  struct Curl_message *msg;
   bool connected;
   bool async;
 

+ 6 - 2
Source/CTest/Curl/telnet.c

@@ -1202,7 +1202,7 @@ CURLcode Curl_telnet(struct connectdata *conn)
     case WAIT_TIMEOUT:
     {
       unsigned char outbuf[2];
-      int out_count = 0;
+      int out_count;
       ssize_t bytes_written;
       char *buffer = buf;
 
@@ -1239,7 +1239,7 @@ CURLcode Curl_telnet(struct connectdata *conn)
     case WAIT_OBJECT_0 + 1:
     {
       unsigned char outbuf[2];
-      int out_count = 0;
+      int out_count;
       ssize_t bytes_written;
       char *buffer = buf;
 
@@ -1300,6 +1300,10 @@ CURLcode Curl_telnet(struct connectdata *conn)
   close_event_func = NULL;
   event_select_func = NULL;
   enum_netevents_func = NULL;
+  (void)create_event_func;
+  (void)close_event_func;
+  (void)event_select_func;
+  (void)enum_netevents_func;
 
   /* We called LoadLibrary, so call FreeLibrary */
   if (!FreeLibrary(wsock2))

+ 3 - 3
Source/CTest/Curl/timeval.c

@@ -53,9 +53,9 @@ static int gettimeofday(struct timeval *tp, void *nothing)
    ** of multimedia apis offer a better time resolution
    ** of 1ms.Need to link against winmm.lib for this
    **/
-  unsigned long Ticks = 0;
-  unsigned long Sec =0;
-  unsigned long Usec = 0;
+  unsigned long Ticks;
+  unsigned long Sec;
+  unsigned long Usec;
   Ticks = timeGetTime();
 
   Sec = Ticks/1000;

+ 8 - 4
Source/CTest/Curl/transfer.c

@@ -1163,6 +1163,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
             k->keepon &= ~KEEP_WRITE; /* we're done writing */
             FD_ZERO(&k->wkeepfd);
             writedone = TRUE;
+            (void)writedone;
             break;
           }
 
@@ -1337,7 +1338,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
 
 CURLcode Curl_readwrite_init(struct connectdata *conn)
 {
-  struct SessionHandle *data = conn->data;
+  struct SessionHandle *data;
   struct Curl_transfer_keeper *k = &conn->keep;
 
   /* NB: the content encoding software depends on this initialization of
@@ -1856,6 +1857,7 @@ CURLcode Curl_follow(struct SessionHandle *data,
 
   data->change.url = newurl;
   newurl = NULL; /* don't free! */
+  (void)newurl;
 
   infof(data, "Issue another request to this URL: '%s'\n", data->change.url);
 
@@ -1953,8 +1955,8 @@ static CURLcode
 Curl_connect_host(struct SessionHandle *data,
                   struct connectdata **conn)
 {
-  CURLcode res = CURLE_OK;
-  int urlchanged = FALSE;
+  CURLcode res;
+  int urlchanged;
 
   do {
     bool async;
@@ -2086,6 +2088,8 @@ CURLcode Curl_perform(struct SessionHandle *data)
         /* Curl_do() failed, clean up left-overs in the done-call */
         res2 = Curl_done(&conn, res);
 
+      (void)res2;
+
       /*
        * Important: 'conn' cannot be used here, since it may have been closed
        * in 'Curl_done' or other functions.
@@ -2158,7 +2162,7 @@ Curl_Transfer(struct connectdata *c_conn, /* connection data */
  */
 CURLcode Curl_pretransfersec(struct connectdata *conn)
 {
-  CURLcode status = CURLE_OK;
+  CURLcode status;
   struct SessionHandle *data = conn->data;
   struct connectdata *sec_conn = NULL;   /* secondary connection */
 

+ 3 - 1
Source/CTest/Curl/url.c

@@ -1869,6 +1869,7 @@ static int handleSock5Proxy(const char *proxy_name,
     if(rc == CURLRESOLV_PENDING)
       /* this requires that we're in "wait for resolve" state */
       rc = Curl_wait_for_resolv(conn, &dns);
+    (void)rc;
 
     /*
      * We cannot use 'hostent' as a struct that Curl_resolv() returns.  It
@@ -2401,10 +2402,11 @@ static CURLcode CreateConnection(struct SessionHandle *data,
      * For compatibility, the all-uppercase versions of these variables are
      * checked if the lowercase versions don't exist.
      */
-    char *no_proxy=NULL;
+    char *no_proxy;
     char *no_proxy_tok_buf;
     char *proxy=NULL;
     char proxy_env[128];
+    (void)proxy;
 
     no_proxy=curl_getenv("no_proxy");
     if(!no_proxy)

+ 1 - 0
Source/CTest/Curl/version.c

@@ -112,6 +112,7 @@ char *curl_version(void)
   strcpy(ptr, LIBCURL_NAME "/" LIBCURL_VERSION );
   ptr=strchr(ptr, '\0');
   left -= strlen(ptr);
+  (void)left;
 
 #ifdef USE_SSLEAY
   {