Deal with the fact that modern compilers assume different scoping rules

Patch from Pascal Stumpf <Pascal.Stumpf@cubes.de>:

So here are all the patches that deal with the fact that modern
compilers assume different scoping rules for variables declared in for
loops.  On Linux, -fpermissive has been added as a compiler flag to
compensate for this old C code, but I think it is the wrong approach.

Sorry, couldn't help sneaking in a || defined(CSRG_BASED) and some casts
needed for other reasons ...
This commit is contained in:
Jon Trulson
2012-08-09 12:18:30 -06:00
parent 1bb40f1f0b
commit 491ff2228f
7 changed files with 32 additions and 24 deletions

View File

@@ -510,12 +510,14 @@ CTokenizedString::~CTokenizedString()
CString CTokenizedString::next()
{
char * q = 0;
char * p;
int i;
if (cursor) {
if (strlen(delimiter) == 1)
q = strchr(cursor,delimiter[0]);
else {
for (int i = 0; i < strlen(cursor); i++)
for (i = 0; i < strlen(cursor); i++)
if (strchr(delimiter,cursor[i])) {
q = &cursor[i];
break;
@@ -533,7 +535,7 @@ char * q = 0;
// eliminate trailing white space
if (skipWhiteSpace) {
for (char *p = q; isspace(*(p-1)); p--);
for (p = q; isspace(*(p-1)); p--);
*p = 0;
}
CString result(cursor);