Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build with >=exiv2-0.28.0, raise minimum to 0.27.0 #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ viewnior_deps = [
dependency('gio-2.0', version: glib_ver),
dependency('shared-mime-info', version: '>= 0.20'),
dependency('gdk-pixbuf-2.0', version: '>= 0.21'),
dependency('exiv2', version: '>= 0.21'),
dependency('exiv2', version: '>= 0.27'),
]
#

Expand Down
21 changes: 15 additions & 6 deletions src/uni-exiv2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,29 @@

#include <exiv2/exiv2.hpp>
#include <iostream>
#include <memory>

#include "uni-exiv2.hpp"

#if EXIV2_TEST_VERSION(0,28,0)
typedef Exiv2::Error Exiv2Error;
typedef Exiv2::Image::UniquePtr ImagePtr;
#else
typedef Exiv2::AnyError Exiv2Error;
typedef Exiv2::Image::AutoPtr ImagePtr;
#endif

#define ARRAY_SIZE(array) (sizeof array/sizeof(array[0]))

static Exiv2::Image::AutoPtr cached_image;
static ImagePtr cached_image;

extern "C"
void
uni_read_exiv2_map(const char *uri, void (*callback)(const char*, const char*, void*), void *user_data)
{
Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute);
try {
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(uri);
ImagePtr image = Exiv2::ImageFactory::open(uri);
if ( image.get() == 0 ) {
return;
}
Expand Down Expand Up @@ -80,7 +89,7 @@ uni_read_exiv2_map(const char *uri, void (*callback)(const char*, const char*, v
}
}
}
} catch (Exiv2::AnyError& e) {
} catch (Exiv2Error& e) {
std::cerr << "Exiv2: '" << e << "'\n";
}
}
Expand All @@ -103,7 +112,7 @@ uni_read_exiv2_to_cache(const char *uri)
}

cached_image->readMetadata();
} catch (Exiv2::AnyError& e) {
} catch (Exiv2Error& e) {
std::cerr << "Exiv2: '" << e << "'\n";
}

Expand All @@ -121,7 +130,7 @@ uni_write_exiv2_from_cache(const char *uri)
}

try {
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(uri);
ImagePtr image = Exiv2::ImageFactory::open(uri);
if ( image.get() == 0 ) {
return 2;
}
Expand All @@ -133,7 +142,7 @@ uni_write_exiv2_from_cache(const char *uri)
cached_image.reset(NULL);

return 0;
} catch (Exiv2::AnyError& e) {
} catch (Exiv2Error& e) {
std::cerr << "Exiv2: '" << e << "'\n";
}

Expand Down