diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index c766597c..c2d5a94f 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -16,6 +16,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see
.
+Changes in v0.19.0:
+ 1/ Add exiv2.XmpParser.encode() to Python interface.
+ 2/ Fix crash when getting strings of malformed values.
+ 3/ Python 3.15 compatibility.
+
Changes in v0.18.1:
1/ Binary wheels incorporate libexiv2 v0.28.8
diff --git a/README.rst b/README.rst
index a37f00fd..58ad50ad 100644
--- a/README.rst
+++ b/README.rst
@@ -1,4 +1,4 @@
-python-exiv2 v\ 0.18.1
+python-exiv2 v\ 0.19.0
======================
python-exiv2 is a low level interface (or binding) to the exiv2_ C++ library.
diff --git a/pyproject.toml b/pyproject.toml
index 92e4715a..663c4369 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,8 +1,27 @@
+# python-exiv2 - Python interface to libexiv2
+# http://github.com/jim-easterbrook/python-exiv2
+# Copyright (C) 2023-26 Jim Easterbrook jim@jim-easterbrook.me.uk
+#
+# This file is part of python-exiv2.
+#
+# python-exiv2 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# python-exiv2 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with python-exiv2. If not, see .
+
[build-system]
requires = [
"setuptools >= 59.6, < 61.0; python_version < '3.9'",
"setuptools >= 77.0; python_version >= '3.9'",
- "toml"
+ "toml; python_version < '3.9'"
]
build-backend = "setuptools.build_meta"
diff --git a/setup.py b/setup.py
index de27481c..071450e6 100644
--- a/setup.py
+++ b/setup.py
@@ -92,13 +92,13 @@ def get_mod_src_dir(exiv2_version):
library_dirs = [path]
package_dir['exiv2.lib'] = path
package_data['exiv2.lib'] = [x for x in os.listdir(path)
- if re.fullmatch('libexiv2\.so\.\d+', x)]
+ if re.fullmatch(r'libexiv2\.so\.\d+', x)]
elif platform == 'darwin':
path = os.path.join(exiv2_root, 'lib')
library_dirs = [path]
package_dir['exiv2.lib'] = path
package_data['exiv2.lib'] = [x for x in os.listdir(path)
- if re.fullmatch('libexiv2\.\d+\.dylib', x)]
+ if re.fullmatch(r'libexiv2\.\d+\.dylib', x)]
elif platform in ('win32', 'mingw'):
library_dirs = [os.path.join(exiv2_root, 'lib')]
package_dir['exiv2.lib'] = os.path.join(exiv2_root, 'bin')
diff --git a/src/doc/requirements.txt b/src/doc/requirements.txt
index 36bdd36f..1501db29 100644
--- a/src/doc/requirements.txt
+++ b/src/doc/requirements.txt
@@ -1,4 +1,4 @@
-exiv2 == 0.18.1
+exiv2 == 0.19.0
sphinx == 8.2.3
sphinx-rtd-theme == 3.0.2
enum_tools[sphinx] >= 0.13
diff --git a/src/interface/0_27_7/enum_members.i b/src/interface/0_27_7/enum_members.i
index 4d7b6454..c93c5f4e 100644
--- a/src/interface/0_27_7/enum_members.i
+++ b/src/interface/0_27_7/enum_members.i
@@ -36,6 +36,20 @@ static PyObject* _get_enum_data_%mangle(Exiv2::LogMsg::Level)() {
NULL);
};
}
+%fragment("_get_enum_data"{Exiv2::XmpParser::XmpFormatFlags}, "header",
+ fragment="_get_enum_data") {
+static PyObject* _get_enum_data_%mangle(Exiv2::XmpParser::XmpFormatFlags)() {
+ return _get_enum_data("Exiv2::XmpParser::XmpFormatFlags",
+ "omitPacketWrapper", Exiv2::XmpParser::omitPacketWrapper,
+ "readOnlyPacket", Exiv2::XmpParser::readOnlyPacket,
+ "useCompactFormat", Exiv2::XmpParser::useCompactFormat,
+ "includeThumbnailPad", Exiv2::XmpParser::includeThumbnailPad,
+ "exactPacketLength", Exiv2::XmpParser::exactPacketLength,
+ "writeAliasComments", Exiv2::XmpParser::writeAliasComments,
+ "omitAllFormatting", Exiv2::XmpParser::omitAllFormatting,
+ NULL);
+};
+}
%fragment("_get_enum_data"{Exiv2::XmpValue::XmpArrayType}, "header",
fragment="_get_enum_data") {
static PyObject* _get_enum_data_%mangle(Exiv2::XmpValue::XmpArrayType)() {
diff --git a/src/interface/0_28_7/enum_members.i b/src/interface/0_28_7/enum_members.i
index 2b01ca79..940fece4 100644
--- a/src/interface/0_28_7/enum_members.i
+++ b/src/interface/0_28_7/enum_members.i
@@ -36,6 +36,20 @@ static PyObject* _get_enum_data_%mangle(Exiv2::LogMsg::Level)() {
NULL);
};
}
+%fragment("_get_enum_data"{Exiv2::XmpParser::XmpFormatFlags}, "header",
+ fragment="_get_enum_data") {
+static PyObject* _get_enum_data_%mangle(Exiv2::XmpParser::XmpFormatFlags)() {
+ return _get_enum_data("Exiv2::XmpParser::XmpFormatFlags",
+ "omitPacketWrapper", Exiv2::XmpParser::omitPacketWrapper,
+ "readOnlyPacket", Exiv2::XmpParser::readOnlyPacket,
+ "useCompactFormat", Exiv2::XmpParser::useCompactFormat,
+ "includeThumbnailPad", Exiv2::XmpParser::includeThumbnailPad,
+ "exactPacketLength", Exiv2::XmpParser::exactPacketLength,
+ "writeAliasComments", Exiv2::XmpParser::writeAliasComments,
+ "omitAllFormatting", Exiv2::XmpParser::omitAllFormatting,
+ NULL);
+};
+}
%fragment("_get_enum_data"{Exiv2::XmpValue::XmpArrayType}, "header",
fragment="_get_enum_data") {
static PyObject* _get_enum_data_%mangle(Exiv2::XmpValue::XmpArrayType)() {
diff --git a/src/interface/0_28_8/enum_members.i b/src/interface/0_28_8/enum_members.i
index 2b01ca79..940fece4 100644
--- a/src/interface/0_28_8/enum_members.i
+++ b/src/interface/0_28_8/enum_members.i
@@ -36,6 +36,20 @@ static PyObject* _get_enum_data_%mangle(Exiv2::LogMsg::Level)() {
NULL);
};
}
+%fragment("_get_enum_data"{Exiv2::XmpParser::XmpFormatFlags}, "header",
+ fragment="_get_enum_data") {
+static PyObject* _get_enum_data_%mangle(Exiv2::XmpParser::XmpFormatFlags)() {
+ return _get_enum_data("Exiv2::XmpParser::XmpFormatFlags",
+ "omitPacketWrapper", Exiv2::XmpParser::omitPacketWrapper,
+ "readOnlyPacket", Exiv2::XmpParser::readOnlyPacket,
+ "useCompactFormat", Exiv2::XmpParser::useCompactFormat,
+ "includeThumbnailPad", Exiv2::XmpParser::includeThumbnailPad,
+ "exactPacketLength", Exiv2::XmpParser::exactPacketLength,
+ "writeAliasComments", Exiv2::XmpParser::writeAliasComments,
+ "omitAllFormatting", Exiv2::XmpParser::omitAllFormatting,
+ NULL);
+};
+}
%fragment("_get_enum_data"{Exiv2::XmpValue::XmpArrayType}, "header",
fragment="_get_enum_data") {
static PyObject* _get_enum_data_%mangle(Exiv2::XmpValue::XmpArrayType)() {
diff --git a/src/interface/basicio.i b/src/interface/basicio.i
index 66ae1c61..337fd93c 100644
--- a/src/interface/basicio.i
+++ b/src/interface/basicio.i
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
-// Copyright (C) 2022-25 Jim Easterbrook jim@jim-easterbrook.me.uk
+// Copyright (C) 2022-26 Jim Easterbrook jim@jim-easterbrook.me.uk
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -166,7 +166,9 @@ RETURN_VIEW(Exiv2::byte* mmap, $1 ? arg1->size() : 0,
%}
%typemap(check, fragment="memoryview_funcs") Exiv2::BasicIo* self {
%#ifdef RELEASE_VIEWS_$symname
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
%#endif
}
diff --git a/src/interface/image.i b/src/interface/image.i
index ebd13ad3..3d0d8b5e 100644
--- a/src/interface/image.i
+++ b/src/interface/image.i
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
-// Copyright (C) 2021-25 Jim Easterbrook jim@jim-easterbrook.me.uk
+// Copyright (C) 2021-26 Jim Easterbrook jim@jim-easterbrook.me.uk
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -108,7 +108,9 @@ DEFINE_VIEW_CALLBACK(Exiv2::Image, release_ptr(&self->io());)
%}
%typemap(check, fragment="memoryview_funcs") Exiv2::Image* self {
%#ifdef RELEASE_VIEWS_$symname
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
%#endif
}
@@ -219,10 +221,6 @@ KEEP_REFERENCE(Exiv2::XmpData&)
KEEP_REFERENCE(Exiv2::DataBuf*)
KEEP_REFERENCE(Exiv2::DataBuf&)
-// xmpPacket() returns a modifiable std::string, Python strings are immutable
-// so treat it as a non-modifiable std::string
-%apply const std::string& {std::string& xmpPacket};
-
#if EXIV2_VERSION_HEX < 0x001c0000
// Extend ImageType namespace with ones that don't get picked up by swig
%{
diff --git a/src/interface/shared/containers.i b/src/interface/shared/containers.i
index 72522c98..5a353ece 100644
--- a/src/interface/shared/containers.i
+++ b/src/interface/shared/containers.i
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
-// Copyright (C) 2023-25 Jim Easterbrook jim@jim-easterbrook.me.uk
+// Copyright (C) 2023-26 Jim Easterbrook jim@jim-easterbrook.me.uk
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -102,7 +102,8 @@ MP_ASS_SUBSCRIPT(Exiv2::base_class, PyObject*,
if (pos == self->end())
return PyErr_Format(PyExc_KeyError, "'%s'", key);
#if SWIG_VERSION >= 0x040400
- invalidate_pointers(py_self, pos);
+ if (invalidate_pointers(py_self, pos) < 0)
+ return NULL;
#endif
self->erase(pos), false)
SQ_CONTAINS(
diff --git a/src/interface/shared/keep_reference.i b/src/interface/shared/keep_reference.i
index 943fc97d..229cc949 100644
--- a/src/interface/shared/keep_reference.i
+++ b/src/interface/shared/keep_reference.i
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
-// Copyright (C) 2023-25 Jim Easterbrook jim@jim-easterbrook.me.uk
+// Copyright (C) 2023-26 Jim Easterbrook jim@jim-easterbrook.me.uk
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
%typemap(ret, fragment="private_data") return_type %{
if ($result != Py_None)
if (private_store_set($result, "refers_to", target)) {
+ Py_DECREF($result);
SWIG_fail;
}
%}
diff --git a/src/interface/shared/pointer_store.i b/src/interface/shared/pointer_store.i
index 3ad18466..fbf61ada 100644
--- a/src/interface/shared/pointer_store.i
+++ b/src/interface/shared/pointer_store.i
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
-// Copyright (C) 2023-25 Jim Easterbrook jim@jim-easterbrook.me.uk
+// Copyright (C) 2023-26 Jim Easterbrook jim@jim-easterbrook.me.uk
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -25,15 +25,19 @@
#if SWIG_VERSION >= 0x040400
// Functions to store weak references to pointers (swig >= v4.4)
-%fragment("pointer_store", "header", fragment="private_data") {
-static void _process_list(PyObject* list, bool purge_only,
- Exiv2::container_type::iterator* beg,
- Exiv2::container_type::iterator* end) {
+%fragment("pointer_store", "header", fragment="private_data",
+ fragment="weakref_getref") {
+static int _process_list(PyObject* list, bool purge_only,
+ Exiv2::container_type::iterator* beg,
+ Exiv2::container_type::iterator* end) {
PyObject* py_ptr = NULL;
datum_type##_pointer* cpp_ptr = NULL;
for (Py_ssize_t idx = PyList_Size(list); idx > 0; idx--) {
- py_ptr = PyWeakref_GetObject(PyList_GetItem(list, idx-1));
- if (py_ptr == Py_None)
+ if (PyWeakref_GetRef(PyList_GetItem(list, idx-1), &py_ptr) < 0)
+ return -1;
+ if (py_ptr)
+ Py_DECREF(py_ptr);
+ else
goto forget;
if (purge_only)
continue;
@@ -52,35 +56,41 @@ forget:
PyList_SetSlice(list, idx-1, idx, NULL);
continue;
}
+ return 0;
};
-static void purge_pointers(PyObject* list) {
- _process_list(list, true, NULL, NULL);
+static int purge_pointers(PyObject* list) {
+ return _process_list(list, true, NULL, NULL);
};
-static void invalidate_pointers(PyObject* py_self) {
+static int invalidate_pointers(PyObject* py_self) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, NULL, NULL);
+ return _process_list(list, false, NULL, NULL);
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::container_type::iterator pos) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::container_type::iterator pos) {
PyObject* list = private_store_get(py_self, "pointers");
if (list) {
Exiv2::container_type::iterator end = pos;
end++;
- _process_list(list, false, &pos, &end);
+ return _process_list(list, false, &pos, &end);
}
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::container_type::iterator beg,
- Exiv2::container_type::iterator end) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::container_type::iterator beg,
+ Exiv2::container_type::iterator end) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, &beg, &end);
+ return _process_list(list, false, &beg, &end);
+ return 0;
};
static int store_pointer(PyObject* py_self, PyObject* py_ptr) {
PyObject* list = private_store_get(py_self, "pointers");
- if (list)
- purge_pointers(list);
+ if (list) {
+ if (purge_pointers(list) < 0)
+ return -1;
+ }
else {
list = PyList_New(0);
if (!list)
@@ -114,21 +124,30 @@ static int store_pointer(PyObject* py_self, PyObject* py_ptr) {
#if SWIG_VERSION >= 0x040400
// clear() invalidates all pointers
%typemap(ret, fragment="pointer_store") void clear {
- invalidate_pointers(self);
+ if (invalidate_pointers(self) < 0) {
+ Py_DECREF($result);
+ SWIG_fail;
+ }
}
// erase() and eraseFamily() invalidate some pointers
%typemap(check, fragment="pointer_store")
Exiv2::container_type::iterator pos {
- invalidate_pointers(self, $1);
+ if (invalidate_pointers(self, $1) < 0) {
+ SWIG_fail;
+ }
}
%typemap(check, fragment="pointer_store")
(Exiv2::container_type::iterator beg,
Exiv2::container_type::iterator end) {
- invalidate_pointers(self, $1, $2);
+ if (invalidate_pointers(self, $1, $2) < 0) {
+ SWIG_fail;
+ }
}
%typemap(check, fragment="pointer_store")
Exiv2::container_type::iterator& pos {
- invalidate_pointers(self, *$1, arg1->end());
+ if (invalidate_pointers(self, *$1, arg1->end()) < 0) {
+ SWIG_fail;
+ }
}
#endif // SWIG_VERSION
diff --git a/src/interface/shared/private_data.i b/src/interface/shared/private_data.i
index 5bc28670..50696934 100644
--- a/src/interface/shared/private_data.i
+++ b/src/interface/shared/private_data.i
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
-// Copyright (C) 2025 Jim Easterbrook jim@jim-easterbrook.me.uk
+// Copyright (C) 2025-26 Jim Easterbrook jim@jim-easterbrook.me.uk
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -60,8 +60,24 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
}
+// Implementation of PyWeakref_GetRef for Python < 3.13
+%fragment("weakref_getref", "header") {
+%#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+%#endif
+}
+
// Functions to store references to memoryview objects and release them
-%fragment("memoryview_funcs", "header", fragment="private_data") {
+%fragment("memoryview_funcs", "header", fragment="private_data",
+ fragment="weakref_getref") {
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -92,9 +108,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
diff --git a/src/interface/shared/slots.i b/src/interface/shared/slots.i
index f413140a..10a6db96 100644
--- a/src/interface/shared/slots.i
+++ b/src/interface/shared/slots.i
@@ -1,6 +1,6 @@
/* python-exiv2 - Python interface to libexiv2
* http://github.com/jim-easterbrook/python-exiv2
- * Copyright (C) 2025 Jim Easterbrook jim@jim-easterbrook.me.uk
+ * Copyright (C) 2025-26 Jim Easterbrook jim@jim-easterbrook.me.uk
*
* This file is part of python-exiv2.
*
@@ -19,6 +19,8 @@
*/
+%include "shared/exception.i"
+
// Macro to add mp_ass_subscript slot and functions
%define MP_ASS_SUBSCRIPT(type, item_type, setfunc, delfunc, canfail)
// Use %inline so SWIG generates wrappers with type conversions.
@@ -200,11 +202,18 @@ static PyObject* _getitem_%mangle(type)_closure(
// Macro to add tp_str slot and function
%define TP_STR(type, func)
-%fragment("str"{type}, "header") {
+%fragment("str"{type}, "header", fragment="_set_python_exception") {
static PyObject* _str_%mangle(type)(PyObject* py_self) {
type* self = NULL;
+ std::string result;
SWIG_ConvertPtr(py_self, (void**)&self, $descriptor(type*), 0);
- std::string result = func;
+ try {
+ result = func;
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ return NULL;
+ }
return SWIG_FromCharPtrAndSize(result.data(), result.size());
};
}
diff --git a/src/interface/types.i b/src/interface/types.i
index 739afb58..92826c2d 100644
--- a/src/interface/types.i
+++ b/src/interface/types.i
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
-// Copyright (C) 2021-25 Jim Easterbrook jim@jim-easterbrook.me.uk
+// Copyright (C) 2021-26 Jim Easterbrook jim@jim-easterbrook.me.uk
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -177,12 +177,18 @@ DEFINE_VIEW_CALLBACK(Exiv2::DataBuf,)
// Release memoryview when other functions are called
%typemap(ret, fragment="memoryview_funcs")
(void alloc), (void reset), (void resize) %{
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF($result);
+ SWIG_fail;
+ }
%}
#if EXIV2_VERSION_HEX < 0x001c0000
%typemap(ret, fragment="memoryview_funcs")
(void free) %{
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF($result);
+ SWIG_fail;
+ }
%}
#endif
diff --git a/src/interface/value.i b/src/interface/value.i
index 2b86c680..4ba8027c 100644
--- a/src/interface/value.i
+++ b/src/interface/value.i
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
-// Copyright (C) 2021-25 Jim Easterbrook jim@jim-easterbrook.me.uk
+// Copyright (C) 2021-26 Jim Easterbrook jim@jim-easterbrook.me.uk
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -446,7 +446,10 @@ RETURN_VIEW(const char* data, arg1->value_.size(), PyBUF_READ, class##::data)
DEFINE_VIEW_CALLBACK(class,)
// Release memoryviews when new data is read
%typemap(ret, fragment="memoryview_funcs") (int class::read) %{
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF($result);
+ SWIG_fail;
+ }
%}
%enddef // RAW_STRING_DATA
RAW_STRING_DATA(Exiv2::StringValueBase)
diff --git a/src/interface/xmp.i b/src/interface/xmp.i
index f04b7d73..5fb344a9 100644
--- a/src/interface/xmp.i
+++ b/src/interface/xmp.i
@@ -1,6 +1,6 @@
// python-exiv2 - Python interface to libexiv2
// http://github.com/jim-easterbrook/python-exiv2
-// Copyright (C) 2021-25 Jim Easterbrook jim@jim-easterbrook.me.uk
+// Copyright (C) 2021-26 Jim Easterbrook jim@jim-easterbrook.me.uk
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@
#endif
#pragma SWIG nowarn=508 // Declaration of '__str__' shadows declaration accessible via operator->()
+// #pragma SWIG nowarn=509 // Overloaded method effectively ignored
%include "shared/preamble.i"
%include "shared/containers.i"
@@ -55,6 +56,34 @@ EXCEPTION()
DATA_CONTAINER(XmpData, Xmpdatum, XmpKey,
Exiv2::XmpProperties::propertyType(Exiv2::XmpKey(datum->key())))
+// Typemaps for different uses of xmpPacket.
+// Exiv2::Image::xmpPacket return value
+%apply const std::string & {std::string &xmpPacket()};
+
+// Exiv2::Image::setXmpPacket input value
+%typemap(in) const std::string &xmpPacket = std::string &INPUT;
+%typemap(argout) const std::string &xmpPacket ""
+
+// Exiv2::XmpParser::encode output value
+%typemap(in, numinputs=0) std::string &xmpPacket = std::string &OUTPUT;
+%typemap(argout) std::string &xmpPacket = std::string &OUTPUT;
+%typemap(freearg) std::string &xmpPacket "";
+
+// Default typemaps for Exiv2::XmpParser::encode
+%typemap(default) uint16_t formatFlags %{
+ $1 = Exiv2::XmpParser::XmpFormatFlags::useCompactFormat;
+%}
+%typemap(default) uint32_t padding %{ $1 = 0; %}
+%ignore Exiv2::XmpParser::encode(std::string &, const XmpData &);
+%ignore Exiv2::XmpParser::encode(std::string &, const XmpData &, uint16_t);
+
+// Make enums more Pythonic
+#ifndef SWIGIMPORTED
+DEFINE_CLASS_ENUM(XmpParser, XmpFormatFlags,)
+#else
+IMPORT_CLASS_ENUM(_xmp, XmpParser, XmpFormatFlags)
+#endif
+
// Ignore const overloads of some methods
%ignore Exiv2::XmpData::begin() const;
%ignore Exiv2::XmpData::end() const;
@@ -64,6 +93,5 @@ DATA_CONTAINER(XmpData, Xmpdatum, XmpKey,
%ignore Exiv2::operatorHelper;
%ignore Exiv2::XmpData::operator[];
%ignore Exiv2::XmpParser::decode;
-%ignore Exiv2::XmpParser::encode;
%include "exiv2/xmp_exiv2.hpp"
diff --git a/src/swig-0_27_7/__init__.py b/src/swig-0_27_7/__init__.py
index c6d5b85f..592af026 100644
--- a/src/swig-0_27_7/__init__.py
+++ b/src/swig-0_27_7/__init__.py
@@ -10,9 +10,9 @@
os.environ['PATH'] = _dir + ';' + os.environ['PATH']
#: python-exiv2 version as a string
-__version__ = "0.18.1"
+__version__ = "0.19.0"
#: python-exiv2 version as a tuple of ints
-__version_tuple__ = tuple((0, 18, 1))
+__version_tuple__ = tuple((0, 19, 0))
from exiv2.extras import Exiv2Error
__all__ = ["Exiv2Error"]
diff --git a/src/swig-0_27_7/_enum_data.py b/src/swig-0_27_7/_enum_data.py
index 9f37cf15..33079c4b 100644
--- a/src/swig-0_27_7/_enum_data.py
+++ b/src/swig-0_27_7/_enum_data.py
@@ -152,6 +152,49 @@
'xmpText': 'XMP text type. '}},
'Exiv2::XmpCategory': {'doc': 'Category of an XMP property. ',
'values': {}},
+ 'Exiv2::XmpParser::XmpFormatFlags': {'doc': 'Options to control the '
+ 'format of the serialized '
+ 'XMP packet. ',
+ 'values': {'exactPacketLength': 'The '
+ 'padding '
+ 'parameter '
+ 'is '
+ 'the '
+ 'overall '
+ 'packet '
+ 'length. ',
+ 'includeThumbnailPad': 'Include '
+ 'a '
+ 'padding '
+ 'allowance '
+ 'for '
+ 'a '
+ 'thumbnail '
+ 'image. ',
+ 'omitAllFormatting': 'Omit '
+ 'all '
+ 'formatting '
+ 'whitespace. ',
+ 'omitPacketWrapper': 'Omit '
+ 'the '
+ 'XML '
+ 'packet '
+ 'wrapper. ',
+ 'readOnlyPacket': 'Default '
+ 'is a '
+ 'writeable '
+ 'packet. ',
+ 'useCompactFormat': 'Use '
+ 'a '
+ 'compact '
+ 'form '
+ 'of '
+ 'RDF. ',
+ 'writeAliasComments': 'Show '
+ 'aliases '
+ 'as '
+ 'XML '
+ 'comments. '}},
'Exiv2::XmpValue::XmpArrayType': {'doc': 'XMP array types. ',
'values': {}},
'Exiv2::XmpValue::XmpStruct': {'doc': 'XMP structure indicator. ',
diff --git a/src/swig-0_27_7/basicio_wrap.cxx b/src/swig-0_27_7/basicio_wrap.cxx
index 1390eacf..0b34a26a 100644
--- a/src/swig-0_27_7/basicio_wrap.cxx
+++ b/src/swig-0_27_7/basicio_wrap.cxx
@@ -4835,6 +4835,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -4865,9 +4878,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -5213,7 +5229,9 @@ SWIGINTERN PyObject *_wrap_delete_BasicIo(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_delete_BasicIo
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5247,7 +5265,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_open(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_open
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5285,7 +5305,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_close(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_close
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5341,7 +5363,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_write__SWIG_0(PyObject *self, Py_ssize_t nobj
}
{
#ifdef RELEASE_VIEWS_BasicIo_write
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5397,7 +5421,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_write__SWIG_1(PyObject *self, Py_ssize_t nobj
arg2 = reinterpret_cast< Exiv2::BasicIo * >(argp2);
{
#ifdef RELEASE_VIEWS_BasicIo_write
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5482,7 +5508,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_putb(PyObject *self, PyObject *args) {
arg2 = static_cast< Exiv2::byte >(val2);
{
#ifdef RELEASE_VIEWS_BasicIo_putb
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5525,7 +5553,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_read__SWIG_0(PyObject *self, Py_ssize_t nobjs
arg2 = static_cast< long >(val2);
{
#ifdef RELEASE_VIEWS_BasicIo_read
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5581,7 +5611,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_read__SWIG_1(PyObject *self, Py_ssize_t nobjs
}
{
#ifdef RELEASE_VIEWS_BasicIo_read
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5667,7 +5699,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_getb(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_getb
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5714,7 +5748,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_transfer(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::BasicIo * >(argp2);
{
#ifdef RELEASE_VIEWS_BasicIo_transfer
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5775,7 +5811,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_seek(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_seek
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5828,7 +5866,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_mmap(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_mmap
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5873,7 +5913,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_munmap(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_munmap
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5911,7 +5953,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_tell(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_tell
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5946,7 +5990,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_size(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_size
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5980,7 +6026,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_isopen(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_isopen
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
result = (bool)((Exiv2::BasicIo const *)arg1)->isopen();
@@ -6006,7 +6054,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_error(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_error
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
result = (int)((Exiv2::BasicIo const *)arg1)->error();
@@ -6032,7 +6082,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_eof(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_eof
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6067,7 +6119,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_path(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_path
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
result = ((Exiv2::BasicIo const *)arg1)->path();
@@ -6102,7 +6156,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_ioType(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_ioType
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
result = (char *)Exiv2_BasicIo_ioType(arg1);
@@ -6142,7 +6198,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_data(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_data
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6190,7 +6248,9 @@ SWIGINTERN PyObject *_wrap_BasicIo__view_deleted_cb(PyObject *self, PyObject *ar
arg2 = swig_obj[0];
{
#ifdef RELEASE_VIEWS_BasicIo__view_deleted_cb
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
diff --git a/src/swig-0_27_7/exif_wrap.cxx b/src/swig-0_27_7/exif_wrap.cxx
index 7436cbdc..1f9d31cc 100644
--- a/src/swig-0_27_7/exif_wrap.cxx
+++ b/src/swig-0_27_7/exif_wrap.cxx
@@ -5631,14 +5631,30 @@ static PyObject* set_value_from_py(Exiv2::Exifdatum* datum,
};
-static void _process_list(PyObject* list, bool purge_only,
- Exiv2::ExifData::iterator* beg,
- Exiv2::ExifData::iterator* end) {
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
+static int _process_list(PyObject* list, bool purge_only,
+ Exiv2::ExifData::iterator* beg,
+ Exiv2::ExifData::iterator* end) {
PyObject* py_ptr = NULL;
Exifdatum_pointer* cpp_ptr = NULL;
for (Py_ssize_t idx = PyList_Size(list); idx > 0; idx--) {
- py_ptr = PyWeakref_GetObject(PyList_GetItem(list, idx-1));
- if (py_ptr == Py_None)
+ if (PyWeakref_GetRef(PyList_GetItem(list, idx-1), &py_ptr) < 0)
+ return -1;
+ if (py_ptr)
+ Py_DECREF(py_ptr);
+ else
goto forget;
if (purge_only)
continue;
@@ -5657,35 +5673,41 @@ static void _process_list(PyObject* list, bool purge_only,
PyList_SetSlice(list, idx-1, idx, NULL);
continue;
}
+ return 0;
};
-static void purge_pointers(PyObject* list) {
- _process_list(list, true, NULL, NULL);
+static int purge_pointers(PyObject* list) {
+ return _process_list(list, true, NULL, NULL);
};
-static void invalidate_pointers(PyObject* py_self) {
+static int invalidate_pointers(PyObject* py_self) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, NULL, NULL);
+ return _process_list(list, false, NULL, NULL);
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::ExifData::iterator pos) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::ExifData::iterator pos) {
PyObject* list = private_store_get(py_self, "pointers");
if (list) {
Exiv2::ExifData::iterator end = pos;
end++;
- _process_list(list, false, &pos, &end);
+ return _process_list(list, false, &pos, &end);
}
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::ExifData::iterator beg,
- Exiv2::ExifData::iterator end) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::ExifData::iterator beg,
+ Exiv2::ExifData::iterator end) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, &beg, &end);
+ return _process_list(list, false, &beg, &end);
+ return 0;
};
static int store_pointer(PyObject* py_self, PyObject* py_ptr) {
PyObject* list = private_store_get(py_self, "pointers");
- if (list)
- purge_pointers(list);
+ if (list) {
+ if (purge_pointers(list) < 0)
+ return -1;
+ }
else {
list = PyList_New(0);
if (!list)
@@ -5715,7 +5737,8 @@ static PyObject* _delitem_Exiv2_ExifData(
if (pos == self->end())
return PyErr_Format(PyExc_KeyError, "'%s'", key);
#if 0x040401 >= 0x040400
- invalidate_pointers(py_self, pos);
+ if (invalidate_pointers(py_self, pos) < 0)
+ return NULL;
#endif
self->erase(pos);
return SWIG_Py_Void();
@@ -6930,6 +6953,7 @@ SWIGINTERN PyObject *_wrap_Exifdatum_pointer_value__SWIG_0(PyObject *self, Py_ss
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6980,6 +7004,7 @@ SWIGINTERN PyObject *_wrap_Exifdatum_pointer_value__SWIG_1(PyObject *self, Py_ss
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7312,6 +7337,7 @@ SWIGINTERN PyObject *_wrap_ExifData_iterator___iter__(PyObject *self, PyObject *
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7459,6 +7485,7 @@ SWIGINTERN PyObject *_wrap__getitem_Exiv2_ExifData(PyObject *self, PyObject *arg
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8529,6 +8556,7 @@ SWIGINTERN PyObject *_wrap_Exifdatum_value__SWIG_0(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8830,6 +8858,7 @@ SWIGINTERN PyObject *_wrap_Exifdatum_value__SWIG_1(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9286,6 +9315,7 @@ SWIGINTERN int _wrap_new_ExifThumb(PyObject *self, PyObject *args, PyObject *kwa
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", args)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9837,7 +9867,9 @@ SWIGINTERN PyObject *_wrap_ExifData_erase__SWIG_0(PyObject *self, Py_ssize_t nob
arg2 = argp2->_ptr();
{
- invalidate_pointers(self, arg2);
+ if (invalidate_pointers(self, arg2) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -9862,6 +9894,7 @@ SWIGINTERN PyObject *_wrap_ExifData_erase__SWIG_0(PyObject *self, Py_ssize_t nob
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9925,7 +9958,9 @@ SWIGINTERN PyObject *_wrap_ExifData_erase__SWIG_1(PyObject *self, Py_ssize_t nob
arg3 = argp3->_ptr();
{
- invalidate_pointers(self, arg2, arg3);
+ if (invalidate_pointers(self, arg2, arg3) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -9950,6 +9985,7 @@ SWIGINTERN PyObject *_wrap_ExifData_erase__SWIG_1(PyObject *self, Py_ssize_t nob
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10003,7 +10039,10 @@ SWIGINTERN PyObject *_wrap_ExifData_clear(PyObject *self, PyObject *args) {
(arg1)->clear();
resultobj = SWIG_Py_Void();
{
- invalidate_pointers(self);
+ if (invalidate_pointers(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
}
return resultobj;
fail:
@@ -10095,6 +10134,7 @@ SWIGINTERN PyObject *_wrap_ExifData_begin(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10132,6 +10172,7 @@ SWIGINTERN PyObject *_wrap_ExifData_end(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10190,6 +10231,7 @@ SWIGINTERN PyObject *_wrap_ExifData_findKey(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
diff --git a/src/swig-0_27_7/image_wrap.cxx b/src/swig-0_27_7/image_wrap.cxx
index 9e4c2e8e..644a2d3a 100644
--- a/src/swig-0_27_7/image_wrap.cxx
+++ b/src/swig-0_27_7/image_wrap.cxx
@@ -5053,6 +5053,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -5083,9 +5096,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -5381,7 +5397,9 @@ SWIGINTERN PyObject *_wrap_delete_Image(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_delete_Image
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5414,7 +5432,9 @@ SWIGINTERN PyObject *_wrap_Image_readMetadata(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_readMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5451,7 +5471,9 @@ SWIGINTERN PyObject *_wrap_Image_writeMetadata(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_writeMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5504,7 +5526,9 @@ SWIGINTERN PyObject *_wrap_Image_setExifData(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::ExifData * >(argp2);
{
#ifdef RELEASE_VIEWS_Image_setExifData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5537,7 +5561,9 @@ SWIGINTERN PyObject *_wrap_Image_clearExifData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearExifData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5583,7 +5609,9 @@ SWIGINTERN PyObject *_wrap_Image_setIptcData(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::IptcData * >(argp2);
{
#ifdef RELEASE_VIEWS_Image_setIptcData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5616,7 +5644,9 @@ SWIGINTERN PyObject *_wrap_Image_clearIptcData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearIptcData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5641,7 +5671,7 @@ SWIGINTERN PyObject *_wrap_Image_setXmpPacket(PyObject *self, PyObject *args) {
std::string *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- int res2 = SWIG_OLDOBJ ;
+ int res2 = 0 ;
PyObject *swig_obj[2] ;
if (!args) SWIG_fail;
@@ -5651,20 +5681,19 @@ SWIGINTERN PyObject *_wrap_Image_setXmpPacket(PyObject *self, PyObject *args) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Image_setXmpPacket" "', argument " "1"" of type '" "Exiv2::Image *""'");
}
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
- {
- std::string *ptr = (std::string *)0;
- res2 = SWIG_AsPtr_std_string(swig_obj[0], &ptr);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Image_setXmpPacket" "', argument " "2"" of type '" "std::string const &""'");
- }
- if (!ptr) {
- SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "Image_setXmpPacket" "', argument " "2"" of type '" "std::string const &""'");
- }
- arg2 = ptr;
+ res2 = SWIG_AsPtr_std_string(swig_obj[0], &arg2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Image_setXmpPacket" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!arg2) {
+ SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "Image_setXmpPacket" "', argument " "2"" of type '" "std::string const &""'");
}
+ res2 = SWIG_AddTmpMask(res2);
{
#ifdef RELEASE_VIEWS_Image_setXmpPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5677,6 +5706,7 @@ SWIGINTERN PyObject *_wrap_Image_setXmpPacket(PyObject *self, PyObject *args) {
}
}
resultobj = SWIG_Py_Void();
+
if (SWIG_IsNewObj(res2)) delete arg2;
return resultobj;
fail:
@@ -5699,7 +5729,9 @@ SWIGINTERN PyObject *_wrap_Image_clearXmpPacket(PyObject *self, PyObject *args)
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearXmpPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5745,7 +5777,9 @@ SWIGINTERN PyObject *_wrap_Image_setXmpData(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::XmpData * >(argp2);
{
#ifdef RELEASE_VIEWS_Image_setXmpData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5778,7 +5812,9 @@ SWIGINTERN PyObject *_wrap_Image_clearXmpData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearXmpData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5826,7 +5862,9 @@ SWIGINTERN PyObject *_wrap_Image_setComment(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_Image_setComment
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5861,7 +5899,9 @@ SWIGINTERN PyObject *_wrap_Image_clearComment(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearComment
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5919,7 +5959,9 @@ SWIGINTERN PyObject *_wrap_Image_setIccProfile(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_Image_setIccProfile
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5952,7 +5994,9 @@ SWIGINTERN PyObject *_wrap_Image_clearIccProfile(PyObject *self, PyObject *args)
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearIccProfile
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5986,7 +6030,9 @@ SWIGINTERN PyObject *_wrap_Image_iccProfileDefined(PyObject *self, PyObject *arg
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_iccProfileDefined
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6020,7 +6066,9 @@ SWIGINTERN PyObject *_wrap_Image_iccProfile(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_iccProfile
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6036,6 +6084,7 @@ SWIGINTERN PyObject *_wrap_Image_iccProfile(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6072,7 +6121,9 @@ SWIGINTERN PyObject *_wrap_Image_setMetadata(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::Image * >(argp2);
{
#ifdef RELEASE_VIEWS_Image_setMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6105,7 +6156,9 @@ SWIGINTERN PyObject *_wrap_Image_clearMetadata(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6139,7 +6192,9 @@ SWIGINTERN PyObject *_wrap_Image_exifData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_exifData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6155,6 +6210,7 @@ SWIGINTERN PyObject *_wrap_Image_exifData(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6179,7 +6235,9 @@ SWIGINTERN PyObject *_wrap_Image_iptcData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_iptcData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6195,6 +6253,7 @@ SWIGINTERN PyObject *_wrap_Image_iptcData(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6219,7 +6278,9 @@ SWIGINTERN PyObject *_wrap_Image_xmpData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_xmpData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6235,6 +6296,7 @@ SWIGINTERN PyObject *_wrap_Image_xmpData(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6259,7 +6321,9 @@ SWIGINTERN PyObject *_wrap_Image_xmpPacket(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_xmpPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6300,7 +6364,9 @@ SWIGINTERN PyObject *_wrap_Image_writeXmpFromPacket__SWIG_0(PyObject *self, Py_s
arg2 = static_cast< bool >(val2);
{
#ifdef RELEASE_VIEWS_Image_writeXmpFromPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6348,7 +6414,9 @@ SWIGINTERN PyObject *_wrap_Image_setByteOrder(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_Image_setByteOrder
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6382,7 +6450,9 @@ SWIGINTERN PyObject *_wrap_Image_byteOrder(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_byteOrder
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6420,7 +6490,9 @@ SWIGINTERN PyObject *_wrap_Image_good(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_good
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6454,7 +6526,9 @@ SWIGINTERN PyObject *_wrap_Image_mimeType(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_mimeType
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6488,7 +6562,9 @@ SWIGINTERN PyObject *_wrap_Image_pixelWidth(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_pixelWidth
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6522,7 +6598,9 @@ SWIGINTERN PyObject *_wrap_Image_pixelHeight(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_pixelHeight
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6556,7 +6634,9 @@ SWIGINTERN PyObject *_wrap_Image_comment(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_comment
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6590,7 +6670,9 @@ SWIGINTERN PyObject *_wrap_Image_io(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_io
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6606,6 +6688,7 @@ SWIGINTERN PyObject *_wrap_Image_io(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6645,7 +6728,9 @@ SWIGINTERN PyObject *_wrap_Image_checkMode(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_Image_checkMode
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6698,7 +6783,9 @@ SWIGINTERN PyObject *_wrap_Image_supportsMetadata(PyObject *self, PyObject *args
}
{
#ifdef RELEASE_VIEWS_Image_supportsMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6733,7 +6820,9 @@ SWIGINTERN PyObject *_wrap_Image_writeXmpFromPacket__SWIG_1(PyObject *self, Py_s
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_writeXmpFromPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6817,7 +6906,9 @@ SWIGINTERN PyObject *_wrap_Image_setTypeSupported(PyObject *self, PyObject *args
arg3 = static_cast< uint16_t >(val3);
{
#ifdef RELEASE_VIEWS_Image_setTypeSupported
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6851,7 +6942,9 @@ SWIGINTERN PyObject *_wrap_Image_imageType(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_imageType
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6893,7 +6986,9 @@ SWIGINTERN PyObject *_wrap_Image_data(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_data
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6931,7 +7026,9 @@ SWIGINTERN PyObject *_wrap_Image__view_deleted_cb(PyObject *self, PyObject *args
arg2 = swig_obj[0];
{
#ifdef RELEASE_VIEWS_Image__view_deleted_cb
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
diff --git a/src/swig-0_27_7/iptc_wrap.cxx b/src/swig-0_27_7/iptc_wrap.cxx
index bf279966..e1cfc678 100644
--- a/src/swig-0_27_7/iptc_wrap.cxx
+++ b/src/swig-0_27_7/iptc_wrap.cxx
@@ -5623,14 +5623,30 @@ static PyObject* set_value_from_py(Exiv2::Iptcdatum* datum,
};
-static void _process_list(PyObject* list, bool purge_only,
- Exiv2::IptcData::iterator* beg,
- Exiv2::IptcData::iterator* end) {
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
+static int _process_list(PyObject* list, bool purge_only,
+ Exiv2::IptcData::iterator* beg,
+ Exiv2::IptcData::iterator* end) {
PyObject* py_ptr = NULL;
Iptcdatum_pointer* cpp_ptr = NULL;
for (Py_ssize_t idx = PyList_Size(list); idx > 0; idx--) {
- py_ptr = PyWeakref_GetObject(PyList_GetItem(list, idx-1));
- if (py_ptr == Py_None)
+ if (PyWeakref_GetRef(PyList_GetItem(list, idx-1), &py_ptr) < 0)
+ return -1;
+ if (py_ptr)
+ Py_DECREF(py_ptr);
+ else
goto forget;
if (purge_only)
continue;
@@ -5649,35 +5665,41 @@ static void _process_list(PyObject* list, bool purge_only,
PyList_SetSlice(list, idx-1, idx, NULL);
continue;
}
+ return 0;
};
-static void purge_pointers(PyObject* list) {
- _process_list(list, true, NULL, NULL);
+static int purge_pointers(PyObject* list) {
+ return _process_list(list, true, NULL, NULL);
};
-static void invalidate_pointers(PyObject* py_self) {
+static int invalidate_pointers(PyObject* py_self) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, NULL, NULL);
+ return _process_list(list, false, NULL, NULL);
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::IptcData::iterator pos) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::IptcData::iterator pos) {
PyObject* list = private_store_get(py_self, "pointers");
if (list) {
Exiv2::IptcData::iterator end = pos;
end++;
- _process_list(list, false, &pos, &end);
+ return _process_list(list, false, &pos, &end);
}
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::IptcData::iterator beg,
- Exiv2::IptcData::iterator end) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::IptcData::iterator beg,
+ Exiv2::IptcData::iterator end) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, &beg, &end);
+ return _process_list(list, false, &beg, &end);
+ return 0;
};
static int store_pointer(PyObject* py_self, PyObject* py_ptr) {
PyObject* list = private_store_get(py_self, "pointers");
- if (list)
- purge_pointers(list);
+ if (list) {
+ if (purge_pointers(list) < 0)
+ return -1;
+ }
else {
list = PyList_New(0);
if (!list)
@@ -5707,7 +5729,8 @@ static PyObject* _delitem_Exiv2_IptcData(
if (pos == self->end())
return PyErr_Format(PyExc_KeyError, "'%s'", key);
#if 0x040401 >= 0x040400
- invalidate_pointers(py_self, pos);
+ if (invalidate_pointers(py_self, pos) < 0)
+ return NULL;
#endif
self->erase(pos);
return SWIG_Py_Void();
@@ -6788,6 +6811,7 @@ SWIGINTERN PyObject *_wrap_Iptcdatum_pointer_value__SWIG_0(PyObject *self, Py_ss
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6838,6 +6862,7 @@ SWIGINTERN PyObject *_wrap_Iptcdatum_pointer_value__SWIG_1(PyObject *self, Py_ss
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7109,6 +7134,7 @@ SWIGINTERN PyObject *_wrap_IptcData_iterator___iter__(PyObject *self, PyObject *
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7256,6 +7282,7 @@ SWIGINTERN PyObject *_wrap__getitem_Exiv2_IptcData(PyObject *self, PyObject *arg
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8272,6 +8299,7 @@ SWIGINTERN PyObject *_wrap_Iptcdatum_value__SWIG_0(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8512,6 +8540,7 @@ SWIGINTERN PyObject *_wrap_Iptcdatum_value__SWIG_1(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8885,7 +8914,9 @@ SWIGINTERN PyObject *_wrap_IptcData_erase(PyObject *self, PyObject *args) {
arg2 = argp2->_ptr();
{
- invalidate_pointers(self, arg2);
+ if (invalidate_pointers(self, arg2) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -8910,6 +8941,7 @@ SWIGINTERN PyObject *_wrap_IptcData_erase(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8934,7 +8966,10 @@ SWIGINTERN PyObject *_wrap_IptcData_clear(PyObject *self, PyObject *args) {
(arg1)->clear();
resultobj = SWIG_Py_Void();
{
- invalidate_pointers(self);
+ if (invalidate_pointers(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
}
return resultobj;
fail:
@@ -9026,6 +9061,7 @@ SWIGINTERN PyObject *_wrap_IptcData_begin(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9063,6 +9099,7 @@ SWIGINTERN PyObject *_wrap_IptcData_end(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9121,6 +9158,7 @@ SWIGINTERN PyObject *_wrap_IptcData_findKey(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9182,6 +9220,7 @@ SWIGINTERN PyObject *_wrap_IptcData_findId__SWIG_0(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9235,6 +9274,7 @@ SWIGINTERN PyObject *_wrap_IptcData_findId__SWIG_1(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
diff --git a/src/swig-0_27_7/metadatum_wrap.cxx b/src/swig-0_27_7/metadatum_wrap.cxx
index ebc8c024..f1c9c399 100644
--- a/src/swig-0_27_7/metadatum_wrap.cxx
+++ b/src/swig-0_27_7/metadatum_wrap.cxx
@@ -4715,16 +4715,30 @@ static void _set_python_exception() {
static PyObject* _str_Exiv2_Metadatum(PyObject* py_self) {
Exiv2::Metadatum* self = NULL;
+ std::string result;
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__Metadatum, 0);
- std::string result = metadatum_str(self);
+ try {
+ result = metadatum_str(self);
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ return NULL;
+ }
return SWIG_FromCharPtrAndSize(result.data(), result.size());
};
static PyObject* _str_MetadatumPointerBase(PyObject* py_self) {
MetadatumPointerBase* self = NULL;
+ std::string result;
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_MetadatumPointerBase, 0);
- std::string result = self->__str__();
+ try {
+ result = self->__str__();
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ return NULL;
+ }
return SWIG_FromCharPtrAndSize(result.data(), result.size());
};
@@ -6665,6 +6679,7 @@ SWIGINTERN PyObject *_wrap_Metadatum_value(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
diff --git a/src/swig-0_27_7/preview_wrap.cxx b/src/swig-0_27_7/preview_wrap.cxx
index e3be5cb4..2a3f0963 100644
--- a/src/swig-0_27_7/preview_wrap.cxx
+++ b/src/swig-0_27_7/preview_wrap.cxx
@@ -5940,6 +5940,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -5970,9 +5983,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -6913,6 +6929,7 @@ SWIGINTERN int _wrap_new_PreviewManager(PyObject *self, PyObject *args, PyObject
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", args)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
diff --git a/src/swig-0_27_7/types_wrap.cxx b/src/swig-0_27_7/types_wrap.cxx
index d6ab2127..bcc06d96 100644
--- a/src/swig-0_27_7/types_wrap.cxx
+++ b/src/swig-0_27_7/types_wrap.cxx
@@ -5163,6 +5163,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -5193,9 +5206,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -6285,7 +6301,10 @@ SWIGINTERN PyObject *_wrap_DataBuf_alloc(PyObject *self, PyObject *args) {
}
resultobj = SWIG_Py_Void();
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -6308,7 +6327,10 @@ SWIGINTERN PyObject *_wrap_DataBuf_free(PyObject *self, PyObject *args) {
(arg1)->free();
resultobj = SWIG_Py_Void();
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -6331,7 +6353,10 @@ SWIGINTERN PyObject *_wrap_DataBuf_reset(PyObject *self, PyObject *args) {
(arg1)->reset();
resultobj = SWIG_Py_Void();
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
diff --git a/src/swig-0_27_7/value_wrap.cxx b/src/swig-0_27_7/value_wrap.cxx
index 0028a5df..ba6d6a40 100644
--- a/src/swig-0_27_7/value_wrap.cxx
+++ b/src/swig-0_27_7/value_wrap.cxx
@@ -5763,8 +5763,15 @@ namespace swig {
static PyObject* _str_Exiv2_Value(PyObject* py_self) {
Exiv2::Value* self = NULL;
+ std::string result;
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__Value, 0);
- std::string result = self->toString();
+ try {
+ result = self->toString();
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ return NULL;
+ }
return SWIG_FromCharPtrAndSize(result.data(), result.size());
};
@@ -6541,6 +6548,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -6571,9 +6591,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -9682,7 +9705,10 @@ SWIGINTERN PyObject *_wrap_StringValueBase_read__SWIG_0(PyObject *self, Py_ssize
resultobj = SWIG_From_int(static_cast< int >(result));
if (SWIG_IsNewObj(res2)) delete arg2;
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -9755,7 +9781,10 @@ SWIGINTERN PyObject *_wrap_StringValueBase_read__SWIG_1(PyObject *self, Py_ssize
Py_XDECREF(_global_view);
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -11893,7 +11922,10 @@ SWIGINTERN PyObject *_wrap_XmpTextValue_read__SWIG_0(PyObject *self, Py_ssize_t
Py_XDECREF(_global_view);
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -11942,7 +11974,10 @@ SWIGINTERN PyObject *_wrap_XmpTextValue_read__SWIG_1(PyObject *self, Py_ssize_t
resultobj = SWIG_From_int(static_cast< int >(result));
if (SWIG_IsNewObj(res2)) delete arg2;
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
diff --git a/src/swig-0_27_7/xmp_wrap.cxx b/src/swig-0_27_7/xmp_wrap.cxx
index 81c179bb..1b157d2f 100644
--- a/src/swig-0_27_7/xmp_wrap.cxx
+++ b/src/swig-0_27_7/xmp_wrap.cxx
@@ -4398,15 +4398,16 @@ SwigPyBuiltin_iternextfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
#define SWIGTYPE_p_std__ostream swig_types[59]
#define SWIGTYPE_p_std__pairT_int32_t_int32_t_t swig_types[60]
#define SWIGTYPE_p_std__pairT_uint32_t_uint32_t_t swig_types[61]
-#define SWIGTYPE_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t swig_types[62]
-#define SWIGTYPE_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator swig_types[63]
-#define SWIGTYPE_p_unsigned_char swig_types[64]
-#define SWIGTYPE_p_unsigned_int swig_types[65]
-#define SWIGTYPE_p_unsigned_long_long swig_types[66]
-#define SWIGTYPE_p_unsigned_short swig_types[67]
-#define SWIGTYPE_p_value_type swig_types[68]
-static swig_type_info *swig_types[70];
-static swig_module_info swig_module = {swig_types, 69, 0, 0, 0, 0};
+#define SWIGTYPE_p_std__string swig_types[62]
+#define SWIGTYPE_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t swig_types[63]
+#define SWIGTYPE_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator swig_types[64]
+#define SWIGTYPE_p_unsigned_char swig_types[65]
+#define SWIGTYPE_p_unsigned_int swig_types[66]
+#define SWIGTYPE_p_unsigned_long_long swig_types[67]
+#define SWIGTYPE_p_unsigned_short swig_types[68]
+#define SWIGTYPE_p_value_type swig_types[69]
+static swig_type_info *swig_types[71];
+static swig_module_info swig_module = {swig_types, 70, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -5626,14 +5627,30 @@ static PyObject* set_value_from_py(Exiv2::Xmpdatum* datum,
};
-static void _process_list(PyObject* list, bool purge_only,
- Exiv2::XmpData::iterator* beg,
- Exiv2::XmpData::iterator* end) {
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
+static int _process_list(PyObject* list, bool purge_only,
+ Exiv2::XmpData::iterator* beg,
+ Exiv2::XmpData::iterator* end) {
PyObject* py_ptr = NULL;
Xmpdatum_pointer* cpp_ptr = NULL;
for (Py_ssize_t idx = PyList_Size(list); idx > 0; idx--) {
- py_ptr = PyWeakref_GetObject(PyList_GetItem(list, idx-1));
- if (py_ptr == Py_None)
+ if (PyWeakref_GetRef(PyList_GetItem(list, idx-1), &py_ptr) < 0)
+ return -1;
+ if (py_ptr)
+ Py_DECREF(py_ptr);
+ else
goto forget;
if (purge_only)
continue;
@@ -5652,35 +5669,41 @@ static void _process_list(PyObject* list, bool purge_only,
PyList_SetSlice(list, idx-1, idx, NULL);
continue;
}
+ return 0;
};
-static void purge_pointers(PyObject* list) {
- _process_list(list, true, NULL, NULL);
+static int purge_pointers(PyObject* list) {
+ return _process_list(list, true, NULL, NULL);
};
-static void invalidate_pointers(PyObject* py_self) {
+static int invalidate_pointers(PyObject* py_self) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, NULL, NULL);
+ return _process_list(list, false, NULL, NULL);
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::XmpData::iterator pos) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::XmpData::iterator pos) {
PyObject* list = private_store_get(py_self, "pointers");
if (list) {
Exiv2::XmpData::iterator end = pos;
end++;
- _process_list(list, false, &pos, &end);
+ return _process_list(list, false, &pos, &end);
}
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::XmpData::iterator beg,
- Exiv2::XmpData::iterator end) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::XmpData::iterator beg,
+ Exiv2::XmpData::iterator end) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, &beg, &end);
+ return _process_list(list, false, &beg, &end);
+ return 0;
};
static int store_pointer(PyObject* py_self, PyObject* py_ptr) {
PyObject* list = private_store_get(py_self, "pointers");
- if (list)
- purge_pointers(list);
+ if (list) {
+ if (purge_pointers(list) < 0)
+ return -1;
+ }
else {
list = PyList_New(0);
if (!list)
@@ -5710,7 +5733,8 @@ static PyObject* _delitem_Exiv2_XmpData(
if (pos == self->end())
return PyErr_Format(PyExc_KeyError, "'%s'", key);
#if 0x040401 >= 0x040400
- invalidate_pointers(py_self, pos);
+ if (invalidate_pointers(py_self, pos) < 0)
+ return NULL;
#endif
self->erase(pos);
return SWIG_Py_Void();
@@ -5749,6 +5773,52 @@ static int _contains_Exiv2_XmpData(PyObject* py_self, PyObject* py_key) {
return self->findKey(Exiv2::XmpKey(key)) != self->end() ? 1 : 0;
};
+
+static PyObject* Python_Exiv2_XmpParser_XmpFormatFlags = NULL;
+
+
+static PyObject* Python_Exiv2_extras_create_enum = NULL;
+
+
+
+
+// Convert enum names & values to a Python list
+static PyObject* _get_enum_data(const char* name, ...) {
+ PyObject* py_obj = NULL;
+ PyObject* members = PyList_New(0);
+ va_list args;
+ va_start(args, name);
+ char* label = va_arg(args, char*);
+ while (label) {
+ py_obj = Py_BuildValue("(si)", label, va_arg(args, int));
+ PyList_Append(members, py_obj);
+ Py_DECREF(py_obj);
+ label = va_arg(args, char*);
+ }
+ va_end(args);
+ return members;
+};
+// Call Python to create an enum from list of names & values
+static PyObject* _create_enum(const char* name, const char* alias_strip,
+ PyObject* members) {
+ return PyObject_CallFunction(
+ Python_Exiv2_extras_create_enum, "(sssN)",
+ SWIG_name, name, alias_strip, members);
+};
+
+
+static PyObject* _get_enum_data_Exiv2_XmpParser_XmpFormatFlags() {
+ return _get_enum_data("Exiv2::XmpParser::XmpFormatFlags",
+ "omitPacketWrapper", Exiv2::XmpParser::omitPacketWrapper,
+ "readOnlyPacket", Exiv2::XmpParser::readOnlyPacket,
+ "useCompactFormat", Exiv2::XmpParser::useCompactFormat,
+ "includeThumbnailPad", Exiv2::XmpParser::includeThumbnailPad,
+ "exactPacketLength", Exiv2::XmpParser::exactPacketLength,
+ "writeAliasComments", Exiv2::XmpParser::writeAliasComments,
+ "omitAllFormatting", Exiv2::XmpParser::omitAllFormatting,
+ NULL);
+};
+
SWIGINTERN bool Exiv2_Xmpdatum_operator_Se__Se_(Exiv2::Xmpdatum const *self,Exiv2::Xmpdatum const &other){
return &other == self;
}
@@ -5817,6 +5887,90 @@ SWIG_AsPtr_std_string (PyObject * obj, std::string **val)
return SWIG_ERROR;
}
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val)
+{
+#if PY_VERSION_HEX < 0x03000000
+ if (PyInt_Check(obj)) {
+ long v = PyInt_AsLong(obj);
+ if (v >= 0) {
+ if (val) *val = v;
+ return SWIG_OK;
+ } else {
+ return SWIG_OverflowError;
+ }
+ } else
+#endif
+ if (PyLong_Check(obj)) {
+ unsigned long v = PyLong_AsUnsignedLong(obj);
+ if (!PyErr_Occurred()) {
+ if (val) *val = v;
+ return SWIG_OK;
+ } else {
+ PyErr_Clear();
+ return SWIG_OverflowError;
+ }
+ }
+#ifdef SWIG_PYTHON_CAST_MODE
+ {
+ int dispatch = 0;
+ unsigned long v = PyLong_AsUnsignedLong(obj);
+ if (!PyErr_Occurred()) {
+ if (val) *val = v;
+ return SWIG_AddCast(SWIG_OK);
+ } else {
+ PyErr_Clear();
+ }
+ if (!dispatch) {
+ double d;
+ int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
+ // Largest double not larger than ULONG_MAX (not portably calculated easily)
+ // Note that double(ULONG_MAX) is stored in a double rounded up by one (for 64-bit unsigned long)
+ // 0xfffffffffffff800ULL == (uint64_t)std::nextafter(double(__uint128_t(ULONG_MAX)+1), double(0))
+ const double ulong_max = sizeof(unsigned long) == 8 ? 0xfffffffffffff800ULL : ULONG_MAX;
+ if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ulong_max)) {
+ if (val) *val = (unsigned long)(d);
+ return res;
+ }
+ }
+ }
+#endif
+ return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_short (PyObject * obj, unsigned short *val)
+{
+ unsigned long v;
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v > USHRT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val) *val = static_cast< unsigned short >(v);
+ }
+ }
+ return res;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
+{
+ unsigned long v;
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v > UINT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val) *val = static_cast< unsigned int >(v);
+ }
+ }
+ return res;
+}
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -6705,6 +6859,7 @@ SWIGINTERN PyObject *_wrap_Xmpdatum_pointer_value__SWIG_0(PyObject *self, Py_ssi
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6755,6 +6910,7 @@ SWIGINTERN PyObject *_wrap_Xmpdatum_pointer_value__SWIG_1(PyObject *self, Py_ssi
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7026,6 +7182,7 @@ SWIGINTERN PyObject *_wrap_XmpData_iterator___iter__(PyObject *self, PyObject *a
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7173,6 +7330,7 @@ SWIGINTERN PyObject *_wrap__getitem_Exiv2_XmpData(PyObject *self, PyObject *args
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8130,6 +8288,7 @@ SWIGINTERN PyObject *_wrap_Xmpdatum_value__SWIG_0(PyObject *self, Py_ssize_t nob
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8370,6 +8529,7 @@ SWIGINTERN PyObject *_wrap_Xmpdatum_value__SWIG_1(PyObject *self, Py_ssize_t nob
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8765,7 +8925,9 @@ SWIGINTERN PyObject *_wrap_XmpData_erase(PyObject *self, PyObject *args) {
arg2 = argp2->_ptr();
{
- invalidate_pointers(self, arg2);
+ if (invalidate_pointers(self, arg2) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -8790,6 +8952,7 @@ SWIGINTERN PyObject *_wrap_XmpData_erase(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8836,7 +8999,9 @@ SWIGINTERN PyObject *_wrap_XmpData_eraseFamily(PyObject *self, PyObject *args) {
arg2 = &it2;
}
{
- invalidate_pointers(self, *arg2, arg1->end());
+ if (invalidate_pointers(self, *arg2, arg1->end()) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -8869,7 +9034,10 @@ SWIGINTERN PyObject *_wrap_XmpData_clear(PyObject *self, PyObject *args) {
(arg1)->clear();
resultobj = SWIG_Py_Void();
{
- invalidate_pointers(self);
+ if (invalidate_pointers(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
}
return resultobj;
fail:
@@ -8933,6 +9101,7 @@ SWIGINTERN PyObject *_wrap_XmpData_begin(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8970,6 +9139,7 @@ SWIGINTERN PyObject *_wrap_XmpData_end(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9028,6 +9198,7 @@ SWIGINTERN PyObject *_wrap_XmpData_findKey(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9180,7 +9351,7 @@ SWIGINTERN PyObject *_wrap_XmpData_setPacket(PyObject *self, PyObject *args) {
std::string *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- int res2 = SWIG_OLDOBJ ;
+ int res2 = 0 ;
PyObject *swig_obj[2] ;
if (!args) SWIG_fail;
@@ -9190,17 +9361,14 @@ SWIGINTERN PyObject *_wrap_XmpData_setPacket(PyObject *self, PyObject *args) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XmpData_setPacket" "', argument " "1"" of type '" "Exiv2::XmpData *""'");
}
arg1 = reinterpret_cast< Exiv2::XmpData * >(argp1);
- {
- std::string *ptr = (std::string *)0;
- res2 = SWIG_AsPtr_std_string(swig_obj[0], &ptr);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "XmpData_setPacket" "', argument " "2"" of type '" "std::string const &""'");
- }
- if (!ptr) {
- SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "XmpData_setPacket" "', argument " "2"" of type '" "std::string const &""'");
- }
- arg2 = ptr;
+ res2 = SWIG_AsPtr_std_string(swig_obj[0], &arg2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "XmpData_setPacket" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!arg2) {
+ SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "XmpData_setPacket" "', argument " "2"" of type '" "std::string const &""'");
}
+ res2 = SWIG_AddTmpMask(res2);
{
try {
(arg1)->setPacket((std::string const &)*arg2);
@@ -9211,6 +9379,7 @@ SWIGINTERN PyObject *_wrap_XmpData_setPacket(PyObject *self, PyObject *args) {
}
}
resultobj = SWIG_Py_Void();
+
if (SWIG_IsNewObj(res2)) delete arg2;
return resultobj;
fail:
@@ -9282,6 +9451,73 @@ SWIGPY_LENFUNC_CLOSURE(_wrap_XmpData_count) /* defines _wrap_XmpData_count_lenfu
SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_XmpData) /* defines _wrap_delete_XmpData_destructor_closure */
+SWIGINTERN PyObject *_wrap_XmpParser_encode(PyObject *self, PyObject *args) {
+ PyObject *resultobj = 0;
+ std::string *arg1 = 0 ;
+ Exiv2::XmpData *arg2 = 0 ;
+ uint16_t arg3 ;
+ uint32_t arg4 ;
+ std::string temp1 ;
+ int res1 = SWIG_TMPOBJ ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ unsigned short val3 ;
+ int ecode3 = 0 ;
+ unsigned int val4 ;
+ int ecode4 = 0 ;
+ PyObject *swig_obj[3] ;
+ int result;
+
+
+ arg3 = Exiv2::XmpParser::XmpFormatFlags::useCompactFormat;
+
+ arg4 = 0;
+ arg1 = &temp1;
+ if (!SWIG_Python_UnpackTuple(args, "XmpParser_encode", 1, 3, swig_obj)) SWIG_fail;
+ res2 = SWIG_ConvertPtr(swig_obj[0], &argp2, SWIGTYPE_p_Exiv2__XmpData, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "XmpParser_encode" "', argument " "2"" of type '" "Exiv2::XmpData const &""'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "XmpParser_encode" "', argument " "2"" of type '" "Exiv2::XmpData const &""'");
+ }
+ arg2 = reinterpret_cast< Exiv2::XmpData * >(argp2);
+ if (swig_obj[1]) {
+ ecode3 = SWIG_AsVal_unsigned_SS_short(swig_obj[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "XmpParser_encode" "', argument " "3"" of type '" "uint16_t""'");
+ }
+ arg3 = static_cast< uint16_t >(val3);
+ }
+ if (swig_obj[2]) {
+ ecode4 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "XmpParser_encode" "', argument " "4"" of type '" "uint32_t""'");
+ }
+ arg4 = static_cast< uint32_t >(val4);
+ }
+ {
+ try {
+ result = (int)Exiv2::XmpParser::encode(*arg1,(Exiv2::XmpData const &)*arg2,arg3,arg4);
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ SWIG_fail;
+ }
+ }
+ resultobj = SWIG_From_int(static_cast< int >(result));
+ if (SWIG_IsTmpObj(res1)) {
+ resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_std_string((*arg1)), 0);
+ } else {
+ int new_flags = SWIG_IsNewObj(res1) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
+ resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg1), SWIGTYPE_p_std__string, new_flags), 0);
+ }
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_XmpParser_initialize__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
PyObject *resultobj = 0;
Exiv2::XmpParser::XmpLockFct arg1 = 0 ;
@@ -11142,6 +11378,31 @@ SwigPyBuiltin__Exiv2__XmpParser_richcompare(PyObject *self, PyObject *other, int
}
SWIGINTERN PyMethodDef SwigPyBuiltin__Exiv2__XmpParser_methods[] = {
+ { "encode", (PyCFunction)(void(*)(void))_wrap_XmpParser_encode, METH_STATIC|METH_VARARGS, "\n"
+ "Encode (serialize) XMP metadata from *xmpData* into a\n"
+ " string xmpPacket. The XMP packet returned in the string\n"
+ " follows the XMP specification. This method only modifies\n"
+ " *xmpPacket* if the operations succeeds (return code 0).\n"
+ "\n"
+ ":type xmpPacket: str\n"
+ ":param xmpPacket: Reference to a string to hold the encoded XMP\n"
+ " packet.\n"
+ ":type xmpData: :py:class:`XmpData`\n"
+ ":param xmpData: XMP properties to encode.\n"
+ ":type formatFlags: int, optional\n"
+ ":param formatFlags: Flags that control the format of the XMP packet,\n"
+ " see enum XmpFormatFlags.\n"
+ ":type padding: int, optional\n"
+ ":param padding: Padding length.\n"
+ ":rtype: int\n"
+ ":return: 0 if successful;\n"
+ "\n"
+ " 1 if XMP support has not been compiled-in;\n"
+ "\n"
+ " 2 if the XMP toolkit failed to initialize;\n"
+ "\n"
+ " 3 if the XMP toolkit failed and raised an XMP_Error\n"
+ "" },
{ "initialize", (PyCFunction)(void(*)(void))_wrap_XmpParser_initialize, METH_STATIC|METH_VARARGS, "\n"
" Initialize the XMP Toolkit.\n"
"\n"
@@ -11640,6 +11901,7 @@ static swig_type_info _swigt__p_size_type = {"_p_size_type", "size_type *", 0, 0
static swig_type_info _swigt__p_std__ostream = {"_p_std__ostream", "std::ostream *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__pairT_int32_t_int32_t_t = {"_p_std__pairT_int32_t_int32_t_t", "Exiv2::Rational *|std::pair< int,int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__pairT_uint32_t_uint32_t_t = {"_p_std__pairT_uint32_t_uint32_t_t", "Exiv2::URational *|std::pair< unsigned int,unsigned int > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__string = {"_p_std__string", "std::string *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t = {"_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t", "Exiv2::XmpMetadata *|std::vector< Exiv2::Xmpdatum,std::allocator< Exiv2::Xmpdatum > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator = {"_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator", "Exiv2::XmpData::iterator *|std::vector< Exiv2::Xmpdatum,std::allocator< Exiv2::Xmpdatum > >::iterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "Exiv2::byte *|uint8_t *|uint_fast8_t *|uint_least8_t *|unsigned char *", 0, 0, (void*)0, 0};
@@ -11711,6 +11973,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_std__ostream,
&_swigt__p_std__pairT_int32_t_int32_t_t,
&_swigt__p_std__pairT_uint32_t_uint32_t_t,
+ &_swigt__p_std__string,
&_swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t,
&_swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator,
&_swigt__p_unsigned_char,
@@ -11782,6 +12045,7 @@ static swig_cast_info _swigc__p_size_type[] = { {&_swigt__p_size_type, 0, 0, 0}
static swig_cast_info _swigc__p_std__ostream[] = { {&_swigt__p_std__ostream, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__pairT_int32_t_int32_t_t[] = { {&_swigt__p_std__pairT_int32_t_int32_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__pairT_uint32_t_uint32_t_t[] = { {&_swigt__p_std__pairT_uint32_t_uint32_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__string[] = { {&_swigt__p_std__string, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t[] = { {&_swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator[] = { {&_swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
@@ -11853,6 +12117,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_std__ostream,
_swigc__p_std__pairT_int32_t_int32_t_t,
_swigc__p_std__pairT_uint32_t_uint32_t_t,
+ _swigc__p_std__string,
_swigc__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t,
_swigc__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator,
_swigc__p_unsigned_char,
@@ -12689,6 +12954,19 @@ SWIGINTERN int SWIG_mod_exec(PyObject *m) {
SwigPyBuiltin_AddPublicSymbol(public_interface, "Xmpdatum_reference");
d = md;
+ Python_Exiv2_extras_create_enum = import_from_python("exiv2.extras","_create_enum");
+ if (!Python_Exiv2_extras_create_enum)
+ return INIT_ERROR_RETURN;
+
+
+ Python_Exiv2_XmpParser_XmpFormatFlags = _create_enum(
+ "Exiv2::XmpParser::XmpFormatFlags","", _get_enum_data_Exiv2_XmpParser_XmpFormatFlags());
+ if (!Python_Exiv2_XmpParser_XmpFormatFlags)
+ return INIT_ERROR_RETURN;
+ // SWIG_Python_SetConstant will decref PyEnum object
+ Py_INCREF(Python_Exiv2_XmpParser_XmpFormatFlags);
+
+
/* type 'Exiv2::Xmpdatum' */
d = PyDict_New();
builtin_base_count = 0;
@@ -12736,13 +13014,7 @@ SWIGINTERN int SWIG_mod_exec(PyObject *m) {
/* type 'Exiv2::XmpParser' */
d = PyDict_New();
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "omitPacketWrapper",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::omitPacketWrapper)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "readOnlyPacket",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::readOnlyPacket)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "useCompactFormat",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::useCompactFormat)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "includeThumbnailPad",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::includeThumbnailPad)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "exactPacketLength",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::exactPacketLength)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "writeAliasComments",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::writeAliasComments)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "omitAllFormatting",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::omitAllFormatting)));
+ SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XmpFormatFlags",Python_Exiv2_XmpParser_XmpFormatFlags);
builtin_base_count = 0;
builtin_bases[builtin_base_count] = NULL;
PyDict_SetItemString(d, "this", this_descr);
diff --git a/src/swig-0_28_7/__init__.py b/src/swig-0_28_7/__init__.py
index c6d5b85f..592af026 100644
--- a/src/swig-0_28_7/__init__.py
+++ b/src/swig-0_28_7/__init__.py
@@ -10,9 +10,9 @@
os.environ['PATH'] = _dir + ';' + os.environ['PATH']
#: python-exiv2 version as a string
-__version__ = "0.18.1"
+__version__ = "0.19.0"
#: python-exiv2 version as a tuple of ints
-__version_tuple__ = tuple((0, 18, 1))
+__version_tuple__ = tuple((0, 19, 0))
from exiv2.extras import Exiv2Error
__all__ = ["Exiv2Error"]
diff --git a/src/swig-0_28_7/_enum_data.py b/src/swig-0_28_7/_enum_data.py
index bff54c24..eebc919d 100644
--- a/src/swig-0_28_7/_enum_data.py
+++ b/src/swig-0_28_7/_enum_data.py
@@ -103,6 +103,49 @@
'xmpText': 'XMP text type. '}},
'Exiv2::XmpCategory': {'doc': 'Category of an XMP property. ',
'values': {}},
+ 'Exiv2::XmpParser::XmpFormatFlags': {'doc': 'Options to control the '
+ 'format of the serialized '
+ 'XMP packet. ',
+ 'values': {'exactPacketLength': 'The '
+ 'padding '
+ 'parameter '
+ 'is '
+ 'the '
+ 'overall '
+ 'packet '
+ 'length. ',
+ 'includeThumbnailPad': 'Include '
+ 'a '
+ 'padding '
+ 'allowance '
+ 'for '
+ 'a '
+ 'thumbnail '
+ 'image. ',
+ 'omitAllFormatting': 'Omit '
+ 'all '
+ 'formatting '
+ 'whitespace. ',
+ 'omitPacketWrapper': 'Omit '
+ 'the '
+ 'XML '
+ 'packet '
+ 'wrapper. ',
+ 'readOnlyPacket': 'Default '
+ 'is a '
+ 'writeable '
+ 'packet. ',
+ 'useCompactFormat': 'Use '
+ 'a '
+ 'compact '
+ 'form '
+ 'of '
+ 'RDF. ',
+ 'writeAliasComments': 'Show '
+ 'aliases '
+ 'as '
+ 'XML '
+ 'comments. '}},
'Exiv2::XmpValue::XmpArrayType': {'doc': 'XMP array types. ',
'values': {}},
'Exiv2::XmpValue::XmpStruct': {'doc': 'XMP structure indicator. ',
diff --git a/src/swig-0_28_7/basicio_wrap.cxx b/src/swig-0_28_7/basicio_wrap.cxx
index 2b95ee76..7e44d76f 100644
--- a/src/swig-0_28_7/basicio_wrap.cxx
+++ b/src/swig-0_28_7/basicio_wrap.cxx
@@ -4834,6 +4834,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -4864,9 +4877,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -5316,7 +5332,9 @@ SWIGINTERN PyObject *_wrap_delete_BasicIo(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_delete_BasicIo
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5350,7 +5368,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_open(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_open
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5388,7 +5408,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_close(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_close
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5444,7 +5466,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_write__SWIG_0(PyObject *self, Py_ssize_t nobj
}
{
#ifdef RELEASE_VIEWS_BasicIo_write
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5500,7 +5524,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_write__SWIG_1(PyObject *self, Py_ssize_t nobj
arg2 = reinterpret_cast< Exiv2::BasicIo * >(argp2);
{
#ifdef RELEASE_VIEWS_BasicIo_write
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5585,7 +5611,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_putb(PyObject *self, PyObject *args) {
arg2 = static_cast< Exiv2::byte >(val2);
{
#ifdef RELEASE_VIEWS_BasicIo_putb
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5628,7 +5656,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_read__SWIG_0(PyObject *self, Py_ssize_t nobjs
arg2 = static_cast< size_t >(val2);
{
#ifdef RELEASE_VIEWS_BasicIo_read
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5684,7 +5714,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_read__SWIG_1(PyObject *self, Py_ssize_t nobjs
}
{
#ifdef RELEASE_VIEWS_BasicIo_read
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5805,7 +5837,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_readOrThrow(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_readOrThrow
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5850,7 +5884,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_getb(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_getb
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5897,7 +5933,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_transfer(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::BasicIo * >(argp2);
{
#ifdef RELEASE_VIEWS_BasicIo_transfer
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5958,7 +5996,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_seek(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_seek
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6039,7 +6079,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_seekOrThrow(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_seekOrThrow
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6088,7 +6130,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_mmap(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_mmap
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6133,7 +6177,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_munmap(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_munmap
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6171,7 +6217,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_tell(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_tell
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6206,7 +6254,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_size(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_size
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6240,7 +6290,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_isopen(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_isopen
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
result = (bool)((Exiv2::BasicIo const *)arg1)->isopen();
@@ -6266,7 +6318,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_error(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_error
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
result = (int)((Exiv2::BasicIo const *)arg1)->error();
@@ -6292,7 +6346,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_eof(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_eof
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6327,7 +6383,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_path(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_path
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
result = (std::string *) &((Exiv2::BasicIo const *)arg1)->path();
@@ -6364,7 +6422,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_ioType(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_ioType
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
result = (char *)Exiv2_BasicIo_ioType(arg1);
@@ -6404,7 +6464,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_data(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_data
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6452,7 +6514,9 @@ SWIGINTERN PyObject *_wrap_BasicIo__view_deleted_cb(PyObject *self, PyObject *ar
arg2 = swig_obj[0];
{
#ifdef RELEASE_VIEWS_BasicIo__view_deleted_cb
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
diff --git a/src/swig-0_28_7/exif_wrap.cxx b/src/swig-0_28_7/exif_wrap.cxx
index cce1eb3d..2974d9fa 100644
--- a/src/swig-0_28_7/exif_wrap.cxx
+++ b/src/swig-0_28_7/exif_wrap.cxx
@@ -5793,14 +5793,30 @@ static PyObject* set_value_from_py(Exiv2::Exifdatum* datum,
};
-static void _process_list(PyObject* list, bool purge_only,
- Exiv2::ExifData::iterator* beg,
- Exiv2::ExifData::iterator* end) {
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
+static int _process_list(PyObject* list, bool purge_only,
+ Exiv2::ExifData::iterator* beg,
+ Exiv2::ExifData::iterator* end) {
PyObject* py_ptr = NULL;
Exifdatum_pointer* cpp_ptr = NULL;
for (Py_ssize_t idx = PyList_Size(list); idx > 0; idx--) {
- py_ptr = PyWeakref_GetObject(PyList_GetItem(list, idx-1));
- if (py_ptr == Py_None)
+ if (PyWeakref_GetRef(PyList_GetItem(list, idx-1), &py_ptr) < 0)
+ return -1;
+ if (py_ptr)
+ Py_DECREF(py_ptr);
+ else
goto forget;
if (purge_only)
continue;
@@ -5819,35 +5835,41 @@ static void _process_list(PyObject* list, bool purge_only,
PyList_SetSlice(list, idx-1, idx, NULL);
continue;
}
+ return 0;
};
-static void purge_pointers(PyObject* list) {
- _process_list(list, true, NULL, NULL);
+static int purge_pointers(PyObject* list) {
+ return _process_list(list, true, NULL, NULL);
};
-static void invalidate_pointers(PyObject* py_self) {
+static int invalidate_pointers(PyObject* py_self) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, NULL, NULL);
+ return _process_list(list, false, NULL, NULL);
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::ExifData::iterator pos) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::ExifData::iterator pos) {
PyObject* list = private_store_get(py_self, "pointers");
if (list) {
Exiv2::ExifData::iterator end = pos;
end++;
- _process_list(list, false, &pos, &end);
+ return _process_list(list, false, &pos, &end);
}
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::ExifData::iterator beg,
- Exiv2::ExifData::iterator end) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::ExifData::iterator beg,
+ Exiv2::ExifData::iterator end) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, &beg, &end);
+ return _process_list(list, false, &beg, &end);
+ return 0;
};
static int store_pointer(PyObject* py_self, PyObject* py_ptr) {
PyObject* list = private_store_get(py_self, "pointers");
- if (list)
- purge_pointers(list);
+ if (list) {
+ if (purge_pointers(list) < 0)
+ return -1;
+ }
else {
list = PyList_New(0);
if (!list)
@@ -5877,7 +5899,8 @@ static PyObject* _delitem_Exiv2_ExifData(
if (pos == self->end())
return PyErr_Format(PyExc_KeyError, "'%s'", key);
#if 0x040401 >= 0x040400
- invalidate_pointers(py_self, pos);
+ if (invalidate_pointers(py_self, pos) < 0)
+ return NULL;
#endif
self->erase(pos);
return SWIG_Py_Void();
@@ -7044,6 +7067,7 @@ SWIGINTERN PyObject *_wrap_Exifdatum_pointer_value__SWIG_0(PyObject *self, Py_ss
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7094,6 +7118,7 @@ SWIGINTERN PyObject *_wrap_Exifdatum_pointer_value__SWIG_1(PyObject *self, Py_ss
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7469,6 +7494,7 @@ SWIGINTERN PyObject *_wrap_ExifData_iterator___iter__(PyObject *self, PyObject *
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7616,6 +7642,7 @@ SWIGINTERN PyObject *_wrap__getitem_Exiv2_ExifData(PyObject *self, PyObject *arg
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8697,6 +8724,7 @@ SWIGINTERN PyObject *_wrap_Exifdatum_value__SWIG_0(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8998,6 +9026,7 @@ SWIGINTERN PyObject *_wrap_Exifdatum_value__SWIG_1(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9454,6 +9483,7 @@ SWIGINTERN int _wrap_new_ExifThumb(PyObject *self, PyObject *args, PyObject *kwa
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", args)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10005,7 +10035,9 @@ SWIGINTERN PyObject *_wrap_ExifData_erase__SWIG_0(PyObject *self, Py_ssize_t nob
arg2 = argp2->_ptr();
{
- invalidate_pointers(self, arg2);
+ if (invalidate_pointers(self, arg2) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -10030,6 +10062,7 @@ SWIGINTERN PyObject *_wrap_ExifData_erase__SWIG_0(PyObject *self, Py_ssize_t nob
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10093,7 +10126,9 @@ SWIGINTERN PyObject *_wrap_ExifData_erase__SWIG_1(PyObject *self, Py_ssize_t nob
arg3 = argp3->_ptr();
{
- invalidate_pointers(self, arg2, arg3);
+ if (invalidate_pointers(self, arg2, arg3) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -10118,6 +10153,7 @@ SWIGINTERN PyObject *_wrap_ExifData_erase__SWIG_1(PyObject *self, Py_ssize_t nob
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10171,7 +10207,10 @@ SWIGINTERN PyObject *_wrap_ExifData_clear(PyObject *self, PyObject *args) {
(arg1)->clear();
resultobj = SWIG_Py_Void();
{
- invalidate_pointers(self);
+ if (invalidate_pointers(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
}
return resultobj;
fail:
@@ -10263,6 +10302,7 @@ SWIGINTERN PyObject *_wrap_ExifData_begin(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10300,6 +10340,7 @@ SWIGINTERN PyObject *_wrap_ExifData_end(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10358,6 +10399,7 @@ SWIGINTERN PyObject *_wrap_ExifData_findKey(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
diff --git a/src/swig-0_28_7/image_wrap.cxx b/src/swig-0_28_7/image_wrap.cxx
index a46c19ee..ad1267eb 100644
--- a/src/swig-0_28_7/image_wrap.cxx
+++ b/src/swig-0_28_7/image_wrap.cxx
@@ -5040,6 +5040,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -5070,9 +5083,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -5435,7 +5451,9 @@ SWIGINTERN PyObject *_wrap_delete_Image(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_delete_Image
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5468,7 +5486,9 @@ SWIGINTERN PyObject *_wrap_Image_readMetadata(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_readMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5505,7 +5525,9 @@ SWIGINTERN PyObject *_wrap_Image_writeMetadata(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_writeMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5558,7 +5580,9 @@ SWIGINTERN PyObject *_wrap_Image_setExifData(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::ExifData * >(argp2);
{
#ifdef RELEASE_VIEWS_Image_setExifData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5591,7 +5615,9 @@ SWIGINTERN PyObject *_wrap_Image_clearExifData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearExifData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5637,7 +5663,9 @@ SWIGINTERN PyObject *_wrap_Image_setIptcData(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::IptcData * >(argp2);
{
#ifdef RELEASE_VIEWS_Image_setIptcData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5670,7 +5698,9 @@ SWIGINTERN PyObject *_wrap_Image_clearIptcData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearIptcData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5695,7 +5725,7 @@ SWIGINTERN PyObject *_wrap_Image_setXmpPacket(PyObject *self, PyObject *args) {
std::string *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- int res2 = SWIG_OLDOBJ ;
+ int res2 = 0 ;
PyObject *swig_obj[2] ;
if (!args) SWIG_fail;
@@ -5705,20 +5735,19 @@ SWIGINTERN PyObject *_wrap_Image_setXmpPacket(PyObject *self, PyObject *args) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Image_setXmpPacket" "', argument " "1"" of type '" "Exiv2::Image *""'");
}
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
- {
- std::string *ptr = (std::string *)0;
- res2 = SWIG_AsPtr_std_string(swig_obj[0], &ptr);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Image_setXmpPacket" "', argument " "2"" of type '" "std::string const &""'");
- }
- if (!ptr) {
- SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "Image_setXmpPacket" "', argument " "2"" of type '" "std::string const &""'");
- }
- arg2 = ptr;
+ res2 = SWIG_AsPtr_std_string(swig_obj[0], &arg2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Image_setXmpPacket" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!arg2) {
+ SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "Image_setXmpPacket" "', argument " "2"" of type '" "std::string const &""'");
}
+ res2 = SWIG_AddTmpMask(res2);
{
#ifdef RELEASE_VIEWS_Image_setXmpPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5731,6 +5760,7 @@ SWIGINTERN PyObject *_wrap_Image_setXmpPacket(PyObject *self, PyObject *args) {
}
}
resultobj = SWIG_Py_Void();
+
if (SWIG_IsNewObj(res2)) delete arg2;
return resultobj;
fail:
@@ -5753,7 +5783,9 @@ SWIGINTERN PyObject *_wrap_Image_clearXmpPacket(PyObject *self, PyObject *args)
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearXmpPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5799,7 +5831,9 @@ SWIGINTERN PyObject *_wrap_Image_setXmpData(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::XmpData * >(argp2);
{
#ifdef RELEASE_VIEWS_Image_setXmpData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5832,7 +5866,9 @@ SWIGINTERN PyObject *_wrap_Image_clearXmpData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearXmpData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5880,7 +5916,9 @@ SWIGINTERN PyObject *_wrap_Image_setComment(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_Image_setComment
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5915,7 +5953,9 @@ SWIGINTERN PyObject *_wrap_Image_clearComment(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearComment
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5973,7 +6013,9 @@ SWIGINTERN PyObject *_wrap_Image_setIccProfile(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_Image_setIccProfile
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6006,7 +6048,9 @@ SWIGINTERN PyObject *_wrap_Image_clearIccProfile(PyObject *self, PyObject *args)
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearIccProfile
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6040,7 +6084,9 @@ SWIGINTERN PyObject *_wrap_Image_iccProfileDefined(PyObject *self, PyObject *arg
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_iccProfileDefined
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6074,7 +6120,9 @@ SWIGINTERN PyObject *_wrap_Image_iccProfile(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_iccProfile
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6090,6 +6138,7 @@ SWIGINTERN PyObject *_wrap_Image_iccProfile(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6126,7 +6175,9 @@ SWIGINTERN PyObject *_wrap_Image_setMetadata(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::Image * >(argp2);
{
#ifdef RELEASE_VIEWS_Image_setMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6159,7 +6210,9 @@ SWIGINTERN PyObject *_wrap_Image_clearMetadata(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6193,7 +6246,9 @@ SWIGINTERN PyObject *_wrap_Image_exifData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_exifData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6209,6 +6264,7 @@ SWIGINTERN PyObject *_wrap_Image_exifData(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6233,7 +6289,9 @@ SWIGINTERN PyObject *_wrap_Image_iptcData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_iptcData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6249,6 +6307,7 @@ SWIGINTERN PyObject *_wrap_Image_iptcData(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6273,7 +6332,9 @@ SWIGINTERN PyObject *_wrap_Image_xmpData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_xmpData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6289,6 +6350,7 @@ SWIGINTERN PyObject *_wrap_Image_xmpData(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6313,7 +6375,9 @@ SWIGINTERN PyObject *_wrap_Image_xmpPacket(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_xmpPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6354,7 +6418,9 @@ SWIGINTERN PyObject *_wrap_Image_writeXmpFromPacket__SWIG_0(PyObject *self, Py_s
arg2 = static_cast< bool >(val2);
{
#ifdef RELEASE_VIEWS_Image_writeXmpFromPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6402,7 +6468,9 @@ SWIGINTERN PyObject *_wrap_Image_setByteOrder(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_Image_setByteOrder
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6436,7 +6504,9 @@ SWIGINTERN PyObject *_wrap_Image_byteOrder(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_byteOrder
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6474,7 +6544,9 @@ SWIGINTERN PyObject *_wrap_Image_good(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_good
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6508,7 +6580,9 @@ SWIGINTERN PyObject *_wrap_Image_mimeType(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_mimeType
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6542,7 +6616,9 @@ SWIGINTERN PyObject *_wrap_Image_pixelWidth(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_pixelWidth
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6576,7 +6652,9 @@ SWIGINTERN PyObject *_wrap_Image_pixelHeight(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_pixelHeight
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6610,7 +6688,9 @@ SWIGINTERN PyObject *_wrap_Image_comment(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_comment
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6644,7 +6724,9 @@ SWIGINTERN PyObject *_wrap_Image_io(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_io
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6660,6 +6742,7 @@ SWIGINTERN PyObject *_wrap_Image_io(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6699,7 +6782,9 @@ SWIGINTERN PyObject *_wrap_Image_checkMode(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_Image_checkMode
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6752,7 +6837,9 @@ SWIGINTERN PyObject *_wrap_Image_supportsMetadata(PyObject *self, PyObject *args
}
{
#ifdef RELEASE_VIEWS_Image_supportsMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6787,7 +6874,9 @@ SWIGINTERN PyObject *_wrap_Image_writeXmpFromPacket__SWIG_1(PyObject *self, Py_s
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_writeXmpFromPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6871,7 +6960,9 @@ SWIGINTERN PyObject *_wrap_Image_setTypeSupported(PyObject *self, PyObject *args
arg3 = static_cast< uint16_t >(val3);
{
#ifdef RELEASE_VIEWS_Image_setTypeSupported
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6905,7 +6996,9 @@ SWIGINTERN PyObject *_wrap_Image_imageType(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_imageType
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6947,7 +7040,9 @@ SWIGINTERN PyObject *_wrap_Image_data(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_data
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6985,7 +7080,9 @@ SWIGINTERN PyObject *_wrap_Image__view_deleted_cb(PyObject *self, PyObject *args
arg2 = swig_obj[0];
{
#ifdef RELEASE_VIEWS_Image__view_deleted_cb
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
diff --git a/src/swig-0_28_7/iptc_wrap.cxx b/src/swig-0_28_7/iptc_wrap.cxx
index cf4f9dcf..ee9b6eee 100644
--- a/src/swig-0_28_7/iptc_wrap.cxx
+++ b/src/swig-0_28_7/iptc_wrap.cxx
@@ -5785,14 +5785,30 @@ static PyObject* set_value_from_py(Exiv2::Iptcdatum* datum,
};
-static void _process_list(PyObject* list, bool purge_only,
- Exiv2::IptcData::iterator* beg,
- Exiv2::IptcData::iterator* end) {
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
+static int _process_list(PyObject* list, bool purge_only,
+ Exiv2::IptcData::iterator* beg,
+ Exiv2::IptcData::iterator* end) {
PyObject* py_ptr = NULL;
Iptcdatum_pointer* cpp_ptr = NULL;
for (Py_ssize_t idx = PyList_Size(list); idx > 0; idx--) {
- py_ptr = PyWeakref_GetObject(PyList_GetItem(list, idx-1));
- if (py_ptr == Py_None)
+ if (PyWeakref_GetRef(PyList_GetItem(list, idx-1), &py_ptr) < 0)
+ return -1;
+ if (py_ptr)
+ Py_DECREF(py_ptr);
+ else
goto forget;
if (purge_only)
continue;
@@ -5811,35 +5827,41 @@ static void _process_list(PyObject* list, bool purge_only,
PyList_SetSlice(list, idx-1, idx, NULL);
continue;
}
+ return 0;
};
-static void purge_pointers(PyObject* list) {
- _process_list(list, true, NULL, NULL);
+static int purge_pointers(PyObject* list) {
+ return _process_list(list, true, NULL, NULL);
};
-static void invalidate_pointers(PyObject* py_self) {
+static int invalidate_pointers(PyObject* py_self) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, NULL, NULL);
+ return _process_list(list, false, NULL, NULL);
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::IptcData::iterator pos) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::IptcData::iterator pos) {
PyObject* list = private_store_get(py_self, "pointers");
if (list) {
Exiv2::IptcData::iterator end = pos;
end++;
- _process_list(list, false, &pos, &end);
+ return _process_list(list, false, &pos, &end);
}
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::IptcData::iterator beg,
- Exiv2::IptcData::iterator end) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::IptcData::iterator beg,
+ Exiv2::IptcData::iterator end) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, &beg, &end);
+ return _process_list(list, false, &beg, &end);
+ return 0;
};
static int store_pointer(PyObject* py_self, PyObject* py_ptr) {
PyObject* list = private_store_get(py_self, "pointers");
- if (list)
- purge_pointers(list);
+ if (list) {
+ if (purge_pointers(list) < 0)
+ return -1;
+ }
else {
list = PyList_New(0);
if (!list)
@@ -5869,7 +5891,8 @@ static PyObject* _delitem_Exiv2_IptcData(
if (pos == self->end())
return PyErr_Format(PyExc_KeyError, "'%s'", key);
#if 0x040401 >= 0x040400
- invalidate_pointers(py_self, pos);
+ if (invalidate_pointers(py_self, pos) < 0)
+ return NULL;
#endif
self->erase(pos);
return SWIG_Py_Void();
@@ -6909,6 +6932,7 @@ SWIGINTERN PyObject *_wrap_Iptcdatum_pointer_value__SWIG_0(PyObject *self, Py_ss
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6959,6 +6983,7 @@ SWIGINTERN PyObject *_wrap_Iptcdatum_pointer_value__SWIG_1(PyObject *self, Py_ss
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7273,6 +7298,7 @@ SWIGINTERN PyObject *_wrap_IptcData_iterator___iter__(PyObject *self, PyObject *
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7420,6 +7446,7 @@ SWIGINTERN PyObject *_wrap__getitem_Exiv2_IptcData(PyObject *self, PyObject *arg
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8447,6 +8474,7 @@ SWIGINTERN PyObject *_wrap_Iptcdatum_value__SWIG_0(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8687,6 +8715,7 @@ SWIGINTERN PyObject *_wrap_Iptcdatum_value__SWIG_1(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9060,7 +9089,9 @@ SWIGINTERN PyObject *_wrap_IptcData_erase(PyObject *self, PyObject *args) {
arg2 = argp2->_ptr();
{
- invalidate_pointers(self, arg2);
+ if (invalidate_pointers(self, arg2) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -9085,6 +9116,7 @@ SWIGINTERN PyObject *_wrap_IptcData_erase(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9109,7 +9141,10 @@ SWIGINTERN PyObject *_wrap_IptcData_clear(PyObject *self, PyObject *args) {
(arg1)->clear();
resultobj = SWIG_Py_Void();
{
- invalidate_pointers(self);
+ if (invalidate_pointers(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
}
return resultobj;
fail:
@@ -9201,6 +9236,7 @@ SWIGINTERN PyObject *_wrap_IptcData_begin(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9238,6 +9274,7 @@ SWIGINTERN PyObject *_wrap_IptcData_end(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9296,6 +9333,7 @@ SWIGINTERN PyObject *_wrap_IptcData_findKey(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9357,6 +9395,7 @@ SWIGINTERN PyObject *_wrap_IptcData_findId__SWIG_0(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9410,6 +9449,7 @@ SWIGINTERN PyObject *_wrap_IptcData_findId__SWIG_1(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
diff --git a/src/swig-0_28_7/metadatum_wrap.cxx b/src/swig-0_28_7/metadatum_wrap.cxx
index 4e1b3c51..97d9a43e 100644
--- a/src/swig-0_28_7/metadatum_wrap.cxx
+++ b/src/swig-0_28_7/metadatum_wrap.cxx
@@ -4715,16 +4715,30 @@ static void _set_python_exception() {
static PyObject* _str_Exiv2_Metadatum(PyObject* py_self) {
Exiv2::Metadatum* self = NULL;
+ std::string result;
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__Metadatum, 0);
- std::string result = metadatum_str(self);
+ try {
+ result = metadatum_str(self);
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ return NULL;
+ }
return SWIG_FromCharPtrAndSize(result.data(), result.size());
};
static PyObject* _str_MetadatumPointerBase(PyObject* py_self) {
MetadatumPointerBase* self = NULL;
+ std::string result;
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_MetadatumPointerBase, 0);
- std::string result = self->__str__();
+ try {
+ result = self->__str__();
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ return NULL;
+ }
return SWIG_FromCharPtrAndSize(result.data(), result.size());
};
@@ -6910,6 +6924,7 @@ SWIGINTERN PyObject *_wrap_Metadatum_value(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
diff --git a/src/swig-0_28_7/preview_wrap.cxx b/src/swig-0_28_7/preview_wrap.cxx
index a31ea62c..84c743e5 100644
--- a/src/swig-0_28_7/preview_wrap.cxx
+++ b/src/swig-0_28_7/preview_wrap.cxx
@@ -5983,6 +5983,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -6013,9 +6026,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -6960,6 +6976,7 @@ SWIGINTERN int _wrap_new_PreviewManager(PyObject *self, PyObject *args, PyObject
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", args)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
diff --git a/src/swig-0_28_7/types_wrap.cxx b/src/swig-0_28_7/types_wrap.cxx
index c9eb2fc3..d25a78d4 100644
--- a/src/swig-0_28_7/types_wrap.cxx
+++ b/src/swig-0_28_7/types_wrap.cxx
@@ -5278,6 +5278,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -5308,9 +5321,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -6294,7 +6310,10 @@ SWIGINTERN PyObject *_wrap_DataBuf_alloc(PyObject *self, PyObject *args) {
}
resultobj = SWIG_Py_Void();
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -6335,7 +6354,10 @@ SWIGINTERN PyObject *_wrap_DataBuf_resize(PyObject *self, PyObject *args) {
}
resultobj = SWIG_Py_Void();
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -6358,7 +6380,10 @@ SWIGINTERN PyObject *_wrap_DataBuf_reset(PyObject *self, PyObject *args) {
(arg1)->reset();
resultobj = SWIG_Py_Void();
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
diff --git a/src/swig-0_28_7/value_wrap.cxx b/src/swig-0_28_7/value_wrap.cxx
index 5f62815d..8497abad 100644
--- a/src/swig-0_28_7/value_wrap.cxx
+++ b/src/swig-0_28_7/value_wrap.cxx
@@ -5763,8 +5763,15 @@ namespace swig {
static PyObject* _str_Exiv2_Value(PyObject* py_self) {
Exiv2::Value* self = NULL;
+ std::string result;
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__Value, 0);
- std::string result = self->toString();
+ try {
+ result = self->toString();
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ return NULL;
+ }
return SWIG_FromCharPtrAndSize(result.data(), result.size());
};
@@ -6711,6 +6718,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -6741,9 +6761,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -9756,7 +9779,10 @@ SWIGINTERN PyObject *_wrap_StringValueBase_read__SWIG_0(PyObject *self, Py_ssize
resultobj = SWIG_From_int(static_cast< int >(result));
if (SWIG_IsNewObj(res2)) delete arg2;
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -9829,7 +9855,10 @@ SWIGINTERN PyObject *_wrap_StringValueBase_read__SWIG_1(PyObject *self, Py_ssize
Py_XDECREF(_global_view);
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -11992,7 +12021,10 @@ SWIGINTERN PyObject *_wrap_XmpTextValue_read__SWIG_0(PyObject *self, Py_ssize_t
Py_XDECREF(_global_view);
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -12041,7 +12073,10 @@ SWIGINTERN PyObject *_wrap_XmpTextValue_read__SWIG_1(PyObject *self, Py_ssize_t
resultobj = SWIG_From_int(static_cast< int >(result));
if (SWIG_IsNewObj(res2)) delete arg2;
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
diff --git a/src/swig-0_28_7/xmp_wrap.cxx b/src/swig-0_28_7/xmp_wrap.cxx
index afa6c52f..c1d29a9a 100644
--- a/src/swig-0_28_7/xmp_wrap.cxx
+++ b/src/swig-0_28_7/xmp_wrap.cxx
@@ -4398,15 +4398,16 @@ SwigPyBuiltin_iternextfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
#define SWIGTYPE_p_std__ostream swig_types[59]
#define SWIGTYPE_p_std__pairT_int32_t_int32_t_t swig_types[60]
#define SWIGTYPE_p_std__pairT_uint32_t_uint32_t_t swig_types[61]
-#define SWIGTYPE_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t swig_types[62]
-#define SWIGTYPE_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator swig_types[63]
-#define SWIGTYPE_p_unsigned_char swig_types[64]
-#define SWIGTYPE_p_unsigned_int swig_types[65]
-#define SWIGTYPE_p_unsigned_long_long swig_types[66]
-#define SWIGTYPE_p_unsigned_short swig_types[67]
-#define SWIGTYPE_p_value_type swig_types[68]
-static swig_type_info *swig_types[70];
-static swig_module_info swig_module = {swig_types, 69, 0, 0, 0, 0};
+#define SWIGTYPE_p_std__string swig_types[62]
+#define SWIGTYPE_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t swig_types[63]
+#define SWIGTYPE_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator swig_types[64]
+#define SWIGTYPE_p_unsigned_char swig_types[65]
+#define SWIGTYPE_p_unsigned_int swig_types[66]
+#define SWIGTYPE_p_unsigned_long_long swig_types[67]
+#define SWIGTYPE_p_unsigned_short swig_types[68]
+#define SWIGTYPE_p_value_type swig_types[69]
+static swig_type_info *swig_types[71];
+static swig_module_info swig_module = {swig_types, 70, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -5788,14 +5789,30 @@ static PyObject* set_value_from_py(Exiv2::Xmpdatum* datum,
};
-static void _process_list(PyObject* list, bool purge_only,
- Exiv2::XmpData::iterator* beg,
- Exiv2::XmpData::iterator* end) {
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
+static int _process_list(PyObject* list, bool purge_only,
+ Exiv2::XmpData::iterator* beg,
+ Exiv2::XmpData::iterator* end) {
PyObject* py_ptr = NULL;
Xmpdatum_pointer* cpp_ptr = NULL;
for (Py_ssize_t idx = PyList_Size(list); idx > 0; idx--) {
- py_ptr = PyWeakref_GetObject(PyList_GetItem(list, idx-1));
- if (py_ptr == Py_None)
+ if (PyWeakref_GetRef(PyList_GetItem(list, idx-1), &py_ptr) < 0)
+ return -1;
+ if (py_ptr)
+ Py_DECREF(py_ptr);
+ else
goto forget;
if (purge_only)
continue;
@@ -5814,35 +5831,41 @@ static void _process_list(PyObject* list, bool purge_only,
PyList_SetSlice(list, idx-1, idx, NULL);
continue;
}
+ return 0;
};
-static void purge_pointers(PyObject* list) {
- _process_list(list, true, NULL, NULL);
+static int purge_pointers(PyObject* list) {
+ return _process_list(list, true, NULL, NULL);
};
-static void invalidate_pointers(PyObject* py_self) {
+static int invalidate_pointers(PyObject* py_self) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, NULL, NULL);
+ return _process_list(list, false, NULL, NULL);
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::XmpData::iterator pos) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::XmpData::iterator pos) {
PyObject* list = private_store_get(py_self, "pointers");
if (list) {
Exiv2::XmpData::iterator end = pos;
end++;
- _process_list(list, false, &pos, &end);
+ return _process_list(list, false, &pos, &end);
}
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::XmpData::iterator beg,
- Exiv2::XmpData::iterator end) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::XmpData::iterator beg,
+ Exiv2::XmpData::iterator end) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, &beg, &end);
+ return _process_list(list, false, &beg, &end);
+ return 0;
};
static int store_pointer(PyObject* py_self, PyObject* py_ptr) {
PyObject* list = private_store_get(py_self, "pointers");
- if (list)
- purge_pointers(list);
+ if (list) {
+ if (purge_pointers(list) < 0)
+ return -1;
+ }
else {
list = PyList_New(0);
if (!list)
@@ -5872,7 +5895,8 @@ static PyObject* _delitem_Exiv2_XmpData(
if (pos == self->end())
return PyErr_Format(PyExc_KeyError, "'%s'", key);
#if 0x040401 >= 0x040400
- invalidate_pointers(py_self, pos);
+ if (invalidate_pointers(py_self, pos) < 0)
+ return NULL;
#endif
self->erase(pos);
return SWIG_Py_Void();
@@ -5911,6 +5935,52 @@ static int _contains_Exiv2_XmpData(PyObject* py_self, PyObject* py_key) {
return self->findKey(Exiv2::XmpKey(key)) != self->end() ? 1 : 0;
};
+
+static PyObject* Python_Exiv2_XmpParser_XmpFormatFlags = NULL;
+
+
+static PyObject* Python_Exiv2_extras_create_enum = NULL;
+
+
+
+
+// Convert enum names & values to a Python list
+static PyObject* _get_enum_data(const char* name, ...) {
+ PyObject* py_obj = NULL;
+ PyObject* members = PyList_New(0);
+ va_list args;
+ va_start(args, name);
+ char* label = va_arg(args, char*);
+ while (label) {
+ py_obj = Py_BuildValue("(si)", label, va_arg(args, int));
+ PyList_Append(members, py_obj);
+ Py_DECREF(py_obj);
+ label = va_arg(args, char*);
+ }
+ va_end(args);
+ return members;
+};
+// Call Python to create an enum from list of names & values
+static PyObject* _create_enum(const char* name, const char* alias_strip,
+ PyObject* members) {
+ return PyObject_CallFunction(
+ Python_Exiv2_extras_create_enum, "(sssN)",
+ SWIG_name, name, alias_strip, members);
+};
+
+
+static PyObject* _get_enum_data_Exiv2_XmpParser_XmpFormatFlags() {
+ return _get_enum_data("Exiv2::XmpParser::XmpFormatFlags",
+ "omitPacketWrapper", Exiv2::XmpParser::omitPacketWrapper,
+ "readOnlyPacket", Exiv2::XmpParser::readOnlyPacket,
+ "useCompactFormat", Exiv2::XmpParser::useCompactFormat,
+ "includeThumbnailPad", Exiv2::XmpParser::includeThumbnailPad,
+ "exactPacketLength", Exiv2::XmpParser::exactPacketLength,
+ "writeAliasComments", Exiv2::XmpParser::writeAliasComments,
+ "omitAllFormatting", Exiv2::XmpParser::omitAllFormatting,
+ NULL);
+};
+
SWIGINTERN bool Exiv2_Xmpdatum_operator_Se__Se_(Exiv2::Xmpdatum const *self,Exiv2::Xmpdatum const &other){
return &other == self;
}
@@ -5979,6 +6049,38 @@ SWIG_AsPtr_std_string (PyObject * obj, std::string **val)
return SWIG_ERROR;
}
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_short (PyObject * obj, unsigned short *val)
+{
+ unsigned long v;
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v > USHRT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val) *val = static_cast< unsigned short >(v);
+ }
+ }
+ return res;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
+{
+ unsigned long v;
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v > UINT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val) *val = static_cast< unsigned int >(v);
+ }
+ }
+ return res;
+}
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -6878,6 +6980,7 @@ SWIGINTERN PyObject *_wrap_Xmpdatum_pointer_value__SWIG_0(PyObject *self, Py_ssi
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6928,6 +7031,7 @@ SWIGINTERN PyObject *_wrap_Xmpdatum_pointer_value__SWIG_1(PyObject *self, Py_ssi
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7242,6 +7346,7 @@ SWIGINTERN PyObject *_wrap_XmpData_iterator___iter__(PyObject *self, PyObject *a
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7389,6 +7494,7 @@ SWIGINTERN PyObject *_wrap__getitem_Exiv2_XmpData(PyObject *self, PyObject *args
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8357,6 +8463,7 @@ SWIGINTERN PyObject *_wrap_Xmpdatum_value__SWIG_0(PyObject *self, Py_ssize_t nob
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8597,6 +8704,7 @@ SWIGINTERN PyObject *_wrap_Xmpdatum_value__SWIG_1(PyObject *self, Py_ssize_t nob
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8992,7 +9100,9 @@ SWIGINTERN PyObject *_wrap_XmpData_erase(PyObject *self, PyObject *args) {
arg2 = argp2->_ptr();
{
- invalidate_pointers(self, arg2);
+ if (invalidate_pointers(self, arg2) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -9017,6 +9127,7 @@ SWIGINTERN PyObject *_wrap_XmpData_erase(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9063,7 +9174,9 @@ SWIGINTERN PyObject *_wrap_XmpData_eraseFamily(PyObject *self, PyObject *args) {
arg2 = &it2;
}
{
- invalidate_pointers(self, *arg2, arg1->end());
+ if (invalidate_pointers(self, *arg2, arg1->end()) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -9096,7 +9209,10 @@ SWIGINTERN PyObject *_wrap_XmpData_clear(PyObject *self, PyObject *args) {
(arg1)->clear();
resultobj = SWIG_Py_Void();
{
- invalidate_pointers(self);
+ if (invalidate_pointers(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
}
return resultobj;
fail:
@@ -9160,6 +9276,7 @@ SWIGINTERN PyObject *_wrap_XmpData_begin(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9197,6 +9314,7 @@ SWIGINTERN PyObject *_wrap_XmpData_end(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9255,6 +9373,7 @@ SWIGINTERN PyObject *_wrap_XmpData_findKey(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9504,6 +9623,73 @@ SWIGPY_LENFUNC_CLOSURE(_wrap_XmpData_count) /* defines _wrap_XmpData_count_lenfu
SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_XmpData) /* defines _wrap_delete_XmpData_destructor_closure */
+SWIGINTERN PyObject *_wrap_XmpParser_encode(PyObject *self, PyObject *args) {
+ PyObject *resultobj = 0;
+ std::string *arg1 = 0 ;
+ Exiv2::XmpData *arg2 = 0 ;
+ uint16_t arg3 ;
+ uint32_t arg4 ;
+ std::string temp1 ;
+ int res1 = SWIG_TMPOBJ ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ unsigned short val3 ;
+ int ecode3 = 0 ;
+ unsigned int val4 ;
+ int ecode4 = 0 ;
+ PyObject *swig_obj[3] ;
+ int result;
+
+
+ arg3 = Exiv2::XmpParser::XmpFormatFlags::useCompactFormat;
+
+ arg4 = 0;
+ arg1 = &temp1;
+ if (!SWIG_Python_UnpackTuple(args, "XmpParser_encode", 1, 3, swig_obj)) SWIG_fail;
+ res2 = SWIG_ConvertPtr(swig_obj[0], &argp2, SWIGTYPE_p_Exiv2__XmpData, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "XmpParser_encode" "', argument " "2"" of type '" "Exiv2::XmpData const &""'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "XmpParser_encode" "', argument " "2"" of type '" "Exiv2::XmpData const &""'");
+ }
+ arg2 = reinterpret_cast< Exiv2::XmpData * >(argp2);
+ if (swig_obj[1]) {
+ ecode3 = SWIG_AsVal_unsigned_SS_short(swig_obj[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "XmpParser_encode" "', argument " "3"" of type '" "uint16_t""'");
+ }
+ arg3 = static_cast< uint16_t >(val3);
+ }
+ if (swig_obj[2]) {
+ ecode4 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "XmpParser_encode" "', argument " "4"" of type '" "uint32_t""'");
+ }
+ arg4 = static_cast< uint32_t >(val4);
+ }
+ {
+ try {
+ result = (int)Exiv2::XmpParser::encode(*arg1,(Exiv2::XmpData const &)*arg2,arg3,arg4);
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ SWIG_fail;
+ }
+ }
+ resultobj = SWIG_From_int(static_cast< int >(result));
+ if (SWIG_IsTmpObj(res1)) {
+ resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_std_string((*arg1)), 0);
+ } else {
+ int new_flags = SWIG_IsNewObj(res1) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
+ resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg1), SWIGTYPE_p_std__string, new_flags), 0);
+ }
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_XmpParser_initialize__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
PyObject *resultobj = 0;
Exiv2::XmpParser::XmpLockFct arg1 = 0 ;
@@ -11367,6 +11553,31 @@ SwigPyBuiltin__Exiv2__XmpParser_richcompare(PyObject *self, PyObject *other, int
}
SWIGINTERN PyMethodDef SwigPyBuiltin__Exiv2__XmpParser_methods[] = {
+ { "encode", (PyCFunction)(void(*)(void))_wrap_XmpParser_encode, METH_STATIC|METH_VARARGS, "\n"
+ "Encode (serialize) XMP metadata from *xmpData* into a\n"
+ " string xmpPacket. The XMP packet returned in the string\n"
+ " follows the XMP specification. This method only modifies\n"
+ " *xmpPacket* if the operations succeeds (return code 0).\n"
+ "\n"
+ ":type xmpPacket: str\n"
+ ":param xmpPacket: Reference to a string to hold the encoded XMP\n"
+ " packet.\n"
+ ":type xmpData: :py:class:`XmpData`\n"
+ ":param xmpData: XMP properties to encode.\n"
+ ":type formatFlags: int, optional\n"
+ ":param formatFlags: Flags that control the format of the XMP packet,\n"
+ " see enum XmpFormatFlags.\n"
+ ":type padding: int, optional\n"
+ ":param padding: Padding length.\n"
+ ":rtype: int\n"
+ ":return: 0 if successful;\n"
+ "\n"
+ " 1 if XMP support has not been compiled-in;\n"
+ "\n"
+ " 2 if the XMP toolkit failed to initialize;\n"
+ "\n"
+ " 3 if the XMP toolkit failed and raised an XMP_Error\n"
+ "" },
{ "initialize", (PyCFunction)(void(*)(void))_wrap_XmpParser_initialize, METH_STATIC|METH_VARARGS, "\n"
"Initialize the XMP Toolkit.\n"
"\n"
@@ -11865,6 +12076,7 @@ static swig_type_info _swigt__p_size_type = {"_p_size_type", "size_type *", 0, 0
static swig_type_info _swigt__p_std__ostream = {"_p_std__ostream", "std::ostream *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__pairT_int32_t_int32_t_t = {"_p_std__pairT_int32_t_int32_t_t", "Exiv2::Rational *|std::pair< int,int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__pairT_uint32_t_uint32_t_t = {"_p_std__pairT_uint32_t_uint32_t_t", "Exiv2::URational *|std::pair< unsigned int,unsigned int > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__string = {"_p_std__string", "std::string *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t = {"_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t", "Exiv2::XmpMetadata *|std::vector< Exiv2::Xmpdatum,std::allocator< Exiv2::Xmpdatum > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator = {"_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator", "Exiv2::XmpData::iterator *|std::vector< Exiv2::Xmpdatum,std::allocator< Exiv2::Xmpdatum > >::iterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "Exiv2::byte *|uint8_t *|uint_fast8_t *|uint_least8_t *|unsigned char *", 0, 0, (void*)0, 0};
@@ -11936,6 +12148,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_std__ostream,
&_swigt__p_std__pairT_int32_t_int32_t_t,
&_swigt__p_std__pairT_uint32_t_uint32_t_t,
+ &_swigt__p_std__string,
&_swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t,
&_swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator,
&_swigt__p_unsigned_char,
@@ -12007,6 +12220,7 @@ static swig_cast_info _swigc__p_size_type[] = { {&_swigt__p_size_type, 0, 0, 0}
static swig_cast_info _swigc__p_std__ostream[] = { {&_swigt__p_std__ostream, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__pairT_int32_t_int32_t_t[] = { {&_swigt__p_std__pairT_int32_t_int32_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__pairT_uint32_t_uint32_t_t[] = { {&_swigt__p_std__pairT_uint32_t_uint32_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__string[] = { {&_swigt__p_std__string, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t[] = { {&_swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator[] = { {&_swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
@@ -12078,6 +12292,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_std__ostream,
_swigc__p_std__pairT_int32_t_int32_t_t,
_swigc__p_std__pairT_uint32_t_uint32_t_t,
+ _swigc__p_std__string,
_swigc__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t,
_swigc__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator,
_swigc__p_unsigned_char,
@@ -12914,6 +13129,19 @@ SWIGINTERN int SWIG_mod_exec(PyObject *m) {
SwigPyBuiltin_AddPublicSymbol(public_interface, "Xmpdatum_reference");
d = md;
+ Python_Exiv2_extras_create_enum = import_from_python("exiv2.extras","_create_enum");
+ if (!Python_Exiv2_extras_create_enum)
+ return INIT_ERROR_RETURN;
+
+
+ Python_Exiv2_XmpParser_XmpFormatFlags = _create_enum(
+ "Exiv2::XmpParser::XmpFormatFlags","", _get_enum_data_Exiv2_XmpParser_XmpFormatFlags());
+ if (!Python_Exiv2_XmpParser_XmpFormatFlags)
+ return INIT_ERROR_RETURN;
+ // SWIG_Python_SetConstant will decref PyEnum object
+ Py_INCREF(Python_Exiv2_XmpParser_XmpFormatFlags);
+
+
/* type 'Exiv2::Xmpdatum' */
d = PyDict_New();
builtin_base_count = 0;
@@ -12961,13 +13189,7 @@ SWIGINTERN int SWIG_mod_exec(PyObject *m) {
/* type 'Exiv2::XmpParser' */
d = PyDict_New();
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "omitPacketWrapper",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::omitPacketWrapper)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "readOnlyPacket",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::readOnlyPacket)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "useCompactFormat",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::useCompactFormat)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "includeThumbnailPad",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::includeThumbnailPad)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "exactPacketLength",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::exactPacketLength)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "writeAliasComments",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::writeAliasComments)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "omitAllFormatting",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::omitAllFormatting)));
+ SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XmpFormatFlags",Python_Exiv2_XmpParser_XmpFormatFlags);
builtin_base_count = 0;
builtin_bases[builtin_base_count] = NULL;
PyDict_SetItemString(d, "this", this_descr);
diff --git a/src/swig-0_28_8/__init__.py b/src/swig-0_28_8/__init__.py
index c6d5b85f..592af026 100644
--- a/src/swig-0_28_8/__init__.py
+++ b/src/swig-0_28_8/__init__.py
@@ -10,9 +10,9 @@
os.environ['PATH'] = _dir + ';' + os.environ['PATH']
#: python-exiv2 version as a string
-__version__ = "0.18.1"
+__version__ = "0.19.0"
#: python-exiv2 version as a tuple of ints
-__version_tuple__ = tuple((0, 18, 1))
+__version_tuple__ = tuple((0, 19, 0))
from exiv2.extras import Exiv2Error
__all__ = ["Exiv2Error"]
diff --git a/src/swig-0_28_8/_enum_data.py b/src/swig-0_28_8/_enum_data.py
index bff54c24..eebc919d 100644
--- a/src/swig-0_28_8/_enum_data.py
+++ b/src/swig-0_28_8/_enum_data.py
@@ -103,6 +103,49 @@
'xmpText': 'XMP text type. '}},
'Exiv2::XmpCategory': {'doc': 'Category of an XMP property. ',
'values': {}},
+ 'Exiv2::XmpParser::XmpFormatFlags': {'doc': 'Options to control the '
+ 'format of the serialized '
+ 'XMP packet. ',
+ 'values': {'exactPacketLength': 'The '
+ 'padding '
+ 'parameter '
+ 'is '
+ 'the '
+ 'overall '
+ 'packet '
+ 'length. ',
+ 'includeThumbnailPad': 'Include '
+ 'a '
+ 'padding '
+ 'allowance '
+ 'for '
+ 'a '
+ 'thumbnail '
+ 'image. ',
+ 'omitAllFormatting': 'Omit '
+ 'all '
+ 'formatting '
+ 'whitespace. ',
+ 'omitPacketWrapper': 'Omit '
+ 'the '
+ 'XML '
+ 'packet '
+ 'wrapper. ',
+ 'readOnlyPacket': 'Default '
+ 'is a '
+ 'writeable '
+ 'packet. ',
+ 'useCompactFormat': 'Use '
+ 'a '
+ 'compact '
+ 'form '
+ 'of '
+ 'RDF. ',
+ 'writeAliasComments': 'Show '
+ 'aliases '
+ 'as '
+ 'XML '
+ 'comments. '}},
'Exiv2::XmpValue::XmpArrayType': {'doc': 'XMP array types. ',
'values': {}},
'Exiv2::XmpValue::XmpStruct': {'doc': 'XMP structure indicator. ',
diff --git a/src/swig-0_28_8/basicio_wrap.cxx b/src/swig-0_28_8/basicio_wrap.cxx
index 2b95ee76..7e44d76f 100644
--- a/src/swig-0_28_8/basicio_wrap.cxx
+++ b/src/swig-0_28_8/basicio_wrap.cxx
@@ -4834,6 +4834,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -4864,9 +4877,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -5316,7 +5332,9 @@ SWIGINTERN PyObject *_wrap_delete_BasicIo(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_delete_BasicIo
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5350,7 +5368,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_open(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_open
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5388,7 +5408,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_close(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_close
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5444,7 +5466,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_write__SWIG_0(PyObject *self, Py_ssize_t nobj
}
{
#ifdef RELEASE_VIEWS_BasicIo_write
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5500,7 +5524,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_write__SWIG_1(PyObject *self, Py_ssize_t nobj
arg2 = reinterpret_cast< Exiv2::BasicIo * >(argp2);
{
#ifdef RELEASE_VIEWS_BasicIo_write
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5585,7 +5611,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_putb(PyObject *self, PyObject *args) {
arg2 = static_cast< Exiv2::byte >(val2);
{
#ifdef RELEASE_VIEWS_BasicIo_putb
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5628,7 +5656,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_read__SWIG_0(PyObject *self, Py_ssize_t nobjs
arg2 = static_cast< size_t >(val2);
{
#ifdef RELEASE_VIEWS_BasicIo_read
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5684,7 +5714,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_read__SWIG_1(PyObject *self, Py_ssize_t nobjs
}
{
#ifdef RELEASE_VIEWS_BasicIo_read
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5805,7 +5837,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_readOrThrow(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_readOrThrow
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5850,7 +5884,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_getb(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_getb
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5897,7 +5933,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_transfer(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::BasicIo * >(argp2);
{
#ifdef RELEASE_VIEWS_BasicIo_transfer
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5958,7 +5996,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_seek(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_seek
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6039,7 +6079,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_seekOrThrow(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_seekOrThrow
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6088,7 +6130,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_mmap(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_mmap
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6133,7 +6177,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_munmap(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_munmap
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6171,7 +6217,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_tell(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_tell
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6206,7 +6254,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_size(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_size
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6240,7 +6290,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_isopen(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_isopen
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
result = (bool)((Exiv2::BasicIo const *)arg1)->isopen();
@@ -6266,7 +6318,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_error(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_error
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
result = (int)((Exiv2::BasicIo const *)arg1)->error();
@@ -6292,7 +6346,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_eof(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_eof
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6327,7 +6383,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_path(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_path
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
result = (std::string *) &((Exiv2::BasicIo const *)arg1)->path();
@@ -6364,7 +6422,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_ioType(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::BasicIo * >(argp1);
{
#ifdef RELEASE_VIEWS_BasicIo_ioType
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
result = (char *)Exiv2_BasicIo_ioType(arg1);
@@ -6404,7 +6464,9 @@ SWIGINTERN PyObject *_wrap_BasicIo_data(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_BasicIo_data
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6452,7 +6514,9 @@ SWIGINTERN PyObject *_wrap_BasicIo__view_deleted_cb(PyObject *self, PyObject *ar
arg2 = swig_obj[0];
{
#ifdef RELEASE_VIEWS_BasicIo__view_deleted_cb
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
diff --git a/src/swig-0_28_8/exif_wrap.cxx b/src/swig-0_28_8/exif_wrap.cxx
index cce1eb3d..2974d9fa 100644
--- a/src/swig-0_28_8/exif_wrap.cxx
+++ b/src/swig-0_28_8/exif_wrap.cxx
@@ -5793,14 +5793,30 @@ static PyObject* set_value_from_py(Exiv2::Exifdatum* datum,
};
-static void _process_list(PyObject* list, bool purge_only,
- Exiv2::ExifData::iterator* beg,
- Exiv2::ExifData::iterator* end) {
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
+static int _process_list(PyObject* list, bool purge_only,
+ Exiv2::ExifData::iterator* beg,
+ Exiv2::ExifData::iterator* end) {
PyObject* py_ptr = NULL;
Exifdatum_pointer* cpp_ptr = NULL;
for (Py_ssize_t idx = PyList_Size(list); idx > 0; idx--) {
- py_ptr = PyWeakref_GetObject(PyList_GetItem(list, idx-1));
- if (py_ptr == Py_None)
+ if (PyWeakref_GetRef(PyList_GetItem(list, idx-1), &py_ptr) < 0)
+ return -1;
+ if (py_ptr)
+ Py_DECREF(py_ptr);
+ else
goto forget;
if (purge_only)
continue;
@@ -5819,35 +5835,41 @@ static void _process_list(PyObject* list, bool purge_only,
PyList_SetSlice(list, idx-1, idx, NULL);
continue;
}
+ return 0;
};
-static void purge_pointers(PyObject* list) {
- _process_list(list, true, NULL, NULL);
+static int purge_pointers(PyObject* list) {
+ return _process_list(list, true, NULL, NULL);
};
-static void invalidate_pointers(PyObject* py_self) {
+static int invalidate_pointers(PyObject* py_self) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, NULL, NULL);
+ return _process_list(list, false, NULL, NULL);
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::ExifData::iterator pos) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::ExifData::iterator pos) {
PyObject* list = private_store_get(py_self, "pointers");
if (list) {
Exiv2::ExifData::iterator end = pos;
end++;
- _process_list(list, false, &pos, &end);
+ return _process_list(list, false, &pos, &end);
}
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::ExifData::iterator beg,
- Exiv2::ExifData::iterator end) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::ExifData::iterator beg,
+ Exiv2::ExifData::iterator end) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, &beg, &end);
+ return _process_list(list, false, &beg, &end);
+ return 0;
};
static int store_pointer(PyObject* py_self, PyObject* py_ptr) {
PyObject* list = private_store_get(py_self, "pointers");
- if (list)
- purge_pointers(list);
+ if (list) {
+ if (purge_pointers(list) < 0)
+ return -1;
+ }
else {
list = PyList_New(0);
if (!list)
@@ -5877,7 +5899,8 @@ static PyObject* _delitem_Exiv2_ExifData(
if (pos == self->end())
return PyErr_Format(PyExc_KeyError, "'%s'", key);
#if 0x040401 >= 0x040400
- invalidate_pointers(py_self, pos);
+ if (invalidate_pointers(py_self, pos) < 0)
+ return NULL;
#endif
self->erase(pos);
return SWIG_Py_Void();
@@ -7044,6 +7067,7 @@ SWIGINTERN PyObject *_wrap_Exifdatum_pointer_value__SWIG_0(PyObject *self, Py_ss
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7094,6 +7118,7 @@ SWIGINTERN PyObject *_wrap_Exifdatum_pointer_value__SWIG_1(PyObject *self, Py_ss
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7469,6 +7494,7 @@ SWIGINTERN PyObject *_wrap_ExifData_iterator___iter__(PyObject *self, PyObject *
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7616,6 +7642,7 @@ SWIGINTERN PyObject *_wrap__getitem_Exiv2_ExifData(PyObject *self, PyObject *arg
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8697,6 +8724,7 @@ SWIGINTERN PyObject *_wrap_Exifdatum_value__SWIG_0(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8998,6 +9026,7 @@ SWIGINTERN PyObject *_wrap_Exifdatum_value__SWIG_1(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9454,6 +9483,7 @@ SWIGINTERN int _wrap_new_ExifThumb(PyObject *self, PyObject *args, PyObject *kwa
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", args)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10005,7 +10035,9 @@ SWIGINTERN PyObject *_wrap_ExifData_erase__SWIG_0(PyObject *self, Py_ssize_t nob
arg2 = argp2->_ptr();
{
- invalidate_pointers(self, arg2);
+ if (invalidate_pointers(self, arg2) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -10030,6 +10062,7 @@ SWIGINTERN PyObject *_wrap_ExifData_erase__SWIG_0(PyObject *self, Py_ssize_t nob
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10093,7 +10126,9 @@ SWIGINTERN PyObject *_wrap_ExifData_erase__SWIG_1(PyObject *self, Py_ssize_t nob
arg3 = argp3->_ptr();
{
- invalidate_pointers(self, arg2, arg3);
+ if (invalidate_pointers(self, arg2, arg3) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -10118,6 +10153,7 @@ SWIGINTERN PyObject *_wrap_ExifData_erase__SWIG_1(PyObject *self, Py_ssize_t nob
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10171,7 +10207,10 @@ SWIGINTERN PyObject *_wrap_ExifData_clear(PyObject *self, PyObject *args) {
(arg1)->clear();
resultobj = SWIG_Py_Void();
{
- invalidate_pointers(self);
+ if (invalidate_pointers(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
}
return resultobj;
fail:
@@ -10263,6 +10302,7 @@ SWIGINTERN PyObject *_wrap_ExifData_begin(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10300,6 +10340,7 @@ SWIGINTERN PyObject *_wrap_ExifData_end(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -10358,6 +10399,7 @@ SWIGINTERN PyObject *_wrap_ExifData_findKey(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
diff --git a/src/swig-0_28_8/image_wrap.cxx b/src/swig-0_28_8/image_wrap.cxx
index a46c19ee..ad1267eb 100644
--- a/src/swig-0_28_8/image_wrap.cxx
+++ b/src/swig-0_28_8/image_wrap.cxx
@@ -5040,6 +5040,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -5070,9 +5083,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -5435,7 +5451,9 @@ SWIGINTERN PyObject *_wrap_delete_Image(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_delete_Image
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5468,7 +5486,9 @@ SWIGINTERN PyObject *_wrap_Image_readMetadata(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_readMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5505,7 +5525,9 @@ SWIGINTERN PyObject *_wrap_Image_writeMetadata(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_writeMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5558,7 +5580,9 @@ SWIGINTERN PyObject *_wrap_Image_setExifData(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::ExifData * >(argp2);
{
#ifdef RELEASE_VIEWS_Image_setExifData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5591,7 +5615,9 @@ SWIGINTERN PyObject *_wrap_Image_clearExifData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearExifData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5637,7 +5663,9 @@ SWIGINTERN PyObject *_wrap_Image_setIptcData(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::IptcData * >(argp2);
{
#ifdef RELEASE_VIEWS_Image_setIptcData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5670,7 +5698,9 @@ SWIGINTERN PyObject *_wrap_Image_clearIptcData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearIptcData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5695,7 +5725,7 @@ SWIGINTERN PyObject *_wrap_Image_setXmpPacket(PyObject *self, PyObject *args) {
std::string *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- int res2 = SWIG_OLDOBJ ;
+ int res2 = 0 ;
PyObject *swig_obj[2] ;
if (!args) SWIG_fail;
@@ -5705,20 +5735,19 @@ SWIGINTERN PyObject *_wrap_Image_setXmpPacket(PyObject *self, PyObject *args) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Image_setXmpPacket" "', argument " "1"" of type '" "Exiv2::Image *""'");
}
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
- {
- std::string *ptr = (std::string *)0;
- res2 = SWIG_AsPtr_std_string(swig_obj[0], &ptr);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Image_setXmpPacket" "', argument " "2"" of type '" "std::string const &""'");
- }
- if (!ptr) {
- SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "Image_setXmpPacket" "', argument " "2"" of type '" "std::string const &""'");
- }
- arg2 = ptr;
+ res2 = SWIG_AsPtr_std_string(swig_obj[0], &arg2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Image_setXmpPacket" "', argument " "2"" of type '" "std::string const &""'");
+ }
+ if (!arg2) {
+ SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "Image_setXmpPacket" "', argument " "2"" of type '" "std::string const &""'");
}
+ res2 = SWIG_AddTmpMask(res2);
{
#ifdef RELEASE_VIEWS_Image_setXmpPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5731,6 +5760,7 @@ SWIGINTERN PyObject *_wrap_Image_setXmpPacket(PyObject *self, PyObject *args) {
}
}
resultobj = SWIG_Py_Void();
+
if (SWIG_IsNewObj(res2)) delete arg2;
return resultobj;
fail:
@@ -5753,7 +5783,9 @@ SWIGINTERN PyObject *_wrap_Image_clearXmpPacket(PyObject *self, PyObject *args)
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearXmpPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5799,7 +5831,9 @@ SWIGINTERN PyObject *_wrap_Image_setXmpData(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::XmpData * >(argp2);
{
#ifdef RELEASE_VIEWS_Image_setXmpData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5832,7 +5866,9 @@ SWIGINTERN PyObject *_wrap_Image_clearXmpData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearXmpData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5880,7 +5916,9 @@ SWIGINTERN PyObject *_wrap_Image_setComment(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_Image_setComment
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5915,7 +5953,9 @@ SWIGINTERN PyObject *_wrap_Image_clearComment(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearComment
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -5973,7 +6013,9 @@ SWIGINTERN PyObject *_wrap_Image_setIccProfile(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_Image_setIccProfile
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6006,7 +6048,9 @@ SWIGINTERN PyObject *_wrap_Image_clearIccProfile(PyObject *self, PyObject *args)
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearIccProfile
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6040,7 +6084,9 @@ SWIGINTERN PyObject *_wrap_Image_iccProfileDefined(PyObject *self, PyObject *arg
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_iccProfileDefined
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6074,7 +6120,9 @@ SWIGINTERN PyObject *_wrap_Image_iccProfile(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_iccProfile
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6090,6 +6138,7 @@ SWIGINTERN PyObject *_wrap_Image_iccProfile(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6126,7 +6175,9 @@ SWIGINTERN PyObject *_wrap_Image_setMetadata(PyObject *self, PyObject *args) {
arg2 = reinterpret_cast< Exiv2::Image * >(argp2);
{
#ifdef RELEASE_VIEWS_Image_setMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6159,7 +6210,9 @@ SWIGINTERN PyObject *_wrap_Image_clearMetadata(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_clearMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6193,7 +6246,9 @@ SWIGINTERN PyObject *_wrap_Image_exifData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_exifData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6209,6 +6264,7 @@ SWIGINTERN PyObject *_wrap_Image_exifData(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6233,7 +6289,9 @@ SWIGINTERN PyObject *_wrap_Image_iptcData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_iptcData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6249,6 +6307,7 @@ SWIGINTERN PyObject *_wrap_Image_iptcData(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6273,7 +6332,9 @@ SWIGINTERN PyObject *_wrap_Image_xmpData(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_xmpData
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6289,6 +6350,7 @@ SWIGINTERN PyObject *_wrap_Image_xmpData(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6313,7 +6375,9 @@ SWIGINTERN PyObject *_wrap_Image_xmpPacket(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_xmpPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6354,7 +6418,9 @@ SWIGINTERN PyObject *_wrap_Image_writeXmpFromPacket__SWIG_0(PyObject *self, Py_s
arg2 = static_cast< bool >(val2);
{
#ifdef RELEASE_VIEWS_Image_writeXmpFromPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6402,7 +6468,9 @@ SWIGINTERN PyObject *_wrap_Image_setByteOrder(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_Image_setByteOrder
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6436,7 +6504,9 @@ SWIGINTERN PyObject *_wrap_Image_byteOrder(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_byteOrder
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6474,7 +6544,9 @@ SWIGINTERN PyObject *_wrap_Image_good(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_good
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6508,7 +6580,9 @@ SWIGINTERN PyObject *_wrap_Image_mimeType(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_mimeType
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6542,7 +6616,9 @@ SWIGINTERN PyObject *_wrap_Image_pixelWidth(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_pixelWidth
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6576,7 +6652,9 @@ SWIGINTERN PyObject *_wrap_Image_pixelHeight(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_pixelHeight
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6610,7 +6688,9 @@ SWIGINTERN PyObject *_wrap_Image_comment(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_comment
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6644,7 +6724,9 @@ SWIGINTERN PyObject *_wrap_Image_io(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_io
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6660,6 +6742,7 @@ SWIGINTERN PyObject *_wrap_Image_io(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6699,7 +6782,9 @@ SWIGINTERN PyObject *_wrap_Image_checkMode(PyObject *self, PyObject *args) {
}
{
#ifdef RELEASE_VIEWS_Image_checkMode
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6752,7 +6837,9 @@ SWIGINTERN PyObject *_wrap_Image_supportsMetadata(PyObject *self, PyObject *args
}
{
#ifdef RELEASE_VIEWS_Image_supportsMetadata
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6787,7 +6874,9 @@ SWIGINTERN PyObject *_wrap_Image_writeXmpFromPacket__SWIG_1(PyObject *self, Py_s
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_writeXmpFromPacket
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6871,7 +6960,9 @@ SWIGINTERN PyObject *_wrap_Image_setTypeSupported(PyObject *self, PyObject *args
arg3 = static_cast< uint16_t >(val3);
{
#ifdef RELEASE_VIEWS_Image_setTypeSupported
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6905,7 +6996,9 @@ SWIGINTERN PyObject *_wrap_Image_imageType(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_imageType
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6947,7 +7040,9 @@ SWIGINTERN PyObject *_wrap_Image_data(PyObject *self, PyObject *args) {
arg1 = reinterpret_cast< Exiv2::Image * >(argp1);
{
#ifdef RELEASE_VIEWS_Image_data
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
@@ -6985,7 +7080,9 @@ SWIGINTERN PyObject *_wrap_Image__view_deleted_cb(PyObject *self, PyObject *args
arg2 = swig_obj[0];
{
#ifdef RELEASE_VIEWS_Image__view_deleted_cb
- release_views(self);
+ if (release_views(self) < 0) {
+ SWIG_fail;
+ }
#endif
}
{
diff --git a/src/swig-0_28_8/iptc_wrap.cxx b/src/swig-0_28_8/iptc_wrap.cxx
index cf4f9dcf..ee9b6eee 100644
--- a/src/swig-0_28_8/iptc_wrap.cxx
+++ b/src/swig-0_28_8/iptc_wrap.cxx
@@ -5785,14 +5785,30 @@ static PyObject* set_value_from_py(Exiv2::Iptcdatum* datum,
};
-static void _process_list(PyObject* list, bool purge_only,
- Exiv2::IptcData::iterator* beg,
- Exiv2::IptcData::iterator* end) {
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
+static int _process_list(PyObject* list, bool purge_only,
+ Exiv2::IptcData::iterator* beg,
+ Exiv2::IptcData::iterator* end) {
PyObject* py_ptr = NULL;
Iptcdatum_pointer* cpp_ptr = NULL;
for (Py_ssize_t idx = PyList_Size(list); idx > 0; idx--) {
- py_ptr = PyWeakref_GetObject(PyList_GetItem(list, idx-1));
- if (py_ptr == Py_None)
+ if (PyWeakref_GetRef(PyList_GetItem(list, idx-1), &py_ptr) < 0)
+ return -1;
+ if (py_ptr)
+ Py_DECREF(py_ptr);
+ else
goto forget;
if (purge_only)
continue;
@@ -5811,35 +5827,41 @@ static void _process_list(PyObject* list, bool purge_only,
PyList_SetSlice(list, idx-1, idx, NULL);
continue;
}
+ return 0;
};
-static void purge_pointers(PyObject* list) {
- _process_list(list, true, NULL, NULL);
+static int purge_pointers(PyObject* list) {
+ return _process_list(list, true, NULL, NULL);
};
-static void invalidate_pointers(PyObject* py_self) {
+static int invalidate_pointers(PyObject* py_self) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, NULL, NULL);
+ return _process_list(list, false, NULL, NULL);
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::IptcData::iterator pos) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::IptcData::iterator pos) {
PyObject* list = private_store_get(py_self, "pointers");
if (list) {
Exiv2::IptcData::iterator end = pos;
end++;
- _process_list(list, false, &pos, &end);
+ return _process_list(list, false, &pos, &end);
}
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::IptcData::iterator beg,
- Exiv2::IptcData::iterator end) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::IptcData::iterator beg,
+ Exiv2::IptcData::iterator end) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, &beg, &end);
+ return _process_list(list, false, &beg, &end);
+ return 0;
};
static int store_pointer(PyObject* py_self, PyObject* py_ptr) {
PyObject* list = private_store_get(py_self, "pointers");
- if (list)
- purge_pointers(list);
+ if (list) {
+ if (purge_pointers(list) < 0)
+ return -1;
+ }
else {
list = PyList_New(0);
if (!list)
@@ -5869,7 +5891,8 @@ static PyObject* _delitem_Exiv2_IptcData(
if (pos == self->end())
return PyErr_Format(PyExc_KeyError, "'%s'", key);
#if 0x040401 >= 0x040400
- invalidate_pointers(py_self, pos);
+ if (invalidate_pointers(py_self, pos) < 0)
+ return NULL;
#endif
self->erase(pos);
return SWIG_Py_Void();
@@ -6909,6 +6932,7 @@ SWIGINTERN PyObject *_wrap_Iptcdatum_pointer_value__SWIG_0(PyObject *self, Py_ss
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6959,6 +6983,7 @@ SWIGINTERN PyObject *_wrap_Iptcdatum_pointer_value__SWIG_1(PyObject *self, Py_ss
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7273,6 +7298,7 @@ SWIGINTERN PyObject *_wrap_IptcData_iterator___iter__(PyObject *self, PyObject *
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7420,6 +7446,7 @@ SWIGINTERN PyObject *_wrap__getitem_Exiv2_IptcData(PyObject *self, PyObject *arg
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8447,6 +8474,7 @@ SWIGINTERN PyObject *_wrap_Iptcdatum_value__SWIG_0(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8687,6 +8715,7 @@ SWIGINTERN PyObject *_wrap_Iptcdatum_value__SWIG_1(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9060,7 +9089,9 @@ SWIGINTERN PyObject *_wrap_IptcData_erase(PyObject *self, PyObject *args) {
arg2 = argp2->_ptr();
{
- invalidate_pointers(self, arg2);
+ if (invalidate_pointers(self, arg2) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -9085,6 +9116,7 @@ SWIGINTERN PyObject *_wrap_IptcData_erase(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9109,7 +9141,10 @@ SWIGINTERN PyObject *_wrap_IptcData_clear(PyObject *self, PyObject *args) {
(arg1)->clear();
resultobj = SWIG_Py_Void();
{
- invalidate_pointers(self);
+ if (invalidate_pointers(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
}
return resultobj;
fail:
@@ -9201,6 +9236,7 @@ SWIGINTERN PyObject *_wrap_IptcData_begin(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9238,6 +9274,7 @@ SWIGINTERN PyObject *_wrap_IptcData_end(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9296,6 +9333,7 @@ SWIGINTERN PyObject *_wrap_IptcData_findKey(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9357,6 +9395,7 @@ SWIGINTERN PyObject *_wrap_IptcData_findId__SWIG_0(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9410,6 +9449,7 @@ SWIGINTERN PyObject *_wrap_IptcData_findId__SWIG_1(PyObject *self, Py_ssize_t no
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
diff --git a/src/swig-0_28_8/metadatum_wrap.cxx b/src/swig-0_28_8/metadatum_wrap.cxx
index 4e1b3c51..97d9a43e 100644
--- a/src/swig-0_28_8/metadatum_wrap.cxx
+++ b/src/swig-0_28_8/metadatum_wrap.cxx
@@ -4715,16 +4715,30 @@ static void _set_python_exception() {
static PyObject* _str_Exiv2_Metadatum(PyObject* py_self) {
Exiv2::Metadatum* self = NULL;
+ std::string result;
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__Metadatum, 0);
- std::string result = metadatum_str(self);
+ try {
+ result = metadatum_str(self);
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ return NULL;
+ }
return SWIG_FromCharPtrAndSize(result.data(), result.size());
};
static PyObject* _str_MetadatumPointerBase(PyObject* py_self) {
MetadatumPointerBase* self = NULL;
+ std::string result;
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_MetadatumPointerBase, 0);
- std::string result = self->__str__();
+ try {
+ result = self->__str__();
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ return NULL;
+ }
return SWIG_FromCharPtrAndSize(result.data(), result.size());
};
@@ -6910,6 +6924,7 @@ SWIGINTERN PyObject *_wrap_Metadatum_value(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
diff --git a/src/swig-0_28_8/preview_wrap.cxx b/src/swig-0_28_8/preview_wrap.cxx
index a31ea62c..84c743e5 100644
--- a/src/swig-0_28_8/preview_wrap.cxx
+++ b/src/swig-0_28_8/preview_wrap.cxx
@@ -5983,6 +5983,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -6013,9 +6026,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -6960,6 +6976,7 @@ SWIGINTERN int _wrap_new_PreviewManager(PyObject *self, PyObject *args, PyObject
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", args)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
diff --git a/src/swig-0_28_8/types_wrap.cxx b/src/swig-0_28_8/types_wrap.cxx
index c9eb2fc3..d25a78d4 100644
--- a/src/swig-0_28_8/types_wrap.cxx
+++ b/src/swig-0_28_8/types_wrap.cxx
@@ -5278,6 +5278,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -5308,9 +5321,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -6294,7 +6310,10 @@ SWIGINTERN PyObject *_wrap_DataBuf_alloc(PyObject *self, PyObject *args) {
}
resultobj = SWIG_Py_Void();
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -6335,7 +6354,10 @@ SWIGINTERN PyObject *_wrap_DataBuf_resize(PyObject *self, PyObject *args) {
}
resultobj = SWIG_Py_Void();
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -6358,7 +6380,10 @@ SWIGINTERN PyObject *_wrap_DataBuf_reset(PyObject *self, PyObject *args) {
(arg1)->reset();
resultobj = SWIG_Py_Void();
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
diff --git a/src/swig-0_28_8/value_wrap.cxx b/src/swig-0_28_8/value_wrap.cxx
index b19e620b..a58f51a2 100644
--- a/src/swig-0_28_8/value_wrap.cxx
+++ b/src/swig-0_28_8/value_wrap.cxx
@@ -5763,8 +5763,15 @@ namespace swig {
static PyObject* _str_Exiv2_Value(PyObject* py_self) {
Exiv2::Value* self = NULL;
+ std::string result;
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__Value, 0);
- std::string result = self->toString();
+ try {
+ result = self->toString();
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ return NULL;
+ }
return SWIG_FromCharPtrAndSize(result.data(), result.size());
};
@@ -6697,6 +6704,19 @@ static int private_store_del(PyObject* py_self, const char* name) {
};
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
static int store_view(PyObject* py_self, PyObject* view) {
PyObject* view_list = private_store_get(py_self, "view_list");
if (!view_list) {
@@ -6727,9 +6747,12 @@ static int release_views(PyObject* py_self) {
PyObject* view = NULL;
for (Py_ssize_t idx = PyList_Size(view_list); idx > 0; idx--) {
view_ref = PyList_GetItem(view_list, idx - 1);
- view = PyWeakref_GetObject(view_ref);
- if (view != Py_None)
+ if (PyWeakref_GetRef(view_ref, &view) < 0)
+ return -1;
+ if (view) {
Py_XDECREF(PyObject_CallMethod(view, "release", NULL));
+ Py_DECREF(view);
+ }
PyList_SetSlice(view_list, idx - 1, idx, NULL);
}
return 0;
@@ -9156,7 +9179,10 @@ SWIGINTERN PyObject *_wrap_DataValue_read__SWIG_0(PyObject *self, Py_ssize_t nob
Py_XDECREF(_global_view);
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -9205,7 +9231,10 @@ SWIGINTERN PyObject *_wrap_DataValue_read__SWIG_1(PyObject *self, Py_ssize_t nob
resultobj = SWIG_From_int(static_cast< int >(result));
if (SWIG_IsNewObj(res2)) delete arg2;
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -9774,7 +9803,10 @@ SWIGINTERN PyObject *_wrap_StringValueBase_read__SWIG_0(PyObject *self, Py_ssize
resultobj = SWIG_From_int(static_cast< int >(result));
if (SWIG_IsNewObj(res2)) delete arg2;
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -9847,7 +9879,10 @@ SWIGINTERN PyObject *_wrap_StringValueBase_read__SWIG_1(PyObject *self, Py_ssize
Py_XDECREF(_global_view);
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -12010,7 +12045,10 @@ SWIGINTERN PyObject *_wrap_XmpTextValue_read__SWIG_0(PyObject *self, Py_ssize_t
Py_XDECREF(_global_view);
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
@@ -12059,7 +12097,10 @@ SWIGINTERN PyObject *_wrap_XmpTextValue_read__SWIG_1(PyObject *self, Py_ssize_t
resultobj = SWIG_From_int(static_cast< int >(result));
if (SWIG_IsNewObj(res2)) delete arg2;
- release_views(self);
+ if (release_views(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
return resultobj;
fail:
diff --git a/src/swig-0_28_8/xmp_wrap.cxx b/src/swig-0_28_8/xmp_wrap.cxx
index afa6c52f..c1d29a9a 100644
--- a/src/swig-0_28_8/xmp_wrap.cxx
+++ b/src/swig-0_28_8/xmp_wrap.cxx
@@ -4398,15 +4398,16 @@ SwigPyBuiltin_iternextfunc_closure(SwigPyWrapperFunction wrapper, PyObject *a) {
#define SWIGTYPE_p_std__ostream swig_types[59]
#define SWIGTYPE_p_std__pairT_int32_t_int32_t_t swig_types[60]
#define SWIGTYPE_p_std__pairT_uint32_t_uint32_t_t swig_types[61]
-#define SWIGTYPE_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t swig_types[62]
-#define SWIGTYPE_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator swig_types[63]
-#define SWIGTYPE_p_unsigned_char swig_types[64]
-#define SWIGTYPE_p_unsigned_int swig_types[65]
-#define SWIGTYPE_p_unsigned_long_long swig_types[66]
-#define SWIGTYPE_p_unsigned_short swig_types[67]
-#define SWIGTYPE_p_value_type swig_types[68]
-static swig_type_info *swig_types[70];
-static swig_module_info swig_module = {swig_types, 69, 0, 0, 0, 0};
+#define SWIGTYPE_p_std__string swig_types[62]
+#define SWIGTYPE_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t swig_types[63]
+#define SWIGTYPE_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator swig_types[64]
+#define SWIGTYPE_p_unsigned_char swig_types[65]
+#define SWIGTYPE_p_unsigned_int swig_types[66]
+#define SWIGTYPE_p_unsigned_long_long swig_types[67]
+#define SWIGTYPE_p_unsigned_short swig_types[68]
+#define SWIGTYPE_p_value_type swig_types[69]
+static swig_type_info *swig_types[71];
+static swig_module_info swig_module = {swig_types, 70, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -5788,14 +5789,30 @@ static PyObject* set_value_from_py(Exiv2::Xmpdatum* datum,
};
-static void _process_list(PyObject* list, bool purge_only,
- Exiv2::XmpData::iterator* beg,
- Exiv2::XmpData::iterator* end) {
+#if PY_VERSION_HEX < 0x030d0000
+static int PyWeakref_GetRef(PyObject *ref, PyObject **pobj) {
+ *pobj = PyWeakref_GetObject(ref);
+ if (*pobj == Py_None) {
+ *pobj = NULL;
+ return 0;
+ }
+ Py_INCREF(*pobj);
+ return 1;
+};
+#endif
+
+
+static int _process_list(PyObject* list, bool purge_only,
+ Exiv2::XmpData::iterator* beg,
+ Exiv2::XmpData::iterator* end) {
PyObject* py_ptr = NULL;
Xmpdatum_pointer* cpp_ptr = NULL;
for (Py_ssize_t idx = PyList_Size(list); idx > 0; idx--) {
- py_ptr = PyWeakref_GetObject(PyList_GetItem(list, idx-1));
- if (py_ptr == Py_None)
+ if (PyWeakref_GetRef(PyList_GetItem(list, idx-1), &py_ptr) < 0)
+ return -1;
+ if (py_ptr)
+ Py_DECREF(py_ptr);
+ else
goto forget;
if (purge_only)
continue;
@@ -5814,35 +5831,41 @@ static void _process_list(PyObject* list, bool purge_only,
PyList_SetSlice(list, idx-1, idx, NULL);
continue;
}
+ return 0;
};
-static void purge_pointers(PyObject* list) {
- _process_list(list, true, NULL, NULL);
+static int purge_pointers(PyObject* list) {
+ return _process_list(list, true, NULL, NULL);
};
-static void invalidate_pointers(PyObject* py_self) {
+static int invalidate_pointers(PyObject* py_self) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, NULL, NULL);
+ return _process_list(list, false, NULL, NULL);
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::XmpData::iterator pos) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::XmpData::iterator pos) {
PyObject* list = private_store_get(py_self, "pointers");
if (list) {
Exiv2::XmpData::iterator end = pos;
end++;
- _process_list(list, false, &pos, &end);
+ return _process_list(list, false, &pos, &end);
}
+ return 0;
};
-static void invalidate_pointers(PyObject* py_self,
- Exiv2::XmpData::iterator beg,
- Exiv2::XmpData::iterator end) {
+static int invalidate_pointers(PyObject* py_self,
+ Exiv2::XmpData::iterator beg,
+ Exiv2::XmpData::iterator end) {
PyObject* list = private_store_get(py_self, "pointers");
if (list)
- _process_list(list, false, &beg, &end);
+ return _process_list(list, false, &beg, &end);
+ return 0;
};
static int store_pointer(PyObject* py_self, PyObject* py_ptr) {
PyObject* list = private_store_get(py_self, "pointers");
- if (list)
- purge_pointers(list);
+ if (list) {
+ if (purge_pointers(list) < 0)
+ return -1;
+ }
else {
list = PyList_New(0);
if (!list)
@@ -5872,7 +5895,8 @@ static PyObject* _delitem_Exiv2_XmpData(
if (pos == self->end())
return PyErr_Format(PyExc_KeyError, "'%s'", key);
#if 0x040401 >= 0x040400
- invalidate_pointers(py_self, pos);
+ if (invalidate_pointers(py_self, pos) < 0)
+ return NULL;
#endif
self->erase(pos);
return SWIG_Py_Void();
@@ -5911,6 +5935,52 @@ static int _contains_Exiv2_XmpData(PyObject* py_self, PyObject* py_key) {
return self->findKey(Exiv2::XmpKey(key)) != self->end() ? 1 : 0;
};
+
+static PyObject* Python_Exiv2_XmpParser_XmpFormatFlags = NULL;
+
+
+static PyObject* Python_Exiv2_extras_create_enum = NULL;
+
+
+
+
+// Convert enum names & values to a Python list
+static PyObject* _get_enum_data(const char* name, ...) {
+ PyObject* py_obj = NULL;
+ PyObject* members = PyList_New(0);
+ va_list args;
+ va_start(args, name);
+ char* label = va_arg(args, char*);
+ while (label) {
+ py_obj = Py_BuildValue("(si)", label, va_arg(args, int));
+ PyList_Append(members, py_obj);
+ Py_DECREF(py_obj);
+ label = va_arg(args, char*);
+ }
+ va_end(args);
+ return members;
+};
+// Call Python to create an enum from list of names & values
+static PyObject* _create_enum(const char* name, const char* alias_strip,
+ PyObject* members) {
+ return PyObject_CallFunction(
+ Python_Exiv2_extras_create_enum, "(sssN)",
+ SWIG_name, name, alias_strip, members);
+};
+
+
+static PyObject* _get_enum_data_Exiv2_XmpParser_XmpFormatFlags() {
+ return _get_enum_data("Exiv2::XmpParser::XmpFormatFlags",
+ "omitPacketWrapper", Exiv2::XmpParser::omitPacketWrapper,
+ "readOnlyPacket", Exiv2::XmpParser::readOnlyPacket,
+ "useCompactFormat", Exiv2::XmpParser::useCompactFormat,
+ "includeThumbnailPad", Exiv2::XmpParser::includeThumbnailPad,
+ "exactPacketLength", Exiv2::XmpParser::exactPacketLength,
+ "writeAliasComments", Exiv2::XmpParser::writeAliasComments,
+ "omitAllFormatting", Exiv2::XmpParser::omitAllFormatting,
+ NULL);
+};
+
SWIGINTERN bool Exiv2_Xmpdatum_operator_Se__Se_(Exiv2::Xmpdatum const *self,Exiv2::Xmpdatum const &other){
return &other == self;
}
@@ -5979,6 +6049,38 @@ SWIG_AsPtr_std_string (PyObject * obj, std::string **val)
return SWIG_ERROR;
}
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_short (PyObject * obj, unsigned short *val)
+{
+ unsigned long v;
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v > USHRT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val) *val = static_cast< unsigned short >(v);
+ }
+ }
+ return res;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
+{
+ unsigned long v;
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v > UINT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val) *val = static_cast< unsigned int >(v);
+ }
+ }
+ return res;
+}
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -6878,6 +6980,7 @@ SWIGINTERN PyObject *_wrap_Xmpdatum_pointer_value__SWIG_0(PyObject *self, Py_ssi
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -6928,6 +7031,7 @@ SWIGINTERN PyObject *_wrap_Xmpdatum_pointer_value__SWIG_1(PyObject *self, Py_ssi
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7242,6 +7346,7 @@ SWIGINTERN PyObject *_wrap_XmpData_iterator___iter__(PyObject *self, PyObject *a
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -7389,6 +7494,7 @@ SWIGINTERN PyObject *_wrap__getitem_Exiv2_XmpData(PyObject *self, PyObject *args
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8357,6 +8463,7 @@ SWIGINTERN PyObject *_wrap_Xmpdatum_value__SWIG_0(PyObject *self, Py_ssize_t nob
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8597,6 +8704,7 @@ SWIGINTERN PyObject *_wrap_Xmpdatum_value__SWIG_1(PyObject *self, Py_ssize_t nob
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -8992,7 +9100,9 @@ SWIGINTERN PyObject *_wrap_XmpData_erase(PyObject *self, PyObject *args) {
arg2 = argp2->_ptr();
{
- invalidate_pointers(self, arg2);
+ if (invalidate_pointers(self, arg2) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -9017,6 +9127,7 @@ SWIGINTERN PyObject *_wrap_XmpData_erase(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9063,7 +9174,9 @@ SWIGINTERN PyObject *_wrap_XmpData_eraseFamily(PyObject *self, PyObject *args) {
arg2 = &it2;
}
{
- invalidate_pointers(self, *arg2, arg1->end());
+ if (invalidate_pointers(self, *arg2, arg1->end()) < 0) {
+ SWIG_fail;
+ }
}
{
try {
@@ -9096,7 +9209,10 @@ SWIGINTERN PyObject *_wrap_XmpData_clear(PyObject *self, PyObject *args) {
(arg1)->clear();
resultobj = SWIG_Py_Void();
{
- invalidate_pointers(self);
+ if (invalidate_pointers(self) < 0) {
+ Py_DECREF(resultobj);
+ SWIG_fail;
+ }
}
return resultobj;
fail:
@@ -9160,6 +9276,7 @@ SWIGINTERN PyObject *_wrap_XmpData_begin(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9197,6 +9314,7 @@ SWIGINTERN PyObject *_wrap_XmpData_end(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9255,6 +9373,7 @@ SWIGINTERN PyObject *_wrap_XmpData_findKey(PyObject *self, PyObject *args) {
if (resultobj != Py_None)
if (private_store_set(resultobj, "refers_to", self)) {
+ Py_DECREF(resultobj);
SWIG_fail;
}
@@ -9504,6 +9623,73 @@ SWIGPY_LENFUNC_CLOSURE(_wrap_XmpData_count) /* defines _wrap_XmpData_count_lenfu
SWIGPY_DESTRUCTOR_CLOSURE(_wrap_delete_XmpData) /* defines _wrap_delete_XmpData_destructor_closure */
+SWIGINTERN PyObject *_wrap_XmpParser_encode(PyObject *self, PyObject *args) {
+ PyObject *resultobj = 0;
+ std::string *arg1 = 0 ;
+ Exiv2::XmpData *arg2 = 0 ;
+ uint16_t arg3 ;
+ uint32_t arg4 ;
+ std::string temp1 ;
+ int res1 = SWIG_TMPOBJ ;
+ void *argp2 = 0 ;
+ int res2 = 0 ;
+ unsigned short val3 ;
+ int ecode3 = 0 ;
+ unsigned int val4 ;
+ int ecode4 = 0 ;
+ PyObject *swig_obj[3] ;
+ int result;
+
+
+ arg3 = Exiv2::XmpParser::XmpFormatFlags::useCompactFormat;
+
+ arg4 = 0;
+ arg1 = &temp1;
+ if (!SWIG_Python_UnpackTuple(args, "XmpParser_encode", 1, 3, swig_obj)) SWIG_fail;
+ res2 = SWIG_ConvertPtr(swig_obj[0], &argp2, SWIGTYPE_p_Exiv2__XmpData, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "XmpParser_encode" "', argument " "2"" of type '" "Exiv2::XmpData const &""'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_NullReferenceError, "invalid null reference " "in method '" "XmpParser_encode" "', argument " "2"" of type '" "Exiv2::XmpData const &""'");
+ }
+ arg2 = reinterpret_cast< Exiv2::XmpData * >(argp2);
+ if (swig_obj[1]) {
+ ecode3 = SWIG_AsVal_unsigned_SS_short(swig_obj[1], &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "XmpParser_encode" "', argument " "3"" of type '" "uint16_t""'");
+ }
+ arg3 = static_cast< uint16_t >(val3);
+ }
+ if (swig_obj[2]) {
+ ecode4 = SWIG_AsVal_unsigned_SS_int(swig_obj[2], &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "XmpParser_encode" "', argument " "4"" of type '" "uint32_t""'");
+ }
+ arg4 = static_cast< uint32_t >(val4);
+ }
+ {
+ try {
+ result = (int)Exiv2::XmpParser::encode(*arg1,(Exiv2::XmpData const &)*arg2,arg3,arg4);
+ }
+ catch(std::exception const& e) {
+ _set_python_exception();
+ SWIG_fail;
+ }
+ }
+ resultobj = SWIG_From_int(static_cast< int >(result));
+ if (SWIG_IsTmpObj(res1)) {
+ resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_std_string((*arg1)), 0);
+ } else {
+ int new_flags = SWIG_IsNewObj(res1) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
+ resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg1), SWIGTYPE_p_std__string, new_flags), 0);
+ }
+ return resultobj;
+fail:
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_XmpParser_initialize__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
PyObject *resultobj = 0;
Exiv2::XmpParser::XmpLockFct arg1 = 0 ;
@@ -11367,6 +11553,31 @@ SwigPyBuiltin__Exiv2__XmpParser_richcompare(PyObject *self, PyObject *other, int
}
SWIGINTERN PyMethodDef SwigPyBuiltin__Exiv2__XmpParser_methods[] = {
+ { "encode", (PyCFunction)(void(*)(void))_wrap_XmpParser_encode, METH_STATIC|METH_VARARGS, "\n"
+ "Encode (serialize) XMP metadata from *xmpData* into a\n"
+ " string xmpPacket. The XMP packet returned in the string\n"
+ " follows the XMP specification. This method only modifies\n"
+ " *xmpPacket* if the operations succeeds (return code 0).\n"
+ "\n"
+ ":type xmpPacket: str\n"
+ ":param xmpPacket: Reference to a string to hold the encoded XMP\n"
+ " packet.\n"
+ ":type xmpData: :py:class:`XmpData`\n"
+ ":param xmpData: XMP properties to encode.\n"
+ ":type formatFlags: int, optional\n"
+ ":param formatFlags: Flags that control the format of the XMP packet,\n"
+ " see enum XmpFormatFlags.\n"
+ ":type padding: int, optional\n"
+ ":param padding: Padding length.\n"
+ ":rtype: int\n"
+ ":return: 0 if successful;\n"
+ "\n"
+ " 1 if XMP support has not been compiled-in;\n"
+ "\n"
+ " 2 if the XMP toolkit failed to initialize;\n"
+ "\n"
+ " 3 if the XMP toolkit failed and raised an XMP_Error\n"
+ "" },
{ "initialize", (PyCFunction)(void(*)(void))_wrap_XmpParser_initialize, METH_STATIC|METH_VARARGS, "\n"
"Initialize the XMP Toolkit.\n"
"\n"
@@ -11865,6 +12076,7 @@ static swig_type_info _swigt__p_size_type = {"_p_size_type", "size_type *", 0, 0
static swig_type_info _swigt__p_std__ostream = {"_p_std__ostream", "std::ostream *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__pairT_int32_t_int32_t_t = {"_p_std__pairT_int32_t_int32_t_t", "Exiv2::Rational *|std::pair< int,int > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__pairT_uint32_t_uint32_t_t = {"_p_std__pairT_uint32_t_uint32_t_t", "Exiv2::URational *|std::pair< unsigned int,unsigned int > *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_std__string = {"_p_std__string", "std::string *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t = {"_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t", "Exiv2::XmpMetadata *|std::vector< Exiv2::Xmpdatum,std::allocator< Exiv2::Xmpdatum > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator = {"_p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator", "Exiv2::XmpData::iterator *|std::vector< Exiv2::Xmpdatum,std::allocator< Exiv2::Xmpdatum > >::iterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "Exiv2::byte *|uint8_t *|uint_fast8_t *|uint_least8_t *|unsigned char *", 0, 0, (void*)0, 0};
@@ -11936,6 +12148,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_std__ostream,
&_swigt__p_std__pairT_int32_t_int32_t_t,
&_swigt__p_std__pairT_uint32_t_uint32_t_t,
+ &_swigt__p_std__string,
&_swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t,
&_swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator,
&_swigt__p_unsigned_char,
@@ -12007,6 +12220,7 @@ static swig_cast_info _swigc__p_size_type[] = { {&_swigt__p_size_type, 0, 0, 0}
static swig_cast_info _swigc__p_std__ostream[] = { {&_swigt__p_std__ostream, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__pairT_int32_t_int32_t_t[] = { {&_swigt__p_std__pairT_int32_t_int32_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__pairT_uint32_t_uint32_t_t[] = { {&_swigt__p_std__pairT_uint32_t_uint32_t_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_std__string[] = { {&_swigt__p_std__string, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t[] = { {&_swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator[] = { {&_swigt__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
@@ -12078,6 +12292,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_std__ostream,
_swigc__p_std__pairT_int32_t_int32_t_t,
_swigc__p_std__pairT_uint32_t_uint32_t_t,
+ _swigc__p_std__string,
_swigc__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t,
_swigc__p_std__vectorT_Exiv2__Xmpdatum_std__allocatorT_Exiv2__Xmpdatum_t_t__iterator,
_swigc__p_unsigned_char,
@@ -12914,6 +13129,19 @@ SWIGINTERN int SWIG_mod_exec(PyObject *m) {
SwigPyBuiltin_AddPublicSymbol(public_interface, "Xmpdatum_reference");
d = md;
+ Python_Exiv2_extras_create_enum = import_from_python("exiv2.extras","_create_enum");
+ if (!Python_Exiv2_extras_create_enum)
+ return INIT_ERROR_RETURN;
+
+
+ Python_Exiv2_XmpParser_XmpFormatFlags = _create_enum(
+ "Exiv2::XmpParser::XmpFormatFlags","", _get_enum_data_Exiv2_XmpParser_XmpFormatFlags());
+ if (!Python_Exiv2_XmpParser_XmpFormatFlags)
+ return INIT_ERROR_RETURN;
+ // SWIG_Python_SetConstant will decref PyEnum object
+ Py_INCREF(Python_Exiv2_XmpParser_XmpFormatFlags);
+
+
/* type 'Exiv2::Xmpdatum' */
d = PyDict_New();
builtin_base_count = 0;
@@ -12961,13 +13189,7 @@ SWIGINTERN int SWIG_mod_exec(PyObject *m) {
/* type 'Exiv2::XmpParser' */
d = PyDict_New();
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "omitPacketWrapper",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::omitPacketWrapper)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "readOnlyPacket",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::readOnlyPacket)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "useCompactFormat",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::useCompactFormat)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "includeThumbnailPad",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::includeThumbnailPad)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "exactPacketLength",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::exactPacketLength)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "writeAliasComments",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::writeAliasComments)));
- SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "omitAllFormatting",SWIG_From_int(static_cast< int >(Exiv2::XmpParser::omitAllFormatting)));
+ SWIG_Python_SetConstant(d, d == md ? public_interface : NULL, "XmpFormatFlags",Python_Exiv2_XmpParser_XmpFormatFlags);
builtin_base_count = 0;
builtin_bases[builtin_base_count] = NULL;
PyDict_SetItemString(d, "this", this_descr);
diff --git a/tests/test_basicio.py b/tests/test_basicio.py
index 5ea7fce2..c3a3aaf8 100644
--- a/tests/test_basicio.py
+++ b/tests/test_basicio.py
@@ -244,6 +244,9 @@ def test_MemIo(self):
def test_ref_counts(self):
# MemIo keeps a reference to the data buffer
count = sys.getrefcount(self.data)
+ if count > 1000000:
+ # self.data is "immortal"
+ return
io = exiv2.ImageFactory.createIo(self.data)
self.assertEqual(sys.getrefcount(self.data), count + 1)
del io
diff --git a/tests/test_value.py b/tests/test_value.py
index 12d38ddc..347c2ef0 100644
--- a/tests/test_value.py
+++ b/tests/test_value.py
@@ -202,6 +202,21 @@ def test_CommentValue(self):
self.do_common_string_tests(value, data)
self.do_conversion_tests(value, text, data[0])
self.do_dataarea_tests(value)
+ # test bug #65
+ if not exiv2.testVersion(0, 28, 0):
+ return
+ value = exiv2.CommentValue()
+ # read some invalid data (odd length UTF-16)
+ with self.assertWarns(DeprecationWarning):
+ value.read(data[:-1])
+ with self.assertRaises(exiv2.Exiv2Error) as cm:
+ str(value)
+ self.assertEqual(cm.exception.code,
+ exiv2.ErrorCode.kerInvalidIconvEncoding)
+ with self.assertRaises(exiv2.Exiv2Error) as cm:
+ value.toString()
+ self.assertEqual(cm.exception.code,
+ exiv2.ErrorCode.kerInvalidIconvEncoding)
def test_StringValue(self):
text = 'The quick brown fox jumps over the lazy dog. àéīöûç'
diff --git a/tests/test_xmp.py b/tests/test_xmp.py
index a8d09afb..fbc3bb95 100644
--- a/tests/test_xmp.py
+++ b/tests/test_xmp.py
@@ -37,6 +37,24 @@ def setUpClass(cls):
os.environ['LANG'] = name
os.environ['LANGUAGE'] = name
+ def test_XmpParser(self):
+ parser = exiv2.XmpParser
+ data = self.image.xmpData()
+ res, packet = parser.encode(data)
+ lines = packet.splitlines()
+ self.assertEqual(res, 0)
+ self.assertEqual(lines[0], '')
+ self.assertEqual(lines[-1], '')
+ res, packet = parser.encode(
+ data, parser.XmpFormatFlags.useCompactFormat |
+ parser.XmpFormatFlags.omitPacketWrapper)
+ lines = packet.splitlines()
+ self.assertEqual(res, 0)
+ self.assertEqual(lines[0], '')
+ self.assertEqual(lines[-1], '')
+
def test_XmpData(self):
# empty container
data = exiv2.XmpData()
diff --git a/utils/extract_enums.py b/utils/extract_enums.py
index 3ae2011e..96a66b80 100644
--- a/utils/extract_enums.py
+++ b/utils/extract_enums.py
@@ -1,6 +1,6 @@
# python-exiv2 - Python interface to exiv2
# http://github.com/jim-easterbrook/python-exiv2
-# Copyright (C) 2025 Jim Easterbrook jim@jim-easterbrook.me.uk
+# Copyright (C) 2025-26 Jim Easterbrook jim@jim-easterbrook.me.uk
#
# This file is part of python-exiv2.
#
@@ -109,7 +109,8 @@ def main():
if name not in ('AccessMode', 'ByteOrder', 'CharsetId',
'ErrorCode', 'IfdId', 'ImageType', 'Level',
'MetadataId', 'Position', 'SectionId', 'TypeId',
- 'XmpArrayType', 'XmpCategory', 'XmpStruct'):
+ 'XmpArrayType', 'XmpCategory', 'XmpFormatFlags',
+ 'XmpStruct'):
continue
parent = parent_map[parent_map[child]]
name = root_name + '::' + name