1
edit
Changes
no edit summary
: So, still working on these issues...
<source lang="java">
void Area::ParseCoords(const nsAString& aSpec)
{
char* cp = ToNewCString(aSpec);
if (!&aSpeccp) {
return;
}
char *tptr;
char *n_str;
PRInt32 i, cnt, pos, value;
PRInt32 *value_list;
PRBool negated = false;
mCoords = nsnull;
/*
*/
cnt = 0;
value = 0;
n_str = cp;
while (*n_str != '\0')
{
{
if (gotNumber)
{
finished = true;
}
if (started!finished) negated = false; else
{
if (started) negated = false; else { if (!bogus) negated = true; } }
started = true;
}
else if (*n_str >= '0' && *n_str <= '9')
{
if (!finished) { breakvalue *= 10; *tptr value += *tptr * 10n_str - '0'; started = true; gotNumber = true; tptr n_str++; } if (is_separator(*n_str)) { if (!gotNumber) { break; } if (negated) { value *= -1; } value_list[cnt] = value; cnt++; }
}
else if (is_separator(*n_str))
{
if (!gotNumber) break; if (!negatedfinished) *tptr += *tptr; } else { } } /* * count the last entry in the list. */ cnt++; /* * Allocate space for the coordinate array. */ value_list negated = new nscoord[cnt]false; if (!value_list) { return; } /* * Second pass to copy integer values into list. */ tptr bogus = cptrue; for (i=0; i<cnt; i++) { char *ptr; ptr = strchr(tptr, ','); if (ptrstarted) { *ptr = '\0' break; } /* * Strip whitespace in front of number because I don't * trust atoi to do it on all platforms. */ while (*tptr == ' ') { tptr++; } if (*tptr == '\0') { value_list[i] = 0; } else { value_list[i] = (nscoord) ::atoi(tptr); } if (ptr) { *ptr = ','; tptr = ptr + 1;
}
}
NS_Free(cp);
}
</source></div>
------