On Tue, Oct 12, 2004 at 01:29:15PM +1000, Scott Smedley wrote:
> Hi Dominik, :)
> 
> After revision 1.61 of libs/Parse.c, DoPeekToken() is behaving very
> oddly. Best illustrated with an example:
> 
> If I pass a string, say, "2.5.13" to DoPeekToken() with delimiters ".",
> I get back the token "2" (correct) but the pointer to the rest of the
> string (the actual return value) is ".13" which is incorrect. (The '5'
> character got truncated in CopyToken().)
> 
> +   t = SkipSpaces(src, spaces, snum);
> +   if (*t != 0 && dnum && strchr(delims, *t) != NULL)
> +   {
> +       src = t + 1;
> +   }
> 
> I think the strchr() needs to be replaced with a function that
> checks for delims at the _start_ of t (not just anywhere in t).

strchr(delims, *t) looks for the character *t in the string
delims, not vice versa.

> But I'm not really sure what your intention was, hence why I'll
> leave it to you to fix.

The intention was to skip the delimiter that ended the token, even
if it is preceded by spaces.  I missed the case that there is no
whitespace *after* the delimiter, though.  Fixed.

> I noticed this problem because the following syntax no longer works:
> 
> Test (Version >= 2.5.11) Echo yup

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [EMAIL PROTECTED]

Attachment: pgpgghaeNzF8z.pgp
Description: PGP signature

  • CopyToken() Scott Smedley
    • Re: CopyToken() Dominik Vogt

Reply via email to