1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 15:48:49 -05:00

if () => if()

while () => while()
and some other minor re-indentings
This commit is contained in:
Daniel Stenberg 2007-11-07 09:21:35 +00:00
parent 33f7ac06c3
commit cbd1a77ec2
38 changed files with 356 additions and 351 deletions

View File

@ -483,7 +483,7 @@ Curl_cookie_add(struct SessionHandle *data,
/* It turns out, that sometimes the file format allows the path
field to remain not filled in, we try to detect this and work
around it! Andrés García made us aware of this... */
if (strcmp("TRUE", ptr) && strcmp("FALSE", ptr)) {
if(strcmp("TRUE", ptr) && strcmp("FALSE", ptr)) {
/* only if the path doesn't look like a boolean option! */
co->path = strdup(ptr);
if(!co->path)
@ -972,7 +972,7 @@ int Curl_cookie_output(struct CookieInfo *c, const char *dumphere)
while(co) {
format_ptr = get_netscape_format(co);
if (format_ptr == NULL) {
if(format_ptr == NULL) {
fprintf(out, "#\n# Fatal libcurl error\n");
fclose(out);
return 1;
@ -996,27 +996,27 @@ struct curl_slist *Curl_cookie_list(struct SessionHandle *data)
struct Cookie *c;
char *line;
if ((data->cookies == NULL) ||
if((data->cookies == NULL) ||
(data->cookies->numcookies == 0))
return NULL;
c = data->cookies->cookies;
beg = list;
while (c) {
while(c) {
/* fill the list with _all_ the cookies we know */
line = get_netscape_format(c);
if (line == NULL) {
if(line == NULL) {
curl_slist_free_all(beg);
return NULL;
}
list = curl_slist_append(list, line);
free(line);
if (list == NULL) {
if(list == NULL) {
curl_slist_free_all(beg);
return NULL;
}
else if (beg == NULL) {
else if(beg == NULL) {
beg = list;
}
c = c->next;

View File

@ -129,7 +129,7 @@ static char *unescape_word(struct SessionHandle *data, const char *inp)
for(ptr = newp;
(byte = *ptr) != 0;
ptr++) {
if ((byte <= 32) || (byte == 127) ||
if((byte <= 32) || (byte == 127) ||
(byte == '\'') || (byte == '\"') || (byte == '\\')) {
dictp[olen++] = '\\';
}
@ -164,35 +164,35 @@ static CURLcode Curl_dict(struct connectdata *conn, bool *done)
/* AUTH is missing */
}
if (strnequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) ||
if(strnequal(path, DICT_MATCH, sizeof(DICT_MATCH)-1) ||
strnequal(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) ||
strnequal(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) {
word = strchr(path, ':');
if (word) {
if(word) {
word++;
database = strchr(word, ':');
if (database) {
if(database) {
*database++ = (char)0;
strategy = strchr(database, ':');
if (strategy) {
if(strategy) {
*strategy++ = (char)0;
nthdef = strchr(strategy, ':');
if (nthdef) {
if(nthdef) {
*nthdef++ = (char)0;
}
}
}
}
if ((word == NULL) || (*word == (char)0)) {
if((word == NULL) || (*word == (char)0)) {
infof(data, "lookup word is missing");
word=(char *)"default";
}
if ((database == NULL) || (*database == (char)0)) {
if((database == NULL) || (*database == (char)0)) {
database = (char *)"!";
}
if ((strategy == NULL) || (*strategy == (char)0)) {
if((strategy == NULL) || (*strategy == (char)0)) {
strategy = (char *)".";
}
@ -223,28 +223,28 @@ static CURLcode Curl_dict(struct connectdata *conn, bool *done)
if(result)
return result;
}
else if (strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
else if(strnequal(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
strnequal(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||
strnequal(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) {
word = strchr(path, ':');
if (word) {
if(word) {
word++;
database = strchr(word, ':');
if (database) {
if(database) {
*database++ = (char)0;
nthdef = strchr(database, ':');
if (nthdef) {
if(nthdef) {
*nthdef++ = (char)0;
}
}
}
if ((word == NULL) || (*word == (char)0)) {
if((word == NULL) || (*word == (char)0)) {
infof(data, "lookup word is missing");
word=(char *)"default";
}
if ((database == NULL) || (*database == (char)0)) {
if((database == NULL) || (*database == (char)0)) {
database = (char *)"!";
}
@ -276,12 +276,12 @@ static CURLcode Curl_dict(struct connectdata *conn, bool *done)
else {
ppath = strchr(path, '/');
if (ppath) {
if(ppath) {
int i;
ppath++;
for (i = 0; ppath[i]; i++) {
if (ppath[i] == ':')
if(ppath[i] == ':')
ppath[i] = ' ';
}
result = Curl_sendf(sockfd, conn,

View File

@ -112,7 +112,7 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
#ifdef CURL_DOES_CONVERSIONS
/* escape sequences are always in ASCII so convert them on non-ASCII hosts */
if (!handle ||
if(!handle ||
(Curl_convert_to_network(handle, &in, 1) != CURLE_OK)) {
/* Curl_convert_to_network calls failf if unsuccessful */
free(ns);
@ -163,7 +163,7 @@ char *curl_easy_unescape(CURL *handle, const char *string, int length,
#ifdef CURL_DOES_CONVERSIONS
/* escape sequences are always in ASCII so convert them on non-ASCII hosts */
if (!handle ||
if(!handle ||
(Curl_convert_from_network(handle, &in, 1) != CURLE_OK)) {
/* Curl_convert_from_network calls failf if unsuccessful */
free(ns);

View File

@ -142,7 +142,7 @@ static CURLcode Curl_file_connect(struct connectdata *conn, bool *done)
sessionhandle, deal with it */
Curl_reset_reqproto(conn);
if (!data->reqdata.proto.file) {
if(!data->reqdata.proto.file) {
file = (struct FILEPROTO *)calloc(sizeof(struct FILEPROTO), 1);
if(!file) {
free(real_path);
@ -177,7 +177,7 @@ static CURLcode Curl_file_connect(struct connectdata *conn, bool *done)
with a drive letter.
*/
actual_path = real_path;
if ((actual_path[0] == '/') &&
if((actual_path[0] == '/') &&
actual_path[1] &&
(actual_path[2] == ':' || actual_path[2] == '|'))
{
@ -187,7 +187,7 @@ static CURLcode Curl_file_connect(struct connectdata *conn, bool *done)
/* change path separators from '/' to '\\' for DOS, Windows and OS/2 */
for (i=0; actual_path[i] != '\0'; ++i)
if (actual_path[i] == '/')
if(actual_path[i] == '/')
actual_path[i] = '\\';
fd = open(actual_path, O_RDONLY | O_BINARY); /* no CR/LF translation! */
@ -270,7 +270,7 @@ static CURLcode file_upload(struct connectdata *conn)
fd = open(file->path, O_WRONLY|O_CREAT|O_TRUNC,
conn->data->set.new_file_perms);
#endif /* !(WIN32 || MSDOS || __EMX__) */
if (fd < 0) {
if(fd < 0) {
failf(data, "Can't open %s for writing", file->path);
return CURLE_WRITE_ERROR;
}
@ -297,13 +297,13 @@ static CURLcode file_upload(struct connectdata *conn)
data->reqdata.resume_from = (curl_off_t)file_stat.st_size;
}
while (res == CURLE_OK) {
while(res == CURLE_OK) {
int readcount;
res = Curl_fillreadbuffer(conn, BUFSIZE, &readcount);
if(res)
break;
if (readcount <= 0) /* fix questionable compare error. curlvms */
if(readcount <= 0) /* fix questionable compare error. curlvms */
break;
nread = (size_t)readcount;
@ -435,14 +435,14 @@ static CURLcode Curl_file(struct connectdata *conn, bool *done)
return result;
}
if (data->reqdata.resume_from <= expected_size)
if(data->reqdata.resume_from <= expected_size)
expected_size -= data->reqdata.resume_from;
else {
failf(data, "failed to resume file:// transfer");
return CURLE_BAD_DOWNLOAD_RESUME;
}
if (fstated && (expected_size == 0))
if(fstated && (expected_size == 0))
return CURLE_OK;
/* The following is a shortcut implementation of file reading
@ -460,13 +460,13 @@ static CURLcode Curl_file(struct connectdata *conn, bool *done)
Curl_pgrsTime(data, TIMER_STARTTRANSFER);
while (res == CURLE_OK) {
while(res == CURLE_OK) {
nread = read(fd, buf, BUFSIZE-1);
if ( nread > 0)
if( nread > 0)
buf[nread] = 0;
if (nread <= 0)
if(nread <= 0)
break;
bytecount += nread;

View File

@ -111,7 +111,7 @@
#endif
#ifdef CURL_DISABLE_VERBOSE_STRINGS
#define ftp_pasv_verbose(a,b,c,d) do { } while (0)
#define ftp_pasv_verbose(a,b,c,d) do { } while(0)
#endif
/* Local API functions */

View File

@ -46,13 +46,13 @@ char *GetEnv(const char *variable)
char env[MAX_PATH]; /* MAX_PATH is from windef.h */
char *temp = getenv(variable);
env[0] = '\0';
if (temp != NULL)
if(temp != NULL)
ExpandEnvironmentStrings(temp, env, sizeof(env));
return (env[0] != '\0')?strdup(env):NULL;
#else
char *env = getenv(variable);
#ifdef VMS
if (env && strcmp("HOME",variable) == 0)
if(env && strcmp("HOME",variable) == 0)
env = decc$translate_vms(env);
#endif
return (env && env[0])?strdup(env):NULL;

View File

@ -58,7 +58,7 @@ CURLcode Curl_initinfo(struct SessionHandle *data)
info->httpversion=0;
info->filetime=-1; /* -1 is an illegal time and thus means unknown */
if (info->contenttype)
if(info->contenttype)
free(info->contenttype);
info->contenttype = NULL;
@ -214,7 +214,7 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
/* determine if ssl */
if(c->ssl[FIRSTSOCKET].use) {
/* use the SSL context */
if (!Curl_ssl_check_cxn(c))
if(!Curl_ssl_check_cxn(c))
*param_longp = -1; /* FIN received */
}
/* Minix 3.1 doesn't support any flags on recv; just assume socket is OK */

View File

@ -97,7 +97,7 @@ int Curl_gtls_init(void)
static int _Curl_gtls_init(void)
{
int ret = 1;
if (!gtls_inited) {
if(!gtls_inited) {
ret = gnutls_global_init()?0:1;
#ifdef GTLSDEBUG
gnutls_global_set_log_function(tls_log_func);
@ -110,7 +110,7 @@ static int _Curl_gtls_init(void)
int Curl_gtls_cleanup(void)
{
if (gtls_inited)
if(gtls_inited)
gnutls_global_deinit();
return 1;
}
@ -148,7 +148,7 @@ static CURLcode handshake(struct connectdata *conn,
{
struct SessionHandle *data = conn->data;
int rc;
if (!gtls_inited)
if(!gtls_inited)
_Curl_gtls_init();
do {
rc = gnutls_handshake(session);
@ -198,7 +198,7 @@ static CURLcode handshake(struct connectdata *conn,
break;
} while(1);
if (rc < 0) {
if(rc < 0) {
failf(data, "gnutls_handshake() failed: %s", gnutls_strerror(rc));
return CURLE_SSL_CONNECT_ERROR;
}
@ -244,7 +244,7 @@ Curl_gtls_connect(struct connectdata *conn,
void *ssl_sessionid;
size_t ssl_idsize;
if (!gtls_inited) _Curl_gtls_init();
if(!gtls_inited) _Curl_gtls_init();
/* GnuTLS only supports TLSv1 (and SSLv3?) */
if(data->set.ssl.version == CURL_SSLVERSION_SSLv2) {
failf(data, "GnuTLS does not support SSLv2");
@ -269,7 +269,7 @@ Curl_gtls_connect(struct connectdata *conn,
if(rc < 0) {
infof(data, "error reading ca cert file %s (%s)\n",
data->set.ssl.CAfile, gnutls_strerror(rc));
if (data->set.ssl.verifypeer)
if(data->set.ssl.verifypeer)
return CURLE_SSL_CACERT_BADFILE;
}
else
@ -365,14 +365,14 @@ Curl_gtls_connect(struct connectdata *conn,
gnutls_certificate_set_verify_limits(). */
rc = gnutls_certificate_verify_peers2(session, &verify_status);
if (rc < 0) {
if(rc < 0) {
failf(data, "server cert verify failed: %d", rc);
return CURLE_SSL_CONNECT_ERROR;
}
/* verify_status is a bitmask of gnutls_certificate_status bits */
if(verify_status & GNUTLS_CERT_INVALID) {
if (data->set.ssl.verifypeer) {
if(data->set.ssl.verifypeer) {
failf(data, "server certificate verification failed. CAfile: %s",
data->set.ssl.CAfile?data->set.ssl.CAfile:"none");
return CURLE_SSL_CACERT;
@ -409,7 +409,7 @@ Curl_gtls_connect(struct connectdata *conn,
rc = gnutls_x509_crt_check_hostname(x509_cert, conn->host.name);
if(!rc) {
if (data->set.ssl.verifyhost > 1) {
if(data->set.ssl.verifyhost > 1) {
failf(data, "SSL: certificate subject name (%s) does not match "
"target host name '%s'", certbuf, conn->host.dispname);
gnutls_x509_crt_deinit(x509_cert);
@ -431,7 +431,7 @@ Curl_gtls_connect(struct connectdata *conn,
}
if(clock < time(NULL)) {
if (data->set.ssl.verifypeer) {
if(data->set.ssl.verifypeer) {
failf(data, "server certificate expiration date has passed.");
return CURLE_PEER_FAILED_VERIFICATION;
}
@ -449,7 +449,7 @@ Curl_gtls_connect(struct connectdata *conn,
}
if(clock > time(NULL)) {
if (data->set.ssl.verifypeer) {
if(data->set.ssl.verifypeer) {
failf(data, "server certificate not activated yet.");
return CURLE_PEER_FAILED_VERIFICATION;
}
@ -670,12 +670,12 @@ ssize_t Curl_gtls_recv(struct connectdata *conn, /* connection data */
}
*wouldblock = FALSE;
if (!ret) {
if(!ret) {
failf(conn->data, "Peer closed the TLS connection");
return -1;
}
if (ret < 0) {
if(ret < 0) {
failf(conn->data, "GnuTLS recv error (%d): %s",
(int)ret, gnutls_strerror(ret));
return -1;

View File

@ -39,7 +39,7 @@ hash_element_dtor(void *user, void *element)
struct curl_hash *h = (struct curl_hash *) user;
struct curl_hash_element *e = (struct curl_hash_element *) element;
if (e->key)
if(e->key)
free(e->key);
h->dtor(e->ptr);
@ -57,7 +57,7 @@ Curl_hash_init(struct curl_hash *h,
{
int i;
if (!slots || !hfunc || !comparator ||!dtor) {
if(!slots || !hfunc || !comparator ||!dtor) {
return 1; /* failure */
}
@ -92,12 +92,12 @@ Curl_hash_alloc(int slots,
{
struct curl_hash *h;
if (!slots || !hfunc || !comparator ||!dtor) {
if(!slots || !hfunc || !comparator ||!dtor) {
return NULL; /* failure */
}
h = (struct curl_hash *) malloc(sizeof(struct curl_hash));
if (h) {
if(h) {
if(Curl_hash_init(h, slots, hfunc, comparator, dtor)) {
/* failure */
free(h);
@ -148,14 +148,14 @@ Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p)
for (le = l->head; le; le = le->next) {
he = (struct curl_hash_element *) le->ptr;
if (h->comp_func(he->key, he->key_len, key, key_len)) {
if(h->comp_func(he->key, he->key_len, key, key_len)) {
h->dtor(p); /* remove the NEW entry */
return he->ptr; /* return the EXISTING entry */
}
}
he = mk_hash_element(key, key_len, p);
if (he) {
if(he) {
if(Curl_llist_insert_next(l, l->tail, he)) {
++h->size;
return p; /* return the new entry */
@ -182,7 +182,7 @@ int Curl_hash_delete(struct curl_hash *h, void *key, size_t key_len)
for (le = l->head; le; le = le->next) {
he = le->ptr;
if (h->comp_func(he->key, he->key_len, key, key_len)) {
if(h->comp_func(he->key, he->key_len, key, key_len)) {
Curl_llist_remove(l, le, (void *) h);
return 0;
}
@ -199,7 +199,7 @@ Curl_hash_pick(struct curl_hash *h, void *key, size_t key_len)
for (le = l->head; le; le = le->next) {
he = le->ptr;
if (h->comp_func(he->key, he->key_len, key, key_len)) {
if(h->comp_func(he->key, he->key_len, key, key_len)) {
return he->ptr;
}
}
@ -254,7 +254,7 @@ Curl_hash_clean_with_criterium(struct curl_hash *h, void *user,
struct curl_hash_element *he = le->ptr;
lnext = le->next;
/* ask the callback function if we shall remove this entry or not */
if (comp(user, he->ptr)) {
if(comp(user, he->ptr)) {
Curl_llist_remove(list, le, (void *) h);
--h->size; /* one less entry in the hash now */
}
@ -266,7 +266,7 @@ Curl_hash_clean_with_criterium(struct curl_hash *h, void *user,
void
Curl_hash_destroy(struct curl_hash *h)
{
if (!h)
if(!h)
return;
Curl_hash_clean(h);
@ -279,7 +279,7 @@ size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num)
const char *end = key_str + key_length;
unsigned long h = 5381;
while (key_str < end) {
while(key_str < end) {
h += h << 5;
h ^= (unsigned long) *key_str++;
}
@ -292,7 +292,7 @@ size_t Curl_str_key_compare(void*k1, size_t key1_len, void*k2, size_t key2_len)
char *key1 = (char *)k1;
char *key2 = (char *)k2;
if (key1_len == key2_len &&
if(key1_len == key2_len &&
*key1 == *key2 &&
memcmp(key1, key2, key1_len) == 0) {
return 1;
@ -309,7 +309,7 @@ void Curl_hash_print(struct curl_hash *h,
struct curl_llist_element *le;
struct curl_llist *list;
struct curl_hash_element *he;
if (!h)
if(!h)
return;
fprintf(stderr, "=Hash dump=\n");

View File

@ -244,7 +244,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
timeout = CURL_TIMEOUT_RESOLVE * 1000; /* default name resolve timeout */
/* Wait for the name resolve query to complete. */
while (1) {
while(1) {
struct timeval *tvp, tv, store;
struct timeval now = Curl_tvnow();
long timediff;
@ -262,7 +262,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
timediff = Curl_tvdiff(Curl_tvnow(), now); /* spent time */
timeout -= timediff?timediff:1; /* always deduct at least 1 */
if (timeout < 0) {
if(timeout < 0) {
/* our timeout, so we cancel the ares operation */
ares_cancel(data->state.areschannel);
break;
@ -316,7 +316,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
*waitp = FALSE;
if (in != CURL_INADDR_NONE) {
if(in != CURL_INADDR_NONE) {
/* This is a dotted IP address 123.123.123.123-style */
return Curl_ip2addr(in, hostname, port);
}

View File

@ -130,7 +130,7 @@ static void freednsentry(void *freethis);
*/
void Curl_global_host_cache_init(void)
{
if (!host_cache_initialized) {
if(!host_cache_initialized) {
Curl_hash_init(&hostname_cache, 7, Curl_hash_str, Curl_str_key_compare,
freednsentry);
host_cache_initialized = 1;
@ -150,7 +150,7 @@ struct curl_hash *Curl_global_host_cache_get(void)
*/
void Curl_global_host_cache_dtor(void)
{
if (host_cache_initialized) {
if(host_cache_initialized) {
Curl_hash_clean(&hostname_cache);
host_cache_initialized = 0;
}
@ -218,7 +218,7 @@ hostcache_timestamp_remove(void *datap, void *hc)
(struct hostcache_prune_data *) datap;
struct Curl_dns_entry *c = (struct Curl_dns_entry *) hc;
if ((data->now - c->timestamp < data->cache_timeout) ||
if((data->now - c->timestamp < data->cache_timeout) ||
c->inuse) {
/* please don't remove */
return 0;
@ -284,7 +284,7 @@ remove_entry_if_stale(struct SessionHandle *data, struct Curl_dns_entry *dns)
time(&user.now);
user.cache_timeout = data->set.dns_cache_timeout;
if ( !hostcache_timestamp_remove(&user,dns) )
if( !hostcache_timestamp_remove(&user,dns) )
return 0;
/* ok, we do need to clear the cache. although we need to remove just a
@ -336,13 +336,13 @@ Curl_cache_addr(struct SessionHandle *data,
/* Create an entry id, based upon the hostname and port */
entry_id = create_hostcache_id(hostname, port);
/* If we can't create the entry id, fail */
if (!entry_id)
if(!entry_id)
return NULL;
entry_len = strlen(entry_id);
/* Create a new cache entry */
dns = (struct Curl_dns_entry *) calloc(sizeof(struct Curl_dns_entry), 1);
if (!dns) {
if(!dns) {
free(entry_id);
return NULL;
}
@ -407,7 +407,7 @@ int Curl_resolv(struct connectdata *conn,
/* this allows us to time-out from the name resolver, as the timeout
will generate a signal and we will siglongjmp() from that here */
if(!data->set.no_signal) {
if (sigsetjmp(curl_jmpenv, 1)) {
if(sigsetjmp(curl_jmpenv, 1)) {
/* this is coming from a siglongjmp() */
failf(data, "name lookup timed out");
return CURLRESOLV_ERROR;
@ -418,7 +418,7 @@ int Curl_resolv(struct connectdata *conn,
/* Create an entry id, based upon the hostname and port */
entry_id = create_hostcache_id(hostname, port);
/* If we can't create the entry id, fail */
if (!entry_id)
if(!entry_id)
return CURLRESOLV_ERROR;
entry_len = strlen(entry_id);
@ -437,12 +437,12 @@ int Curl_resolv(struct connectdata *conn,
/* See whether the returned entry is stale. Deliberately done after the
locked block */
if ( remove_entry_if_stale(data,dns) )
if( remove_entry_if_stale(data,dns) )
dns = NULL; /* the memory deallocation is being handled by the hash */
rc = CURLRESOLV_ERROR; /* default to failure */
if (!dns) {
if(!dns) {
/* The entry was not in the cache. Resolve it to IP address */
Curl_addrinfo *addr;
@ -458,7 +458,7 @@ int Curl_resolv(struct connectdata *conn,
resolve call */
addr = Curl_getaddrinfo(conn, hostname, port, &respwait);
if (!addr) {
if(!addr) {
if(respwait) {
/* the response to our resolve call will come asynchronously at
a later time, good or bad */

View File

@ -289,7 +289,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
#else
h = gethostbyname(hostname);
#endif
if (!h)
if(!h)
infof(conn->data, "gethostbyname(2) failed for %s\n", hostname);
#endif /*HAVE_GETHOSTBYNAME_R */
}
@ -297,7 +297,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
if(h) {
ai = Curl_he2ai(h, port);
if (buf) /* used a *_r() function */
if(buf) /* used a *_r() function */
free(buf);
}

View File

@ -185,7 +185,7 @@ bool Curl_ipvalid(struct SessionHandle *data)
if(data->set.ip_version == CURL_IPRESOLVE_V6) {
/* see if we have an IPv6 stack */
curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0);
if (s == CURL_SOCKET_BAD)
if(s == CURL_SOCKET_BAD)
/* an ipv6 address was requested and we can't get/use one */
return FALSE;
sclose(s);
@ -204,7 +204,7 @@ static void dump_addrinfo(struct connectdata *conn, const struct addrinfo *ai)
printf(" fam %2d, CNAME %s, ",
ai->ai_family, ai->ai_canonname ? ai->ai_canonname : "<none>");
if (Curl_printable_address(ai, buf, sizeof(buf)))
if(Curl_printable_address(ai, buf, sizeof(buf)))
printf("%s\n", buf);
else
printf("failed; %s\n", Curl_strerror(conn, SOCKERRNO));
@ -241,7 +241,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
/* see if we have an IPv6 stack */
s = socket(PF_INET6, SOCK_DGRAM, 0);
if (s == CURL_SOCKET_BAD) {
if(s == CURL_SOCKET_BAD) {
/* Some non-IPv6 stacks have been found to make very slow name resolves
* when PF_UNSPEC is used, so thus we switch to a mere PF_INET lookup if
* the stack seems to be a non-ipv6 one. */
@ -290,7 +290,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
sbufptr=sbuf;
}
error = getaddrinfo(hostname, sbufptr, &hints, &res);
if (error) {
if(error) {
infof(data, "getaddrinfo(3) failed for %s:%d\n", hostname, port);
return NULL;
}

View File

@ -118,7 +118,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
/* the original data is written to the client, but we go on with the
chunk read process, to properly calculate the content length*/
if (data->set.http_te_skip && !k->ignorebody)
if(data->set.http_te_skip && !k->ignorebody)
Curl_client_write(conn, CLIENTWRITE_BODY, datap,datalen);
while(length) {
@ -178,7 +178,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
if(*datap == 0x0a) {
/* we're now expecting data to come, unless size was zero! */
if(0 == ch->datasize) {
if (conn->bits.trailerHdrPresent!=TRUE) {
if(conn->bits.trailerHdrPresent!=TRUE) {
/* No Trailer: header found - revert to original Curl processing */
ch->state = CHUNK_STOPCR;
@ -221,7 +221,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
case IDENTITY:
#endif
if(!k->ignorebody) {
if ( !data->set.http_te_skip )
if( !data->set.http_te_skip )
result = Curl_client_write(conn, CLIENTWRITE_BODY, datap,
piece);
else
@ -298,7 +298,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
case CHUNK_TRAILER:
/* conn->trailer is assumed to be freed in url.c on a
connection basis */
if (conn->trlPos >= conn->trlMax) {
if(conn->trlPos >= conn->trlMax) {
char *ptr;
if(conn->trlMax) {
conn->trlMax *= 2;
@ -333,10 +333,10 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
break;
case CHUNK_TRAILER_POSTCR:
if (*datap == 0x0a) {
if(*datap == 0x0a) {
conn->trailer[conn->trlPos++]=0x0a;
conn->trailer[conn->trlPos]=0;
if (conn->trlPos==2) {
if(conn->trlPos==2) {
ch->state = CHUNK_STOP;
datap++;
length--;
@ -362,7 +362,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
return(CHUNKE_BAD_CHUNK);
}
#endif /* CURL_DOES_CONVERSIONS */
if ( !data->set.http_te_skip )
if( !data->set.http_te_skip )
Curl_client_write(conn, CLIENTWRITE_HEADER,
conn->trailer, conn->trlPos);
}
@ -389,7 +389,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
break;
case CHUNK_STOP:
if (*datap == 0x0a) {
if(*datap == 0x0a) {
datap++;
length--;

View File

@ -133,23 +133,23 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
if(!tmp)
return CURLDIGEST_NOMEM;
token = strtok_r(tmp, ",", &tok_buf);
while (token != NULL) {
if (strequal(token, "auth")) {
while(token != NULL) {
if(strequal(token, "auth")) {
foundAuth = TRUE;
}
else if (strequal(token, "auth-int")) {
else if(strequal(token, "auth-int")) {
foundAuthInt = TRUE;
}
token = strtok_r(NULL, ",", &tok_buf);
}
free(tmp);
/*select only auth o auth-int. Otherwise, ignore*/
if (foundAuth) {
if(foundAuth) {
d->qop = strdup("auth");
if(!d->qop)
return CURLDIGEST_NOMEM;
}
else if (foundAuthInt) {
else if(foundAuthInt) {
d->qop = strdup("auth-int");
if(!d->qop)
return CURLDIGEST_NOMEM;
@ -243,7 +243,7 @@ CURLcode Curl_output_digest(struct connectdata *conn,
*/
#define CURL_OUTPUT_DIGEST_CONV(a, b) \
rc = Curl_convert_to_network(a, (char *)b, strlen((const char*)b)); \
if (rc != CURLE_OK) { \
if(rc != CURLE_OK) { \
free(b); \
return rc; \
}
@ -266,7 +266,7 @@ CURLcode Curl_output_digest(struct connectdata *conn,
authp = &data->state.authhost;
}
if (*allocuserpwd) {
if(*allocuserpwd) {
Curl_safefree(*allocuserpwd);
*allocuserpwd = NULL;
}
@ -353,7 +353,7 @@ CURLcode Curl_output_digest(struct connectdata *conn,
return CURLE_OUT_OF_MEMORY;
}
if (d->qop && strequal(d->qop, "auth-int")) {
if(d->qop && strequal(d->qop, "auth-int")) {
/* We don't support auth-int at the moment. I can't see a easy way to get
entity-body here */
/* TODO: Append H(entity-body)*/
@ -363,7 +363,7 @@ CURLcode Curl_output_digest(struct connectdata *conn,
free(md5this); /* free this again */
md5_to_ascii(md5buf, ha2);
if (d->qop) {
if(d->qop) {
md5this = (unsigned char *)aprintf("%s:%s:%08x:%s:%s:%s",
ha1,
d->nonce,
@ -393,7 +393,7 @@ CURLcode Curl_output_digest(struct connectdata *conn,
nonce="1053604145", uri="/64", response="c55f7f30d83d774a3d2dcacf725abaca"
*/
if (d->qop) {
if(d->qop) {
*allocuserpwd =
aprintf( "%sAuthorization: Digest "
"username=\"%s\", "

View File

@ -91,7 +91,7 @@ char *Curl_if2ip(const char *interface, char *buf, int buf_size)
return NULL;
dummy = socket(AF_INET, SOCK_STREAM, 0);
if (SYS_ERROR == dummy) {
if(SYS_ERROR == dummy) {
return NULL;
}
else {
@ -105,9 +105,9 @@ char *Curl_if2ip(const char *interface, char *buf, int buf_size)
memcpy(req.ifr_name, interface, len+1);
req.ifr_addr.sa_family = AF_INET;
#ifdef IOCTL_3_ARGS
if (SYS_ERROR == ioctl(dummy, SIOCGIFADDR, &req)) {
if(SYS_ERROR == ioctl(dummy, SIOCGIFADDR, &req)) {
#else
if (SYS_ERROR == ioctl(dummy, SIOCGIFADDR, &req, sizeof(req))) {
if(SYS_ERROR == ioctl(dummy, SIOCGIFADDR, &req, sizeof(req))) {
#endif
sclose(dummy);
return NULL;

View File

@ -79,7 +79,7 @@ static char *inet_ntop4 (const unsigned char *src, char *dst, size_t size)
#else
const char *addr = inet_ntoa(*(struct in_addr*)src);
if (strlen(addr) >= size)
if(strlen(addr) >= size)
{
SET_ERRNO(ENOSPC);
return (NULL);
@ -125,23 +125,23 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)
for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++)
{
if (words[i] == 0)
if(words[i] == 0)
{
if (cur.base == -1)
if(cur.base == -1)
cur.base = i, cur.len = 1;
else
cur.len++;
}
else if (cur.base != -1)
else if(cur.base != -1)
{
if (best.base == -1 || cur.len > best.len)
if(best.base == -1 || cur.len > best.len)
best = cur;
cur.base = -1;
}
}
if ((cur.base != -1) && (best.base == -1 || cur.len > best.len))
if((cur.base != -1) && (best.base == -1 || cur.len > best.len))
best = cur;
if (best.base != -1 && best.len < 2)
if(best.base != -1 && best.len < 2)
best.base = -1;
/* Format the result.
@ -151,24 +151,24 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)
{
/* Are we inside the best run of 0x00's?
*/
if (best.base != -1 && i >= best.base && i < (best.base + best.len))
if(best.base != -1 && i >= best.base && i < (best.base + best.len))
{
if (i == best.base)
if(i == best.base)
*tp++ = ':';
continue;
}
/* Are we following an initial run of 0x00s or any real hex?
*/
if (i != 0)
if(i != 0)
*tp++ = ':';
/* Is this address an encapsulated IPv4?
*/
if (i == 6 && best.base == 0 &&
if(i == 6 && best.base == 0 &&
(best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
{
if (!inet_ntop4(src+12, tp, sizeof(tmp) - (tp - tmp)))
if(!inet_ntop4(src+12, tp, sizeof(tmp) - (tp - tmp)))
{
SET_ERRNO(ENOSPC);
return (NULL);
@ -181,13 +181,13 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)
/* Was it a trailing run of 0x00's?
*/
if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ))
if(best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ))
*tp++ = ':';
*tp++ = '\0';
/* Check for overflow, copy, and we're done.
*/
if ((size_t)(tp - tmp) > size)
if((size_t)(tp - tmp) > size)
{
SET_ERRNO(ENOSPC);
return (NULL);

View File

@ -108,7 +108,7 @@ inet_pton4(const char *src, unsigned char *dst)
octets = 0;
tp = tmp;
*tp = 0;
while ((ch = *src++) != '\0') {
while((ch = *src++) != '\0') {
const char *pch;
if((pch = strchr(digits, ch)) != NULL) {
@ -173,7 +173,7 @@ inet_pton6(const char *src, unsigned char *dst)
curtok = src;
saw_xdigit = 0;
val = 0;
while ((ch = *src++) != '\0') {
while((ch = *src++) != '\0') {
const char *pch;
if((pch = strchr((xdigits = xdigits_l), ch)) == NULL)

View File

@ -97,7 +97,7 @@ strlcpy (char *dst, const char *src, size_t dst_sz)
++p, ++src, ++n)
*p = *src;
*p = '\0';
if (*src == '\0')
if(*src == '\0')
return n;
else
return n + strlen (src);
@ -228,17 +228,17 @@ krb4_auth(void *app_data, struct connectdata *conn)
}
#ifdef HAVE_KRB_GET_OUR_IP_FOR_REALM
if (krb_get_config_bool("nat_in_use")) {
if(krb_get_config_bool("nat_in_use")) {
struct sockaddr_in *localaddr = (struct sockaddr_in *)LOCAL_ADDR;
struct in_addr natAddr;
if (krb_get_our_ip_for_realm(krb_realmofhost(host),
if(krb_get_our_ip_for_realm(krb_realmofhost(host),
&natAddr) != KSUCCESS
&& krb_get_our_ip_for_realm(NULL, &natAddr) != KSUCCESS)
infof(data, "Can't get address for realm %s\n",
krb_realmofhost(host));
else {
if (natAddr.s_addr != localaddr->sin_addr.s_addr) {
if(natAddr.s_addr != localaddr->sin_addr.s_addr) {
#ifdef HAVE_INET_NTOA_R
char ntoa_buf[64];
char *ip = (char *)inet_ntoa_r(natAddr, ntoa_buf, sizeof(ntoa_buf));
@ -387,7 +387,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
des_pcbc_encrypt((void *)tkt.dat, (void *)tktcopy.dat,
tkt.length,
schedule, &key, DES_DECRYPT);
if (strcmp ((char*)tktcopy.dat + 8,
if(strcmp ((char*)tktcopy.dat + 8,
KRB_TICKET_GRANTING_TICKET) != 0) {
afs_string_to_key(passwd,
krb_realmofhost(conn->host.name),

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2007, 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
@ -68,7 +68,7 @@ Curl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e,
return 0;
ne->ptr = (void *) p;
if (list->size == 0) {
if(list->size == 0) {
list->head = ne;
list->head->prev = NULL;
list->head->next = NULL;
@ -77,7 +77,7 @@ Curl_llist_insert_next(struct curl_llist *list, struct curl_llist_element *e,
else {
ne->next = e->next;
ne->prev = e;
if (e->next) {
if(e->next) {
e->next->prev = ne;
}
else {
@ -95,19 +95,19 @@ int
Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e,
void *user)
{
if (e == NULL || list->size == 0)
if(e == NULL || list->size == 0)
return 1;
if (e == list->head) {
if(e == list->head) {
list->head = e->next;
if (list->head == NULL)
if(list->head == NULL)
list->tail = NULL;
else
e->next->prev = NULL;
} else {
e->prev->next = e->next;
if (!e->next)
if(!e->next)
list->tail = e->prev;
else
e->next->prev = e->prev;
@ -124,7 +124,7 @@ void
Curl_llist_destroy(struct curl_llist *list, void *user)
{
if(list) {
while (list->size > 0)
while(list->size > 0)
Curl_llist_remove(list, list->tail, user);
free(list);

View File

@ -1,16 +1,16 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2007, 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
* are also available at http://curl.haxx.se/docs/copyright.html.
*
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
@ -161,21 +161,21 @@ static void MD5_Update (struct md5_ctx *context, /* context */
bufindex = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((UINT4)inputLen << 3))
if((context->count[0] += ((UINT4)inputLen << 3))
< ((UINT4)inputLen << 3))
context->count[1]++;
context->count[1] += ((UINT4)inputLen >> 29);
partLen = 64 - bufindex;
/* Transform as many times as possible. */
if (inputLen >= partLen) {
if(inputLen >= partLen) {
memcpy((void *)&context->buffer[bufindex], (void *)input, partLen);
MD5Transform(context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
MD5Transform(context->state, &input[i]);
bufindex = 0;
}
else

View File

@ -71,7 +71,7 @@ static long memsize = 0; /* set number of mallocs allowed */
/* this sets the log file name */
void curl_memdebug(const char *logname)
{
if (!logfile) {
if(!logfile) {
if(logname)
logfile = fopen(logname, "w");
else
@ -87,7 +87,7 @@ void curl_memdebug(const char *logname)
successfully! */
void curl_memlimit(long limit)
{
if (!memlimit) {
if(!memlimit) {
memlimit = TRUE;
memsize = limit;
}
@ -185,8 +185,8 @@ char *curl_dostrdup(const char *str, int line, const char *source)
len=strlen(str)+1;
mem=curl_domalloc(len, 0, NULL); /* NULL prevents logging */
if (mem)
memcpy(mem, str, len);
if(mem)
memcpy(mem, str, len);
if(logfile)
fprintf(logfile, "MEM %s:%d strdup(%p) (%zd) = %p\n",

View File

@ -99,7 +99,7 @@ int Curl_parsenetrc(char *host,
char *override = curl_getenv("CURL_DEBUG_NETRC");
if (override) {
if(override) {
fprintf(stderr, "NETRC: overridden " NETRC " file: %s\n", override);
netrcfile = override;
netrc_alloc = TRUE;
@ -115,7 +115,7 @@ int Curl_parsenetrc(char *host,
else {
struct passwd *pw;
pw= getpwuid(geteuid());
if (pw) {
if(pw) {
#ifdef VMS
home = decc$translate_vms(pw->pw_dir);
#else
@ -148,7 +148,7 @@ int Curl_parsenetrc(char *host,
tok=strtok_r(netrcbuffer, " \t\n", &tok_buf);
while(!done && tok) {
if (login[0] && password[0]) {
if(login[0] && password[0]) {
done=TRUE;
break;
}
@ -179,7 +179,7 @@ int Curl_parsenetrc(char *host,
case HOSTVALID:
/* we are now parsing sub-keywords concerning "our" host */
if(state_login) {
if (specific_login) {
if(specific_login) {
state_our_login = strequal(login, tok);
}
else {
@ -191,7 +191,7 @@ int Curl_parsenetrc(char *host,
state_login=0;
}
else if(state_password) {
if (state_our_login || !specific_login) {
if(state_our_login || !specific_login) {
strncpy(password, tok, PASSWORDSIZE-1);
#ifdef _NETRC_DEBUG
fprintf(stderr, "PASSWORD: %s\n", password);
@ -212,7 +212,7 @@ int Curl_parsenetrc(char *host,
} /* switch (state) */
tok = strtok_r(NULL, " \t\n", &tok_buf);
} /* while (tok) */
} /* while(tok) */
} /* while fgets() */
fclose(file);

View File

@ -82,7 +82,7 @@ int _NonAppStart( void *NLMHandle,
const char **messages )
{
NX_LOCK_INFO_ALLOC(liblock, "Per-Application Data Lock", 0);
#ifndef __GNUC__
#pragma unused(cmdLine)
#pragma unused(loadDirPath)
@ -105,7 +105,7 @@ int _NonAppStart( void *NLMHandle,
"<library-name> memory allocations",
AllocSignature);
if (!gAllocTag) {
if(!gAllocTag) {
OutputToScreen(errorScreen, "Unable to allocate resource tag for "
"library memory allocations.\n");
return -1;
@ -113,7 +113,7 @@ int _NonAppStart( void *NLMHandle,
gLibId = register_library(DisposeLibraryData);
if (gLibId < -1) {
if(gLibId < -1) {
OutputToScreen(errorScreen, "Unable to register library with kernel.\n");
return -1;
}
@ -121,8 +121,8 @@ int _NonAppStart( void *NLMHandle,
gLibHandle = NLMHandle;
gLibLock = NXMutexAlloc(0, 0, &liblock);
if (!gLibLock) {
if(!gLibLock) {
OutputToScreen(errorScreen, "Unable to allocate library data lock.\n");
return -1;
}
@ -175,7 +175,7 @@ int GetOrSetUpData(int id, libdata_t **appData,
*/
app_data = (libdata_t *) get_app_data(id);
if (!app_data) {
if(!app_data) {
/*
** This application hasn't called us before; set up application AND per-thread
** data. Of course, just in case a thread from this same application is calling
@ -186,25 +186,25 @@ int GetOrSetUpData(int id, libdata_t **appData,
*/
NXLock(gLibLock);
if (!(app_data = (libdata_t *) get_app_data(id))) {
if(!(app_data = (libdata_t *) get_app_data(id))) {
app_data = (libdata_t *) malloc(sizeof(libdata_t));
if (app_data) {
if(app_data) {
memset(app_data, 0, sizeof(libdata_t));
app_data->tenbytes = malloc(10);
app_data->lock = NXMutexAlloc(0, 0, &liblock);
if (!app_data->tenbytes || !app_data->lock) {
if (app_data->lock)
if(!app_data->tenbytes || !app_data->lock) {
if(app_data->lock)
NXMutexFree(app_data->lock);
free(app_data);
app_data = (libdata_t *) NULL;
err = ENOMEM;
}
if (app_data) {
if(app_data) {
/*
** Here we burn in the application data that we were trying to get by calling
** get_app_data(). Next time we call the first function, we'll get this data
@ -213,8 +213,8 @@ int GetOrSetUpData(int id, libdata_t **appData,
** thread the first time it calls us.
*/
err = set_app_data(gLibId, app_data);
if (err) {
if(err) {
free(app_data);
app_data = (libdata_t *) NULL;
err = ENOMEM;
@ -222,23 +222,23 @@ int GetOrSetUpData(int id, libdata_t **appData,
else {
/* create key for thread-specific data... */
err = NXKeyCreate(DisposeThreadData, (void *) NULL, &key);
if (err) /* (no more keys left?) */
if(err) /* (no more keys left?) */
key = -1;
app_data->perthreadkey = key;
}
}
}
}
NXUnlock(gLibLock);
}
if (app_data) {
if(app_data) {
key = app_data->perthreadkey;
if (key != -1 /* couldn't create a key? no thread data */
if(key != -1 /* couldn't create a key? no thread data */
&& !(err = NXKeyGetValue(key, (void **) &thread_data))
&& !thread_data) {
/*
@ -249,18 +249,18 @@ int GetOrSetUpData(int id, libdata_t **appData,
** complex per-thread data.
*/
thread_data = (libthreaddata_t *) malloc(sizeof(libthreaddata_t));
if (thread_data) {
if(thread_data) {
thread_data->_errno = 0;
thread_data->twentybytes = malloc(20);
if (!thread_data->twentybytes) {
if(!thread_data->twentybytes) {
free(thread_data);
thread_data = (libthreaddata_t *) NULL;
err = ENOMEM;
}
if ((err = NXKeySetValue(key, thread_data))) {
if((err = NXKeySetValue(key, thread_data))) {
free(thread_data->twentybytes);
free(thread_data);
thread_data = (libthreaddata_t *) NULL;
@ -269,10 +269,10 @@ int GetOrSetUpData(int id, libdata_t **appData,
}
}
if (appData)
if(appData)
*appData = app_data;
if (threadData)
if(threadData)
*threadData = thread_data;
return err;
@ -280,12 +280,12 @@ int GetOrSetUpData(int id, libdata_t **appData,
int DisposeLibraryData( void *data )
{
if (data) {
if(data) {
void *tenbytes = ((libdata_t *) data)->tenbytes;
if (tenbytes)
if(tenbytes)
free(tenbytes);
free(data);
}
@ -294,12 +294,12 @@ int DisposeLibraryData( void *data )
void DisposeThreadData( void *data )
{
if (data) {
if(data) {
void *twentybytes = ((libthreaddata_t *) data)->twentybytes;
if (twentybytes)
if(twentybytes)
free(twentybytes);
free(data);
}
}
@ -312,7 +312,7 @@ int main ( void )
{
/* initialize any globals here... */
/* do this if any global initializing was done
/* do this if any global initializing was done
SynchronizeStart();
*/
ExitThread (TSR_THREAD, 0);

View File

@ -57,17 +57,17 @@ int netware_init ( void )
/* import UseAccurateCaseForPaths dynamically for NW3.x compatibility */
void (*pUseAccurateCaseForPaths)(int) = (void(*)(int))
ImportSymbol(myHandle, "UseAccurateCaseForPaths");
if (pUnAugmentAsterisk)
if(pUnAugmentAsterisk)
pUnAugmentAsterisk(1);
if (pUseAccurateCaseForPaths)
if(pUseAccurateCaseForPaths)
pUseAccurateCaseForPaths(1);
UnimportSymbol(myHandle, "UnAugmentAsterisk");
UnimportSymbol(myHandle, "UseAccurateCaseForPaths");
/* set long name space */
if ((SetCurrentNameSpace(4) == 255)) {
if((SetCurrentNameSpace(4) == 255)) {
rc = 1;
}
if ((SetTargetNameSpace(4) == 255)) {
if((SetTargetNameSpace(4) == 255)) {
rc = rc + 2;
}
return rc;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2007, 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
@ -325,7 +325,7 @@ static time_t Curl_parsedate(const char *date)
yearnum = val;
found = TRUE;
if(yearnum < 1900) {
if (yearnum > 70)
if(yearnum > 70)
yearnum += 1900;
else
yearnum += 2000;

View File

@ -80,10 +80,10 @@ static CURLcode Curl_qsossl_init_session(struct SessionHandle * data)
certname = data->set.str[STRING_CERT];
if (!certname) {
if(!certname) {
certname = data->set.str[STRING_SSL_CAFILE];
if (!certname)
if(!certname)
return CURLE_OK; /* Use previous setup. */
}
@ -94,7 +94,7 @@ static CURLcode Curl_qsossl_init_session(struct SessionHandle * data)
initappstr.sessionType = SSL_REGISTERED_AS_CLIENT;
rc = SSL_Init_Application(&initappstr);
if (rc == SSL_ERROR_NOT_REGISTERED) {
if(rc == SSL_ERROR_NOT_REGISTERED) {
initstr.keyringFileName = certname;
initstr.keyringPassword = data->set.str[STRING_KEY];
initstr.cipherSuiteList = NULL; /* Use default. */
@ -141,7 +141,7 @@ static CURLcode Curl_qsossl_create(struct connectdata * conn, int sockindex)
h = SSL_Create(conn->sock[sockindex], SSL_ENCRYPT);
if (!h) {
if(!h) {
failf(conn->data, "SSL_Create() I/O error: %s\n", strerror(errno));
return CURLE_SSL_CONNECT_ERROR;
}
@ -169,17 +169,17 @@ static CURLcode Curl_qsossl_handshake(struct connectdata * conn, int sockindex)
h->exitPgm = NULL;
if (!data->set.ssl.verifyhost)
if(!data->set.ssl.verifyhost)
h->exitPgm = Curl_qsossl_trap_cert;
if (data->set.connecttimeout) {
if(data->set.connecttimeout) {
timeout_ms = data->set.connecttimeout;
if (data->set.timeout)
if (timeout_ms > data->set.timeout)
if(data->set.timeout)
if(timeout_ms > data->set.timeout)
timeout_ms = data->set.timeout;
}
else if (data->set.timeout)
else if(data->set.timeout)
timeout_ms = data->set.timeout;
else
timeout_ms = DEFAULT_CONNECT_TIMEOUT;
@ -253,10 +253,10 @@ CURLcode Curl_qsossl_connect(struct connectdata * conn, int sockindex)
rc = Curl_qsossl_init_session(data);
if (rc == CURLE_OK) {
if(rc == CURLE_OK) {
rc = Curl_qsossl_create(conn, sockindex);
if (rc == CURLE_OK)
if(rc == CURLE_OK)
rc = Curl_qsossl_handshake(conn, sockindex);
else {
SSL_Destroy(connssl->handle);
@ -281,7 +281,7 @@ static int Curl_qsossl_close_one(struct ssl_connect_data * conn,
rc = SSL_Destroy(conn->handle);
if(rc) {
if (rc == SSL_ERROR_IO) {
if(rc == SSL_ERROR_IO) {
failf(data, "SSL_Destroy() I/O error: %s\n", strerror(errno));
return -1;
}
@ -326,13 +326,13 @@ int Curl_qsossl_shutdown(struct connectdata * conn, int sockindex)
int rc;
char buf[120];
if (!connssl->handle)
if(!connssl->handle)
return 0;
if (data->set.ftp_ccc != CURLFTPSSL_CCC_ACTIVE)
if(data->set.ftp_ccc != CURLFTPSSL_CCC_ACTIVE)
return 0;
if (Curl_qsossl_close_one(connssl, data))
if(Curl_qsossl_close_one(connssl, data))
return -1;
rc = 0;
@ -341,14 +341,14 @@ int Curl_qsossl_shutdown(struct connectdata * conn, int sockindex)
CURL_SOCKET_BAD, SSL_SHUTDOWN_TIMEOUT);
for (;;) {
if (what < 0) {
if(what < 0) {
/* anything that gets here is fatally bad */
failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
rc = -1;
break;
}
if (!what) { /* timeout */
if(!what) { /* timeout */
failf(data, "SSL shutdown timeout");
break;
}
@ -358,12 +358,12 @@ int Curl_qsossl_shutdown(struct connectdata * conn, int sockindex)
nread = read(conn->sock[sockindex], buf, sizeof(buf));
if (nread < 0) {
if(nread < 0) {
failf(data, "read: %s\n", strerror(errno));
rc = -1;
}
if (nread <= 0)
if(nread <= 0)
break;
what = Curl_socket_ready(conn->sock[sockindex], CURL_SOCKET_BAD, 0);
@ -470,13 +470,13 @@ int Curl_qsossl_check_cxn(struct connectdata * cxn)
/* The only thing that can be tested here is at the socket level. */
if (!cxn->ssl[FIRSTSOCKET].handle)
if(!cxn->ssl[FIRSTSOCKET].handle)
return 0; /* connection has been closed */
err = 0;
errlen = sizeof err;
if (getsockopt(cxn->sock[FIRSTSOCKET], SOL_SOCKET, SO_ERROR,
if(getsockopt(cxn->sock[FIRSTSOCKET], SOL_SOCKET, SO_ERROR,
(unsigned char *) &err, &errlen) ||
errlen != sizeof err || err)
return 0; /* connection has been closed */

View File

@ -9,6 +9,9 @@
*
* Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
*
* Copyright (C) 2001 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -67,13 +70,13 @@
#define min(a, b) ((a) < (b) ? (a) : (b))
static const struct {
enum protection_level level;
const char *name;
enum protection_level level;
const char *name;
} level_names[] = {
{ prot_clear, "clear" },
{ prot_safe, "safe" },
{ prot_confidential, "confidential" },
{ prot_private, "private" }
{ prot_clear, "clear" },
{ prot_safe, "safe" },
{ prot_confidential, "confidential" },
{ prot_private, "private" }
};
static enum protection_level
@ -88,12 +91,12 @@ name_to_level(const char *name)
static const struct Curl_sec_client_mech * const mechs[] = {
#ifdef HAVE_GSSAPI
&Curl_krb5_client_mech,
&Curl_krb5_client_mech,
#endif
#ifdef HAVE_KRB4
&Curl_krb4_client_mech,
&Curl_krb4_client_mech,
#endif
NULL
NULL
};
int
@ -116,11 +119,11 @@ block_read(int fd, void *buf, size_t len)
int b;
while(len) {
b = read(fd, p, len);
if (b == 0)
if(b == 0)
return 0;
else if (b < 0 && (errno == EINTR || errno == EAGAIN))
else if(b < 0 && (errno == EINTR || errno == EAGAIN))
continue;
else if (b < 0)
else if(b < 0)
return -1;
len -= b;
p += b;
@ -135,7 +138,7 @@ block_write(int fd, const void *buf, size_t len)
int b;
while(len) {
b = write(fd, p, len);
if (b < 0 && (errno == EINTR || errno == EAGAIN))
if(b < 0 && (errno == EINTR || errno == EAGAIN))
continue;
else if(b < 0)
return -1;
@ -153,16 +156,16 @@ sec_get_data(struct connectdata *conn,
int b;
b = block_read(fd, &len, sizeof(len));
if (b == 0)
if(b == 0)
return 0;
else if (b < 0)
else if(b < 0)
return -1;
len = ntohl(len);
buf->data = realloc(buf->data, len);
b = buf->data ? block_read(fd, buf->data, len) : -1;
if (b == 0)
if(b == 0)
return 0;
else if (b < 0)
else if(b < 0)
return -1;
buf->size = (conn->mech->decode)(conn->app_data, buf->data, len,
conn->data_prot, conn);
@ -173,64 +176,64 @@ sec_get_data(struct connectdata *conn,
static size_t
buffer_read(struct krb4buffer *buf, void *data, size_t len)
{
len = min(len, buf->size - buf->index);
memcpy(data, (char*)buf->data + buf->index, len);
buf->index += len;
return len;
len = min(len, buf->size - buf->index);
memcpy(data, (char*)buf->data + buf->index, len);
buf->index += len;
return len;
}
static size_t
buffer_write(struct krb4buffer *buf, void *data, size_t len)
{
if(buf->index + len > buf->size) {
void *tmp;
if(buf->data == NULL)
tmp = malloc(1024);
else
tmp = realloc(buf->data, buf->index + len);
if(tmp == NULL)
return -1;
buf->data = tmp;
buf->size = buf->index + len;
}
memcpy((char*)buf->data + buf->index, data, len);
buf->index += len;
return len;
if(buf->index + len > buf->size) {
void *tmp;
if(buf->data == NULL)
tmp = malloc(1024);
else
tmp = realloc(buf->data, buf->index + len);
if(tmp == NULL)
return -1;
buf->data = tmp;
buf->size = buf->index + len;
}
memcpy((char*)buf->data + buf->index, data, len);
buf->index += len;
return len;
}
int
Curl_sec_read(struct connectdata *conn, int fd, void *buffer, int length)
{
size_t len;
int rx = 0;
size_t len;
int rx = 0;
if(conn->sec_complete == 0 || conn->data_prot == 0)
return read(fd, buffer, length);
if(conn->sec_complete == 0 || conn->data_prot == 0)
return read(fd, buffer, length);
if(conn->in_buffer.eof_flag){
conn->in_buffer.eof_flag = 0;
return 0;
if(conn->in_buffer.eof_flag){
conn->in_buffer.eof_flag = 0;
return 0;
}
len = buffer_read(&conn->in_buffer, buffer, length);
length -= len;
rx += len;
buffer = (char*)buffer + len;
while(length) {
if(sec_get_data(conn, fd, &conn->in_buffer) < 0)
return -1;
if(conn->in_buffer.size == 0) {
if(rx)
conn->in_buffer.eof_flag = 1;
return rx;
}
len = buffer_read(&conn->in_buffer, buffer, length);
length -= len;
rx += len;
buffer = (char*)buffer + len;
while(length) {
if(sec_get_data(conn, fd, &conn->in_buffer) < 0)
return -1;
if(conn->in_buffer.size == 0) {
if(rx)
conn->in_buffer.eof_flag = 1;
return rx;
}
len = buffer_read(&conn->in_buffer, buffer, length);
length -= len;
rx += len;
buffer = (char*)buffer + len;
}
return rx;
}
return rx;
}
static int
@ -255,15 +258,17 @@ sec_send(struct connectdata *conn, int fd, char *from, int length)
bytes = Curl_base64_encode(conn->data, (char *)buf, bytes, &cmdbuf);
if(bytes > 0) {
if(protlevel == prot_private)
block_write(fd, "ENC ", 4);
block_write(fd, "ENC ", 4);
else
block_write(fd, "MIC ", 4);
block_write(fd, "MIC ", 4);
block_write(fd, cmdbuf, bytes);
block_write(fd, "\r\n", 2);
Curl_infof(conn->data, "%s %s\n", protlevel == prot_private ? "ENC" : "MIC", cmdbuf);
Curl_infof(conn->data, "%s %s\n",
protlevel == prot_private ? "ENC" : "MIC", cmdbuf);
free(cmdbuf);
}
} else {
}
else {
bytes = htonl(bytes);
block_write(fd, &bytes, sizeof(bytes));
block_write(fd, buf, ntohl(bytes));
@ -278,7 +283,7 @@ Curl_sec_fflush_fd(struct connectdata *conn, int fd)
if(conn->data_prot != prot_clear) {
if(conn->out_buffer.index > 0){
Curl_sec_write(conn, fd,
conn->out_buffer.data, conn->out_buffer.index);
conn->out_buffer.data, conn->out_buffer.index);
conn->out_buffer.index = 0;
}
sec_send(conn, fd, NULL, 0);
@ -457,7 +462,7 @@ Curl_sec_login(struct connectdata *conn)
void *tmp;
tmp = realloc(conn->app_data, (*m)->size);
if (tmp == NULL) {
if(tmp == NULL) {
failf (data, "realloc %u failed", (*m)->size);
return -1;
}
@ -518,7 +523,7 @@ Curl_sec_login(struct connectdata *conn)
void
Curl_sec_end(struct connectdata *conn)
{
if (conn->mech != NULL) {
if(conn->mech != NULL) {
if(conn->mech->end)
(conn->mech->end)(conn->app_data);
memset(conn->app_data, 0, conn->mech->size);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2007, 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
@ -38,7 +38,7 @@ curl_share_init(void)
{
struct Curl_share *share =
(struct Curl_share *)malloc(sizeof(struct Curl_share));
if (share) {
if(share) {
memset (share, 0, sizeof(struct Curl_share));
share->specifier |= (1<<CURL_LOCK_DATA_SHARE);
}
@ -56,7 +56,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
curl_unlock_function unlockfunc;
void *ptr;
if (share->dirty)
if(share->dirty)
/* don't allow setting options while one or more handles are already
using this share */
return CURLSHE_IN_USE;
@ -70,7 +70,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
share->specifier |= (1<<type);
switch( type ) {
case CURL_LOCK_DATA_DNS:
if (!share->hostcache) {
if(!share->hostcache) {
share->hostcache = Curl_mk_dnscache();
if(!share->hostcache)
return CURLSHE_NOMEM;
@ -79,7 +79,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
case CURL_LOCK_DATA_COOKIE:
if (!share->cookies) {
if(!share->cookies) {
share->cookies = Curl_cookie_init(NULL, NULL, NULL, TRUE );
if(!share->cookies)
return CURLSHE_NOMEM;
@ -102,7 +102,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
switch( type )
{
case CURL_LOCK_DATA_DNS:
if (share->hostcache) {
if(share->hostcache) {
Curl_hash_destroy(share->hostcache);
share->hostcache = NULL;
}
@ -110,7 +110,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
case CURL_LOCK_DATA_COOKIE:
if (share->cookies) {
if(share->cookies) {
Curl_cookie_cleanup(share->cookies);
share->cookies = NULL;
}
@ -155,14 +155,14 @@ curl_share_cleanup(CURLSH *sh)
{
struct Curl_share *share = (struct Curl_share *)sh;
if (share == NULL)
if(share == NULL)
return CURLSHE_INVALID;
if(share->lockfunc)
share->lockfunc(NULL, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE,
share->clientdata);
if (share->dirty) {
if(share->dirty) {
if(share->unlockfunc)
share->unlockfunc(NULL, CURL_LOCK_DATA_SHARE, share->clientdata);
return CURLSHE_IN_USE;
@ -190,7 +190,7 @@ Curl_share_lock(struct SessionHandle *data, curl_lock_data type,
{
struct Curl_share *share = data->share;
if (share == NULL)
if(share == NULL)
return CURLSHE_INVALID;
if(share->specifier & (1<<type)) {
@ -207,7 +207,7 @@ Curl_share_unlock(struct SessionHandle *data, curl_lock_data type)
{
struct Curl_share *share = data->share;
if (share == NULL)
if(share == NULL)
return CURLSHE_INVALID;
if(share->specifier & (1<<type)) {

View File

@ -1801,7 +1801,7 @@ static CURLcode ssh_easy_statemach(struct connectdata *conn)
struct ssh_conn *sshc = &conn->proto.sshc;
CURLcode result = CURLE_OK;
while (sshc->state != SSH_STOP) {
while(sshc->state != SSH_STOP) {
result = ssh_statemach_act(conn);
if(result) {
break;

View File

@ -383,7 +383,7 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
store->name = clone_host; /* clone host name */
store->remote_port = conn->remote_port; /* port number */
if (!Curl_clone_ssl_config(&conn->ssl_config, &store->ssl_config))
if(!Curl_clone_ssl_config(&conn->ssl_config, &store->ssl_config))
return CURLE_OUT_OF_MEMORY;
return CURLE_OK;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2007, 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
@ -30,12 +30,12 @@ char *curlx_strdup(const char *str)
int len;
char *newstr;
if (!str)
if(!str)
return (char *)NULL;
len = strlen(str);
newstr = (char *) malloc((len+1)*sizeof(char));
if (!newstr)
if(!newstr)
return (char *)NULL;
memcpy(newstr,str,(len+1)*sizeof(char));

View File

@ -52,8 +52,8 @@ int curl_strequal(const char *first, const char *second)
#elif defined(HAVE_STRICMP)
return !(stricmp)(first, second);
#else
while (*first && *second) {
if (toupper(*first) != toupper(*second)) {
while(*first && *second) {
if(toupper(*first) != toupper(*second)) {
break;
}
first++;
@ -72,8 +72,8 @@ int curl_strnequal(const char *first, const char *second, size_t max)
#elif defined(HAVE_STRICMP)
return !strnicmp(first, second, max);
#else
while (*first && *second && max) {
if (toupper(*first) != toupper(*second)) {
while(*first && *second && max) {
if(toupper(*first) != toupper(*second)) {
break;
}
max--;
@ -132,15 +132,15 @@ size_t Curl_strlcat(char *dst, const char *src, size_t siz)
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
while(n-- != 0 && *d != '\0')
d++;
dlen = d - dst;
n = siz - dlen;
if (n == 0)
if(n == 0)
return(dlen + strlen(s));
while (*s != '\0') {
if (n != 1) {
while(*s != '\0') {
if(n != 1) {
*d++ = *s;
n--;
}

View File

@ -294,7 +294,7 @@ curl_easy_strerror(CURLcode error)
*/
return "Unknown error";
#else
if (error == CURLE_OK)
if(error == CURLE_OK)
return "No error";
else
return "Error";
@ -336,7 +336,7 @@ curl_multi_strerror(CURLMcode error)
return "Unknown error";
#else
if (error == CURLM_OK)
if(error == CURLM_OK)
return "No error";
else
return "Error";
@ -369,7 +369,7 @@ curl_share_strerror(CURLSHcode error)
return "CURLSHcode unknown";
#else
if (error == CURLSHE_OK)
if(error == CURLSHE_OK)
return "No error";
else
return "Error";
@ -555,7 +555,7 @@ get_winsock_error (int err, char *buf, size_t len)
return NULL;
}
#else
if (err == CURLE_OK)
if(err == CURLE_OK)
return NULL;
else
p = "error";
@ -604,10 +604,10 @@ const char *Curl_strerror(struct connectdata *conn, int err)
#else
/* 'sys_nerr' is the maximum errno number, it is not widely portable */
if (err >= 0 && err < sys_nerr)
if(err >= 0 && err < sys_nerr)
strncpy(buf, strerror(err), max);
else {
if (!get_winsock_error(err, buf, max) &&
if(!get_winsock_error(err, buf, max) &&
!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
LANG_NEUTRAL, buf, (DWORD)max, NULL))
snprintf(buf, max, "Unknown error %d (%#x)", err, err);
@ -646,9 +646,9 @@ const char *Curl_strerror(struct connectdata *conn, int err)
buf[max] = '\0'; /* make sure the string is zero terminated */
/* strip trailing '\r\n' or '\n'. */
if ((p = strrchr(buf,'\n')) != NULL && (p - buf) >= 2)
if((p = strrchr(buf,'\n')) != NULL && (p - buf) >= 2)
*p = '\0';
if ((p = strrchr(buf,'\r')) != NULL && (p - buf) >= 1)
if((p = strrchr(buf,'\r')) != NULL && (p - buf) >= 1)
*p = '\0';
return buf;
}
@ -716,12 +716,12 @@ const char *Curl_idn_strerror (struct connectdata *conn, int err)
break;
}
#else
if ((Idna_rc)err == IDNA_SUCCESS)
if((Idna_rc)err == IDNA_SUCCESS)
str = "No error";
else
str = "Error";
#endif
if (str)
if(str)
strncpy(buf, str, max);
buf[max] = '\0';
return (buf);

View File

@ -1,16 +1,16 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2007, 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
* are also available at http://curl.haxx.se/docs/copyright.html.
*
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
@ -32,15 +32,15 @@
char *
Curl_strtok_r(char *ptr, const char *sep, char **end)
{
if (!ptr)
if(!ptr)
/* we got NULL input so then we get our last position instead */
ptr = *end;
/* pass all letters that are including in the separator string */
while (*ptr && strchr(sep, *ptr))
while(*ptr && strchr(sep, *ptr))
++ptr;
if (*ptr) {
if(*ptr) {
/* so this is where the next piece of string starts */
char *start = ptr;
@ -49,10 +49,10 @@ Curl_strtok_r(char *ptr, const char *sep, char **end)
/* scan through the string to find where it ends, it ends on a
null byte or a character that exists in the separator string */
while (**end && !strchr(sep, **end))
while(**end && !strchr(sep, **end))
++*end;
if (**end) {
if(**end) {
/* the end is not a null byte */
**end = '\0'; /* zero terminate it! */
++*end; /* advance the last pointer to beyond the null byte */

View File

@ -959,12 +959,12 @@ void telrcv(struct connectdata *conn,
struct TELNET *tn = (struct TELNET *)data->reqdata.proto.telnet;
#define startskipping() \
if (startwrite >= 0) \
if(startwrite >= 0) \
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)&inbuf[startwrite], in-startwrite); \
startwrite = -1
#define writebyte() \
if (startwrite < 0) \
if(startwrite < 0) \
startwrite = in
#define bufferflush() startskipping()

View File

@ -318,7 +318,7 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
file name so we skip the always-present first letter of the path string. */
filename = curl_easy_unescape(data, &state->conn->data->reqdata.path[1], 0,
NULL);
if (!filename)
if(!filename)
return CURLE_OUT_OF_MEMORY;
snprintf((char *)&state->spacket.data[2],
@ -377,12 +377,12 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event)
/* Is this the block we expect? */
rblock = getrpacketblock(&state->rpacket);
if ((state->block+1) != rblock) {
if((state->block+1) != rblock) {
/* No, log it, up the retry count and fail if over the limit */
infof(data,
"Received unexpected DATA packet block %d\n", rblock);
state->retries++;
if (state->retries>state->retry_max) {
if(state->retries>state->retry_max) {
failf(data, "tftp_rx: giving up waiting for block %d\n",
state->block+1);
return CURLE_TFTP_ILLEGAL;
@ -403,7 +403,7 @@ static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event)
}
/* Check if completed (That is, a less than full packet is received) */
if (state->rbytes < (int)sizeof(state->spacket)){
if(state->rbytes < (int)sizeof(state->spacket)){
state->state = TFTP_STATE_FIN;
}
else {
@ -742,7 +742,7 @@ static CURLcode Curl_tftp(struct connectdata *conn, bool *done)
failf(data, "%s\n", Curl_strerror(conn, error));
event = TFTP_EVENT_ERROR;
}
else if (rc==0) {
else if(rc==0) {
/* A timeout occured */
event = TFTP_EVENT_TIMEOUT;
@ -763,7 +763,7 @@ static CURLcode Curl_tftp(struct connectdata *conn, bool *done)
}
/* Sanity check packet length */
if (state->rbytes < 4) {
if(state->rbytes < 4) {
failf(conn->data, "Received too short packet\n");
/* Not a timeout, but how best to handle it? */
event = TFTP_EVENT_TIMEOUT;
@ -776,7 +776,7 @@ static CURLcode Curl_tftp(struct connectdata *conn, bool *done)
switch(event) {
case TFTP_EVENT_DATA:
/* Don't pass to the client empty or retransmitted packets */
if (state->rbytes > 4 &&
if(state->rbytes > 4 &&
((state->block+1) == getrpacketblock(&state->rpacket))) {
code = Curl_client_write(conn, CLIENTWRITE_BODY,
(char *)&state->rpacket.data[4],
@ -882,10 +882,10 @@ static CURLcode Curl_tftp_setup_connection(struct connectdata * conn)
* we'll try to get now! */
type = strstr(data->reqdata.path, ";mode=");
if (!type)
if(!type)
type = strstr(conn->host.rawalloc, ";mode=");
if (type) {
if(type) {
*type = 0; /* it was in the middle of the hostname */
command = (char) toupper((int) type[6]);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2007, 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
@ -61,10 +61,10 @@ char *curl_version(void)
left -= len;
ptr += len;
if (left > 1) {
if(left > 1) {
len = Curl_ssl_version(ptr + 1, left - 1);
if (len > 0) {
if(len > 0) {
*ptr = ' ';
left -= ++len;
ptr += len;