gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r1349 - Extractor/src/plugins/exiv2


From: grothoff
Subject: [GNUnet-SVN] r1349 - Extractor/src/plugins/exiv2
Date: Sat, 9 Jul 2005 07:07:42 -0700 (PDT)

Author: grothoff
Date: 2005-07-09 07:06:45 -0700 (Sat, 09 Jul 2005)
New Revision: 1349

Modified:
   Extractor/src/plugins/exiv2/canonmn.cpp
   Extractor/src/plugins/exiv2/exif.cpp
   Extractor/src/plugins/exiv2/exif.hpp
   Extractor/src/plugins/exiv2/exiv2.cpp
   Extractor/src/plugins/exiv2/exiv2.hpp
   Extractor/src/plugins/exiv2/exv_conf.h
   Extractor/src/plugins/exiv2/fujimn.cpp
   Extractor/src/plugins/exiv2/ifd.cpp
   Extractor/src/plugins/exiv2/image.cpp
   Extractor/src/plugins/exiv2/image.hpp
   Extractor/src/plugins/exiv2/iptc.cpp
   Extractor/src/plugins/exiv2/iptc.hpp
   Extractor/src/plugins/exiv2/makernote.cpp
   Extractor/src/plugins/exiv2/makernote.hpp
   Extractor/src/plugins/exiv2/metacopy.cpp
   Extractor/src/plugins/exiv2/olympusmn.cpp
   Extractor/src/plugins/exiv2/panasonicmn.cpp
   Extractor/src/plugins/exiv2/sigmamn.cpp
   Extractor/src/plugins/exiv2/sonymn.cpp
   Extractor/src/plugins/exiv2/tags.cpp
Log:
update

Modified: Extractor/src/plugins/exiv2/canonmn.cpp
===================================================================
--- Extractor/src/plugins/exiv2/canonmn.cpp     2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/canonmn.cpp     2005-07-09 14:06:45 UTC (rev 
1349)
@@ -20,7 +20,7 @@
  */
 /*
   File:      canonmn.cpp
-  Version:   $Rev: 569 $
+  Version:   $Rev: 600 $
   Author(s): Andreas Huggel (ahu) <address@hidden>
   History:   18-Feb-04, ahu: created
              07-Mar-04, ahu: isolated as a separate component
@@ -30,7 +30,7 @@
  */
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: canonmn.cpp 569 2005-05-28 05:48:43Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: canonmn.cpp 600 2005-07-09 10:38:09Z ahuggel $");
 
 // 
*****************************************************************************
 // included header files
@@ -49,9 +49,6 @@
 #include <cstring>
 #include <cmath>
 
-// Define DEBUG_MAKERNOTE to output debug information to std::cerr
-#undef DEBUG_MAKERNOTE
-
 // 
*****************************************************************************
 // local declarations
 namespace {
@@ -90,7 +87,7 @@
             canonCs2IfdId, MakerNote::AutoPtr(new CanonMakerNote));
         MakerNoteFactory::registerMakerNote(
             canonCfIfdId, MakerNote::AutoPtr(new CanonMakerNote));
-        
+
         ExifTags::registerMakerTagInfo(canonIfdId, tagInfo_);
         ExifTags::registerMakerTagInfo(canonCs1IfdId, tagInfoCs1_);
         ExifTags::registerMakerTagInfo(canonCs2IfdId, tagInfoCs2_);

Modified: Extractor/src/plugins/exiv2/exif.cpp
===================================================================
--- Extractor/src/plugins/exiv2/exif.cpp        2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/exif.cpp        2005-07-09 14:06:45 UTC (rev 
1349)
@@ -20,14 +20,14 @@
  */
 /*
   File:      exif.cpp
-  Version:   $Rev: 569 $
+  Version:   $Rev: 600 $
   Author(s): Andreas Huggel (ahu) <address@hidden>
   History:   26-Jan-04, ahu: created
              11-Feb-04, ahu: isolated as a component
  */
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: exif.cpp 569 2005-05-28 05:48:43Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: exif.cpp 600 2005-07-09 10:38:09Z ahuggel $");
 
 // Define DEBUG_MAKERNOTE to output debug information to std::cerr, e.g, by 
 // calling make like this: make DEFS=-DDEBUG_MAKERNOTE exif.o 
@@ -114,6 +114,12 @@
         if (rhs.value_.get() != 0) value_ = rhs.value_->clone(); // deep copy
     }
 
