[gexiv2] Fix build against exiv2 master



commit c6b5679604035b795f6cc06e1188cad2832476ba
Author: Jens Georg <mail jensge org>
Date:   Sun Dec 29 11:35:12 2019 +0100

    Fix build against exiv2 master
    
    BasicIO::read() takes a size_t now, DataBuf() as well

 gexiv2/gexiv2-metadata.cpp  |  9 ++++++---
 gexiv2/gexiv2-stream-io.cpp | 13 +++++++++++++
 gexiv2/gexiv2-stream-io.h   |  6 +++++-
 3 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/gexiv2/gexiv2-metadata.cpp b/gexiv2/gexiv2-metadata.cpp
index 73e1538..98feb6b 100644
--- a/gexiv2/gexiv2-metadata.cpp
+++ b/gexiv2/gexiv2-metadata.cpp
@@ -86,9 +86,12 @@ public:
     size_type write(BasicIo &src) { return 0; }
     int putb(Exiv2::byte data) { return EOF; }
 
-
-    Exiv2::DataBuf read(long rcount) {
-        Exiv2::DataBuf b{static_cast<GioIo::size_type>(rcount)};
+#if EXIV2_TEST_VERSION(0,27,99)
+    Exiv2::DataBuf read(size_t rcount) noexcept {
+#else
+    Exiv2::DataBuf read(long rcount) override {
+#endif
+        Exiv2::DataBuf b{rcount};
 
         auto bytes_read = this->read(b.pData_, rcount);
         if (bytes_read > 0 && bytes_read != rcount) {
diff --git a/gexiv2/gexiv2-stream-io.cpp b/gexiv2/gexiv2-stream-io.cpp
index ecd8293..a7528c2 100644
--- a/gexiv2/gexiv2-stream-io.cpp
+++ b/gexiv2/gexiv2-stream-io.cpp
@@ -163,6 +163,18 @@ int StreamIo::close () {
     return 0;
 }
 
+#if EXIV2_TEST_VERSION(0,27,99)
+
+Exiv2::DataBuf StreamIo::read (size_t read_count) noexcept {
+    Exiv2::DataBuf buffer (read_count);
+
+    long read_bytes = read (buffer.pData_, buffer.size_);
+
+    buffer.size_ = read_bytes;
+
+    return buffer;
+}
+#else
 Exiv2::DataBuf StreamIo::read (long read_count) {
     Exiv2::DataBuf buffer (read_count);
     
@@ -172,6 +184,7 @@ Exiv2::DataBuf StreamIo::read (long read_count) {
     
     return buffer;
 }
+#endif
 
 StreamIo::size_type StreamIo::read (Exiv2::byte* buf, StreamIo::size_type read_count) {
     StreamIo::size_type total_read_bytes = 0;
diff --git a/gexiv2/gexiv2-stream-io.h b/gexiv2/gexiv2-stream-io.h
index aa6c4f0..98b484f 100644
--- a/gexiv2/gexiv2-stream-io.h
+++ b/gexiv2/gexiv2-stream-io.h
@@ -38,7 +38,11 @@ public:
        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);
+#if EXIV2_TEST_VERSION(0,27,99)
+       Exiv2::DataBuf read (size_t rcount) noexcept override;
+#else
+       Exiv2::DataBuf read (long rcount) override;
+#endif
        virtual size_type read (Exiv2::byte* buf, size_type rcount);
        virtual int getb ();
        virtual void transfer (Exiv2::BasicIo& src);


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