Skip to content

Commit 0b0ea75

Browse files
swig 4.4 compatibility
1 parent 797f165 commit 0b0ea75

File tree

16 files changed

+49
-25
lines changed

16 files changed

+49
-25
lines changed

src/interface/shared/containers.i

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,19 @@ static PyObject* set_value_from_py(Exiv2::datum_type* datum,
8989
Exiv2::base_class::count;
9090
MP_SUBSCRIPT(Exiv2::base_class, Exiv2::datum_type&, (*self)[key])
9191
%fragment("set_value_from_py"{Exiv2::datum_type});
92+
#if SWIG_VERSION >= 0x040400
93+
%fragment("pointer_store");
94+
#endif
9295
MP_ASS_SUBSCRIPT(Exiv2::base_class, PyObject*,
9396
// setfunc
9497
return set_value_from_py(&(*self)[key], value),
9598
// delfunc
9699
auto pos = self->findKey(Exiv2::key_type(key));
97100
if (pos == self->end())
98101
return PyErr_Format(PyExc_KeyError, "'%s'", key);
102+
#if SWIG_VERSION >= 0x040400
103+
invalidate_pointers(py_self, pos);
104+
#endif
99105
self->erase(pos))
100106
SQ_CONTAINS(
101107
Exiv2::base_class, self->findKey(Exiv2::key_type(key)) != self->end())

src/interface/shared/slots.i

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static int __setitem__%mangle(type)_closure(
142142
%define SQ_CONTAINS(type, func)
143143
%fragment("__contains__"{type}, "header") {
144144
static int __contains__%mangle(type)(PyObject* py_self, PyObject* py_key) {
145-
type* self;
145+
type* self = NULL;
146146
SWIG_ConvertPtr(py_self, (void**)&self, $descriptor(type*), 0);
147147
const char* key = PyUnicode_AsUTF8(py_key);
148148
if (!key)
@@ -159,7 +159,7 @@ static int __contains__%mangle(type)(PyObject* py_self, PyObject* py_key) {
159159
%define SQ_LENGTH(type, func)
160160
%fragment("__len__"{type}, "header") {
161161
static Py_ssize_t __len__%mangle(type)(PyObject* py_self) {
162-
type* self;
162+
type* self = NULL;
163163
SWIG_ConvertPtr(py_self, (void**)&self, $descriptor(type*), 0);
164164
return func;
165165
};
@@ -200,7 +200,7 @@ static PyObject* __getitem__%mangle(type)_closure(
200200
%define TP_STR(type, func)
201201
%fragment("__str__"{type}, "header") {
202202
static PyObject* __str__%mangle(type)(PyObject* py_self) {
203-
type* self;
203+
type* self = NULL;
204204
SWIG_ConvertPtr(py_self, (void**)&self, $descriptor(type*), 0);
205205
std::string result = func;
206206
return SWIG_FromCharPtrAndSize(result.data(), result.size());

src/swig-0_27_7/exif_wrap.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5178,7 +5178,7 @@ static int private_store_del(PyObject* py_self, const char* name) {
51785178

51795179

51805180
static PyObject* __str__Exifdatum_pointer(PyObject* py_self) {
5181-
Exifdatum_pointer* self;
5181+
Exifdatum_pointer* self = NULL;
51825182
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exifdatum_pointer, 0);
51835183
std::string result = self->__str__();
51845184
return SWIG_FromCharPtrAndSize(result.data(), result.size());
@@ -5399,6 +5399,9 @@ static PyObject* __delitem__Exiv2_ExifData(
53995399
auto pos = self->findKey(Exiv2::ExifKey(key));
54005400
if (pos == self->end())
54015401
return PyErr_Format(PyExc_KeyError, "'%s'", key);
5402+
#if 0x040301 >= 0x040400
5403+
invalidate_pointers(py_self, pos);
5404+
#endif
54025405
self->erase(pos);
54035406
return SWIG_Py_Void();
54045407
};
@@ -5428,7 +5431,7 @@ static int __setitem__Exiv2_ExifData_closure(
54285431

54295432

54305433
static int __contains__Exiv2_ExifData(PyObject* py_self, PyObject* py_key) {
5431-
Exiv2::ExifData* self;
5434+
Exiv2::ExifData* self = NULL;
54325435
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__ExifData, 0);
54335436
const char* key = PyUnicode_AsUTF8(py_key);
54345437
if (!key)

src/swig-0_27_7/iptc_wrap.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5171,7 +5171,7 @@ static int private_store_del(PyObject* py_self, const char* name) {
51715171

51725172

51735173
static PyObject* __str__Iptcdatum_pointer(PyObject* py_self) {
5174-
Iptcdatum_pointer* self;
5174+
Iptcdatum_pointer* self = NULL;
51755175
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Iptcdatum_pointer, 0);
51765176
std::string result = self->__str__();
51775177
return SWIG_FromCharPtrAndSize(result.data(), result.size());
@@ -5392,6 +5392,9 @@ static PyObject* __delitem__Exiv2_IptcData(
53925392
auto pos = self->findKey(Exiv2::IptcKey(key));
53935393
if (pos == self->end())
53945394
return PyErr_Format(PyExc_KeyError, "'%s'", key);
5395+
#if 0x040301 >= 0x040400
5396+
invalidate_pointers(py_self, pos);
5397+
#endif
53955398
self->erase(pos);
53965399
return SWIG_Py_Void();
53975400
};
@@ -5421,7 +5424,7 @@ static int __setitem__Exiv2_IptcData_closure(
54215424

54225425

54235426
static int __contains__Exiv2_IptcData(PyObject* py_self, PyObject* py_key) {
5424-
Exiv2::IptcData* self;
5427+
Exiv2::IptcData* self = NULL;
54255428
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__IptcData, 0);
54265429
const char* key = PyUnicode_AsUTF8(py_key);
54275430
if (!key)

src/swig-0_27_7/metadatum_wrap.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4356,7 +4356,7 @@ static std::string metadatum_str(Exiv2::Metadatum* datum) {
43564356

43574357

43584358
static PyObject* __str__Exiv2_Metadatum(PyObject* py_self) {
4359-
Exiv2::Metadatum* self;
4359+
Exiv2::Metadatum* self = NULL;
43604360
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__Metadatum, 0);
43614361
std::string result = metadatum_str(self);
43624362
return SWIG_FromCharPtrAndSize(result.data(), result.size());

src/swig-0_27_7/preview_wrap.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5414,7 +5414,7 @@ namespace swig {
54145414

54155415

54165416
static Py_ssize_t __len__Exiv2_PreviewImage(PyObject* py_self) {
5417-
Exiv2::PreviewImage* self;
5417+
Exiv2::PreviewImage* self = NULL;
54185418
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__PreviewImage, 0);
54195419
return self->size();
54205420
};

src/swig-0_27_7/types_wrap.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4565,7 +4565,7 @@ static PyObject* _get_enum_data_Exiv2_TypeId() {
45654565

45664566

45674567
static Py_ssize_t __len__Exiv2_DataBuf(PyObject* py_self) {
4568-
Exiv2::DataBuf* self;
4568+
Exiv2::DataBuf* self = NULL;
45694569
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__DataBuf, 0);
45704570
return self->DATABUF_SIZE;
45714571
};

src/swig-0_27_7/value_wrap.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4889,7 +4889,7 @@ static int __setitem__Exiv2_LangAltValue_closure(
48894889

48904890

48914891
static int __contains__Exiv2_LangAltValue(PyObject* py_self, PyObject* py_key) {
4892-
Exiv2::LangAltValue* self;
4892+
Exiv2::LangAltValue* self = NULL;
48934893
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__LangAltValue, 0);
48944894
const char* key = PyUnicode_AsUTF8(py_key);
48954895
if (!key)
@@ -5445,7 +5445,7 @@ namespace swig {
54455445

54465446

54475447
static PyObject* __str__Exiv2_Value(PyObject* py_self) {
5448-
Exiv2::Value* self;
5448+
Exiv2::Value* self = NULL;
54495449
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__Value, 0);
54505450
std::string result = self->toString();
54515451
return SWIG_FromCharPtrAndSize(result.data(), result.size());

src/swig-0_27_7/xmp_wrap.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5174,7 +5174,7 @@ static int private_store_del(PyObject* py_self, const char* name) {
51745174

51755175

51765176
static PyObject* __str__Xmpdatum_pointer(PyObject* py_self) {
5177-
Xmpdatum_pointer* self;
5177+
Xmpdatum_pointer* self = NULL;
51785178
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Xmpdatum_pointer, 0);
51795179
std::string result = self->__str__();
51805180
return SWIG_FromCharPtrAndSize(result.data(), result.size());
@@ -5395,6 +5395,9 @@ static PyObject* __delitem__Exiv2_XmpData(
53955395
auto pos = self->findKey(Exiv2::XmpKey(key));
53965396
if (pos == self->end())
53975397
return PyErr_Format(PyExc_KeyError, "'%s'", key);
5398+
#if 0x040301 >= 0x040400
5399+
invalidate_pointers(py_self, pos);
5400+
#endif
53985401
self->erase(pos);
53995402
return SWIG_Py_Void();
54005403
};
@@ -5424,7 +5427,7 @@ static int __setitem__Exiv2_XmpData_closure(
54245427

54255428

54265429
static int __contains__Exiv2_XmpData(PyObject* py_self, PyObject* py_key) {
5427-
Exiv2::XmpData* self;
5430+
Exiv2::XmpData* self = NULL;
54285431
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__XmpData, 0);
54295432
const char* key = PyUnicode_AsUTF8(py_key);
54305433
if (!key)

src/swig-0_28_7/exif_wrap.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5340,7 +5340,7 @@ SWIGINTERNINLINE PyObject*
53405340

53415341

53425342
static PyObject* __str__Exifdatum_pointer(PyObject* py_self) {
5343-
Exifdatum_pointer* self;
5343+
Exifdatum_pointer* self = NULL;
53445344
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exifdatum_pointer, 0);
53455345
std::string result = self->__str__();
53465346
return SWIG_FromCharPtrAndSize(result.data(), result.size());
@@ -5561,6 +5561,9 @@ static PyObject* __delitem__Exiv2_ExifData(
55615561
auto pos = self->findKey(Exiv2::ExifKey(key));
55625562
if (pos == self->end())
55635563
return PyErr_Format(PyExc_KeyError, "'%s'", key);
5564+
#if 0x040301 >= 0x040400
5565+
invalidate_pointers(py_self, pos);
5566+
#endif
55645567
self->erase(pos);
55655568
return SWIG_Py_Void();
55665569
};
@@ -5590,7 +5593,7 @@ static int __setitem__Exiv2_ExifData_closure(
55905593

55915594

55925595
static int __contains__Exiv2_ExifData(PyObject* py_self, PyObject* py_key) {
5593-
Exiv2::ExifData* self;
5596+
Exiv2::ExifData* self = NULL;
55945597
SWIG_ConvertPtr(py_self, (void**)&self, SWIGTYPE_p_Exiv2__ExifData, 0);
55955598
const char* key = PyUnicode_AsUTF8(py_key);
55965599
if (!key)

0 commit comments

Comments
 (0)