+    const Value& Exifdatum::value() const 
+    {
+        if (value_.get() == 0) throw Error(8);        
+        return *value_; 
+    }
+
     Exifdatum& Exifdatum::operator=(const Exifdatum& rhs)
     {
         if (this == &rhs) return *this;
@@ -497,9 +503,10 @@
                                    byteOrder(),
                                    pExifIfd_->offset() + pos->offset());
             if (rc) {
-                // Todo: How to handle debug output like this
+#ifndef SUPPRESS_WARNINGS
                 std::cerr << "Warning: Failed to read Makernote, rc = "
                           << rc << "\n";
+#endif
                 delete pMakerNote_;
                 pMakerNote_ = 0;
             }

Modified: Extractor/src/plugins/exiv2/exif.hpp
===================================================================
--- Extractor/src/plugins/exiv2/exif.hpp        2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/exif.hpp        2005-07-09 14:06:45 UTC (rev 
1349)
@@ -21,7 +21,7 @@
 /*!
   @file    exif.hpp
   @brief   Encoding and decoding of Exif data
-  @version $Rev: 560 $
+  @version $Rev: 599 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:address@hidden";>address@hidden</a>
   @date    09-Jan-04, ahu: created
@@ -283,8 +283,7 @@
           @return A constant reference to the value.
           @throw Error if the value is not set.
          */
-        const Value& value() const 
-            { if (value_.get() != 0) return *value_; throw Error(8); }
+        const Value& value() const; 
         //! Return the size of the data area.
         long sizeDataArea() const 
             { return value_.get() == 0 ? 0 : value_->sizeDataArea(); }

Modified: Extractor/src/plugins/exiv2/exiv2.cpp
===================================================================
--- Extractor/src/plugins/exiv2/exiv2.cpp       2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/exiv2.cpp       2005-07-09 14:06:45 UTC (rev 
1349)
@@ -22,13 +22,13 @@
   Abstract:  Command line program to display and manipulate image %Exif data
 
   File:      exiv2.cpp
-  Version:   $Rev: 575 $
+  Version:   $Rev: 598 $
   Author(s): Andreas Huggel (ahu) <address@hidden>
   History:   10-Dec-03, ahu: created
  */
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: exiv2.cpp 575 2005-06-04 07:32:20Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: exiv2.cpp 598 2005-07-08 15:29:11Z ahuggel $");
 
 // 
*****************************************************************************
 // included header files
@@ -142,6 +142,10 @@
         }
         task->run(*i);
     }
+
+    taskFactory.cleanup();
+    params.cleanup();
+
     return 0;
 } // main
 
@@ -157,6 +161,12 @@
     return *instance_;
 }
 
