Skip to content

Commit

Permalink
if () => if()
Browse files Browse the repository at this point in the history
while () => while()
and some other minor re-indentings
  • Loading branch information
bagder committed Nov 7, 2007
1 parent 33f7ac0 commit cbd1a77
Show file tree
Hide file tree
Showing 38 changed files with 356 additions and 351 deletions.
14 changes: 7 additions & 7 deletions lib/cookie.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
34 changes: 17 additions & 17 deletions lib/dict.c
Expand Up @@ -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++] = '\\';
}
Expand Down Expand Up @@ -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 *)".";
}

Expand Down Expand Up @@ -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 *)"!";
}

Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions lib/escape.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
22 changes: 11 additions & 11 deletions lib/file.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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] == '|'))
{
Expand All @@ -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! */
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/ftp.c
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions lib/getenv.c
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/getinfo.c
Expand Up @@ -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;

Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit cbd1a77

Please sign in to comment.