[gexiv2] Fix building against exiv2 master



commit 4d8f9774ea4ab7d4176c59493aae0a592c55a16b
Author: Jens Georg <mail jensge org>
Date:   Sun May 19 12:40:11 2019 +0200

    Fix building against exiv2 master

 gexiv2/gexiv2-metadata-xmp.cpp |  4 ++--
 gexiv2/gexiv2-metadata.cpp     | 13 +++++++++----
 gexiv2/gexiv2-stream-io.cpp    | 10 +++++-----
 gexiv2/gexiv2-stream-io.h      |  8 +++++---
 4 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/gexiv2/gexiv2-metadata-xmp.cpp b/gexiv2/gexiv2-metadata-xmp.cpp
index 6f60cd0..eac78b7 100644
--- a/gexiv2/gexiv2-metadata-xmp.cpp
+++ b/gexiv2/gexiv2-metadata-xmp.cpp
@@ -284,11 +284,11 @@ gchar** gexiv2_metadata_get_xmp_tag_multiple (GExiv2Metadata *self, const gchar*
             it++;
         
         if (it != xmp_data.end()) {
-            int size = it->count ();
+            auto size = it->count ();
             gchar **array = g_new (gchar*, size + 1);
             array[size] = NULL;
             
-            for (int i = 0; i < it->count (); i++)
+            for (decltype(size) i = 0; i < size; i++)
                 array[i] = g_strdup (it->toString (i).c_str ());
             
             return array;
diff --git a/gexiv2/gexiv2-metadata.cpp b/gexiv2/gexiv2-metadata.cpp
index c520ede..ab8e091 100644
--- a/gexiv2/gexiv2-metadata.cpp
+++ b/gexiv2/gexiv2-metadata.cpp
@@ -41,6 +41,11 @@ public:
         , _error{nullptr}
         , _eof{false}
         {}
+#if EXIV2_TEST_VERSION(0,27,99)
+    using size_type = size_t;
+#else
+    using size_type = long;
+#endif
 
     ~GioIo() { g_clear_object (&_is); g_clear_error (&_error); _seekable = NULL;}
 #if defined(_MSC_VER)
@@ -64,13 +69,13 @@ public:
     }
 
     // Writing is not supported
-    long write(const Exiv2::byte *data, long wcount) { return 0; }
-    long write(BasicIo &src) { return 0; }
+    size_type write(const Exiv2::byte *data, size_type wcount) { return 0; }
+    size_type write(BasicIo &src) { return 0; }
     int putb(Exiv2::byte data) { return EOF; }
 
 
     Exiv2::DataBuf read(long rcount) {
-        Exiv2::DataBuf b{rcount};
+        Exiv2::DataBuf b{static_cast<GioIo::size_type>(rcount)};
 
         long bytes_read = this->read(b.pData_, rcount);
         if (bytes_read > 0 && bytes_read != rcount) {
@@ -80,7 +85,7 @@ public:
         return b;
     }
 
-    long read(Exiv2::byte *buf, long rcount) {
+    size_type read(Exiv2::byte *buf, size_type rcount) {
         GError *error = NULL;
         gssize result = 0;
 
diff --git a/gexiv2/gexiv2-stream-io.cpp b/gexiv2/gexiv2-stream-io.cpp
index 75042a5..ecd8293 100644
--- a/gexiv2/gexiv2-stream-io.cpp
+++ b/gexiv2/gexiv2-stream-io.cpp
@@ -63,11 +63,11 @@ StreamIo::ptr_type StreamIo::temporary () const {
     return ptr_type{new Exiv2::MemIo ()};
 }
 
-long StreamIo::write (const Exiv2::byte* data, long write_count) {
+StreamIo::size_type StreamIo::write (const Exiv2::byte* data, StreamIo::size_type write_count) {
     if ( ! can_write)
         return 0;
     
-    long total_written_bytes = 0;
+    StreamIo::size_type total_written_bytes = 0;
     
     while (write_count > total_written_bytes) {
     
@@ -83,7 +83,7 @@ long StreamIo::write (const Exiv2::byte* data, long write_count) {
     return total_written_bytes;
 }
 
-long StreamIo::write (Exiv2::BasicIo& src) {
+StreamIo::size_type StreamIo::write (Exiv2::BasicIo& src) {
     if ( ! can_write)
         return 0;
     
@@ -173,8 +173,8 @@ Exiv2::DataBuf StreamIo::read (long read_count) {
     return buffer;
 }
 
-long StreamIo::read (Exiv2::byte* buf, long read_count) {
-    long total_read_bytes = 0;
+StreamIo::size_type StreamIo::read (Exiv2::byte* buf, StreamIo::size_type read_count) {
+    StreamIo::size_type total_read_bytes = 0;
 
     while (read_count > total_read_bytes) {
         /* because of a marshalling problem on managed side, we shift the
diff --git a/gexiv2/gexiv2-stream-io.h b/gexiv2/gexiv2-stream-io.h
index b6aa610..aa6c4f0 100644
--- a/gexiv2/gexiv2-stream-io.h
+++ b/gexiv2/gexiv2-stream-io.h
@@ -24,8 +24,10 @@ class StreamIo : public Exiv2::BasicIo {
 public:
 #if EXIV2_TEST_VERSION(0,27,99)
     using ptr_type = Exiv2::BasicIo::UniquePtr;
+    using size_type = size_t;
 #else
     using ptr_type = Exiv2::BasicIo::AutoPtr;
+    using size_type = long;
 #endif
 
        StreamIo (ManagedStreamCallbacks* cb);
@@ -33,11 +35,11 @@ public:
        virtual ~StreamIo ();
        virtual int open ();
        virtual int close ();
-       virtual long write (const Exiv2::byte* data, long wcount);
-       virtual long write (Exiv2::BasicIo& src);
+       virtual size_type write (const Exiv2::byte* data, size_type wcount);
+       virtual size_type write (Exiv2::BasicIo& src);
        virtual int putb (Exiv2::byte data);
        virtual Exiv2::DataBuf read (long rcount);
-       virtual long read (Exiv2::byte* buf, long rcount);
+       virtual size_type read (Exiv2::byte* buf, size_type rcount);
        virtual int getb ();
        virtual void transfer (Exiv2::BasicIo& src);
        virtual int seek (long offset, Position pos);


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