+void Params::cleanup()
+{
+    delete instance_;
+    instance_ = 0;
+}
+
 void Params::version(std::ostream& os) const
 {
     os << EXV_PACKAGE_STRING << ", " 

Modified: Extractor/src/plugins/exiv2/exiv2.hpp
===================================================================
--- Extractor/src/plugins/exiv2/exiv2.hpp       2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/exiv2.hpp       2005-07-09 14:06:45 UTC (rev 
1349)
@@ -21,7 +21,7 @@
 /*!
   @file    exiv2.hpp
   @brief   Defines class Params, used for the command line handling of exiv2
-  @version $Rev: 567 $
+  @version $Rev: 598 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:address@hidden";>address@hidden</a>
   @date    08-Dec-03, ahu: created
@@ -119,6 +119,8 @@
       @return Reference to the global Params instance.
     */
     static Params& instance();
+    //! Destructor
+    void cleanup();
 
     //! Enumerates print modes
     enum PrintMode { pmSummary, pmInterpreted, pmValues, pmHexdump, pmIptc, 

Modified: Extractor/src/plugins/exiv2/exv_conf.h
===================================================================
--- Extractor/src/plugins/exiv2/exv_conf.h      2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/exv_conf.h      2005-07-09 14:06:45 UTC (rev 
1349)
@@ -9,6 +9,8 @@
 /* Define to 1 if using `alloca.c'. */
 /* #undef EXV_C_ALLOCA */
 
+#define SUPPRESS_WARNINGS 1
+
 /* Define to 1 if you have the `alarm' function. */
 #define EXV_HAVE_ALARM 1
 

Modified: Extractor/src/plugins/exiv2/fujimn.cpp
===================================================================
--- Extractor/src/plugins/exiv2/fujimn.cpp      2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/fujimn.cpp      2005-07-09 14:06:45 UTC (rev 
1349)
@@ -20,7 +20,7 @@
  */
 /*
   File:      fujimn.cpp
-  Version:   $Rev: 569 $
+  Version:   $Rev: 600 $
   Author(s): Andreas Huggel (ahu) <address@hidden>
   History:   18-Feb-04, ahu: created
              07-Mar-04, ahu: isolated as a separate component
@@ -31,7 +31,7 @@
  */
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: fujimn.cpp 569 2005-05-28 05:48:43Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: fujimn.cpp 600 2005-07-09 10:38:09Z ahuggel $");
 
 // 
*****************************************************************************
 // included header files
@@ -46,9 +46,6 @@
 #include <iomanip>
 #include <cassert>
 
-// Define DEBUG_MAKERNOTE to output debug information to std::cerr
-#undef DEBUG_MAKERNOTE
-
 // 
*****************************************************************************
 // class member definitions
 namespace Exiv2 {

Modified: Extractor/src/plugins/exiv2/ifd.cpp
===================================================================
--- Extractor/src/plugins/exiv2/ifd.cpp 2005-07-09 14:06:01 UTC (rev 1348)
+++ Extractor/src/plugins/exiv2/ifd.cpp 2005-07-09 14:06:45 UTC (rev 1349)
@@ -20,14 +20,14 @@
  */
 /*
   File:      ifd.cpp
-  Version:   $Rev: 562 $
+  Version:   $Rev: 600 $
   Author(s): Andreas Huggel (ahu) <address@hidden>
   History:   26-Jan-04, ahu: created
              11-Feb-04, ahu: isolated as a component
  */
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: ifd.cpp 562 2005-04-20 18:16:29Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: ifd.cpp 600 2005-07-09 10:38:09Z ahuggel $");
 
 // 
*****************************************************************************
 // included header files
@@ -313,10 +313,11 @@
 
             for (int i = 0; i < n; ++i) {
                 if (len < o + 12) {
-                    // Todo: How to handle debug output like this
+#ifndef SUPPRESS_WARNINGS
                     std::cerr << "Error: " << ExifTags::ifdName(ifdId_) 
                               << " entry " << i
                               << " lies outside of the IFD memory buffer.\n";
+#endif
                     rc = 6;
                     break;
                 }
@@ -333,10 +334,11 @@
         }
         if (rc == 0 && hasNext_) {
             if (len < o + 4) {
-                // Todo: How to handle debug output like this
+#ifndef SUPPRESS_WARNINGS
                 std::cerr << "Error: " << ExifTags::ifdName(ifdId_) 
                           << " memory of the pointer to the next IFD"
                           << " lies outside of the IFD memory buffer.\n";
+#endif
                 rc = 6;
             }
             else {
@@ -369,7 +371,7 @@
                 }
                 // Set the offset of the first data entry outside of the IFD
                 if (i->offset_ - offset_ >= len) {
-                    // Todo: How to handle debug output like this
+#ifndef SUPPRESS_WARNINGS
                     std::cerr << "Error: Offset of the 1st data entry of " 
                               << ExifTags::ifdName(ifdId_) 
                               << " is out of bounds:\n"
@@ -379,6 +381,7 @@
                               << ", exceeds buffer size by "
                               << std::dec << i->offset_ - len
                               << " Bytes\n";
+#endif
                     rc = 6;
                 }
                 else {
@@ -402,7 +405,7 @@
                 long tmpOffset = 
                     i->size_ > 4 ? i->offset_ - offset_ : i->offsetLoc_;
                 if (tmpOffset + i->size_ > len) {
-                    // Todo: How to handle debug output like this
+#ifndef SUPPRESS_WARNINGS
                     std::cerr << "Warning: Upper boundary of data for " 
                               << ExifTags::ifdName(ifdId_) 
                               << " entry " << static_cast<int>(i - begin) 
@@ -414,6 +417,7 @@
                               << ", exceeds buffer size by "
                               << tmpOffset + i->size_ - len
                               << " Bytes; Truncating the data.\n";
+#endif
                     // Truncate the entry
                     i->size_ = 0;
                     i->count_ = 0;

Modified: Extractor/src/plugins/exiv2/image.cpp
===================================================================
--- Extractor/src/plugins/exiv2/image.cpp       2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/image.cpp       2005-07-09 14:06:45 UTC (rev 
1349)
@@ -20,7 +20,7 @@
  */
 /*
   File:      image.cpp
-  Version:   $Rev: 563 $
+  Version:   $Rev: 598 $
   Author(s): Andreas Huggel (ahu) <address@hidden>
              Brad Schick (brad) <address@hidden>
   History:   26-Jan-04, ahu: created
@@ -30,7 +30,7 @@
  */
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: image.cpp 563 2005-04-21 07:21:53Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: image.cpp 598 2005-07-08 15:29:11Z ahuggel $");
 
 // 
*****************************************************************************
 // included header files
@@ -66,8 +66,28 @@
 // class member definitions
 namespace Exiv2 {
 
+    int ImageFactory::Init::count = 0;
+
+    ImageFactory::Init::Init()
+    {
+        ++count;
+    }
+
+    ImageFactory::Init::~Init()
+    {
+        if (--count == 0) {
+            Exiv2::ImageFactory::cleanup();
+        }
+    }
+
     ImageFactory::Registry* ImageFactory::registry_ = 0;
 
+    void ImageFactory::cleanup()
+    {
+        delete registry_;
+        registry_ = 0;
+    }
+
     void ImageFactory::init()
     {
         if (0 == registry_) {

Modified: Extractor/src/plugins/exiv2/image.hpp
===================================================================
--- Extractor/src/plugins/exiv2/image.hpp       2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/image.hpp       2005-07-09 14:06:45 UTC (rev 
1349)
@@ -21,7 +21,7 @@
 /*!
   @file    image.hpp
   @brief   Class JpegImage to access JPEG images
-  @version $Rev: 563 $
+  @version $Rev: 598 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:address@hidden";>address@hidden</a>
   @author  Brad Schick (brad) 
@@ -252,6 +252,8 @@
     public:
         //! @name Manipulators
         //@{
+        //! Destructor.
+        static void cleanup();
         /*!
           @brief Register image type together with its function pointers.
 
@@ -372,7 +374,25 @@
         static Image::Type getType(BasicIo& io);
         //@}
 
+        /*!
+          @brief Class Init is used to execute initialisation and termination 
+                 code exactly once, at the begin and end of the program.
 
+          See Bjarne Stroustrup, 'The C++ Programming Language 3rd
+          Edition', section 21.5.2 for details about this pattern.
+        */
+        class Init {
+            static int count;           //!< Counts calls to constructor
+        public:
+            //! @name Creators
+            //@{                            
+            //! Perform one-time initialisations.
+            Init();
+            //! Perform one-time cleanup operations.
+            ~Init();
+            //@}
+        };
+
     private:
         //! @name Creators
         //@{
@@ -458,4 +478,16 @@
 
 }                                       // namespace Exiv2
 
+namespace {
+    /*!
+      Each translation unit that includes image.hpp declares its own
+      Init object. The destructor ensures that the factory is properly
+      freed exactly once.
+
+      See Bjarne Stroustrup, 'The C++ Programming Language 3rd
+      Edition', section 21.5.2 for details about this pattern.
+    */
+    Exiv2::ImageFactory::Init imageFactoryInit;
+}
+
 #endif                                  // #ifndef IMAGE_HPP_

Modified: Extractor/src/plugins/exiv2/iptc.cpp
===================================================================
--- Extractor/src/plugins/exiv2/iptc.cpp        2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/iptc.cpp        2005-07-09 14:06:45 UTC (rev 
1349)
@@ -20,17 +20,14 @@
  */
 /*
   File:      iptc.cpp
-  Version:   $Rev: 560 $
+  Version:   $Rev: 600 $
   Author(s): Brad Schick (brad) <address@hidden>
   History:   31-July-04, brad: created
  */
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: iptc.cpp 560 2005-04-17 11:51:32Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: iptc.cpp 600 2005-07-09 10:38:09Z ahuggel $");
 
-// Define DEBUG_MAKERNOTE to output debug information to std::cerr
-#undef DEBUG_MAKERNOTE
-
 // 
*****************************************************************************
 // included header files
 #include "iptc.hpp"
@@ -66,6 +63,12 @@
     {
     }
 
+    const Value& Iptcdatum::value() const
+    {
+        if (value_.get() == 0) throw Error(8);
+        return *value_; 
+    }
+
     Iptcdatum& Iptcdatum::operator=(const Iptcdatum& rhs)
     {
         if (this == &rhs) return *this;

Modified: Extractor/src/plugins/exiv2/iptc.hpp
===================================================================
--- Extractor/src/plugins/exiv2/iptc.hpp        2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/iptc.hpp        2005-07-09 14:06:45 UTC (rev 
1349)
@@ -21,7 +21,7 @@
 /*!
   @file    iptc.hpp
   @brief   Encoding and decoding of Iptc data
-  @version $Rev: 560 $
+  @version $Rev: 599 $
   @author  Brad Schick (brad) 
            <a href="mailto:address@hidden";>address@hidden</a>
   @date    31-Jul-04, brad: created
@@ -226,8 +226,7 @@
           @return A constant reference to the value.
           @throw Error If the value is not set.
          */
-        const Value& value() const
-            { if (value_.get() != 0) return *value_; throw Error(8); }
+        const Value& value() const;
         //@}
 
     private:

Modified: Extractor/src/plugins/exiv2/makernote.cpp
===================================================================
--- Extractor/src/plugins/exiv2/makernote.cpp   2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/makernote.cpp   2005-07-09 14:06:45 UTC (rev 
1349)
@@ -20,13 +20,13 @@
  */
 /*
   File:      makernote.cpp
-  Version:   $Rev: 579 $
+  Version:   $Rev: 600 $
   Author(s): Andreas Huggel (ahu) <address@hidden>
   History:   18-Feb-04, ahu: created
  */
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: makernote.cpp 579 2005-06-11 04:11:23Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: makernote.cpp 600 2005-07-09 10:38:09Z ahuggel $");
 
 // Define DEBUG_* to output debug information to std::cerr, e.g, by calling
 // make like this: make DEFS=-DDEBUG_MAKERNOTE makernote.o 
@@ -103,9 +103,11 @@
         if (rc == 0) {
             // IfdMakerNote currently does not support multiple IFDs
             if (ifd_.next() != 0) {
+#ifndef SUPPRESS_WARNINGS
                 std::cerr << "Warning: Makernote IFD has a next pointer != 0 ("
                           << ifd_.next()
                           << "). Ignored.\n";
+#endif
             }
         }
 #ifdef DEBUG_MAKERNOTE
@@ -184,9 +186,42 @@
         return AutoPtr(clone_());
     }
 
+    int MakerNoteFactory::Init::count = 0;
+
+    MakerNoteFactory::Init::Init()
+    {
+        ++count;
+    }
+
+    MakerNoteFactory::Init::~Init()
+    {
+        if (--count == 0) {
+            Exiv2::MakerNoteFactory::cleanup();
+        }
+    }
+
     MakerNoteFactory::Registry* MakerNoteFactory::pRegistry_ = 0;
     MakerNoteFactory::IfdIdRegistry* MakerNoteFactory::pIfdIdRegistry_ = 0;
 
+    void MakerNoteFactory::cleanup()
+    {
+        if (pRegistry_ != 0) {
+            Registry::iterator e = pRegistry_->end();
+            for (Registry::iterator i = pRegistry_->begin(); i != e; ++i) {
+                delete i->second;
+            }
+            delete pRegistry_;
+        }
+
+        if (pIfdIdRegistry_ != 0) {
+            IfdIdRegistry::iterator e = pIfdIdRegistry_->end();
+            for (IfdIdRegistry::iterator i = pIfdIdRegistry_->begin(); i != e; 
++i) {
+                delete i->second;
+            }
+            delete pIfdIdRegistry_;
+        }
+    }
+
     void MakerNoteFactory::init()
     {
         if (0 == pRegistry_) {
@@ -203,6 +238,11 @@
         init();
         MakerNote* pMakerNote = makerNote.release();
         assert(pMakerNote);
+        IfdIdRegistry::iterator pos = pIfdIdRegistry_->find(ifdId);
+        if (pos != pIfdIdRegistry_->end()) {
+            delete pos->second;
+            pos->second = 0;
+        }
         (*pIfdIdRegistry_)[ifdId] = pMakerNote;
     } // MakerNoteFactory::registerMakerNote
 

Modified: Extractor/src/plugins/exiv2/makernote.hpp
===================================================================
--- Extractor/src/plugins/exiv2/makernote.hpp   2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/makernote.hpp   2005-07-09 14:06:45 UTC (rev 
1349)
@@ -22,7 +22,7 @@
   @file    makernote.hpp
   @brief   Contains the Exif %MakerNote interface, IFD %MakerNote and a 
            MakerNote factory
-  @version $Rev: 569 $
+  @version $Rev: 598 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:address@hidden";>address@hidden</a>
   @date    18-Feb-04, ahu: created
@@ -344,6 +344,8 @@
     */
     class MakerNoteFactory {
     public:
+        //! Destructor.
+        static void cleanup();
         /*!
           @brief Register a %MakerNote create function for a camera make and
                  model.
@@ -442,6 +444,25 @@
          */
         static int match(const std::string& regEntry, const std::string& key);
 
+        /*!
+          @brief Class Init is used to execute initialisation and termination 
+                 code exactly once, at the begin and end of the program.
+
+          See Bjarne Stroustrup, 'The C++ Programming Language 3rd
+          Edition', section 21.5.2 for details about this pattern.
+        */
+        class Init {
+            static int count;           //!< Counts calls to constructor
+        public:
+            //! @name Creators
+            //@{                            
+            //! Perform one-time initialisations.
+            Init();
+            //! Perform one-time cleanup operations.
+            ~Init();
+            //@}
+        };
+
     private:
         //! @name Creators
         //@{                
@@ -471,4 +492,16 @@
    
 }                                       // namespace Exiv2
 
+namespace {
+    /*!
+      Each translation unit that includes makernote.hpp declares its own
+      Init object. The destructor ensures that the factory is properly
+      freed exactly once.
+
+      See Bjarne Stroustrup, 'The C++ Programming Language 3rd
+      Edition', section 21.5.2 for details about this pattern.
+    */
+    Exiv2::MakerNoteFactory::Init makerNoteFactoryInit;
+}
+
 #endif                                  // #ifndef MAKERNOTE_HPP_

Modified: Extractor/src/plugins/exiv2/metacopy.cpp
===================================================================
--- Extractor/src/plugins/exiv2/metacopy.cpp    2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/metacopy.cpp    2005-07-09 14:06:45 UTC (rev 
1349)
@@ -37,7 +37,6 @@
 #include <fstream>
 #include <cassert>
 
-#if 0
 // 
*****************************************************************************
 // Main
 int main(int argc, char* const argv[])
@@ -92,7 +91,6 @@
     return 10;
 }
 }
-#endif
 
 int Params::option(int opt, const std::string& optarg, int optopt)
 {

Modified: Extractor/src/plugins/exiv2/olympusmn.cpp
===================================================================
--- Extractor/src/plugins/exiv2/olympusmn.cpp   2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/olympusmn.cpp   2005-07-09 14:06:45 UTC (rev 
1349)
@@ -20,7 +20,7 @@
  */
 /*
   File:      olympusmn.cpp
-  Version:   $Rev: 581 $
+  Version:   $Rev: 600 $
   Author(s): Will Stokes (wuz) <address@hidden>
              Andreas Huggel (ahu) <address@hidden>
   History:   10-Mar-05, wuz: created
@@ -29,7 +29,7 @@
 
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: olympusmn.cpp 581 2005-06-12 05:54:57Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: olympusmn.cpp 600 2005-07-09 10:38:09Z ahuggel $");
 
 // 
*****************************************************************************
 // included header files
@@ -44,9 +44,6 @@
 #include <iomanip>
 #include <cassert>
 
-// Define DEBUG_MAKERNOTE to output debug information to std::cerr
-#undef DEBUG_MAKERNOTE
-
 // 
*****************************************************************************
 // class member definitions
 namespace Exiv2 {

Modified: Extractor/src/plugins/exiv2/panasonicmn.cpp
===================================================================
--- Extractor/src/plugins/exiv2/panasonicmn.cpp 2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/panasonicmn.cpp 2005-07-09 14:06:45 UTC (rev 
1349)
@@ -20,14 +20,14 @@
  */
 /*
   File:      panasonicmn.cpp
-  Version:   $Rev: 581 $
+  Version:   $Rev: 600 $
   Author(s): Andreas Huggel (ahu) <address@hidden>
   History:   11-Jun-04, ahu: created
   Credits:   See header file
  */
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: panasonicmn.cpp 581 2005-06-12 05:54:57Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: panasonicmn.cpp 600 2005-07-09 10:38:09Z ahuggel $");
 
 // 
*****************************************************************************
 // included header files
@@ -42,9 +42,6 @@
 #include <iomanip>
 #include <cassert>
 
-// Define DEBUG_MAKERNOTE to output debug information to std::cerr
-#undef DEBUG_MAKERNOTE
-
 // 
*****************************************************************************
 // class member definitions
 namespace Exiv2 {

Modified: Extractor/src/plugins/exiv2/sigmamn.cpp
===================================================================
--- Extractor/src/plugins/exiv2/sigmamn.cpp     2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/sigmamn.cpp     2005-07-09 14:06:45 UTC (rev 
1349)
@@ -20,7 +20,7 @@
  */
 /*
   File:      sigmamn.cpp
-  Version:   $Rev: 569 $
+  Version:   $Rev: 600 $
   Author(s): Andreas Huggel (ahu) <address@hidden>
   History:   02-Apr-04, ahu: created
   Credits:   Sigma and Foveon MakerNote implemented according to the 
specification
@@ -29,7 +29,7 @@
  */
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: sigmamn.cpp 569 2005-05-28 05:48:43Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: sigmamn.cpp 600 2005-07-09 10:38:09Z ahuggel $");
 
 // 
*****************************************************************************
 // included header files
@@ -44,9 +44,6 @@
 #include <iomanip>
 #include <cassert>
 
-// Define DEBUG_MAKERNOTE to output debug information to std::cerr
-#undef DEBUG_MAKERNOTE
-
 // 
*****************************************************************************
 // class member definitions
 namespace Exiv2 {

Modified: Extractor/src/plugins/exiv2/sonymn.cpp
===================================================================
--- Extractor/src/plugins/exiv2/sonymn.cpp      2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/sonymn.cpp      2005-07-09 14:06:45 UTC (rev 
1349)
@@ -20,13 +20,13 @@
  */
 /*
   File:      sonymn.cpp
-  Version:   $Rev: 569 $
+  Version:   $Rev: 600 $
   Author(s): Andreas Huggel (ahu) <address@hidden>
   History:   18-Apr-05, ahu: created
  */
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: sonymn.cpp 569 2005-05-28 05:48:43Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: sonymn.cpp 600 2005-07-09 10:38:09Z ahuggel $");
 
 // 
*****************************************************************************
 // included header files
@@ -41,9 +41,6 @@
 #include <iomanip>
 #include <cassert>
 
-// Define DEBUG_MAKERNOTE to output debug information to std::cerr
-#undef DEBUG_MAKERNOTE
-
 // 
*****************************************************************************
 // class member definitions
 namespace Exiv2 {

Modified: Extractor/src/plugins/exiv2/tags.cpp
===================================================================
--- Extractor/src/plugins/exiv2/tags.cpp        2005-07-09 14:06:01 UTC (rev 
1348)
+++ Extractor/src/plugins/exiv2/tags.cpp        2005-07-09 14:06:45 UTC (rev 
1349)
@@ -20,14 +20,14 @@
  */
 /*
   File:      tags.cpp
-  Version:   $Rev: 581 $
+  Version:   $Rev: 596 $
   Author(s): Andreas Huggel (ahu) <address@hidden>
   History:   15-Jan-04, ahu: created
              21-Jan-05, ahu: added MakerNote TagInfo registry and related code
  */
 // 
*****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id: tags.cpp 581 2005-06-12 05:54:57Z ahuggel $");
+EXIV2_RCSID("@(#) $Id: tags.cpp 596 2005-06-26 11:04:27Z ahuggel $");
 
 // 
*****************************************************************************
 // included header files
@@ -507,6 +507,7 @@
                                      IfdId ifdId,
                                      const Value& value)
     {
+        if (value.count() == 0) return os;
         PrintFct fct = printValue;
         if (isExifIfd(ifdId)) { 
             int idx = tagInfoIdx(tag, ifdId);
@@ -734,8 +735,10 @@
 
     std::ostream& printLong(std::ostream& os, const Value& value)
     {
-        return os << value.toLong();
-    }
+        Rational r = value.toRational();
+        if (r.second != 0) return os << static_cast<long>(r.first) / r.second;
+        return os << "(" << value << ")";
+    } // printLong
 
     std::ostream& printFloat(std::ostream& os, const Value& value)
     {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]