Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

bug compiling without "TIXML_SAFE...

Developer
owaiboulot
2010-11-03
2013-05-20
  • owaiboulot
    owaiboulot
    2010-11-03

    I use version 2.6.1 in Borland c++ 5.02 and I need to undefine "TIXML_SAFE" (very old compiler).
    In this case, i got compiler errors for "TIXML_SSCANF" in tinyxml.cpp line 1191:
    to correct the bug, I added these precompiler tests to the code:

    int TiXmlAttribute::QueryIntValue( int* ival ) const
    {
    [b] #if defined TIXML_SSCANF[/b]
        if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 )
    [b] #else
       if ( scanf( value.c_str(), "%d", ival ) == 1 )
       #endif[/b]
            return TIXML_SUCCESS;
        return TIXML_WRONG_TYPE;
    }
    int TiXmlAttribute::QueryDoubleValue( double* dval ) const
    {            
    [b] #if defined TIXML_SSCANF[/b]
        if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 )
    [b] #else
        if ( scanf( value.c_str(), "%lf", dval ) == 1 )
       #endif[/b]
            return TIXML_SUCCESS;
        return TIXML_WRONG_TYPE;
    }
    
     
  • owaiboulot
    owaiboulot
    2010-11-04

    I made a mistake: one should use "sscanf" instead of "scanf" !!