]> granicus.if.org Git - curl/commitdiff
wrap long lines and do some indent policing
authorDaniel Stenberg <daniel@haxx.se>
Fri, 22 Jan 2010 23:21:39 +0000 (23:21 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 22 Jan 2010 23:21:39 +0000 (23:21 +0000)
lib/connect.c
lib/content_encoding.c
lib/easy.c
lib/escape.c
lib/formdata.c
lib/ftp.c
lib/hostip.c
lib/http.c
lib/sendf.c
lib/url.c

index cca960d8712871908676850ab7e872b402827f21..3ae38c990efb99be5516415ce2ebb874e4e165a5 100644 (file)
@@ -734,12 +734,13 @@ singleipconnect(struct connectdata *conn,
 
   if(data->set.fopensocket)
    /*
-    * If the opensocket callback is set, all the destination address information
-    * is passed to the callback. Depending on this information the callback may
-    * opt to abort the connection, this is indicated returning CURL_SOCKET_BAD;
-    * otherwise it will return a not-connected socket. When the callback returns
-    * a valid socket the destination address information might have been changed
-    * and this 'new' address will actually be used here to connect.
+    * If the opensocket callback is set, all the destination address
+    * information is passed to the callback. Depending on this information the
+    * callback may opt to abort the connection, this is indicated returning
+    * CURL_SOCKET_BAD; otherwise it will return a not-connected socket. When
+    * the callback returns a valid socket the destination address information
+    * might have been changed and this 'new' address will actually be used
+    * here to connect.
     */
     sockfd = data->set.fopensocket(data->set.opensocket_client,
                                    CURLSOCKTYPE_IPCXN,
index 3b7d90c6f890aae3cbdb0f9e4190071e9b35229f..85362da41b663d199e4d2f8ddf9d7ca7f3259a50 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2010, 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
@@ -280,27 +280,27 @@ Curl_unencode_gzip_write(struct connectdata *conn,
     z->avail_in = 0;
 
     if(strcmp(zlibVersion(), "1.2.0.4") >= 0) {
-        /* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */
-        if(inflateInit2(z, MAX_WBITS+32) != Z_OK) {
-          return process_zlib_error(conn, z);
-        }
-        k->zlib_init = ZLIB_INIT_GZIP; /* Transparent gzip decompress state */
-
-    else {
-        /* we must parse the gzip header ourselves */
-        if(inflateInit2(z, -MAX_WBITS) != Z_OK) {
-          return process_zlib_error(conn, z);
-        }
-        k->zlib_init = ZLIB_INIT;   /* Initial call state */
+      /* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */
+      if(inflateInit2(z, MAX_WBITS+32) != Z_OK) {
+        return process_zlib_error(conn, z);
+      }
+      k->zlib_init = ZLIB_INIT_GZIP; /* Transparent gzip decompress state */
+    }
+    else {
+      /* we must parse the gzip header ourselves */
+      if(inflateInit2(z, -MAX_WBITS) != Z_OK) {
+        return process_zlib_error(conn, z);
+      }
+      k->zlib_init = ZLIB_INIT;   /* Initial call state */
     }
   }
 
   if(k->zlib_init == ZLIB_INIT_GZIP) {
-     /* Let zlib handle the gzip decompression entirely */
-     z->next_in = (Bytef *)k->str;
-     z->avail_in = (uInt)nread;
-     /* Now uncompress the data */
-     return inflate_stream(conn, k);
+    /* Let zlib handle the gzip decompression entirely */
+    z->next_in = (Bytef *)k->str;
+    z->avail_in = (uInt)nread;
+    /* Now uncompress the data */
+    return inflate_stream(conn, k);
   }
 
 #ifndef OLD_ZLIB_SUPPORT
index ee74fa62e4134d55568fe0c5cf35a8e8224b43f1..06cd3fb5003ee72f198821e5770751af15fc564f 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2010, 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
@@ -886,7 +886,8 @@ CURLcode Curl_convert_to_network(struct SessionHandle *data,
             rc, curl_easy_strerror(rc));
     }
     return(rc);
-  } else {
+  }
+  else {
 #ifdef HAVE_ICONV
     /* do the translation ourselves */
     char *input_ptr, *output_ptr;
@@ -1007,7 +1008,8 @@ CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
             rc, curl_easy_strerror(rc));
     }
     return(rc);
-  } else {
+  }
+  else {
 #ifdef HAVE_ICONV
     /* do the translation ourselves */
     const char *input_ptr;
index 838100e38266e429bad54bdd25cd3539ff18033b..3164f908aba86827a92d3322741e948fcfba47f1 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2010, 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
@@ -103,7 +103,8 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
     if (Curl_isalnum(in)) {
       /* just copy this */
       ns[strindex++]=in;
-    } else {
+    }
+    else {
       /* encode it */
       newlen += 2; /* the size grows with two, since this'll become a %XX */
       if(newlen > alloc) {
index 98058a5fadf589fd55cefb07cdcc9304056d39af..025ff1274ca22e09811e2ef2ad4e4f9f4f09ee03 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2010, 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
@@ -998,7 +998,8 @@ int curl_formget(struct curl_httppost *form, void *arg,
           return -1;
         }
       } while(nread == sizeof(buffer));
-    } else {
+    }
+    else {
       if(ptr->length != append(arg, ptr->line, ptr->length)) {
         Curl_formclean(&data);
         return -1;
index 0984ca961e78cd65b74b1f73f6cb12e5f69231a3..45503ccf50c40b7d92c49fd32dd56f37df93ced3 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -730,13 +730,14 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
       ip_start = string_ftpport + 1;
       if((ip_end = strchr(string_ftpport, ']')) != NULL )
         strncpy(addr, ip_start, ip_end - ip_start);
-    } else
+    }
+    else
 #endif
       if( *string_ftpport == ':') {
         /* :port */
         ip_end = string_ftpport;
-    } else
-      if( (ip_end = strchr(string_ftpport, ':')) != NULL) {
+    }
+    else if( (ip_end = strchr(string_ftpport, ':')) != NULL) {
         /* either ipv6 or (ipv4|domain|interface):port(-range) */
 #ifdef ENABLE_IPV6
       if(Curl_inet_pton(AF_INET6, string_ftpport, sa6) == 1) {
@@ -750,10 +751,10 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
         /* (ipv4|domain|interface):port(-range) */
         strncpy(addr, string_ftpport, ip_end - ip_start );
       }
-    } else {
+    }
+    else
       /* ipv4|interface */
       strcpy(addr, string_ftpport);
-    }
 
     /* parse the port */
     if( ip_end != NULL ) {
@@ -901,7 +902,8 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
         return CURLE_FTP_PORT_FAILED;
       }
 
-    } else
+    }
+    else
       break;
 
     port++;
@@ -1095,9 +1097,10 @@ static CURLcode ftp_state_post_rest(struct connectdata *conn)
       /* The user has requested that we send a PRET command
          to prepare the server for the upcoming PASV */
       if(!conn->proto.ftpc.file) {
-        PPSENDF(&conn->proto.ftpc.pp, "PRET %s", data->set.str[STRING_CUSTOMREQUEST]?
-                 data->set.str[STRING_CUSTOMREQUEST]:
-                 (data->set.ftp_list_only?"NLST":"LIST"));
+        PPSENDF(&conn->proto.ftpc.pp, "PRET %s",
+                data->set.str[STRING_CUSTOMREQUEST]?
+                data->set.str[STRING_CUSTOMREQUEST]:
+                (data->set.ftp_list_only?"NLST":"LIST"));
       }
       else if(data->set.upload) {
         PPSENDF(&conn->proto.ftpc.pp, "PRET STOR %s", conn->proto.ftpc.file);
@@ -1845,7 +1848,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
       default:
         if(data->info.filetime <= data->set.timevalue) {
           infof(data, "The requested document is not new enough\n");
-          ftp->transfer = FTPTRANSFER_NONE; /* mark this to not transfer data */
+          ftp->transfer = FTPTRANSFER_NONE; /* mark to not transfer data */
           data->info.timecond = TRUE;
           state(conn, FTP_STOP);
           return CURLE_OK;
@@ -1854,7 +1857,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
       case CURL_TIMECOND_IFUNMODSINCE:
         if(data->info.filetime > data->set.timevalue) {
           infof(data, "The requested document is not old enough\n");
-          ftp->transfer = FTPTRANSFER_NONE; /* mark this to not transfer data */
+          ftp->transfer = FTPTRANSFER_NONE; /* mark to not transfer data */
           data->info.timecond = TRUE;
           state(conn, FTP_STOP);
           return CURLE_OK;
@@ -2230,8 +2233,9 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn,
     }
     else {
       failf(data, "RETR response: %03d", ftpcode);
-      return instate == FTP_RETR && ftpcode == 550? CURLE_REMOTE_FILE_NOT_FOUND:
-                                                    CURLE_FTP_COULDNT_RETR_FILE;
+      return instate == FTP_RETR && ftpcode == 550?
+        CURLE_REMOTE_FILE_NOT_FOUND:
+        CURLE_FTP_COULDNT_RETR_FILE;
     }
   }
 
@@ -2995,8 +2999,8 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
     /* out of memory, but we can limp along anyway (and should try to
      * since we're in the out of memory cleanup path) */
     ftpc->prevpath = NULL; /* no path */
-
-  else {
+  }
+  else {
     size_t flen = ftpc->file?strlen(ftpc->file):0; /* file is "raw" already */
     size_t dlen = strlen(path)-flen;
     if(!ftpc->cwdfail) {
@@ -3034,8 +3038,8 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
 
   if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) {
     if(conn->ssl[SECONDARYSOCKET].use) {
-      /* The secondary socket is using SSL so we must close down that part first
-         before we close the socket for real */
+      /* The secondary socket is using SSL so we must close down that part
+         first before we close the socket for real */
       Curl_ssl_close(conn, SECONDARYSOCKET);
 
       /* Note that we keep "use" set to TRUE since that (next) connection is
index 7c72c05ed3613f35dc37eb5bf2ae0fe547c8ff04..0ef806b725f901d137a6d89101ed1878aee08c10 100644 (file)
@@ -189,12 +189,14 @@ Curl_printable_address(const Curl_addrinfo *ai, char *buf, size_t bufsize)
     case AF_INET:
       sa4 = (const void *)ai->ai_addr;
       ipaddr4 = &sa4->sin_addr;
-      return Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize);
+      return Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf,
+                            bufsize);
 #ifdef ENABLE_IPV6
     case AF_INET6:
       sa6 = (const void *)ai->ai_addr;
       ipaddr6 = &sa6->sin6_addr;
-      return Curl_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf, bufsize);
+      return Curl_inet_ntop(ai->ai_family, (const void *)ipaddr6, buf,
+                            bufsize);
 #endif
     default:
       break;
index 53e991b200548b34df3a47225534a7d696036222..15943202e540011f8a37453d2002d45bb157359a 100644 (file)
@@ -972,8 +972,8 @@ Curl_send_buffer *Curl_add_buffer_init(void)
 }
 
 /*
- * Curl_add_buffer_send() sends a header buffer and frees all associated memory.
- * Body data may be appended to the header data if desired.
+ * Curl_add_buffer_send() sends a header buffer and frees all associated
+ * memory.  Body data may be appended to the header data if desired.
  *
  * Returns CURLcode
  */
@@ -1420,7 +1420,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
       }
     }
     else {
-      DEBUGF(infof(data, "Easy mode waiting for response from proxy CONNECT."));
+      DEBUGF(infof(data, "Easy mode waiting response from proxy CONNECT."));
     }
 
     /* at this point, either:
@@ -1538,7 +1538,8 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
 
 #ifdef CURL_DOES_CONVERSIONS
                   /* convert from the network encoding */
-                  result = Curl_convert_from_network(data, line_start, perline);
+                  result = Curl_convert_from_network(data, line_start,
+                                                     perline);
                   /* Curl_convert_from_network calls failf if unsuccessful */
                   if(result)
                     return result;
@@ -1642,14 +1643,15 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
                       return result;
                   }
                   else if(checkprefix("Content-Length:", line_start)) {
-                    cl = curlx_strtoofft(line_start + strlen("Content-Length:"),
-                                         NULL, 10);
+                    cl = curlx_strtoofft(line_start +
+                                         strlen("Content-Length:"), NULL, 10);
                   }
                   else if(Curl_compareheader(line_start,
                                              "Connection:", "close"))
                     closeConnection = TRUE;
                   else if(Curl_compareheader(line_start,
-                                             "Transfer-Encoding:", "chunked")) {
+                                             "Transfer-Encoding:",
+                                             "chunked")) {
                     infof(data, "CONNECT responded chunked\n");
                     chunked_encoding = TRUE;
                     /* init our chunky engine */
@@ -2829,7 +2831,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
 
     if(!Curl_checkheaders(data, "Content-Type:")) {
       result = Curl_add_bufferf(req_buffer,
-                           "Content-Type: application/x-www-form-urlencoded\r\n");
+                                "Content-Type: application/"
+                                "x-www-form-urlencoded\r\n");
       if(result)
         return result;
     }
