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

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


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

The following commit has been merged in the master branch:
commit f7c84631324cde2a73e0dc620d358efae4c89547
Author: vog <vog at notjusthosting.com>
Date:   Wed Jun 22 12:56:20 2011 +0000

    #689: Improved code readability of EpsImage
---
 src/epsimage.cpp | 81 +++++++++++++++++++++++++++++---------------------------
 src/epsimage.hpp |  2 ++
 2 files changed, 44 insertions(+), 39 deletions(-)

diff --git a/src/epsimage.cpp b/src/epsimage.cpp
index e52bbca..a67e3b7 100644
--- a/src/epsimage.cpp
+++ b/src/epsimage.cpp
@@ -370,11 +370,9 @@ namespace Exiv2
 
         std::vector<std::pair<size_t, size_t> > removableEmbeddings;
         bool fixBeginXmlPacket = false;
-        size_t xmpPos, xmpSize;
-        if (!containsXmp) {
-            xmpPos = size;
-            xmpSize = 0;
-        } else {
+        size_t xmpPos = size;
+        size_t xmpSize = 0;
+        if (containsXmp) {
             // search for XMP metadata
             findXmp(xmpPos, xmpSize, data, size, write);
             if (xmpSize == 0) {
@@ -383,6 +381,7 @@ namespace Exiv2
                 #endif
                 throw Error(write ? 21 : 14);
             }
+            // check embedding of XMP metadata
             const size_t posLineAfterXmp = readLine(line, data, xmpPos + xmpSize, size);
             if (line != "") {
                 #ifndef SUPPRESS_WARNINGS
@@ -552,8 +551,8 @@ namespace Exiv2
                 }
                 if (pos == posPage) {
                     if (!startsWith(line, "%%Page:")) {
-                        writeTemp(*tempIo, "%%Page: 1 1" + lineEnding +
-                                           "%%EndPageComments" + lineEnding);
+                        writeTemp(*tempIo, "%%Page: 1 1" + lineEnding);
+                        writeTemp(*tempIo, "%%EndPageComments" + lineEnding);
                     }
                 }
                 // remove unflexible embeddings
@@ -567,9 +566,7 @@ namespace Exiv2
                     // insert XMP metadata into existing flexible embedding
                     if (pos == xmpPos) {
                         if (fixBeginXmlPacket) {
-                            std::ostringstream sizeStream;
-                            sizeStream << xmpPacket_.size();
-                            writeTemp(*tempIo, "%begin_xml_packet: " + sizeStream.str() + lineEnding);
+                            writeTemp(*tempIo, "%begin_xml_packet: " + toString(xmpPacket_.size()) + lineEnding);
                         }
                         writeTemp(*tempIo, xmpPacket_.data(), xmpPacket_.size());
                         skipPos += xmpSize;
@@ -582,36 +579,35 @@ namespace Exiv2
                         }
                         writeTemp(*tempIo, "%Exiv2BeginXMP: Before %%EndPageSetup" + lineEnding);
                         if (photoshop) {
-                            writeTemp(*tempIo, "%Exiv2Notice: The following line is needed by Photoshop." + lineEnding +
-                                               "%begin_xml_code" + lineEnding);
+                            writeTemp(*tempIo, "%Exiv2Notice: The following line is needed by Photoshop." + lineEnding);
+                            writeTemp(*tempIo, "%begin_xml_code" + lineEnding);
                         }
-                        writeTemp(*tempIo, "/currentdistillerparams where" + lineEnding +
-                                           "{pop currentdistillerparams /CoreDistVersion get 5000 lt} {true} ifelse" + lineEnding +
-                                           "{userdict /Exiv2_pdfmark /cleartomark load put" + lineEnding +
-                                           "    userdict /Exiv2_metafile_pdfmark {flushfile cleartomark} bind put}" + lineEnding +
-                                           "{userdict /Exiv2_pdfmark /pdfmark load put" + lineEnding +
-                                           "    userdict /Exiv2_metafile_pdfmark {/PUT pdfmark} bind put} ifelse" + lineEnding +
-                                           "[/NamespacePush Exiv2_pdfmark" + lineEnding +
-                                           "[/_objdef {Exiv2_metadata_stream} /type /stream /OBJ Exiv2_pdfmark" + lineEnding +
-                                           "[{Exiv2_metadata_stream} 2 dict begin" + lineEnding +
-                                           "    /Type /Metadata def /Subtype /XML def currentdict end /PUT Exiv2_pdfmark" + lineEnding +
-                                           "[{Exiv2_metadata_stream}" + lineEnding +
-                                           "    currentfile 0 (% &&end XMP packet marker&&)" + lineEnding +
-                                           "    /SubFileDecode filter Exiv2_metafile_pdfmark" + lineEnding);
+                        writeTemp(*tempIo, "/currentdistillerparams where" + lineEnding);
+                        writeTemp(*tempIo, "{pop currentdistillerparams /CoreDistVersion get 5000 lt} {true} ifelse" + lineEnding);
+                        writeTemp(*tempIo, "{userdict /Exiv2_pdfmark /cleartomark load put" + lineEnding);
+                        writeTemp(*tempIo, "    userdict /Exiv2_metafile_pdfmark {flushfile cleartomark} bind put}" + lineEnding);
+                        writeTemp(*tempIo, "{userdict /Exiv2_pdfmark /pdfmark load put" + lineEnding);
+                        writeTemp(*tempIo, "    userdict /Exiv2_metafile_pdfmark {/PUT pdfmark} bind put} ifelse" + lineEnding);
+                        writeTemp(*tempIo, "[/NamespacePush Exiv2_pdfmark" + lineEnding);
+                        writeTemp(*tempIo, "[/_objdef {Exiv2_metadata_stream} /type /stream /OBJ Exiv2_pdfmark" + lineEnding);
+                        writeTemp(*tempIo, "[{Exiv2_metadata_stream} 2 dict begin" + lineEnding);
+                        writeTemp(*tempIo, "    /Type /Metadata def /Subtype /XML def currentdict end /PUT Exiv2_pdfmark" + lineEnding);
+                        writeTemp(*tempIo, "[{Exiv2_metadata_stream}" + lineEnding);
+                        writeTemp(*tempIo, "    currentfile 0 (% &&end XMP packet marker&&)" + lineEnding);
+                        writeTemp(*tempIo, "    /SubFileDecode filter Exiv2_metafile_pdfmark" + lineEnding);
                         if (photoshop) {
-                            std::ostringstream sizeStream;
-                            sizeStream << xmpPacket_.size();
-                            writeTemp(*tempIo, "%Exiv2Notice: The following line is needed by Photoshop. Parameter must be exact size of XMP metadata." + lineEnding +
-                                               "%begin_xml_packet: " + sizeStream.str() + lineEnding);
+                            writeTemp(*tempIo, "%Exiv2Notice: The following line is needed by Photoshop. "
+                                               "Parameter must be exact size of XMP metadata." + lineEnding);
+                            writeTemp(*tempIo, "%begin_xml_packet: " + toString(xmpPacket_.size()) + lineEnding);
                         }
                         writeTemp(*tempIo, xmpPacket_.data(), xmpPacket_.size());
-                        writeTemp(*tempIo, lineEnding +
-                                           "% &&end XMP packet marker&&" + lineEnding +
-                                           "[/Document 1 dict begin" + lineEnding +
-                                           "    /Metadata {Exiv2_metadata_stream} def currentdict end /BDC Exiv2_pdfmark" + lineEnding);
+                        writeTemp(*tempIo, lineEnding);
+                        writeTemp(*tempIo, "% &&end XMP packet marker&&" + lineEnding);
+                        writeTemp(*tempIo, "[/Document 1 dict begin" + lineEnding);
+                        writeTemp(*tempIo, "    /Metadata {Exiv2_metadata_stream} def currentdict end /BDC Exiv2_pdfmark" + lineEnding);
                         if (photoshop) {
-                            writeTemp(*tempIo, "%Exiv2Notice: The following line is needed by Photoshop." + lineEnding +
-                                               "%end_xml_code" + lineEnding);
+                            writeTemp(*tempIo, "%Exiv2Notice: The following line is needed by Photoshop." + lineEnding);
+                            writeTemp(*tempIo, "%end_xml_code" + lineEnding);
                         }
                         writeTemp(*tempIo, "%Exiv2EndXMP" + lineEnding);
                         if (line != "%%EndPageSetup") {
@@ -624,10 +620,10 @@ namespace Exiv2
                         } else {
                             skipPos = posLineEnd;
                         }
-                        writeTemp(*tempIo, "%Exiv2BeginXMP: After %%PageTrailer" + lineEnding +
-                                           "[/EMC Exiv2_pdfmark" + lineEnding +
-                                           "[/NamespacePop Exiv2_pdfmark" + lineEnding +
-                                           "%Exiv2EndXMP" + lineEnding);
+                        writeTemp(*tempIo, "%Exiv2BeginXMP: After %%PageTrailer" + lineEnding);
+                        writeTemp(*tempIo, "[/EMC Exiv2_pdfmark" + lineEnding);
+                        writeTemp(*tempIo, "[/NamespacePop Exiv2_pdfmark" + lineEnding);
+                        writeTemp(*tempIo, "%Exiv2EndXMP" + lineEnding);
                     }
                 }
                 // add EOF comment if necessary
@@ -885,6 +881,13 @@ namespace Exiv2
         return s.find_first_not_of(" 	") == std::string::npos;
     }
 
+    std::string EpsImage::toString(size_t size)
+    {
+        std::ostringstream stream;
+        stream << size;
+        return stream.str();
+    }
+
     void EpsImage::writeTemp(BasicIo& tempIo, const char* data, size_t size)
     {
         if (size == 0) return;
diff --git a/src/epsimage.hpp b/src/epsimage.hpp
index f1cc8d6..e82366e 100644
--- a/src/epsimage.hpp
+++ b/src/epsimage.hpp
@@ -122,6 +122,8 @@ namespace Exiv2
         EXV_DLLLOCAL static bool startsWith(const std::string& s, const std::string& start);
         //! Check whether a string contains only white space characters
         EXV_DLLLOCAL static bool onlyWhitespaces(const std::string& s);
+        //! Convert an integer of type size_t to a decimal string
+        EXV_DLLLOCAL static std::string toString(size_t size);
         //! Write data into temp file, taking care of errors
         EXV_DLLLOCAL static void writeTemp(BasicIo& tempIo, const char* data, size_t size);
         //! Write data into temp file, taking care of errors

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list