[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:31 UTC 2017


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

The following commit has been merged in the master branch:
commit 9d72b7d1ec8b43518da3a4a074630f663af7e6fb
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Mon Jul 26 08:11:38 2004 +0000

    Revamped image and introduced byte* interface (Brad, bs_1.patch with minor modifications by ahu)
---
 config.h.in         |    9 +
 src/Makefile        |   28 +-
 src/actions.cpp     |   12 +-
 src/canonmn.cpp     |    9 +-
 src/canonmn.hpp     |    6 +-
 src/error.hpp       |    4 +-
 src/exif.cpp        |  112 +++---
 src/exif.hpp        |   30 +-
 src/exifcomment.cpp |    5 +-
 src/fujimn.cpp      |   11 +-
 src/fujimn.hpp      |    6 +-
 src/getopt_win32.c  |    2 +-
 src/ifd-test.cpp    |    4 +-
 src/ifd.cpp         |   36 +-
 src/ifd.hpp         |   20 +-
 src/image.cpp       | 1018 +++++++++++++++++++++++++++++++--------------------
 src/image.hpp       |  780 +++++++++++++++++++++++----------------
 src/imagetest.sh    |  101 +++++
 src/makernote.cpp   |   18 +-
 src/makernote.hpp   |   18 +-
 src/metacopy.cpp    |  193 ++++++++++
 src/metacopy.hpp    |   86 +++++
 src/nikonmn.cpp     |   19 +-
 src/nikonmn.hpp     |   10 +-
 src/sigmamn.cpp     |   14 +-
 src/sigmamn.hpp     |    6 +-
 src/tags.cpp        |    6 +-
 src/tags.hpp        |    4 +-
 src/types.cpp       |  104 +++---
 src/types.hpp       |   38 +-
 src/utils.cpp       |   20 +-
 src/value.cpp       |   26 +-
 src/value.hpp       |   50 +--
 33 files changed, 1801 insertions(+), 1004 deletions(-)

diff --git a/config.h.in b/config.h.in
index 114c49b..62c35f4 100644
--- a/config.h.in
+++ b/config.h.in
@@ -104,3 +104,12 @@
 
 /* Define to `unsigned' if <sys/types.h> does not define. */
 #undef size_t
+
+/* File path seperator */
+#ifdef _MSC_VER
+#define SEPERATOR_STR "\"
+#define SEPERATOR_CHR '\'
+#else
+#define SEPERATOR_STR "/"
+#define SEPERATOR_CHR '/'
+#endif
diff --git a/src/Makefile b/src/Makefile
index 97b470e..2022000 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -61,13 +61,19 @@ BINSRC = addmoddel.cpp exifcomment.cpp exifprint.cpp ifd-test.cpp \
 # State the main source file of the Exiv2 application here
 EXIV2MAIN = exiv2.cpp
 
-# Add additional source files of the real application to this list
+# Add additional source files of the Exiv2 application to this list
 EXIV2SRC = actions.cpp utils.cpp 
-# C source files of the application
+# C source files of the Exiv2 application
 ifndef HAVE_TIMEGM
 EXIVCSRC = localtime.c
 endif
 
+# State the main source file of the metacopy application here
+MCMAIN = metacopy.cpp
+
+# Add additional source files of the metacopy application to this list
+MCSRC = utils.cpp
+
 # ******************************************************************************
 # Library
 
@@ -101,7 +107,8 @@ HDR = $(CCHDR)
 OBJ = $(CCOBJ)
 SOBJ = $(CCSOBJ)
 DEP = $(CCSRC:%.cpp=.%.d) $(BINSRC:%.cpp=.%.d) \
-      $(EXIV2MAIN:%.cpp=.%.d) $(EXIV2SRC:%.cpp=.%.d) $(EXIVCSRC:%.c=.%.d)
+      $(EXIV2MAIN:%.cpp=.%.d) $(EXIV2SRC:%.cpp=.%.d) $(EXIVCSRC:%.c=.%.d) \
+      $(MCMAIN:%.cpp=.%.d) $(MCSRC:%.cpp=.%.d)
 
 BINOBJ = $(BINSRC:.cpp=.o)
 BINARY = $(BINSRC:.cpp=)
@@ -109,6 +116,10 @@ BINARY = $(BINSRC:.cpp=)
 EXIV2OBJ = $(EXIV2MAIN:.cpp=.o) $(EXIV2SRC:.cpp=.o) $(EXIVCSRC:.c=.o)
 EXIV2BIN = $(EXIV2MAIN:.cpp=)
 
+MCOBJ = $(MCMAIN:.cpp=.o) $(MCSRC:.cpp=.o)
+MCBIN = $(MCMAIN:.cpp=)
+
+
 ARCHIVE = lib$(LIBNAME)$(ARCHIVE_SUFFIX)
 SHAREDLIB = lib$(LIBNAME)$(SHAREDLIB_SUFFIX)
 
@@ -179,6 +190,9 @@ $(BINARY): %: %.o
 $(EXIV2BIN): %: %.o
 	$(CXX) $(CXXFLAGS) $(EXIV2OBJ) $(LDLIBS) $(LDFLAGS_BIN) -o $@
 
+$(MCBIN): %: %.o
+	$(CXX) $(CXXFLAGS) $(MCOBJ) $(LDLIBS) $(LDFLAGS_BIN) -o $@
+
 mn.cpp: ./mn.sh
 	./mn.sh
 
@@ -217,7 +231,9 @@ endif
 
 $(EXIV2BIN): lib $(EXIV2OBJ)
 
-bin: lib $(BINARY) $(EXIV2BIN)
+$(MCBIN): lib $(MCOBJ)
+
+bin: lib $(BINARY) $(EXIV2BIN) $(MCBIN)
 
 install: $(INSTALL)
 	$(INSTALL_DIRS) $(bindir) 
@@ -278,7 +294,7 @@ check:
 mostlyclean:
 	$(RM) core
 	$(RM) $(CCSRC:.cpp=.ii)
-	$(RM) $(OBJ) $(SOBJ) $(BINOBJ) $(EXIV2OBJ)
+	$(RM) $(OBJ) $(SOBJ) $(BINOBJ) $(EXIV2OBJ) $(MCOBJ)
 	$(RM) mn.o
 	@if test -n "$(CXX_REPOSITORY)"; then \
 	    echo "rm -rf $(CXX_REPOSITORY)"; \
@@ -287,7 +303,7 @@ mostlyclean:
 
 clean: mostlyclean
 	$(RM) $(ARCHIVE) $(SHAREDLIB)
-	$(RM) $(BINARY) $(EXIV2BIN)
+	$(RM) $(BINARY) $(EXIV2BIN) $(MCBIN)
 
 # Run `make distclean' from the top source directory to also remove
 # files created by configuring the program.
diff --git a/src/actions.cpp b/src/actions.cpp
index f23afa1..646f430 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -20,13 +20,13 @@
  */
 /*
   File:      actions.cpp
-  Version:   $Name:  $ $Revision: 1.30 $
+  Version:   $Name:  $ $Revision: 1.31 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History:   08-Dec-03, ahu: created
  */
 // *****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.30 $ $RCSfile: actions.cpp,v $")
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.31 $ $RCSfile: actions.cpp,v $")
 
 // *****************************************************************************
 // included header files
@@ -513,7 +513,7 @@ namespace Action {
             return 1;
         }
         std::string newPath 
-            = Util::dirname(path) + "/" + basename + Util::suffix(path);
+            = Util::dirname(path) + SEPERATOR_STR + basename + Util::suffix(path);
         if (   Util::dirname(newPath)  == Util::dirname(path)
             && Util::basename(newPath) == Util::basename(path)) {
             if (Params::instance().verbose_) {
@@ -647,7 +647,7 @@ namespace Action {
 
     int Extract::writeExifData(Exiv2::ExifData& exifData) const
     {
-        std::string exvPath =   Util::dirname(path_) + "/"
+        std::string exvPath =   Util::dirname(path_) + SEPERATOR_STR
                               + Util::basename(path_, true) + ".exv";
         if (Params::instance().verbose_) {
             std::cout << "Writing Exif data to " << exvPath << "
";
@@ -669,7 +669,7 @@ namespace Action {
     int Extract::writeThumbnail(const Exiv2::ExifData& exifData) const
     {
         int rc = 0;
-        std::string thumb =   Util::dirname(path_) + "/"
+        std::string thumb =   Util::dirname(path_) + SEPERATOR_STR
                             + Util::basename(path_, true) + "-thumb";
         std::string thumbExt = exifData.thumbnailExtension();
         if (thumbExt.empty()) {
@@ -709,7 +709,7 @@ namespace Action {
 
     int Insert::run(const std::string& path)
     try {
-        std::string exvPath =   Util::dirname(path) + "/"
+        std::string exvPath =   Util::dirname(path) + SEPERATOR_STR
                               + Util::basename(path, true) + ".exv";
         Exiv2::ExifData exifData;
         int rc = exifData.read(exvPath);
diff --git a/src/canonmn.cpp b/src/canonmn.cpp
index 4c37b69..1d8c7d8 100644
--- a/src/canonmn.cpp
+++ b/src/canonmn.cpp
@@ -20,7 +20,7 @@
  */
 /*
   File:      canonmn.cpp
-  Version:   $Name:  $ $Revision: 1.10 $
+  Version:   $Name:  $ $Revision: 1.11 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History:   18-Feb-04, ahu: created
              07-Mar-04, ahu: isolated as a separate component
@@ -30,7 +30,7 @@
  */
 // *****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.10 $ $RCSfile: canonmn.cpp,v $")
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.11 $ $RCSfile: canonmn.cpp,v $")
 
 // *****************************************************************************
 // included header files
@@ -553,7 +553,8 @@ namespace Exiv2 {
         }
         if (value.count() < 26) return os;
 
-        float fu = value.toLong(25);
+        // Todo: why not use toFloat()?
+        float fu = static_cast<float>(value.toLong(25));
         float len1 = value.toLong(23) / fu;
         float len2 = value.toLong(24) / fu;
         std::ostringstream oss;
@@ -656,7 +657,7 @@ namespace Exiv2 {
 // free functions
 
     MakerNote* createCanonMakerNote(bool alloc,
-                                    const char* buf, 
+                                    const byte* buf, 
                                     long len, 
                                     ByteOrder byteOrder, 
                                     long offset)
diff --git a/src/canonmn.hpp b/src/canonmn.hpp
index 32ed4d7..789eb16 100644
--- a/src/canonmn.hpp
+++ b/src/canonmn.hpp
@@ -23,10 +23,10 @@
   @brief   Canon MakerNote implemented according to the specification
            <a href="http://www.burren.cx/david/canon.html">
            EXIF MakerNote of Canon</a> by David Burren
-  @version $Name:  $ $Revision: 1.8 $
+  @version $Name:  $ $Revision: 1.9 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
-  @date    18-Feb-04, ahu: created
+  @date    18-Feb-04, ahu: created<BR>
            07-Mar-04, ahu: isolated as a separate component
  */
 #ifndef CANONMN_HPP_
@@ -73,7 +73,7 @@ namespace Exiv2 {
              this copy and is responsible to delete it!
      */
     MakerNote* createCanonMakerNote(bool alloc,
-                                    const char* buf, 
+                                    const byte* buf, 
                                     long len, 
                                     ByteOrder byteOrder, 
                                     long offset);
diff --git a/src/error.hpp b/src/error.hpp
index 303b50c..116c247 100644
--- a/src/error.hpp
+++ b/src/error.hpp
@@ -21,10 +21,10 @@
 /*!
   @file    error.hpp
   @brief   Error class for exceptions
-  @version $Name:  $ $Revision: 1.2 $
+  @version $Name:  $ $Revision: 1.3 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
-  @date    15-Jan-04, ahu: created
+  @date    15-Jan-04, ahu: created<BR>
            11-Feb-04, ahu: isolated as a component
  */
 #ifndef ERROR_HPP_
diff --git a/src/exif.cpp b/src/exif.cpp
index 597c970..0b7dc98 100644
--- a/src/exif.cpp
+++ b/src/exif.cpp
@@ -20,14 +20,14 @@
  */
 /*
   File:      exif.cpp
-  Version:   $Name:  $ $Revision: 1.48 $
+  Version:   $Name:  $ $Revision: 1.49 $
   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.48 $ $RCSfile: exif.cpp,v $")
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.49 $ $RCSfile: exif.cpp,v $")
 
 // Define DEBUG_MAKERNOTE to output debug information to std::cerr
 #undef DEBUG_MAKERNOTE
@@ -173,7 +173,7 @@ namespace Exiv2 {
           ifd_(ifd1, 0, false)
     {
         if (rhs.pImage_ && rhs.size_ > 0) {
-            pImage_ = new char[rhs.size_];
+            pImage_ = new byte[rhs.size_];
             memcpy(pImage_, rhs.pImage_, rhs.size_);
             tiffHeader_.read(pImage_);
             ifd_.read(pImage_ + tiffHeader_.offset(),
@@ -184,9 +184,9 @@ namespace Exiv2 {
 
     TiffThumbnail& TiffThumbnail::operator=(const TiffThumbnail& rhs)
     {
-        char* pNewImage = 0;
+        byte* pNewImage = 0;
         if (rhs.pImage_ && rhs.size_ > 0) {
-            pNewImage = new char[rhs.size_];
+            pNewImage = new byte[rhs.size_];
             memcpy(pNewImage, rhs.pImage_, rhs.size_);
             tiffHeader_.read(rhs.pImage_);
             ifd_.read(pNewImage + tiffHeader_.offset(), 
@@ -200,7 +200,7 @@ namespace Exiv2 {
         return *this;
     }
 
-    int TiffThumbnail::read(const char* buf,
+    int TiffThumbnail::read(const byte* buf,
                             long len,
                             const ExifData& exifData,
                             ByteOrder byteOrder)
@@ -276,7 +276,7 @@ namespace Exiv2 {
             ifd1.copy(img.pData_ + ifdOffset, tiffHeader.byteOrder(), ifdOffset);
 
             delete[] pImage_;
-            pImage_ = new char[buflen];
+            pImage_ = new byte[buflen];
             memcpy(pImage_, img.pData_, buflen);
             size_ = buflen;
             offset_ = minOffset;
@@ -302,11 +302,12 @@ namespace Exiv2 {
     int TiffThumbnail::write(const std::string& path) const
     {
         std::string name = path + extension();
-        std::ofstream file(name.c_str(), std::ios::binary);
-        if (!file) return -1;
-        file.write(pImage_, size_);
-        if (!file.good()) return 4;
-        return 0;
+        FILE *ofp = fopen(name.c_str(), "wb");
+        if (!ofp) return -1;
+        int rc = 0;
+        if (fwrite(pImage_, 1, size_, ofp) != (size_t)size_) rc = 4;
+        fclose(ofp);
+        return rc;
     } // TiffThumbnail::write
 
     void TiffThumbnail::update(ExifData& exifData) const
@@ -338,7 +339,7 @@ namespace Exiv2 {
 
     } // TiffThumbnail::update
 
-    long TiffThumbnail::copy(char* buf) const
+    long TiffThumbnail::copy(byte* buf) const
     {
         long offset = ifd_.offset() + ifd_.size() + ifd_.dataSize();
         long size = size_ - offset;
@@ -402,16 +403,16 @@ namespace Exiv2 {
         : offset_(rhs.offset_), size_(rhs.size_), pImage_(0)
     {
         if (rhs.pImage_ && rhs.size_ > 0) {
-            pImage_ = new char[rhs.size_];
+            pImage_ = new byte[rhs.size_];
             memcpy(pImage_, rhs.pImage_, rhs.size_);
         }
     }
 
     JpegThumbnail& JpegThumbnail::operator=(const JpegThumbnail& rhs)
     {
-        char* pNewImage = 0;
+        byte* pNewImage = 0;
         if (rhs.pImage_ && rhs.size_ > 0) {
-            pNewImage = new char[rhs.size_];
+            pNewImage = new byte[rhs.size_];
             memcpy(pNewImage, rhs.pImage_, rhs.size_);
         }
         offset_ = rhs.offset_;
@@ -421,7 +422,7 @@ namespace Exiv2 {
         return *this;
     }
 
-    int JpegThumbnail::read(const char* buf, 
+    int JpegThumbnail::read(const byte* buf, 
                             long len,
                             const ExifData& exifData,
                             ByteOrder byteOrder) 
@@ -436,7 +437,7 @@ namespace Exiv2 {
         long size = pos->toLong();
         if (len < offset + size) return 1;
         delete[] pImage_;
-        pImage_ = new char[size];
+        pImage_ = new byte[size];
         memcpy(pImage_, buf + offset, size);
         size_ = size;
         offset_ = offset;
@@ -456,11 +457,12 @@ namespace Exiv2 {
     int JpegThumbnail::write(const std::string& path) const
     {
         std::string name = path + extension();
-        std::ofstream file(name.c_str(), std::ios::binary);
-        if (!file) return -1;
-        file.write(pImage_, size_);
-        if (!file.good()) return 4;
-        return 0;
+        FILE *ofp = fopen(name.c_str(), "wb");
+        if (!ofp) return -1;
+        int rc = 0;
+        if (fwrite(pImage_, 1, size_, ofp) != (size_t)size_) rc = 4;
+        fclose(ofp);
+        return rc;
     } // JpegThumbnail::write
 
     void JpegThumbnail::update(ExifData& exifData) const
@@ -487,7 +489,7 @@ namespace Exiv2 {
 
     } // JpegThumbnail::update
 
-    long JpegThumbnail::copy(char* buf) const
+    long JpegThumbnail::copy(byte* buf) const
     {
         memcpy(buf, pImage_, size_);
         return size_;
@@ -533,30 +535,25 @@ namespace Exiv2 {
 
     int ExifData::read(const std::string& path)
     {
-        std::ifstream file(path.c_str(), std::ios::binary);
-        if (!file) return -1;
-        Image* pImage = ImageFactory::instance().create(file);
+        Image* pImage = ImageFactory::instance().open(path);
+        // Todo: if (!pImage) return -1;
         if (pImage) {
-            int rc = pImage->readExifData(file);
-            if (rc == 0) rc = read(pImage->exifData(), pImage->sizeExifData());
+            int rc = pImage->readMetadata();
+            if (rc == 0 && pImage->sizeExifData() > 0 ) {
+                rc = read(pImage->exifData(), pImage->sizeExifData());
+            }
             delete pImage;
             return rc;
         }
-        if (ExvFile::isThisType(file)) {
-            ExvFile exvFile;
-            int rc = exvFile.readExifData(file);
-            if (rc == 0) rc = read(exvFile.exifData(), exvFile.sizeExifData());
-            return rc;
-        }
         // We don't know this type of file
         return -2;
     }
 
-    int ExifData::read(const char* buf, long len)
+    int ExifData::read(const byte* buf, long len)
     {
         // Copy the data buffer
         delete[] pData_;
-        pData_ = new char[len];
+        pData_ = new byte[len];
         memcpy(pData_, buf, len);
         size_ = len;
 
@@ -581,8 +578,9 @@ namespace Exiv2 {
         if (pos != exifIfd_.end() && make != ifd0_.end() && model != ifd0_.end()) {
             MakerNoteFactory& mnf = MakerNoteFactory::instance();
             // Todo: The conversion to string assumes that there is a 

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list