index 9b360be790f5bec75742eb3cc31f609210ce9c27..cb0bffce472b07741068db98d0287b61520fb515 100644 (file)
@@ -511,7 +511,8 @@ int Curl_read(struct connectdata *conn, /* connection data */
 
   /* If session can pipeline, check connection buffer  */
   if(pipelining) {
-    size_t bytestocopy = CURLMIN(conn->buf_len - conn->read_pos, sizerequested);
+    size_t bytestocopy = CURLMIN(conn->buf_len - conn->read_pos,
+                                 sizerequested);
 
     /* Copy from our master buffer first if we have some unread data there*/
     if(bytestocopy > 0) {
@@ -528,8 +529,9 @@ int Curl_read(struct connectdata *conn, /* connection data */
     buffertofill = conn->master_buffer;
   }
   else {
-    bytesfromsocket = CURLMIN((long)sizerequested, conn->data->set.buffer_size ?
-                          conn->data->set.buffer_size : BUFSIZE);
+    bytesfromsocket = CURLMIN((long)sizerequested,
+                              conn->data->set.buffer_size ?
+                              conn->data->set.buffer_size : BUFSIZE);
     buffertofill = buf;
   }
 
index 927e16887d229552c29989b6fae3119909678f43..12e7e3639f21094393110350df7ad4f52c95c5ee 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -432,7 +432,7 @@ CURLcode Curl_close(struct SessionHandle *data)
         for (curr = pipeline->head; curr; curr=curr->next) {
           if(data == (struct SessionHandle *) curr->ptr) {
             fprintf(stderr,
-                    "MAJOR problem we %p are still in send pipe for %p done %d\n",
+                    "problem we %p are still in send pipe for %p done %d\n",
                     data, connptr, (int)connptr->bits.done);
           }
         }
@@ -442,7 +442,7 @@ CURLcode Curl_close(struct SessionHandle *data)
         for (curr = pipeline->head; curr; curr=curr->next) {
           if(data == (struct SessionHandle *) curr->ptr) {
             fprintf(stderr,
-                    "MAJOR problem we %p are still in recv pipe for %p done %d\n",
+                    "problem we %p are still in recv pipe for %p done %d\n",
                     data, connptr, (int)connptr->bits.done);
           }
         }
@@ -452,7 +452,7 @@ CURLcode Curl_close(struct SessionHandle *data)
         for (curr = pipeline->head; curr; curr=curr->next) {
           if(data == (struct SessionHandle *) curr->ptr) {
             fprintf(stderr,
-                    "MAJOR problem we %p are still in done pipe for %p done %d\n",
+                    "problem we %p are still in done pipe for %p done %d\n",
                     data, connptr, (int)connptr->bits.done);
           }
         }
@@ -462,7 +462,7 @@ CURLcode Curl_close(struct SessionHandle *data)
         for (curr = pipeline->head; curr; curr=curr->next) {
           if(data == (struct SessionHandle *) curr->ptr) {
             fprintf(stderr,
-                    "MAJOR problem we %p are still in pend pipe for %p done %d\n",
+                    "problem we %p are still in pend pipe for %p done %d\n",
                     data, connptr, (int)connptr->bits.done);
           }
         }
@@ -1160,7 +1160,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
            to mark that postfields is used rather than read function or
            form data.
         */
-        p = malloc((size_t)(data->set.postfieldsize?data->set.postfieldsize:1));
+        p = malloc((size_t)(data->set.postfieldsize?
+                            data->set.postfieldsize:1));
 
         if(!p)
           result = CURLE_OUT_OF_MEMORY;
@@ -1411,7 +1412,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
 
     /* the DIGEST_IE bit is only used to set a special marker, for all the
        rest we need to handle it as normal DIGEST */
-    data->state.authhost.iestyle = (bool)((auth & CURLAUTH_DIGEST_IE)?TRUE:FALSE);
+    data->state.authhost.iestyle = (bool)((auth & CURLAUTH_DIGEST_IE)?
+                                          TRUE:FALSE);
 
     if(auth & CURLAUTH_DIGEST_IE) {
       auth |= CURLAUTH_DIGEST; /* set standard digest bit */
@@ -1456,7 +1458,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
 
     /* the DIGEST_IE bit is only used to set a special marker, for all the
        rest we need to handle it as normal DIGEST */
-    data->state.authproxy.iestyle = (bool)((auth & CURLAUTH_DIGEST_IE)?TRUE:FALSE);
+    data->state.authproxy.iestyle = (bool)((auth & CURLAUTH_DIGEST_IE)?
+                                           TRUE:FALSE);
 
     if(auth & CURLAUTH_DIGEST_IE) {
       auth |= CURLAUTH_DIGEST; /* set standard digest bit */
@@ -2874,8 +2877,8 @@ ConnectionExists(struct SessionHandle *data,
 #endif
 
       if((check->sock[FIRSTSOCKET] == CURL_SOCKET_BAD) || check->bits.close) {
-        /* Don't pick a connection that hasn't connected yet or that is going to
-           get closed. */
+        /* Don't pick a connection that hasn't connected yet or that is going
+           to get closed. */
         infof(data, "Connection #%ld isn't open enough, can't reuse\n",
               check->connectindex);
 #ifdef DEBUGBUILD
@@ -3653,7 +3656,8 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data,
       char *endp;
       unsigned long scope = strtoul (percent + 3, &endp, 10);
       if (*endp == ']') {
-        /* The address scope was well formed.  Knock it out of the hostname.  */
+        /* The address scope was well formed.  Knock it out of the
+           hostname. */
         memmove(percent, endp, strlen(endp)+1);
         if (!data->state.this_is_a_follow)
           /* Don't honour a scope given in a Location: header */
@@ -3668,8 +3672,8 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data,
     conn->scope = data->set.scope;
 
   /* Remove the fragment part of the path. Per RFC 2396, this is always the
-     last part of the URI. We are looking for the first '#' so that we deal gracefully
-     with non conformant URI such as http://example.com#foo#bar. */
+     last part of the URI. We are looking for the first '#' so that we deal
+     gracefully with non conformant URI such as http://example.com#foo#bar. */
   fragment = strchr(path, '#');
   if(fragment)
     *fragment = 0;
@@ -3816,7 +3820,8 @@ static bool check_noproxy(const char* name, const char* no_proxy)
       if((tok_end - tok_start) <= namelen) {
         /* Match the last part of the name to the domain we are checking. */
         const char *checkn = name + namelen - (tok_end - tok_start);
-        if(Curl_raw_nequal(no_proxy + tok_start, checkn, tok_end - tok_start)) {
+        if(Curl_raw_nequal(no_proxy + tok_start, checkn,
+                           tok_end - tok_start)) {
           if((tok_end - tok_start) == namelen || *(checkn - 1) == '.') {
             /* We either have an exact match, or the previous character is a .
              * so it is within the same domain, so no proxy for this host.
@@ -4005,7 +4010,8 @@ static CURLcode parse_proxy(struct SessionHandle *data,
   /* detect and extract RFC2732-style IPv6-addresses */
   if(*proxyptr == '[') {
     char *ptr = ++proxyptr; /* advance beyond the initial bracket */
-    while(*ptr && (ISXDIGIT(*ptr) || (*ptr == ':') || (*ptr == '%') || (*ptr == '.')))
+    while(*ptr && (ISXDIGIT(*ptr) || (*ptr == ':') || (*ptr == '%') ||
+                   (*ptr == '.')))
       ptr++;
     if(*ptr == ']') {
       /* yeps, it ended nicely with a bracket as well */