falcong / pugixml

Automatically exported from code.google.com/p/pugixml
0 stars 0 forks source link

Valgrind error in xml_parse_result #76

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Run valgrind on the current svn

What is the expected output? What do you see instead?
No conditional jump on uninitialized value

Which version of pugixml are you using? On what operating system/compiler?
Latest svn

Please provide any additional information below.
Ideally, the parse_result class should have a default constructor setting the 
default value.

Something like this:
/// Default construction
xml_parse_result(const xml_parse_status status = status_internal_error,
                 const ptrdiff_t offset = 0,
                 const xml_encoding encoding = encoding_auto)
                  : status(status), offset(offset), encoding(encoding) {}

You'll need to change the make_parse_result in cpp file (or remove it since it 
becomes useless).

This prevent that our code using a parse_result object and doing "if (!result)" 
fails in valgrind if not constructed, but fails everytime.

Original issue reported on code.google.com by xryl...@gmail.com on 7 Sep 2010 at 4:04

GoogleCodeExporter commented 9 years ago
I'll make a default constructor without arguments, that fully initializes 
xml_parse_result and sets status to internal_error. Is that fine?

Original comment by arseny.k...@gmail.com on 7 Sep 2010 at 4:31

GoogleCodeExporter commented 9 years ago
Yes, sure. 
I think if you do that, you'll have to modify make_parse_result to build a 
defaut object and then mutate it, that's a 'bit' inefficient. 

Original comment by xryl...@gmail.com on 7 Sep 2010 at 4:49

GoogleCodeExporter commented 9 years ago
Fixed in trunk. Thanks for the report!

Original comment by arseny.k...@gmail.com on 20 Sep 2010 at 7:07

GoogleCodeExporter commented 9 years ago
pugixml-1.0 is out, it has the fix to this issue.

Original comment by arseny.k...@gmail.com on 31 Oct 2010 at 6:20