Bug #971
Coverity scan : Not restoring ostream format (STREAM_FORMAT_STATE) CID : 982002 through 982054 (53 similar defects)
Start date:
19 Jul 2014
Due date:
% Done:
100%
Estimated time:
4.00 h
Description
Scan results resembles something like this.
"//format_changed: fixed changes the format state of os for category floatfield. "
" //format_changed: setprecision changes the format state of os for category precision. "
os << std::fixed << std::setprecision(1);
" //Condition len1 == len2, taking true branch" "
if (len1 == len2) {
os << len1 << " mm";
" // Falling through to end of if statement "
} else {
os << len2 << " - " << len1 << " mm";
}
os.copyfmt(oss);
"//CID 982005 (#1 of 1): Not restoring ostream format (STREAM_FORMAT_STATE) "
" //end_of_path: Changing format state of stream os for categories floatfield, precision without later restoring it."
History
Updated by Robin Mills over 7 years ago
- Category set to coverity
- Status changed from New to Assigned
- Assignee set to Mahesh Hegde
- Target version set to 0.25
I submitted r3276 to handle CID: 982053/4. Looks like there are lots more to be fixed.
std::ostream& DateValue::write(std::ostream& os) const
{
std::ios::fmtflags f( os.flags() ); // add this
os << date_.year << '-' << std::right
<< std::setw(2) << std::setfill('0') << date_.month << '-'
<< std::setw(2) << std::setfill('0') << date_.day;
os.flags(f); // and this
return os;
}
Updated by Thomas Beutlich over 5 years ago
- Status changed from Assigned to Resolved
- % Done changed from 0 to 100
Looks like this was resolved by r3281.