Skip to content

Commit b4c923f

Browse files
exiv2 v1.0.0 compatibility
1 parent f6d738f commit b4c923f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/interface/image.i

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@
3737

3838
wrap_auto_unique_ptr(Exiv2::Image);
3939

40+
#if EXIV2_VERSION_HEX < 0x01000000
4041
INPUT_BUFFER_RO(const Exiv2::byte* data, long size)
42+
#else
43+
INPUT_BUFFER_RO(const Exiv2::byte* data, size_t size)
44+
#endif
4145

4246
// Potentially blocking calls allow Python threads
4347
%thread Exiv2::Image::readMetadata;
@@ -46,13 +50,23 @@ INPUT_BUFFER_RO(const Exiv2::byte* data, long size)
4650
%thread Exiv2::ImageFactory::open;
4751

4852
// ImageFactory::open(data, size) needs to keep a reference to the buffer.
53+
#if EXIV2_VERSION_HEX < 0x01000000
4954
%typemap(ret) Exiv2::Image::AutoPtr open %{
5055
if (PyObject_CheckBuffer(swig_obj[0])) {
5156
if (PyObject_SetAttrString($result, "_refers_to", swig_obj[0])) {
5257
SWIG_fail;
5358
}
5459
}
5560
%}
61+
#else
62+
%typemap(ret) Exiv2::Image::UniquePtr open %{
63+
if (PyObject_CheckBuffer(swig_obj[0])) {
64+
if (PyObject_SetAttrString($result, "_refers_to", swig_obj[0])) {
65+
SWIG_fail;
66+
}
67+
}
68+
%}
69+
#endif
5670

5771
// exifData(), iptcData(), and xmpData() return values need to keep a
5872
// reference to Image.

0 commit comments

Comments
 (0)