diff options
author | Daniel Stenberg <daniel@haxx.se> | 2010-01-22 23:21:39 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2010-01-22 23:21:39 +0000 |
commit | 33ce0ec1f1951bc1a8f4d475381c1b7c95d4a03a (patch) | |
tree | 770107eca67cfa3a6b55db2c677d9ee3385583be | |
parent | 143586403055b977bfe17b06042ebc3beb5d4d82 (diff) | |
download | curl-33ce0ec1f1951bc1a8f4d475381c1b7c95d4a03a.tar.gz |
wrap long lines and do some indent policing
-rw-r--r-- | lib/connect.c | 13 | ||||
-rw-r--r-- | lib/content_encoding.c | 36 | ||||
-rw-r--r-- | lib/easy.c | 8 | ||||
-rw-r--r-- | lib/escape.c | 5 | ||||
-rw-r--r-- | lib/formdata.c | 5 | ||||
-rw-r--r-- | lib/ftp.c | 38 | ||||
-rw-r--r-- | lib/hostip.c | 6 | ||||
-rw-r--r-- | lib/http.c | 19 | ||||
-rw-r--r-- | lib/sendf.c | 8 | ||||
-rw-r--r-- | lib/url.c | 34 |
10 files changed, 97 insertions, 75 deletions
diff --git a/lib/connect.c b/lib/connect.c index cca960d87..3ae38c990 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -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, diff --git a/lib/content_encoding.c b/lib/content_encoding.c index 3b7d90c6f..85362da41 100644 --- a/lib/content_encoding.c +++ b/lib/content_encoding.c @@ -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 diff --git a/lib/easy.c b/lib/easy.c index ee74fa62e..06cd3fb50 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -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; diff --git a/lib/escape.c b/lib/escape.c index 838100e38..3164f908a 100644 --- a/lib/escape.c +++ b/lib/escape.c @@ -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) { diff --git a/lib/formdata.c b/lib/formdata.c index 98058a5fa..025ff1274 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -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; @@ -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 diff --git a/lib/hostip.c b/lib/hostip.c index 7c72c05ed..0ef806b72 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -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; diff --git a/lib/http.c b/lib/http.c index 53e991b20..15943202e 100644 --- a/lib/http.c +++ b/lib/http.c @@ -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; } diff --git a/lib/sendf.c b/lib/sendf.c index 9b360be79..cb0bffce4 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -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; } @@ -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 */ |