[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:44:13 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=200c65a

The following commit has been merged in the master branch:
commit 200c65a3807df26258bf69f98258ee8334ed6ad9
Author: Mahesh <maheshmhegade at gmail.com>
Date:   Sun Jul 20 18:50:42 2014 +0000

    Coverity scan fixes CID : 982002 through 982054 (all ostream related)
---
 src/canonmn.cpp   | 36 ++++++++++++++++++++++++++++++++----
 src/casiomn.cpp   |  8 +++++++-
 src/crwimage.cpp  |  2 ++
 src/datasets.cpp  | 31 +++++++++++++++++--------------
 src/minoltamn.cpp |  9 ++++++++-
 src/nikonmn.cpp   | 48 ++++++++++++++++++++++++++++++++++++++++++------
 src/olympusmn.cpp |  3 +++
 src/pentaxmn.cpp  | 10 ++++++++++
 src/tags.cpp      |  7 ++++++-
 9 files changed, 127 insertions(+), 27 deletions(-)

diff --git a/src/canonmn.cpp b/src/canonmn.cpp
index fb9b087..6fc7323 100644
--- a/src/canonmn.cpp
+++ b/src/canonmn.cpp
@@ -1374,8 +1374,14 @@ namespace Exiv2 {
                                                     const Value& value,
                                                     const ExifData* metadata)
     {
+        std::ios::fmtflags f( os.flags() );
         if (   !metadata || value.typeId() != unsignedLong
-            || value.count() == 0) return os << "(" << value << ")";
+            || value.count() == 0)
+        {
+            os << "(" << value << ")";
+            os.flags(f);
+            return os;
+        }
 
         ExifData::const_iterator pos = metadata->findKey(ExifKey("Exif.Image.Model"));
         if (pos == metadata->end()) return os << "(" << value << ")";
@@ -1389,7 +1395,9 @@ namespace Exiv2 {
             uint32_t val = value.toLong();
             uint32_t dn = (val & 0xffc0) >> 6;
             uint32_t fn = ((val >> 16) & 0xff) + ((val & 0x3f) << 8);
-            return os << std::dec << dn << "-" << std::setw(4) << std::setfill('0') << fn;
+            os << std::dec << dn << "-" << std::setw(4) << std::setfill('0') << fn;
+            os.flags(f);
+            return os;
         }
         if (   model.find("30D") != std::string::npos
             || model.find("400D") != std::string::npos
@@ -1400,9 +1408,12 @@ namespace Exiv2 {
             uint32_t dn = (val & 0xffc00) >> 10;
             while (dn < 100) dn += 0x40;
             uint32_t fn = ((val & 0x3ff) << 4) + ((val >> 20) & 0x0f);
-            return os << std::dec << dn << "-" << std::setw(4) << std::setfill('0') << fn;
+            os << std::dec << dn << "-" << std::setw(4) << std::setfill('0') << fn;
+            os.flags(f);
+            return os;
         }
 
+        os.flags(f);
         return os << "(" << value << ")";
     }
 
@@ -1410,9 +1421,11 @@ namespace Exiv2 {
                                                    const Value& value,
                                                    const ExifData* metadata)
     {
+        std::ios::fmtflags f( os.flags() );
         if (   !metadata
             || value.count() < 4
             || value.typeId() != unsignedShort) {
+            os.flags(f);
             return os << value;
         }
 
@@ -1429,10 +1442,12 @@ namespace Exiv2 {
                 os << std::fixed << std::setprecision(1);
                 os << fl << " mm";
                 os.copyfmt(oss);
+                os.flags(f);
                 return os;
             }
         }
 
+        os.flags(f);
         return os << value;
     }
 
@@ -1564,9 +1579,13 @@ namespace Exiv2 {
                                               const Value& value,
                                               const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
+
         if (   value.count() < 3
             || value.typeId() != unsignedShort) {
-            return os << "(" << value << ")";
+            os << "(" << value << ")";
+            os.flags(f);
+            return os;
         }
 
         float fu = value.toFloat(2);
@@ -1582,6 +1601,7 @@ namespace Exiv2 {
             os << len2 << " - " << len1 << " mm";
         }
         os.copyfmt(oss);
+        os.flags(f);
         return os;
     }
 
@@ -1589,11 +1609,13 @@ namespace Exiv2 {
                                                 const Value& value,
                                                 const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         if (   value.typeId() == unsignedShort
             && value.count() > 0) {
             // Ported from Exiftool by Will Stokes
             os << exp(canonEv(value.toLong()) * log(2.0)) * 100.0 / 32.0;
         }
+        os.flags(f);
         return os;
     }
 
@@ -1654,6 +1676,7 @@ namespace Exiv2 {
                                                 const Value& value,
                                                 const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         if (   value.typeId() != unsignedShort
             || value.count() == 0) return os << value;
 
@@ -1664,6 +1687,7 @@ namespace Exiv2 {
         else {
             os << l << "";
         }
+        os.flags(f);
         return os;
     }
 
@@ -1688,6 +1712,7 @@ namespace Exiv2 {
                                                 const Value& value,
                                                 const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         if (   value.typeId() != unsignedShort
             || value.count() == 0) return os << value;
 
@@ -1696,6 +1721,7 @@ namespace Exiv2 {
         if (ur.second > 1) {
             os << "/" << ur.second;
         }
+        os.flags(f);
         return os << " s";
     }
 
@@ -1718,6 +1744,7 @@ namespace Exiv2 {
                                                        const Value& value,
                                                        const ExifData*)
     {
+       std::ios::fmtflags f( os.flags() );
        if (   value.typeId() != signedShort
          || value.count() == 0) return os << value;
 
@@ -1734,6 +1761,7 @@ namespace Exiv2 {
       }
 
       os.copyfmt(oss);
+      os.flags(f);
       return os;
     }
 
diff --git a/src/casiomn.cpp b/src/casiomn.cpp
index 5e74ef1..da46ae3 100644
--- a/src/casiomn.cpp
+++ b/src/casiomn.cpp
@@ -218,10 +218,12 @@ namespace Exiv2 {
 
     std::ostream& CasioMakerNote::print0x0006(std::ostream& os, const Value& value, const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         std::ostringstream oss;
         oss.copyfmt(os);
         os << std::fixed << std::setprecision(2) << value.toLong() / 1000.0 << _(" m");
         os.copyfmt(oss);
+        os.flags(f);
         return os;
     } 
 
@@ -583,14 +585,18 @@ namespace Exiv2 {
 
     std::ostream& Casio2MakerNote::print0x2022(std::ostream& os, const Value& value, const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         if(value.toLong()>=0x20000000)
         {
-            return os << N_("Inf");
+            os << N_("Inf");
+            os.flags(f);
+            return os;
         };
         std::ostringstream oss;
         oss.copyfmt(os);
         os << std::fixed << std::setprecision(2) << value.toLong() / 1000.0 << _(" m");
         os.copyfmt(oss);
+        os.flags(f);
         return os;
     } 
 
diff --git a/src/crwimage.cpp b/src/crwimage.cpp
index 06d2187..f6bc554 100644
--- a/src/crwimage.cpp
+++ b/src/crwimage.cpp
@@ -660,10 +660,12 @@ namespace Exiv2 {
 
     void CiffHeader::print(std::ostream& os, const std::string& prefix) const
     {
+        std::ios::fmtflags f( os.flags() );
         os << prefix
            << _("Header, offset") << " = 0x" << std::setw(8) << std::setfill('0')
            << std::hex << std::right << offset_ << "
";
         if (pRootDir_) pRootDir_->print(os, byteOrder_, prefix);
+        os.flags(f);
     } // CiffHeader::print
 
     void CiffComponent::print(std::ostream&      os,
diff --git a/src/datasets.cpp b/src/datasets.cpp
index 2849f22..3bf6264 100644
--- a/src/datasets.cpp
+++ b/src/datasets.cpp
@@ -714,21 +714,24 @@ namespace Exiv2 {
 
     std::ostream& operator<<(std::ostream& os, const DataSet& dataSet)
     {
+        std::ios::fmtflags f( os.flags() );
         IptcKey iptcKey(dataSet.number_, dataSet.recordId_);
-        return os << dataSet.name_ << ", "
-                  << std::dec << dataSet.number_ << ", "
-                  << "0x" << std::setw(4) << std::setfill('0')
-                  << std::right << std::hex << dataSet.number_ << ", "
-                  << IptcDataSets::recordName(dataSet.recordId_) << ", "
-                  << std::boolalpha << dataSet.mandatory_ << ", "
-                  << dataSet.repeatable_ << ", "
-                  << std::dec << dataSet.minbytes_ << ", "
-                  << dataSet.maxbytes_ << ", "
-                  << iptcKey.key() << ", "
-                  << TypeInfo::typeName(
-                      IptcDataSets::dataSetType(dataSet.number_,
-                                                dataSet.recordId_)) << ", "
-                  << dataSet.desc_;
+        os << dataSet.name_ << ", "
+           << std::dec << dataSet.number_ << ", "
+           << "0x" << std::setw(4) << std::setfill('0')
+           << std::right << std::hex << dataSet.number_ << ", "
+           << IptcDataSets::recordName(dataSet.recordId_) << ", "
+           << std::boolalpha << dataSet.mandatory_ << ", "
+           << dataSet.repeatable_ << ", "
+           << std::dec << dataSet.minbytes_ << ", "
+           << dataSet.maxbytes_ << ", "
+           << iptcKey.key() << ", "
+           << TypeInfo::typeName(
+              IptcDataSets::dataSetType(dataSet.number_,
+                                          dataSet.recordId_)) << ", "
+           << dataSet.desc_;
+        os.flags(f);
+        return os;
     }
 
 }                                       // namespace Exiv2
diff --git a/src/minoltamn.cpp b/src/minoltamn.cpp
index c78fbf1..16b5706 100644
--- a/src/minoltamn.cpp
+++ b/src/minoltamn.cpp
@@ -960,22 +960,26 @@ namespace Exiv2 {
     {
         // From Xavier Raynaud: the value is converted from 0:256 to -5.33:5.33
 
+        std::ios::fmtflags f( os.flags() );
         std::ostringstream oss;
         oss.copyfmt(os);
         os << std::fixed << std::setprecision(2)
            << (float (value.toLong()-128)/24);
         os.copyfmt(oss);
+        os.flags(f);
         return os;
     }
 
     //! Method to convert Minolta Dynax 5D exposure compensation values.
     std::ostream& MinoltaMakerNote::printMinoltaExposureCompensation5D(std::ostream& os, const Value& value, const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         std::ostringstream oss;
         oss.copyfmt(os);
         os << std::fixed << std::setprecision(2)
            << (float (value.toLong()-300)/100);
         os.copyfmt(oss);
+        os.flags(f);
         return os;
     }
 
@@ -2151,10 +2155,13 @@ namespace Exiv2 {
 
     std::ostream& printMinoltaSonyFlashExposureComp(std::ostream& os, const Value& value, const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         if (value.count() != 1 || value.typeId() != signedRational) {
             return os << "(" << value << ")";
         }
-        return os << std::fixed << std::setprecision(2) << value.toFloat(0) << " EV";
+        os << std::fixed << std::setprecision(2) << value.toFloat(0) << " EV";
+        os.flags(f);
+        return os;
     }
 
 }}                                      // namespace Internal, Exiv2
diff --git a/src/nikonmn.cpp b/src/nikonmn.cpp
index 767aad7..2b9ab79 100644
--- a/src/nikonmn.cpp
+++ b/src/nikonmn.cpp
@@ -298,6 +298,7 @@ namespace Exiv2 {
                                                const Value& value,
                                                const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         Rational distance = value.toRational();
         if (distance.first == 0) {
             os << _("Unknown");
@@ -313,6 +314,7 @@ namespace Exiv2 {
         else {
             os << "(" << value << ")";
         }
+        os.flags(f);
         return os;
     }
 
@@ -320,6 +322,7 @@ namespace Exiv2 {
                                                const Value& value,
                                                const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         Rational zoom = value.toRational();
         if (zoom.first == 0) {
             os << _("Not used");
@@ -335,6 +338,7 @@ namespace Exiv2 {
         else {
             os << "(" << value << ")";
         }
+        os.flags(f);
         return os;
     }
 
@@ -501,6 +505,7 @@ namespace Exiv2 {
                                                const Value& value,
                                                const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         Rational zoom = value.toRational();
         if (zoom.first == 0) {
             os << _("Not used");
@@ -516,6 +521,7 @@ namespace Exiv2 {
         else {
             os << "(" << value << ")";
         }
+        os.flags(f);
         return os;
     }
 
@@ -1460,6 +1466,7 @@ namespace Exiv2 {
                                                const Value& value,
                                                const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         if (   value.count() != 4
             || value.toRational(0).second == 0
             || value.toRational(1).second == 0) {
@@ -1485,6 +1492,7 @@ namespace Exiv2 {
                << static_cast<float>(fno2.first) / fno2.second;
         }
         os.copyfmt(oss);
+        os.flags(f);
         return os;
     }
 
@@ -1492,6 +1500,7 @@ namespace Exiv2 {
                                                const Value& value,
                                                const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         Rational distance = value.toRational();
         if (distance.first == 0) {
             os << _("Unknown");
@@ -1507,6 +1516,7 @@ namespace Exiv2 {
         else {
             os << "(" << value << ")";
         }
+        os.flags(f);
         return os;
     }
 
@@ -1514,6 +1524,7 @@ namespace Exiv2 {
                                                const Value& value,
                                                const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         Rational zoom = value.toRational();
         if (zoom.first == 0) {
             os << _("Not used");
@@ -1529,6 +1540,7 @@ namespace Exiv2 {
         else {
             os << "(" << value << ")";
         }
+        os.flags(f);
         return os;
     }
 
@@ -2399,14 +2411,18 @@ fmountlens[] = {
                                                       const Value& value,
                                                       const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         if (value.count() != 1 || value.typeId() != unsignedByte) {
-            return os << "(" << value << ")";
+            os << "(" << value << ")";
+            os.flags(f);
+            return os;
         }
         double dist = 0.01 * pow(10.0, value.toLong()/40.0);
         std::ostringstream oss;
         oss.copyfmt(os);
         os << std::fixed << std::setprecision(2) << dist << " m";
         os.copyfmt(oss);
+        os.flags(f);
         return os;
     }
 
@@ -2414,14 +2430,18 @@ fmountlens[] = {
                                                  const Value& value, 
                                                  const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         if (value.count() != 1 || value.typeId() != unsignedByte) {
-            return os << "(" << value << ")";
+            os << "(" << value << ")";
+            os.flags(f);
+            return os;
         }
         double aperture = pow(2.0, value.toLong()/24.0);
         std::ostringstream oss;
         oss.copyfmt(os);
         os << std::fixed << std::setprecision(1) << "F" << aperture;
         os.copyfmt(oss);
+        os.flags(f);
         return os;
     }
 
@@ -2444,14 +2464,18 @@ fmountlens[] = {
                                                const Value& value, 
                                                const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         if (value.count() != 1 || value.typeId() != unsignedByte) {
-            return os << "(" << value << ")";
+            os << "(" << value << ")";
+            os.flags(f);
+            return os;
         }
         double fstops = value.toLong()/12.0;
         std::ostringstream oss;
         oss.copyfmt(os);
         os << std::fixed << std::setprecision(1) << "F" << fstops;
         os.copyfmt(oss);
+        os.flags(f);
         return os;
     }
 
@@ -2459,14 +2483,18 @@ fmountlens[] = {
                                                           const Value& value, 
                                                           const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         if (value.count() != 1 || value.typeId() != unsignedByte || value.toLong() == 0) {
-            return os << "(" << value << ")";
+            os << "(" << value << ")";
+            os.flags(f);
+            return os;
         }
         double epp = 2048.0/value.toLong();
         std::ostringstream oss;
         oss.copyfmt(os);
         os << std::fixed << std::setprecision(1) << epp << " mm";
         os.copyfmt(oss);
+        os.flags(f);
         return os;
     }
 
@@ -2474,13 +2502,17 @@ 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 << ")";
+            os << "(" << value << ")";
+            os.flags(f);
+            return os;
         }
         std::ostringstream oss;
         oss.copyfmt(os);
         os << std::fixed << std::setprecision(1) << value.toLong() << " mm";
         os.copyfmt(oss);
+        os.flags(f);
         return os;
     }
 
@@ -2520,8 +2552,11 @@ fmountlens[] = {
                                                  const Value& value, 
                                                  const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         if (value.count() != 1 || value.typeId() != signedShort) {
-            return os << "(" << value << ")";
+            os << "(" << value << ")";
+            os.flags(f);
+            return os;
         }
         std::ostringstream oss;
         oss.copyfmt(os);
@@ -2531,6 +2566,7 @@ fmountlens[] = {
         os << std::fixed << "UTC " << sign << std::setw(2) << std::setfill('0') << h << ":" 
            << std::setw(2) << std::setfill('0') << min;
         os.copyfmt(oss);
+        os.flags(f);
         return os;
     }
 
diff --git a/src/olympusmn.cpp b/src/olympusmn.cpp
index 88b2ce4..fb31ac9 100644
--- a/src/olympusmn.cpp
+++ b/src/olympusmn.cpp
@@ -1530,7 +1530,9 @@ namespace Exiv2 {
 
     // Olympus FocusDistance 0x0305
     std::ostream& OlympusMakerNote::print0x0305(std::ostream& os, const Value& value, const ExifData*) {
+        std::ios::fmtflags f( os.flags() );
         if (value.count() != 1 || value.typeId() != unsignedRational) {
+            os.flags(f);
             return os << value;
         }
         
@@ -1545,6 +1547,7 @@ namespace Exiv2 {
             os << (float)distance.first/1000 << " m";
             os.copyfmt(oss); 
         }
+        os.flags(f);
         return os;
     }
     
diff --git a/src/pentaxmn.cpp b/src/pentaxmn.cpp
index 48501a1..176403b 100644
--- a/src/pentaxmn.cpp
+++ b/src/pentaxmn.cpp
@@ -1010,11 +1010,13 @@ namespace Exiv2 {
 
     std::ostream& PentaxMakerNote::printPentaxTime(std::ostream& os, const Value& value, const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         os << std::setw(2) << std::setfill('0') << value.toLong(0);
         os << ":";
         os << std::setw(2) << std::setfill('0') << value.toLong(1);
         os << ":";
         os << std::setw(2) << std::setfill('0') << value.toLong(2);
+        os.flags(f);
         return os;
     }
 
@@ -1026,24 +1028,30 @@ namespace Exiv2 {
 
     std::ostream& PentaxMakerNote::printPentaxFValue(std::ostream& os, const Value& value, const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         os << "F" << std::setprecision(2)
            << static_cast<float>(value.toLong()) / 10;
+        os.flags(f);
         return os;
     }
 
     std::ostream& PentaxMakerNote::printPentaxFocalLength(std::ostream& os, const Value& value, const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         os << std::fixed << std::setprecision(1)
            << static_cast<float>(value.toLong()) / 100
            << " mm";
+        os.flags(f);
         return os;
     }
 
     std::ostream& PentaxMakerNote::printPentaxCompensation(std::ostream& os, const Value& value, const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         os << std::setprecision(2)
            << (static_cast<float>(value.toLong()) - 50) / 10
            << " EV";
+        os.flags(f);
         return os;
     }
 
@@ -1055,9 +1063,11 @@ namespace Exiv2 {
 
     std::ostream& PentaxMakerNote::printPentaxFlashCompensation(std::ostream& os, const Value& value, const ExifData*)
     {
+        std::ios::fmtflags f( os.flags() );
         os << std::setprecision(2)
            << static_cast<float>(value.toLong()) / 256
            << " EV";
+        os.flags(f);
         return os;
     }
 
diff --git a/src/tags.cpp b/src/tags.cpp
index 927d718..16d5e23 100644
--- a/src/tags.cpp
+++ b/src/tags.cpp
@@ -2290,7 +2290,12 @@ namespace Exiv2 {
             for (int i = 0; i < n + 1; ++i) {
                 const int32_t z = value.toRational(i).first;
                 const int32_t d = value.toRational(i).second;
-                if (d == 0) return os << "(" << value << ")";
+                if (d == 0)
+                {
+                    os << "(" << value << ")";
+                    os.flags(f);
+                    return os;
+                }
                 // Hack: Need Value::toDouble
                 double b = static_cast<double>(z)/d;
                 const int p = z % d == 0 ? 0 : prec[i];

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list