@@ -2072,7 +2072,8 @@ inline enum_loc_side lex_enum_loc_side(const char *in, bool throw_on_invalid, co
20722072/* Internal loading functions, which validate and load a PugiXML DOM tree into memory. */
20732073inline int load_int (const char *in, const std::function<void (const char *)> * report_error){
20742074 int out;
2075- errno = 0 ;
2075+ // global variable, must set to 0 before using it to avoid changed by other errors
2076+ errno = 0 ;
20762077 out = std::strtol (in, NULL , 10 );
20772078 if (errno != 0 )
20782079 noreturn_report (report_error, (" Invalid value `" + std::string (in) + " ` when loading into a int." ).c_str ());
@@ -2081,7 +2082,8 @@ inline int load_int(const char *in, const std::function<void(const char *)> * re
20812082
20822083inline unsigned int load_unsigned_int (const char *in, const std::function<void (const char *)> * report_error){
20832084 unsigned int out;
2084- errno = 0 ;
2085+ // global variable, must set to 0 before using it to avoid changed by other errors
2086+ errno = 0 ;
20852087 out = std::strtoul (in, NULL , 10 );
20862088 if (errno != 0 )
20872089 noreturn_report (report_error, (" Invalid value `" + std::string (in) + " ` when loading into a unsigned int." ).c_str ());
@@ -2090,7 +2092,8 @@ inline unsigned int load_unsigned_int(const char *in, const std::function<void(c
20902092
20912093inline float load_float (const char *in, const std::function<void (const char *)> * report_error){
20922094 float out;
2093- errno = 0 ;
2095+ // global variable, must set to 0 before using it to avoid changed by other errors
2096+ errno = 0 ;
20942097 out = std::strtof (in, NULL );
20952098 if (errno != 0 )
20962099 noreturn_report (report_error, (" Invalid value `" + std::string (in) + " ` when loading into a float." ).c_str ());
0 commit comments