Bug #971

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

Added by Mahesh Hegde over 3 years ago. Updated about 1 year ago.

Status:ClosedStart date:19 Jul 2014
Priority:NormalDue date:
Assignee:Mahesh Hegde% Done:

100%

Category:coverityEstimated time:4.00 hours
Target version:0.26

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 over 3 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 over 2 years ago

  • Target version changed from 0.25 to 0.26

#3 Updated by Thomas Beutlich over 1 year 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 1 year ago

  • Status changed from Resolved to Closed

#5 Updated by Robin Mills over 1 year ago

  • Estimated time set to 4.00

#6 Updated by Thomas Beutlich about 1 year ago

I believe it was already resolved in 0.25 then.

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux