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

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


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

The following commit has been merged in the master branch:
commit 41dc298854247ef7fcaef79dc1864e1683b9b544
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Thu May 13 16:13:29 2004 +0000

    Slightly improved error handling
---
 src/actions.cpp     | 98 ++++++++---------------------------------------------
 src/exifcomment.cpp | 79 ++----------------------------------------
 src/exifprint.cpp   | 41 ++--------------------
 src/image.cpp       |  6 ++--
 src/write-test.cpp  | 74 +++-------------------------------------
 5 files changed, 26 insertions(+), 272 deletions(-)

diff --git a/src/actions.cpp b/src/actions.cpp
index b5d7f7d..d906d41 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -20,13 +20,13 @@
  */
 /*
   File:      actions.cpp
-  Version:   $Name:  $ $Revision: 1.22 $
+  Version:   $Name:  $ $Revision: 1.23 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History:   08-Dec-03, ahu: created
  */
 // *****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.22 $ $RCSfile: actions.cpp,v $")
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.23 $ $RCSfile: actions.cpp,v $")
 
 // *****************************************************************************
 // included header files
@@ -65,12 +65,6 @@ namespace {
     // Convert a time type to a string "YYYY:MM:DD HH:MI:SS", "" on error
     std::string time2Str(time_t time);
 
-    // Return an error message for the return code of Exiv2::ExifData::read
-    std::string exifReadError(int rc, const std::string& path);
-
-    // Return an error message for the return code of Exiv2::ExifData::write
-    std::string exifWriteError(int rc, const std::string& path);
-
 }
 
 // *****************************************************************************
@@ -128,7 +122,7 @@ namespace Action {
         Exiv2::ExifData exifData;
         int rc = exifData.read(path);
         if (rc) {
-            std::cerr << exifReadError(rc, path) << "
";
+            std::cerr << Exiv2::ExifData::strError(rc, path) << "
";
             return rc;
         }
         switch (Params::instance().printMode_) {
@@ -451,7 +445,7 @@ namespace Action {
         Exiv2::ExifData exifData;
         int rc = exifData.read(path);
         if (rc) {
-            std::cerr << exifReadError(rc, path) << "
";
+            std::cerr << Exiv2::ExifData::strError(rc, path) << "
";
             return rc;
         }
         std::string key = "Image.DateTime.DateTimeOriginal";
@@ -535,7 +529,7 @@ namespace Action {
         Exiv2::ExifData exifData;
         int rc = exifData.read(path);
         if (rc) {
-            std::cerr << exifReadError(rc, path) << "
";
+            std::cerr << Exiv2::ExifData::strError(rc, path) << "
";
             return rc;
         }
         switch (Params::instance().delTarget_) {
@@ -565,7 +559,7 @@ namespace Action {
             }
             rc = exifData.write(path_);
             if (rc) {
-                std::cerr << exifWriteError(rc, path_) << "
";
+                std::cerr << Exiv2::ExifData::strError(rc, path_) << "
";
             }
         }
         return rc;
@@ -578,7 +572,7 @@ namespace Action {
         }
         int rc = exifData.erase(path_);
         if (rc) {
-            std::cerr << exifWriteError(rc, path_) << "
";
+            std::cerr << Exiv2::ExifData::strError(rc, path_) << "
";
         }
         return rc;
     }
@@ -599,7 +593,7 @@ namespace Action {
         Exiv2::ExifData exifData;
         int rc = exifData.read(path);
         if (rc) {
-            std::cerr << exifReadError(rc, path) << "
";
+            std::cerr << Exiv2::ExifData::strError(rc, path) << "
";
             return rc;
         }
         switch (Params::instance().extractTarget_) {
@@ -631,7 +625,7 @@ namespace Action {
         }
         int rc = exifData.writeExifData(exvPath);
         if (rc) {
-            std::cerr << exifWriteError(rc, exvPath) << "
";
+            std::cerr << Exiv2::ExifData::strError(rc, exvPath) << "
";
         }
         return rc;
     }
@@ -661,7 +655,7 @@ namespace Action {
             }
             rc = exifData.writeThumbnail(thumb);
             if (rc) {
-                std::cerr << exifWriteError(rc, thumb) << "
";
+                std::cerr << Exiv2::ExifData::strError(rc, thumb) << "
";
             }
         }
         return rc;
@@ -684,7 +678,7 @@ namespace Action {
         Exiv2::ExifData exifData;
         int rc = exifData.read(exvPath);
         if (rc) {
-            std::cerr << exifReadError(rc, exvPath) << "
";
+            std::cerr << Exiv2::ExifData::strError(rc, exvPath) << "
";
             return rc;
         }
         if (Params::instance().verbose_) {
@@ -692,7 +686,7 @@ namespace Action {
         }
         rc = exifData.write(path);
         if (rc) {
-            std::cerr << exifWriteError(rc, path) << "
";
+            std::cerr << Exiv2::ExifData::strError(rc, path) << "
";
         }
         return rc;
     }
@@ -720,7 +714,7 @@ namespace Action {
         Exiv2::ExifData exifData;
         int rc = exifData.read(path);
         if (rc) {
-            std::cerr << exifReadError(rc, path) << "
";
+            std::cerr << Exiv2::ExifData::strError(rc, path) << "
";
             return rc;
         }
         rc  = adjustDateTime(exifData, "Image.OtherTags.DateTime", path);
@@ -729,7 +723,7 @@ namespace Action {
         if (rc) return 1;
         rc = exifData.write(path);
         if (rc) {
-            std::cerr << exifWriteError(rc, path) << "
";
+            std::cerr << Exiv2::ExifData::strError(rc, path) << "
";
         }
         return rc;
     }
@@ -840,68 +834,4 @@ namespace {
 
         return os.str();
     } // time2Str
-
-    std::string exifReadError(int rc, const std::string& path)
-    {
-        std::string error;
-        switch (rc) {
-        case -1:
-            error = path + ": Failed to open the file";
-            break;
-        case -2:
-            error = path + ": The file contains data of an unknown image type";
-            break;
-        case 1:
-            error = path + ": Couldn't read from the input stream";
-            break;
-        case 2:
-            error = path + ": This does not look like a JPEG image";
-            break;
-        case 3:
-            error = path + ": No Exif data found in the file";
-            break;
-        case -99:
-            error = path + ": Unsupported Exif or GPS data found in IFD 1";
-            break;
-        default:
-            error = path + ": Reading Exif data failed, rc = " + Exiv2::toString(rc);
-            break;
-        }
-        return error;
-    } // exifReadError
-
-    std::string exifWriteError(int rc, const std::string& path)
-    {
-        std::string error;
-        switch (rc) {
-        case -1:
-            error = path + ": Failed to open the file";
-            break;
-        case -2:
-            error = path + ": The file contains data of an unknown image type";
-            break;
-        case -3:
-            error = path + ": Couldn't open temporary file";
-            break;
-        case -4:
-            error = path + ": Renaming temporary file failed: " + Util::strError();
-            break;
-        case 1:
-            error = path + ": Couldn't read from the input stream";
-            break;
-        case 2:
-            error = path + ": This does not look like a JPEG image";
-            break;
-        case 3:
-            error = path + ": No JFIF APP0 or Exif APP1 segment found in the file";
-            break;
-        case 4:
-            error = path + ": Writing to the output stream failed";
-            break;
-        default:
-            error = path + ": Reading Exif data failed, rc = " + Exiv2::toString(rc);
-            break;
-        }
-        return error;
-    } // exifWriteError
 }
diff --git a/src/exifcomment.cpp b/src/exifcomment.cpp
index 45ed8ab..3125f39 100644
--- a/src/exifcomment.cpp
+++ b/src/exifcomment.cpp
@@ -3,7 +3,7 @@
   Abstract : Sample program showing how to set the Exif comment of an image
 
   File:      exifcomment.cpp
-  Version  : $Name:  $ $Revision: 1.1 $
+  Version  : $Name:  $ $Revision: 1.2 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History  : 10-May-04, ahu: created
  */
@@ -15,12 +15,6 @@
 #include <cstring>
 
 // *****************************************************************************
-// local declarations
-
-std::string readError(int rc, const std::string& path);
-std::string writeError(int rc, const std::string& path);
-
-// *****************************************************************************
 // Main
 int main(int argc, char* const argv[])
 try {
@@ -33,7 +27,7 @@ try {
     Exiv2::ExifData exifData;
     int rc = exifData.read(argv[1]);
     if (rc) {
-        std::string error = readError(rc, argv[1]);
+        std::string error = Exiv2::ExifData::strError(rc, argv[1]);
         throw Exiv2::Error(error);
     }
 
@@ -83,7 +77,7 @@ try {
 
     rc = exifData.write(argv[1]);
     if (rc) {
-        std::string error = writeError(rc, argv[1]);
+        std::string error = Exiv2::ExifData::strError(rc, argv[1]);
         throw Exiv2::Error(error);
     }
 
@@ -93,70 +87,3 @@ catch (Exiv2::Error& e) {
     std::cout << "Caught Exiv2 exception '" << e << "'
";
     return -1;
 }
-
-// *****************************************************************************
-// local definitions
-
-std::string readError(int rc, const std::string& path)
-{
-    std::string error;
-    switch (rc) {
-    case -1:
-        error = path + ": Failed to open the file";
-        break;
-    case -2:
-        error = path + ": The file contains data of an unknown image type";
-        break;
-    case 1:
-        error = path + ": Couldn't read from the input stream";
-        break;
-    case 2:
-        error = path + ": This does not look like a JPEG image";
-        break;
-    case 3:
-        error = path + ": No Exif data found in the file";
-        break;
-    case -99:
-        error = path + ": Unsupported Exif or GPS data found in IFD 1";
-        break;
-    default:
-        error = path + ": Reading Exif data failed, rc = " + Exiv2::toString(rc);
-        break;
-    }
-    return error;
-} // exifReadError
-
-std::string writeError(int rc, const std::string& path)
-{
-    std::string error;
-    switch (rc) {
-    case -1:
-        error = path + ": Failed to open the file";
-        break;
-    case -2:
-        error = path + ": The file contains data of an unknown image type";
-        break;
-    case -3:
-        error = path + ": Couldn't open temporary file";
-        break;
-    case -4:
-        error = path + ": Renaming temporary file failed";
-        break;
-    case 1:
-        error = path + ": Couldn't read from the input stream";
-        break;
-    case 2:
-        error = path + ": This does not look like a JPEG image";
-        break;
-    case 3:
-        error = path + ": No JFIF APP0 or Exif APP1 segment found in the file";
-        break;
-    case 4:
-        error = path + ": Writing to the output stream failed";
-        break;
-    default:
-        error = path + ": Reading Exif data failed, rc = " + Exiv2::toString(rc);
-        break;
-    }
-    return error;
-} // writeError
diff --git a/src/exifprint.cpp b/src/exifprint.cpp
index 746b4dc..294362b 100644
--- a/src/exifprint.cpp
+++ b/src/exifprint.cpp
@@ -3,7 +3,7 @@
   Abstract : Sample program to print the Exif metadata of an image
 
   File:      exifprint.cpp
-  Version  : $Name:  $ $Revision: 1.13 $
+  Version  : $Name:  $ $Revision: 1.14 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History  : 26-Jan-04, ahu: created
  */
@@ -15,11 +15,6 @@
 #include <cstring>
 
 // *****************************************************************************
-// local declarations
-
-std::string readError(int rc, const char* file);
-
-// *****************************************************************************
 // Main
 int main(int argc, char* const argv[])
 try {
@@ -32,7 +27,7 @@ try {
     Exiv2::ExifData exifData;
     int rc = exifData.read(argv[1]);
     if (rc) {
-        std::string error = readError(rc, argv[1]);
+        std::string error = Exiv2::ExifData::strError(rc, argv[1]);
         throw Exiv2::Error(error);
     }
 
@@ -52,35 +47,3 @@ catch (Exiv2::Error& e) {
     std::cout << "Caught Exif exception '" << e << "'
";
     return -1;
 }
-
-// *****************************************************************************
-// local definitions
-
-std::string readError(int rc, const char* file)
-{
-    std::string error;
-    switch (rc) {
-    case -1:
-        error = "Couldn't open file `" + std::string(file) + "'";
-        break;
-    case -2:
-        error = "The file contains data of an unknown image type";
-        break;
-    case 1:
-        error = "Couldn't read from the input stream";
-        break;
-    case 2:
-        error = "This does not look like a JPEG image";
-        break;
-    case 3:
-        error = "No Exif data found in the file";
-        break;
-    case -99:
-        error = "Unsupported Exif or GPS data found in IFD 1";
-        break;
-    default:
-        error = "Reading Exif data failed, rc = " + Exiv2::toString(rc);
-        break;
-    }
-    return error;
-}
diff --git a/src/image.cpp b/src/image.cpp
index 7b20274..dc46017 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -20,14 +20,14 @@
  */
 /*
   File:      image.cpp
-  Version:   $Name:  $ $Revision: 1.13 $
+  Version:   $Name:  $ $Revision: 1.14 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History:   26-Jan-04, ahu: created
              11-Feb-04, ahu: isolated as a component
  */
 // *****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.13 $ $RCSfile: image.cpp,v $")
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.14 $ $RCSfile: image.cpp,v $")
 
 // *****************************************************************************
 // included header files
@@ -357,7 +357,7 @@ namespace Exiv2 {
         else {
             is.seekg(-10, std::ios::cur);
         }
-        if (!validFile) return 3;
+        if (!validFile) return 5;
         // Write SOI marker
         us2Data(tmpbuf, soi_, bigEndian);
         os.write(tmpbuf, 2);
diff --git a/src/write-test.cpp b/src/write-test.cpp
index c8a4c89..05ceeba 100644
--- a/src/write-test.cpp
+++ b/src/write-test.cpp
@@ -3,7 +3,7 @@
   Abstract : ExifData write unit tests
 
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
-  Version  : $Name:  $ $Revision: 1.4 $
+  Version  : $Name:  $ $Revision: 1.5 $
 
   Test procedure: 
    $ rm -f test.jpg thumb.jpg iii ttt; 
@@ -35,8 +35,6 @@ void testCase(const std::string& file1,
               const std::string& key,
               const std::string& value);
 void exifPrint(const ExifData& exifData);
-std::string readError(int rc, const char* file);
-std::string writeError(int rc, const char* file);
 
 // *****************************************************************************
 // Main
@@ -124,7 +122,7 @@ void testCase(const std::string& file1,
     std::cerr << "---> Reading file " << file1 << "
";
     int rc = ed1.read(file1);
     if (rc) {
-        std::string error = readError(rc, file1.c_str());
+        std::string error = ExifData::strError(rc, file1.c_str());
         throw Error(error);
     }
 
@@ -138,7 +136,7 @@ void testCase(const std::string& file1,
     std::cerr << "---> Writing Exif data to file " << file2 << "
";
     rc = ed1.write(file2);
     if (rc) {
-        std::string error = writeError(rc, file2.c_str());
+        std::string error = ExifData::strError(rc, file2.c_str());
         throw Error(error);
     }
 
@@ -147,7 +145,7 @@ void testCase(const std::string& file1,
     std::cerr << "---> Reading file " << file2 << "
";
     rc = ed2.read(file2);
     if (rc) {
-        std::string error = readError(rc, file2.c_str());
+        std::string error = ExifData::strError(rc, file2.c_str());
         throw Error(error);
     }
 
@@ -172,67 +170,3 @@ void exifPrint(const ExifData& exifData)
                   << "
";
     }
 }
-
-std::string readError(int rc, const char* file)
-{
-    std::string error;
-    switch (rc) {
-    case -1:
-        error = "Couldn't open file `" + std::string(file) + "'";
-        break;
-    case -2:
-        error = "The file contains data of an unknown image type";
-        break;
-    case 1:
-        error = "Couldn't read from the input stream";
-        break;
-    case 2:
-        error = "This does not look like a JPEG image";
-        break;
-    case 3:
-        error = "No Exif data found in the file";
-        break;
-    case -99:
-        error = "Unsupported Exif or GPS data found in IFD 1";
-        break;
-    default:
-        error = "Reading Exif data failed, rc = " + toString(rc);
-        break;
-    }
-    return error;
-}
-
-std::string writeError(int rc, const char* file)
-{
-    std::string error;
-    switch (rc) {
-    case -1:
-        error = "Couldn't open file `" + std::string(file) + "'";
-        break;
-    case -2:
-        error = "The file contains data of an unknown image type";
-        break;
-    case -3:
-        error = "Couldn't open temporary file";
-        break;
-    case -4:
-        error = "Renaming temporary file failed";
-        break;
-    case 1:
-        error = "Couldn't read from the input stream";
-        break;
-    case 2:
-        error = "This does not look like a JPEG image";
-        break;
-    case 3:
-        error = "No JFIF APP0 or Exif APP1 segment found in the file";
-        break;
-    case 4:
-        error = "Writing to the output stream failed";
-        break;
-    default:
-        error = "Writing Exif data failed, rc = " + toString(rc);
-        break;
-    }
-    return error;
-}

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list