#108 [cppcheck] found a lots of issues

closed-fixed
nobody
None
5
2010-06-05
2010-05-13
orbitcowboy
No

i have checked the current cvs-head of tinyxml with the static code anlysis tool cppcheck. It found a few issues:

[tinystr.h:116]: (Style) Member variable 'TiXmlString::rep_' is not assigned a value in 'TiXmlString::operator='
[tinystr.h:110]: (Style) 'operator=' should return reference to self
[tinystr.h:116]: (Style) 'operator=' should return reference to self
[tinyxml.h:1229]: (Style) Member variable not initialized in the constructor 'TiXmlText::cdata'
[tinyxml.h:1230]: (Style) Member variable 'TiXmlText::cdata' is not assigned a value in 'TiXmlText::operator='
[tinyxml.h:953]: (Style) 'operator=' should return something
[tinyxml.h:1165]: (Style) 'operator=' should return something
[tinyxml.h:1230]: (Style) 'operator=' should return something
[tinyxml.h:1297]: (Style) 'operator=' should return something
[tinyxml.h:1354]: (Style) 'operator=' should return something
[tinyxml.h:1400]: (Style) 'operator=' should return something
[tinyxmlparser.cpp:177]: (Style) The function 'TiXmlParsingData::Cursor' can be const
[tinyxml.cpp:896]: (Style) Member variable not initialized in the constructor 'TiXmlDocument::useMicrosoftBOM'
[tinyxml.cpp:896]: (Style) Member variable not initialized in the constructor 'TiXmlDocument::tabsize'
[tinyxml.cpp:896]: (Style) Member variable not initialized in the constructor 'TiXmlDocument::errorId'
[tinyxml.cpp:896]: (Style) Member variable not initialized in the constructor 'TiXmlDocument::error'
[xmltest.cpp:923]: (Style) Variable 'loadOkay' is assigned a value that is never used
[xmltest.cpp:617]: (Error) Resource leak: saved

Best regards

Martin

Discussion

  • Lee Thomason

    Lee Thomason - 2010-06-05
    • status: open --> closed-fixed
     
  • Lee Thomason

    Lee Thomason - 2010-06-05

    false positives:
    [tinystr.h:116]: rep_ is assigned by the swap.
    false positives, but syntax changed to be explicit:
    [tinystr.h:110]: (Style) 'operator=' should return reference to self
    [tinystr.h:116]: (Style) 'operator=' should return reference to self
    false positive:
    [tinyxml.h:1229]: (Style) Member variable not initialized in the constructor 'TiXmlText::cdata'
    [tinyxml.h:1230]: (Style) Member variable 'TiXmlText::cdata' is not assigned a value in 'TiXmlText::operator='
    Fixed:
    [tinyxml.h:953]: (Style) 'operator=' should return something
    [tinyxml.h:1165]: (Style) 'operator=' should return something
    [tinyxml.h:1230]: (Style) 'operator=' should return something
    [tinyxml.h:1297]: (Style) 'operator=' should return something
    [tinyxml.h:1354]: (Style) 'operator=' should return something
    [tinyxml.h:1400]: (Style) 'operator=' should return something
    [tinyxmlparser.cpp:177]: (Style) The function 'TiXmlParsingData::Cursor' can be const
    false positive:
    [tinyxml.cpp:896]: (Style) Member variable not initialized in the constructor 'TiXmlDocument::useMicrosoftBOM'
    [tinyxml.cpp:896]: (Style) Member variable not initialized in the constructor 'TiXmlDocument::tabsize'
    [tinyxml.cpp:896]: (Style) Member variable not initialized in the constructor 'TiXmlDocument::errorId'
    [tinyxml.cpp:896]: (Style) Member variable not initialized in the constructor 'TiXmlDocument::error'

    A couple fixes but a lot of noise in the static analysis.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks