dotdot.c: fix global declaration shadowing

This commit is contained in:
Yang Tse
2013-07-11 13:29:20 +02:00
parent 2022b10e50
commit 5c6f12b9f2

View File

@@ -53,7 +53,7 @@ char *Curl_dedotdotify(char *input)
char *clone; char *clone;
size_t clen = inlen; /* the length of the cloned input */ size_t clen = inlen; /* the length of the cloned input */
char *out = malloc(inlen+1); char *out = malloc(inlen+1);
char *outp; char *outptr;
char *orgclone; char *orgclone;
char *queryp; char *queryp;
if(!out) if(!out)
@@ -66,7 +66,7 @@ char *Curl_dedotdotify(char *input)
return NULL; return NULL;
} }
orgclone = clone; orgclone = clone;
outp = out; outptr = out;
/* /*
* To handle query-parts properly, we must find it and remove it during the * To handle query-parts properly, we must find it and remove it during the
@@ -113,24 +113,24 @@ char *Curl_dedotdotify(char *input)
clone+=3; clone+=3;
clen-=3; clen-=3;
/* remove the last segment from the output buffer */ /* remove the last segment from the output buffer */
while(outp > out) { while(outptr > out) {
outp--; outptr--;
if(*outp == '/') if(*outptr == '/')
break; break;
} }
*outp = 0; /* zero-terminate where it stops */ *outptr = 0; /* zero-terminate where it stops */
} }
else if(!strcmp("/..", clone)) { else if(!strcmp("/..", clone)) {
clone[2]='/'; clone[2]='/';
clone+=2; clone+=2;
clen-=2; clen-=2;
/* remove the last segment from the output buffer */ /* remove the last segment from the output buffer */
while(outp > out) { while(outptr > out) {
outp--; outptr--;
if(*outp == '/') if(*outptr == '/')
break; break;
} }
*outp = 0; /* zero-terminate where it stops */ *outptr = 0; /* zero-terminate where it stops */
} }
/* D. if the input buffer consists only of "." or "..", then remove /* D. if the input buffer consists only of "." or "..", then remove
@@ -147,10 +147,10 @@ char *Curl_dedotdotify(char *input)
character or the end of the input buffer. */ character or the end of the input buffer. */
do { do {
*outp++ = *clone++; *outptr++ = *clone++;
clen--; clen--;
} while(*clone && (*clone != '/')); } while(*clone && (*clone != '/'));
*outp=0; *outptr = 0;
} }
} while(*clone); } while(*clone);
@@ -162,7 +162,7 @@ char *Curl_dedotdotify(char *input)
from the correct index. */ from the correct index. */
size_t oindex = queryp - orgclone; size_t oindex = queryp - orgclone;
qlen = strlen(&input[oindex]); qlen = strlen(&input[oindex]);
memcpy(outp, &input[oindex], qlen+1); /* include the ending zero byte */ memcpy(outptr, &input[oindex], qlen+1); /* include the ending zero byte */
} }
free(orgclone); free(orgclone);