COMP: Remove warnings about shadow variables

This commit is contained in:
Andy Cedilnik 2005-02-27 17:36:00 -05:00
parent 8946d2f55e
commit 588653c4e8
10 changed files with 84 additions and 84 deletions

View File

@ -320,12 +320,12 @@ CURLcode Curl_file(struct connectdata *conn)
#ifdef HAVE_STRFTIME
if(fstated) {
struct tm *tm;
time_t clock = (time_t)statbuf.st_mtime;
time_t cuClock = (time_t)statbuf.st_mtime;
#ifdef HAVE_GMTIME_R
struct tm buffer;
tm = (struct tm *)gmtime_r(&clock, &buffer);
tm = (struct tm *)gmtime_r(&cuClock, &buffer);
#else
tm = gmtime(&clock);
tm = gmtime(&cuClock);
#endif
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
strftime(buf, BUFSIZE-1, "Last-Modified: %a, %d %b %Y %H:%M:%S GMT\r\n",

View File

@ -2203,12 +2203,12 @@ CURLcode ftp_perform(struct connectdata *conn,
#ifdef HAVE_STRFTIME
if(data->set.get_filetime && (data->info.filetime>=0) ) {
struct tm *tm;
time_t clock = (time_t)data->info.filetime;
time_t cuClock = (time_t)data->info.filetime;
#ifdef HAVE_GMTIME_R
struct tm buffer;
tm = (struct tm *)gmtime_r(&clock, &buffer);
tm = (struct tm *)gmtime_r(&cuClock, &buffer);
#else
tm = gmtime(&clock);
tm = gmtime(&cuClock);
#endif
/* format: "Tue, 15 Nov 1994 12:45:26" */
strftime(buf, BUFSIZE-1, "Last-Modified: %a, %d %b %Y %H:%M:%S GMT\r\n",

View File

@ -1410,8 +1410,8 @@ CURLcode Curl_http(struct connectdata *conn)
uses the encoded host name! */
if(conn->host.dispname != conn->host.name) {
char *url = data->change.url;
char *ptr = strstr(url, conn->host.dispname);
if(ptr) {
char *iPtr = strstr(url, conn->host.dispname);
if(iPtr) {
/* This is where the display name starts in the URL, now replace this
part with the encoded name. TODO: This method of replacing the host
name is rather crude as I believe there's a slight risk that the
@ -1426,13 +1426,13 @@ CURLcode Curl_http(struct connectdata *conn)
newurl = malloc(urllen + newlen - currlen + 1);
if(newurl) {
/* copy the part before the host name */
memcpy(newurl, url, ptr - url);
memcpy(newurl, url, iPtr - url);
/* append the new host name instead of the old */
memcpy(newurl + (ptr - url), conn->host.name, newlen);
memcpy(newurl + (iPtr - url), conn->host.name, newlen);
/* append the piece after the host name */
memcpy(newurl + newlen + (ptr - url),
ptr + currlen, /* copy the trailing zero byte too */
urllen - (ptr-url) - currlen + 1);
memcpy(newurl + newlen + (iPtr - url),
iPtr + currlen, /* copy the trailing zero byte too */
urllen - (iPtr-url) - currlen + 1);
if(data->change.url_alloc)
free(data->change.url);
data->change.url = newurl;

View File

@ -88,10 +88,10 @@ struct curl_slist *curl_slist_append(struct curl_slist *list,
new_item = (struct curl_slist *) malloc(sizeof(struct curl_slist));
if (new_item) {
char *dup = strdup(data);
if(dup) {
char *cuDup = strdup(data);
if(cuDup) {
new_item->next = NULL;
new_item->data = dup;
new_item->data = cuDup;
}
else {
free(new_item);

View File

@ -83,7 +83,7 @@ typedef struct kwsysProcessCreateInformation_s
static int kwsysProcessInitialize(kwsysProcess* cp);
static void kwsysProcessCleanup(kwsysProcess* cp, int error);
static void kwsysProcessCleanupDescriptor(int* pfd);
static int kwsysProcessCreate(kwsysProcess* cp, int index,
static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
kwsysProcessCreateInformation* si, int* readEnd);
static int kwsysProcessSetupOutputPipeFile(int* p, const char* name);
static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
@ -397,14 +397,14 @@ int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
}
/*--------------------------------------------------------------------------*/
int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, const char* file)
int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, const char* file)
{
char** pfile;
if(!cp)
{
return 0;
}
switch(pipe)
switch(prPipe)
{
case kwsysProcess_Pipe_STDIN: pfile = &cp->PipeFileSTDIN; break;
case kwsysProcess_Pipe_STDOUT: pfile = &cp->PipeFileSTDOUT; break;
@ -429,20 +429,20 @@ int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, const char* file)
/* If we are redirecting the pipe, do not share it. */
if(*pfile)
{
kwsysProcess_SetPipeShared(cp, pipe, 0);
kwsysProcess_SetPipeShared(cp, prPipe, 0);
}
return 1;
}
/*--------------------------------------------------------------------------*/
void kwsysProcess_SetPipeShared(kwsysProcess* cp, int pipe, int shared)
void kwsysProcess_SetPipeShared(kwsysProcess* cp, int prPipe, int shared)
{
if(!cp)
{
return;
}
switch(pipe)
switch(prPipe)
{
case kwsysProcess_Pipe_STDIN: cp->PipeSharedSTDIN = shared?1:0; break;
case kwsysProcess_Pipe_STDOUT: cp->PipeSharedSTDOUT = shared?1:0; break;
@ -453,7 +453,7 @@ void kwsysProcess_SetPipeShared(kwsysProcess* cp, int pipe, int shared)
/* If we are sharing the pipe, do not redirect it to a file. */
if(shared)
{
kwsysProcess_SetPipeFile(cp, pipe, 0);
kwsysProcess_SetPipeFile(cp, prPipe, 0);
}
}
@ -954,7 +954,7 @@ int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
{
int result = 0;
int status = 0;
int pipe = 0;
int prPipe = 0;
/* Make sure we are executing a process. */
if(!cp || cp->State != kwsysProcess_State_Executing)
@ -963,9 +963,9 @@ int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
}
/* Wait for all the pipes to close. Ignore all data. */
while((pipe = kwsysProcess_WaitForData(cp, 0, 0, userTimeout)) > 0)
while((prPipe = kwsysProcess_WaitForData(cp, 0, 0, userTimeout)) > 0)
{
if(pipe == kwsysProcess_Pipe_Timeout)
if(prPipe == kwsysProcess_Pipe_Timeout)
{
return 0;
}
@ -1215,11 +1215,11 @@ static void kwsysProcessCleanupDescriptor(int* pfd)
}
/*--------------------------------------------------------------------------*/
static int kwsysProcessCreate(kwsysProcess* cp, int index,
static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
kwsysProcessCreateInformation* si, int* readEnd)
{
/* Setup the process's stdin. */
if(index > 0)
if(prIndex > 0)
{
si->StdIn = *readEnd;
*readEnd = 0;
@ -1269,7 +1269,7 @@ static int kwsysProcessCreate(kwsysProcess* cp, int index,
/* Replace the stdout pipe with a file if requested. In this case
the select call will report that stdout is closed immediately. */
if(index == cp->NumberOfCommands-1 && cp->PipeFileSTDOUT)
if(prIndex == cp->NumberOfCommands-1 && cp->PipeFileSTDOUT)
{
if(!kwsysProcessSetupOutputPipeFile(&si->StdOut, cp->PipeFileSTDOUT))
{
@ -1280,7 +1280,7 @@ static int kwsysProcessCreate(kwsysProcess* cp, int index,
/* Replace the stdout pipe with the parent's if requested. In this
case the select call will report that stderr is closed
immediately. */
if(index == cp->NumberOfCommands-1 && cp->PipeSharedSTDOUT)
if(prIndex == cp->NumberOfCommands-1 && cp->PipeSharedSTDOUT)
{
kwsysProcessCleanupDescriptor(&si->StdOut);
si->StdOut = 1;
@ -1299,13 +1299,13 @@ static int kwsysProcessCreate(kwsysProcess* cp, int index,
}
/* Fork off a child process. */
cp->ForkPIDs[index] = kwsysProcessFork(cp, si);
if(cp->ForkPIDs[index] < 0)
cp->ForkPIDs[prIndex] = kwsysProcessFork(cp, si);
if(cp->ForkPIDs[prIndex] < 0)
{
return 0;
}
if(cp->ForkPIDs[index] == 0)
if(cp->ForkPIDs[prIndex] == 0)
{
/* Close the read end of the error reporting pipe. */
close(si->ErrorPipe[0]);
@ -1340,7 +1340,7 @@ static int kwsysProcessCreate(kwsysProcess* cp, int index,
kwsysProcessRestoreDefaultSignalHandlers();
/* Execute the real process. If successful, this does not return. */
execvp(cp->Commands[index][0], cp->Commands[index]);
execvp(cp->Commands[prIndex][0], cp->Commands[prIndex]);
/* Failure. Report error to parent and terminate. */
kwsysProcessChildErrorExit(si->ErrorPipe[1]);
@ -1378,7 +1378,7 @@ static int kwsysProcessCreate(kwsysProcess* cp, int index,
}
/* Successfully created this child process. */
if(index > 0 || si->StdIn > 0)
if(prIndex > 0 || si->StdIn > 0)
{
/* The parent process does not need the input pipe read end. */
kwsysProcessCleanupDescriptor(&si->StdIn);

View File

@ -472,7 +472,7 @@ xmlrpc_array_append_item (xmlrpc_env* const env,
void
xmlrpc_array_read_item(xmlrpc_env * const envP,
const xmlrpc_value * const arrayP,
unsigned int const index,
unsigned int const xmIndex,
xmlrpc_value ** const valuePP);
/* Get an item from an XML-RPC array.
@ -482,7 +482,7 @@ xmlrpc_array_read_item(xmlrpc_env * const envP,
xmlrpc_value *
xmlrpc_array_get_item(xmlrpc_env * const env,
const xmlrpc_value * const array,
int const index);
int const xmIndex);
/* Not implemented--we don't need it yet.
extern
@ -609,7 +609,7 @@ xmlrpc_struct_set_value_v(xmlrpc_env * const env,
void
xmlrpc_struct_read_member(xmlrpc_env * const envP,
xmlrpc_value * const structP,
unsigned int const index,
unsigned int const xmIndex,
xmlrpc_value ** const keyvalP,
xmlrpc_value ** const valueP);
@ -622,7 +622,7 @@ xmlrpc_struct_read_member(xmlrpc_env * const envP,
void
xmlrpc_struct_get_key_and_value(xmlrpc_env * const env,
xmlrpc_value * const strct,
int const index,
int const xmIndex,
xmlrpc_value ** const out_keyval,
xmlrpc_value ** const out_value);

View File

@ -30,10 +30,10 @@ xmlrpc_abort_if_array_bad(xmlrpc_value * const arrayP) {
if (contents == NULL)
abort();
else {
unsigned int index;
unsigned int xmIndex;
for (index = 0; index < arraySize; ++index) {
xmlrpc_value * const itemP = contents[index];
for (xmIndex = 0; xmIndex < arraySize; ++xmIndex) {
xmlrpc_value * const itemP = contents[xmIndex];
if (itemP == NULL)
abort();
else if (itemP->_refcount < 1)
@ -56,13 +56,13 @@ xmlrpc_destroyArrayContents(xmlrpc_value * const arrayP) {
xmlrpc_value ** const contents =
XMLRPC_MEMBLOCK_CONTENTS(xmlrpc_value*, &arrayP->_block);
unsigned int index;
unsigned int xmIndex;
XMLRPC_ASSERT_ARRAY_OK(arrayP);
/* Release our reference to each item in the array */
for (index = 0; index < arraySize; ++index) {
xmlrpc_value * const itemP = contents[index];
for (xmIndex = 0; xmIndex < arraySize; ++xmIndex) {
xmlrpc_value * const itemP = contents[xmIndex];
xmlrpc_DECREF(itemP);
}
XMLRPC_MEMBLOCK_CLEAN(xmlrpc_value *, &arrayP->_block);
@ -125,7 +125,7 @@ xmlrpc_array_append_item(xmlrpc_env * const envP,
void
xmlrpc_array_read_item(xmlrpc_env * const envP,
const xmlrpc_value * const arrayP,
unsigned int const index,
unsigned int const xmIndex,
xmlrpc_value ** const valuePP) {
XMLRPC_ASSERT_ENV_OK(envP);
@ -142,12 +142,12 @@ xmlrpc_array_read_item(xmlrpc_env * const envP,
size_t const size =
XMLRPC_MEMBLOCK_SIZE(xmlrpc_value *, &arrayP->_block);
if (index >= size)
if (xmIndex >= size)
xmlrpc_env_set_fault_formatted(
envP, XMLRPC_INDEX_ERROR, "Array index %u is beyond end "
"of %u-item array", index, (unsigned int)size);
"of %u-item array", xmIndex, (unsigned int)size);
else {
*valuePP = contents[index];
*valuePP = contents[xmIndex];
xmlrpc_INCREF(*valuePP);
}
}
@ -158,15 +158,15 @@ xmlrpc_array_read_item(xmlrpc_env * const envP,
xmlrpc_value *
xmlrpc_array_get_item(xmlrpc_env * const envP,
const xmlrpc_value * const arrayP,
int const index) {
int const xmIndex) {
xmlrpc_value * valueP;
if (index < 0)
if (xmIndex < 0)
xmlrpc_env_set_fault_formatted(
envP, XMLRPC_INDEX_ERROR, "Index %d is negative.");
else {
xmlrpc_array_read_item(envP, arrayP, index, &valueP);
xmlrpc_array_read_item(envP, arrayP, xmIndex, &valueP);
if (!envP->fault_occurred)
xmlrpc_DECREF(valueP);

View File

@ -368,12 +368,12 @@ performCurlTransaction(xmlrpc_env * const envP,
"HTTP POST request. curl_easy_perform() says: %s",
curlTransactionP->curlError);
else {
CURLcode res;
CURLcode crRes;
long http_result;
res = curl_easy_getinfo(curlSessionP, CURLINFO_HTTP_CODE,
crRes = curl_easy_getinfo(curlSessionP, CURLINFO_HTTP_CODE,
&http_result);
if (res != CURLE_OK)
if (crRes != CURLE_OK)
xmlrpc_env_set_fault_formatted(
envP, XMLRPC_INTERNAL_ERROR,
"Curl performed the HTTP POST request, but was "

View File

@ -110,7 +110,7 @@ get_child_by_name (xmlrpc_env *env, xml_element *parent, char *name)
*/
static xmlrpc_int32
xmlrpc_atoi(xmlrpc_env *env, char *str, size_t strlen,
xmlrpc_atoi(xmlrpc_env *env, char *str, size_t stringLength,
xmlrpc_int32 min, xmlrpc_int32 max)
{
long i;
@ -128,7 +128,7 @@ xmlrpc_atoi(xmlrpc_env *env, char *str, size_t strlen,
"\"%s\" must not contain whitespace", str);
/* Convert the value. */
end = str + strlen;
end = str + stringLength;
errno = 0;
i = strtol(str, &end, 10);
@ -145,7 +145,7 @@ xmlrpc_atoi(xmlrpc_env *env, char *str, size_t strlen,
"\"%s\" must be in range %d to %d", str, min, max);
/* Check for unused characters. */
if (end != str + strlen)
if (end != str + stringLength)
XMLRPC_FAIL1(env, XMLRPC_PARSE_ERROR,
"\"%s\" contained trailing data", str);
@ -159,7 +159,7 @@ xmlrpc_atoi(xmlrpc_env *env, char *str, size_t strlen,
static double
xmlrpc_atod(xmlrpc_env *env, char *str, size_t strlen)
xmlrpc_atod(xmlrpc_env *env, char *str, size_t stringLength)
{
double d;
char *end;
@ -176,7 +176,7 @@ xmlrpc_atod(xmlrpc_env *env, char *str, size_t strlen)
"\"%s\" must not contain whitespace", str);
/* Convert the value. */
end = str + strlen;
end = str + stringLength;
errno = 0;
d = strtod(str, &end);
@ -188,7 +188,7 @@ xmlrpc_atod(xmlrpc_env *env, char *str, size_t strlen)
str, strerror(errno), errno);
/* Check for unused characters. */
if (end != str + strlen)
if (end != str + stringLength)
XMLRPC_FAIL1(env, XMLRPC_PARSE_ERROR,
"\"%s\" contained trailing data", str);

View File

@ -216,22 +216,22 @@ xmlrpc_struct_has_key_n(xmlrpc_env * const envP,
xmlrpc_value * const strctP,
const char * const key,
size_t const key_len) {
int index;
int xmIndex;
/* Suppress a compiler warning about uninitialized variables. */
index = 0;
xmIndex = 0;
XMLRPC_ASSERT_ENV_OK(envP);
XMLRPC_ASSERT_VALUE_OK(strctP);
XMLRPC_ASSERT(key != NULL);
XMLRPC_TYPE_CHECK(envP, strctP, XMLRPC_TYPE_STRUCT);
index = find_member(strctP, key, key_len);
xmIndex = find_member(strctP, key, key_len);
cleanup:
if (envP->fault_occurred)
return 0;
return (index >= 0);
return (xmIndex >= 0);
}
@ -266,16 +266,16 @@ xmlrpc_struct_find_value(xmlrpc_env * const envP,
envP, XMLRPC_TYPE_ERROR, "Value is not a struct. It is type #%d",
structP->_type);
else {
int index;
int xmIndex;
/* Get our member index. */
index = find_member(structP, key, strlen(key));
if (index < 0)
xmIndex = find_member(structP, key, strlen(key));
if (xmIndex < 0)
*valuePP = NULL;
else {
_struct_member * const members =
XMLRPC_MEMBLOCK_CONTENTS(_struct_member, &structP->_block);
*valuePP = members[index].value;
*valuePP = members[xmIndex].value;
XMLRPC_ASSERT_VALUE_OK(*valuePP);
@ -310,18 +310,18 @@ xmlrpc_struct_find_value_v(xmlrpc_env * const envP,
"It is type #%d",
keyP->_type);
else {
int index;
int xmIndex;
/* Get our member index. */
index = find_member(structP,
xmIndex = find_member(structP,
XMLRPC_MEMBLOCK_CONTENTS(char, &keyP->_block),
XMLRPC_MEMBLOCK_SIZE(char, &keyP->_block)-1);
if (index < 0)
if (xmIndex < 0)
*valuePP = NULL;
else {
_struct_member * const members =
XMLRPC_MEMBLOCK_CONTENTS(_struct_member, &structP->_block);
*valuePP = members[index].value;
*valuePP = members[xmIndex].value;
XMLRPC_ASSERT_VALUE_OK(*valuePP);
@ -487,7 +487,7 @@ xmlrpc_struct_set_value_v(xmlrpc_env * const envP,
char *key;
size_t key_len;
int index;
int xmIndex;
_struct_member *members, *member, new_member;
xmlrpc_value *old_value;
@ -501,14 +501,14 @@ xmlrpc_struct_set_value_v(xmlrpc_env * const envP,
key = XMLRPC_MEMBLOCK_CONTENTS(char, &keyvalP->_block);
key_len = XMLRPC_MEMBLOCK_SIZE(char, &keyvalP->_block) - 1;
index = find_member(strctP, key, key_len);
xmIndex = find_member(strctP, key, key_len);
if (index >= 0) {
if (xmIndex >= 0) {
/* Change the value of an existing member. (But be careful--the
** original and new values might be the same object, so watch
** the order of INCREF and DECREF calls!) */
members = XMLRPC_MEMBLOCK_CONTENTS(_struct_member, &strctP->_block);
member = &members[index];
member = &members[xmIndex];
/* Juggle our references. */
old_value = member->value;
@ -540,7 +540,7 @@ cleanup:
void
xmlrpc_struct_read_member(xmlrpc_env * const envP,
xmlrpc_value * const structP,
unsigned int const index,
unsigned int const xmIndex,
xmlrpc_value ** const keyvalP,
xmlrpc_value ** const valueP) {
@ -559,12 +559,12 @@ xmlrpc_struct_read_member(xmlrpc_env * const envP,
size_t const size =
XMLRPC_MEMBLOCK_SIZE(_struct_member, &structP->_block);
if (index >= size)
if (xmIndex >= size)
xmlrpc_env_set_fault_formatted(
envP, XMLRPC_INDEX_ERROR, "Index %u is beyond the end of "
"the %u-member structure", index, (unsigned int)size);
"the %u-member structure", xmIndex, (unsigned int)size);
else {
_struct_member * const memberP = &members[index];
_struct_member * const memberP = &members[xmIndex];
*keyvalP = memberP->key;
xmlrpc_INCREF(memberP->key);
*valueP = memberP->value;
@ -578,7 +578,7 @@ xmlrpc_struct_read_member(xmlrpc_env * const envP,
void
xmlrpc_struct_get_key_and_value(xmlrpc_env * const envP,
xmlrpc_value * const structP,
int const index,
int const xmIndex,
xmlrpc_value ** const keyvalP,
xmlrpc_value ** const valueP) {
/*----------------------------------------------------------------------------
@ -592,11 +592,11 @@ xmlrpc_struct_get_key_and_value(xmlrpc_env * const envP,
XMLRPC_ASSERT_PTR_OK(keyvalP);
XMLRPC_ASSERT_PTR_OK(valueP);
if (index < 0)
if (xmIndex < 0)
xmlrpc_env_set_fault_formatted(
envP, XMLRPC_INDEX_ERROR, "Index %d is negative.");
else {
xmlrpc_struct_read_member(envP, structP, index, keyvalP, valueP);
xmlrpc_struct_read_member(envP, structP, xmIndex, keyvalP, valueP);
if (!envP->fault_occurred) {
xmlrpc_DECREF(*keyvalP);
xmlrpc_DECREF(*valueP);