Coverity scan fixes CID : 982031 through 982054
This commit is contained in:
parent
27080fe986
commit
d3e0539bac
@ -2488,6 +2488,7 @@ fmountlens[] = {
|
||||
const Value& value,
|
||||
const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
if (value.count() != 1 || value.typeId() != unsignedByte || value.toLong() == 0 || value.toLong() == 255) {
|
||||
return os << "(" << value << ")";
|
||||
}
|
||||
@ -2495,6 +2496,7 @@ fmountlens[] = {
|
||||
oss.copyfmt(os);
|
||||
os << std::fixed << std::setprecision(2) << value.toLong() << " Hz";
|
||||
os.copyfmt(oss);
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -2502,6 +2504,7 @@ fmountlens[] = {
|
||||
const Value& value,
|
||||
const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
if (value.count() != 1 || value.typeId() != unsignedByte || value.toLong() == 0 || value.toLong() == 255) {
|
||||
return os << "(" << value << ")";
|
||||
}
|
||||
@ -2509,6 +2512,7 @@ fmountlens[] = {
|
||||
oss.copyfmt(os);
|
||||
os << std::fixed << std::setprecision(2) << value.toLong();
|
||||
os.copyfmt(oss);
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
@ -1174,6 +1174,7 @@ namespace Exiv2 {
|
||||
|
||||
std::ostream& OlympusMakerNote::print0x0204(std::ostream& os, const Value& value, const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags of( os.flags() );
|
||||
if ( value.count() == 0
|
||||
|| value.toRational().second == 0) {
|
||||
return os << "(" << value << ")";
|
||||
@ -1184,6 +1185,7 @@ namespace Exiv2 {
|
||||
oss.copyfmt(os);
|
||||
os << std::fixed << std::setprecision(1) << f << "x";
|
||||
os.copyfmt(oss);
|
||||
os.flags(of);
|
||||
return os;
|
||||
} // OlympusMakerNote::print0x0204
|
||||
|
||||
|
||||
@ -320,12 +320,14 @@ namespace Exiv2 {
|
||||
const Value& value,
|
||||
const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
std::ostringstream oss;
|
||||
oss.copyfmt(os);
|
||||
os << std::fixed << std::setprecision(1)
|
||||
<< value.toLong() / 3 << _(" EV");
|
||||
os.copyfmt(oss);
|
||||
|
||||
os.flags(f);
|
||||
return os;
|
||||
|
||||
} // PanasonicMakerNote::print0x0023
|
||||
|
||||
@ -93,6 +93,7 @@ namespace Exiv2 {
|
||||
template <int N, const TagDetails (&array)[N], int count, int ignoredcount, int ignoredcountmax>
|
||||
std::ostream& printCombiTag(std::ostream& os, const Value& value, const ExifData* metadata)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
if ((value.count() != count && (value.count() < (count + ignoredcount) || value.count() > (count + ignoredcountmax))) || count > 4) {
|
||||
return printValue(os, value, metadata);
|
||||
}
|
||||
@ -113,6 +114,7 @@ namespace Exiv2 {
|
||||
<< std::hex << l << std::dec << ")";
|
||||
}
|
||||
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
@ -90,6 +90,7 @@ namespace Exiv2 {
|
||||
//! Print the 35mm focal length
|
||||
std::ostream& printFocalLength35(std::ostream& os, const Value& value, const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
if (value.count() != 1 || value.typeId() != unsignedLong) {
|
||||
return os << value;
|
||||
}
|
||||
@ -103,6 +104,7 @@ namespace Exiv2 {
|
||||
os << std::fixed << std::setprecision(1) << length / 10.0 << " mm";
|
||||
os.copyfmt(oss);
|
||||
}
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
37
src/tags.cpp
37
src/tags.cpp
@ -2277,6 +2277,7 @@ namespace Exiv2 {
|
||||
|
||||
std::ostream& printDegrees(std::ostream& os, const Value& value, const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
if (value.count() == 3) {
|
||||
std::ostringstream oss;
|
||||
oss.copyfmt(os);
|
||||
@ -2301,7 +2302,7 @@ namespace Exiv2 {
|
||||
else {
|
||||
os << value;
|
||||
}
|
||||
|
||||
os.flags(f);
|
||||
return os;
|
||||
} // printDegrees
|
||||
|
||||
@ -2348,6 +2349,7 @@ namespace Exiv2 {
|
||||
|
||||
std::ostream& print0x0006(std::ostream& os, const Value& value, const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
std::ostringstream oss;
|
||||
oss.copyfmt(os);
|
||||
const int32_t d = value.toRational().second;
|
||||
@ -2356,11 +2358,13 @@ namespace Exiv2 {
|
||||
os << std::fixed << std::setprecision(p) << value.toFloat() << " m";
|
||||
os.copyfmt(oss);
|
||||
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
std::ostream& print0x0007(std::ostream& os, const Value& value, const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
if (value.count() == 3) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (value.toRational(i).second == 0) {
|
||||
@ -2390,6 +2394,7 @@ namespace Exiv2 {
|
||||
os << value;
|
||||
}
|
||||
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -2472,6 +2477,7 @@ namespace Exiv2 {
|
||||
|
||||
std::ostream& print0x829d(std::ostream& os, const Value& value, const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
Rational fnumber = value.toRational();
|
||||
if (fnumber.second != 0) {
|
||||
std::ostringstream oss;
|
||||
@ -2483,6 +2489,7 @@ namespace Exiv2 {
|
||||
else {
|
||||
os << "(" << value << ")";
|
||||
}
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -2529,6 +2536,7 @@ namespace Exiv2 {
|
||||
|
||||
std::ostream& print0x9202(std::ostream& os, const Value& value, const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
if ( value.count() == 0
|
||||
|| value.toRational().second == 0) {
|
||||
return os << "(" << value << ")";
|
||||
@ -2537,6 +2545,7 @@ namespace Exiv2 {
|
||||
oss.copyfmt(os);
|
||||
os << "F" << std::setprecision(2) << fnumber(value.toFloat());
|
||||
os.copyfmt(oss);
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -2564,6 +2573,7 @@ namespace Exiv2 {
|
||||
|
||||
std::ostream& print0x9206(std::ostream& os, const Value& value, const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
Rational distance = value.toRational();
|
||||
if (distance.first == 0) {
|
||||
os << _("Unknown");
|
||||
@ -2582,6 +2592,7 @@ namespace Exiv2 {
|
||||
else {
|
||||
os << "(" << value << ")";
|
||||
}
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -2597,6 +2608,7 @@ namespace Exiv2 {
|
||||
|
||||
std::ostream& print0x920a(std::ostream& os, const Value& value, const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
Rational length = value.toRational();
|
||||
if (length.second != 0) {
|
||||
std::ostringstream oss;
|
||||
@ -2609,6 +2621,7 @@ namespace Exiv2 {
|
||||
else {
|
||||
os << "(" << value << ")";
|
||||
}
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -2661,6 +2674,7 @@ namespace Exiv2 {
|
||||
|
||||
std::ostream& print0xa404(std::ostream& os, const Value& value, const ExifData*)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
Rational zoom = value.toRational();
|
||||
if (zoom.second == 0) {
|
||||
os << _("Digital zoom not used");
|
||||
@ -2672,6 +2686,7 @@ namespace Exiv2 {
|
||||
<< (float)zoom.first / zoom.second;
|
||||
os.copyfmt(oss);
|
||||
}
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
@ -3109,15 +3124,19 @@ namespace Exiv2 {
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const TagInfo& ti)
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
ExifKey exifKey(ti);
|
||||
return os << exifKey.tagName() << ",\t"
|
||||
<< std::dec << exifKey.tag() << ",\t"
|
||||
<< "0x" << std::setw(4) << std::setfill('0')
|
||||
<< std::right << std::hex << exifKey.tag() << ",\t"
|
||||
<< exifKey.groupName() << ",\t"
|
||||
<< exifKey.key() << ",\t"
|
||||
<< TypeInfo::typeName(exifKey.defaultTypeId()) << ",\t"
|
||||
<< exifKey.tagDesc();
|
||||
os << exifKey.tagName() << ",\t"
|
||||
<< std::dec << exifKey.tag() << ",\t"
|
||||
<< "0x" << std::setw(4) << std::setfill('0')
|
||||
<< std::right << std::hex << exifKey.tag() << ",\t"
|
||||
<< exifKey.groupName() << ",\t"
|
||||
<< exifKey.key() << ",\t"
|
||||
<< TypeInfo::typeName(exifKey.defaultTypeId()) << ",\t"
|
||||
<< exifKey.tagDesc();
|
||||
|
||||
os.flags(f);
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace Exiv2
|
||||
|
||||
@ -2050,6 +2050,7 @@ namespace Exiv2 {
|
||||
|
||||
void TiffHeaderBase::print(std::ostream& os, const std::string& prefix) const
|
||||
{
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
os << prefix
|
||||
<< _("TIFF header, offset") << " = 0x"
|
||||
<< std::setw(8) << std::setfill('0') << std::hex << std::right
|
||||
@ -2061,6 +2062,7 @@ namespace Exiv2 {
|
||||
case invalidByteOrder: break;
|
||||
}
|
||||
os << "\n";
|
||||
os.flags(f);
|
||||
} // TiffHeaderBase::print
|
||||
|
||||
ByteOrder TiffHeaderBase::byteOrder() const
|
||||
|
||||
@ -444,6 +444,7 @@ namespace Exiv2 {
|
||||
{
|
||||
const std::string::size_type pos = 8 + 16 * 3 + 2;
|
||||
const std::string align(pos, ' ');
|
||||
std::ios::fmtflags f( os.flags() );
|
||||
|
||||
long i = 0;
|
||||
while (i < len) {
|
||||
@ -461,6 +462,7 @@ namespace Exiv2 {
|
||||
os << (width > pos ? "" : align.substr(width)) << ss.str() << "\n";
|
||||
}
|
||||
os << std::dec << std::setfill(' ');
|
||||
os.flags(f);
|
||||
} // hexdump
|
||||
|
||||
bool isHex(const std::string& str, size_t size, const std::string& prefix)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user