[Coverity] Restore std::cout flags and MimeAttr ctor. inits

* Restore std::cout flags (CID11245, CID11246) after using hexadecimal
  and zero-filled flags;
* Fix uninit MimeAttribute::fStatus field in one ctor. CID11292.
This commit is contained in:
Siarzhuk Zharski 2012-02-02 20:46:00 +01:00
parent 7408b8cc24
commit d9744a0dfc
1 changed files with 9 additions and 0 deletions

View File

@ -290,6 +290,7 @@ MimeAttribute::MimeAttribute(BMessage& msg, int32 index)
MimeAttribute::MimeAttribute(TUserArgs& args) MimeAttribute::MimeAttribute(TUserArgs& args)
{ {
SyncWith(args); SyncWith(args);
fStatus = B_OK;
} }
@ -368,6 +369,8 @@ MimeAttribute::Dump()
char c3 = (char)((type >> 8) & 0xFF); char c3 = (char)((type >> 8) & 0xFF);
char c4 = (char)(type & 0xFF); char c4 = (char)(type & 0xFF);
ios::fmtflags flags = cout.flags();
cout << " \\" << endl << "\t\t" << kAttrType; cout << " \\" << endl << "\t\t" << kAttrType;
if (IsPrintableChar(c1) && IsPrintableChar(c2) && if (IsPrintableChar(c1) && IsPrintableChar(c2) &&
IsPrintableChar(c3) && IsPrintableChar(c4)) IsPrintableChar(c3) && IsPrintableChar(c4))
@ -381,6 +384,8 @@ MimeAttribute::Dump()
cout << " \\" << endl << "\t\t" << kAttrViewable << " " << fViewable cout << " \\" << endl << "\t\t" << kAttrViewable << " " << fViewable
<< " " << kAttrEditable << " " << fEditable << " " << kAttrEditable << " " << fEditable
<< " " << kAttrExtra << " " << fExtra; << " " << kAttrExtra << " " << fExtra;
cout.flags(flags);
} }
@ -699,12 +704,16 @@ MimeType::_DumpIcon(uint8 *iconData, size_t iconSize)
int lineLimit = iconSize == B_MINI_ICON * B_MINI_ICON int lineLimit = iconSize == B_MINI_ICON * B_MINI_ICON
? B_MINI_ICON : B_LARGE_ICON; ? B_MINI_ICON : B_LARGE_ICON;
ios::fmtflags flags = cout.flags();
for (size_t i = 0; i < iconSize; i++) { for (size_t i = 0; i < iconSize; i++) {
if (i % lineLimit == 0 && i != iconSize - 1) if (i % lineLimit == 0 && i != iconSize - 1)
cout << "\\" << endl; cout << "\\" << endl;
cout << hex << setfill('0') << setw(2) << (uint16) iconData[i]; cout << hex << setfill('0') << setw(2) << (uint16) iconData[i];
} }
cout.flags(flags);
} }