variable type cleanup to hush compilers,

killed trailing whitespace
This commit is contained in:
Daniel Stenberg 2004-07-02 12:28:57 +00:00
parent aedadfc779
commit 7876c078bc
1 changed files with 24 additions and 22 deletions

View File

@ -1,8 +1,8 @@
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
* / __| | | | |_) | | * / __| | | | |_) | |
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
@ -10,7 +10,7 @@
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html. * are also available at http://curl.haxx.se/docs/copyright.html.
* *
* You may opt to use, copy, modify, merge, publish, distribute and/or sell * 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 * copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file. * furnished to do so, under the terms of the COPYING file.
@ -117,13 +117,13 @@ static GlobCode glob_set(URLGlob *glob, char *pattern,
break; break;
case ']': /* illegal closing bracket */ case ']': /* illegal closing bracket */
snprintf(glob->errormsg, sizeof(glob->errormsg), snprintf(glob->errormsg, sizeof(glob->errormsg),
"illegal pattern at pos %d\n", (int)pos); "illegal pattern at pos %d\n", (int)pos);
return GLOB_ERROR; return GLOB_ERROR;
case '\\': /* escaped character, skip '\' */ case '\\': /* escaped character, skip '\' */
if (*(buf+1) == '\0') { /* but no escaping of '\0'! */ if (*(buf+1) == '\0') { /* but no escaping of '\0'! */
snprintf(glob->errormsg, sizeof(glob->errormsg), snprintf(glob->errormsg, sizeof(glob->errormsg),
"illegal pattern at pos %d\n", (int)pos); "illegal pattern at pos %d\n", (int)pos);
return GLOB_ERROR; return GLOB_ERROR;
} }
@ -138,7 +138,8 @@ static GlobCode glob_set(URLGlob *glob, char *pattern,
/* we never reach this point */ /* we never reach this point */
} }
static GlobCode glob_range(URLGlob *glob, char *pattern, int pos, int *amount) static GlobCode glob_range(URLGlob *glob, char *pattern,
size_t pos, int *amount)
{ {
/* processes a range expression with the point behind the opening '[' /* processes a range expression with the point behind the opening '['
- char range: e.g. "a-z]", "B-Q]" - char range: e.g. "a-z]", "B-Q]"
@ -149,7 +150,7 @@ static GlobCode glob_range(URLGlob *glob, char *pattern, int pos, int *amount)
URLPattern *pat; URLPattern *pat;
char *c; char *c;
int wordamount=1; int wordamount=1;
pat = (URLPattern*)&glob->pattern[glob->size / 2]; pat = (URLPattern*)&glob->pattern[glob->size / 2];
/* patterns 0,1,2,... correspond to size=1,3,5,... */ /* patterns 0,1,2,... correspond to size=1,3,5,... */
++glob->size; ++glob->size;
@ -160,7 +161,7 @@ static GlobCode glob_range(URLGlob *glob, char *pattern, int pos, int *amount)
&pat->content.CharRange.max_c) != 2 || &pat->content.CharRange.max_c) != 2 ||
pat->content.CharRange.min_c >= pat->content.CharRange.max_c || pat->content.CharRange.min_c >= pat->content.CharRange.max_c ||
pat->content.CharRange.max_c - pat->content.CharRange.min_c > 'z' - 'a') { pat->content.CharRange.max_c - pat->content.CharRange.min_c > 'z' - 'a') {
/* the pattern is not well-formed */ /* the pattern is not well-formed */
snprintf(glob->errormsg, sizeof(glob->errormsg), snprintf(glob->errormsg, sizeof(glob->errormsg),
"illegal pattern or range specification after pos %d\n", pos); "illegal pattern or range specification after pos %d\n", pos);
return GLOB_ERROR; return GLOB_ERROR;
@ -186,14 +187,14 @@ static GlobCode glob_range(URLGlob *glob, char *pattern, int pos, int *amount)
&pat->content.NumRange.min_n, &pat->content.NumRange.min_n,
&pat->content.NumRange.max_n) != 2 || &pat->content.NumRange.max_n) != 2 ||
pat->content.NumRange.min_n >= pat->content.NumRange.max_n) { pat->content.NumRange.min_n >= pat->content.NumRange.max_n) {
/* the pattern is not well-formed */ /* the pattern is not well-formed */
snprintf(glob->errormsg, sizeof(glob->errormsg), snprintf(glob->errormsg, sizeof(glob->errormsg),
"error: illegal pattern or range specification after pos %d\n", "error: illegal pattern or range specification after pos %d\n",
pos); pos);
return GLOB_ERROR; return GLOB_ERROR;
} }
if (*pattern == '0') { /* leading zero specified */ if (*pattern == '0') { /* leading zero specified */
c = pattern; c = pattern;
while (isdigit((int)*c++)) while (isdigit((int)*c++))
++pat->content.NumRange.padlength; /* padding length is set for all ++pat->content.NumRange.padlength; /* padding length is set for all
instances of this pattern */ instances of this pattern */
@ -211,14 +212,14 @@ static GlobCode glob_range(URLGlob *glob, char *pattern, int pos, int *amount)
if(GLOB_ERROR == glob_word(glob, c, pos + (c - pattern), &wordamount)) if(GLOB_ERROR == glob_word(glob, c, pos + (c - pattern), &wordamount))
wordamount = 1; wordamount = 1;
*amount = (pat->content.NumRange.max_n - *amount = (pat->content.NumRange.max_n -
pat->content.NumRange.min_n + 1) * pat->content.NumRange.min_n + 1) *
wordamount; wordamount;
return GLOB_OK; return GLOB_OK;
} }
snprintf(glob->errormsg, sizeof(glob->errormsg), snprintf(glob->errormsg, sizeof(glob->errormsg),
"illegal character in range specification at pos %d\n", pos); "illegal character in range specification at pos %d\n", pos);
return GLOB_ERROR; return GLOB_ERROR;
} }
@ -228,7 +229,7 @@ static GlobCode glob_word(URLGlob *glob, char *pattern,
{ {
/* processes a literal string component of a URL /* processes a literal string component of a URL
special characters '{' and '[' branch to set/range processing functions special characters '{' and '[' branch to set/range processing functions
*/ */
char* buf = glob->glob_buffer; char* buf = glob->glob_buffer;
size_t litindex; size_t litindex;
GlobCode res = GLOB_OK; GlobCode res = GLOB_OK;
@ -328,9 +329,10 @@ int glob_url(URLGlob** glob, char* url, int *urlnum, FILE *error)
void glob_cleanup(URLGlob* glob) void glob_cleanup(URLGlob* glob)
{ {
int i, elem; size_t i;
int elem;
for (i = glob->size - 1; i >= 0; --i) { for (i = glob->size - 1; i < glob->size; --i) {
if (!(i & 1)) { /* even indexes contain literals */ if (!(i & 1)) { /* even indexes contain literals */
free(glob->literal[i/2]); free(glob->literal[i/2]);
} }
@ -354,7 +356,7 @@ char *glob_next_url(URLGlob *glob)
char *buf = glob->glob_buffer; char *buf = glob->glob_buffer;
URLPattern *pat; URLPattern *pat;
char *lit; char *lit;
int i; size_t i;
size_t j; size_t j;
int carry; int carry;
@ -365,7 +367,7 @@ char *glob_next_url(URLGlob *glob)
/* implement a counter over the index ranges of all patterns, /* implement a counter over the index ranges of all patterns,
starting with the rightmost pattern */ starting with the rightmost pattern */
for (i = glob->size / 2 - 1; carry && i >= 0; --i) { for (i = glob->size / 2 - 1; carry && i < glob->size; --i) {
carry = 0; carry = 0;
pat = &glob->pattern[i]; pat = &glob->pattern[i];
switch (pat->type) { switch (pat->type) {
@ -414,7 +416,7 @@ char *glob_next_url(URLGlob *glob)
break; break;
case UPTNumRange: case UPTNumRange:
sprintf(buf, "%0*d", sprintf(buf, "%0*d",
pat->content.NumRange.padlength, pat->content.NumRange.ptr_n); pat->content.NumRange.padlength, pat->content.NumRange.ptr_n);
buf += strlen(buf); /* make no sprint() return code assumptions */ buf += strlen(buf); /* make no sprint() return code assumptions */
break; break;
default: default: