Bugs item #3005593, was opened at 2010-05-22 03:35
Message generated for change (Tracker Item Submitted) made by nobody
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=462816&aid=3005593&group_id=51305

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxJSON
Group: last released version
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxJSONReader - multiline C-style comment error

Initial Comment:
Multiline C-style comments (/*....*/) was supported correctly in wxJSON 1.0
But it's now not correctly parsed with current release (wxJSON 1.2)
The bug is in wxJSONReader::SkipComment() method.

while ( ch >= 0 ) {
    // check the END-COMMENT chars ('*/')
    if ( ch == '*' )    {
        ch = PeekChar( is );
        if ( ch == '/' )    {
            ch = ReadChar( is ); <--- The comment close '/' char will be return 
instead of the next char
            utf8Buff.AppendData( "*/", 2 );
            break;
        }
    }
    // store the char in the UTF8 temporary buffer
    c = (unsigned char) ch;
    utf8Buff.AppendByte( c );
    ch = ReadChar( is );
}

The following should fix this bug:
while ( ch >= 0 ) {
    // check the END-COMMENT chars ('*/')
    if ( ch == '*' )    {
        ch = PeekChar( is );
        if ( ch == '/' )    {
            ch = ReadChar( is ); //read pass the comment close char
            ch = ReadChar( is );// read the next char that will be returned
            utf8Buff.AppendData( "*/", 2 );
            break;
        }
    }
    // store the char in the UTF8 temporary buffer
    c = (unsigned char) ch;
    utf8Buff.AppendByte( c );
    ch = ReadChar( is );
}

Thank you for this great library!

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=462816&aid=3005593&group_id=51305

------------------------------------------------------------------------------

_______________________________________________
wxCode-users mailing list
wxCode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxcode-users

Reply via email to