Project

General

Profile

Bug #971

Coverity scan : Not restoring ostream format (STREAM_FORMAT_STATE) CID : 982002 through 982054 (53 similar defects)

Added by Mahesh Hegde almost 5 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
coverity
Target version:
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

#1

Updated by Robin Mills almost 5 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;
    }

#2

Updated by Alan Pater almost 4 years ago

  • Target version changed from 0.25 to 0.26
#3

Updated by Thomas Beutlich over 2 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

Looks like this was resolved by r3281.

#4

Updated by Robin Mills over 2 years ago

  • Status changed from Resolved to Closed
#5

Updated by Robin Mills over 2 years ago

  • Estimated time set to 4.00 h
#6

Updated by Thomas Beutlich over 2 years ago

I believe it was already resolved in 0.25 then.

Also available in: Atom PDF