From f024183520d3d6299082b7abfea6513b9d6fd005 Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Thu, 29 May 2003 18:28:46 +0000 Subject: [PATCH] Fixes to default typemap handling of arrays. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4833 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Swig/typemap.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/SWIG/Source/Swig/typemap.c b/SWIG/Source/Swig/typemap.c index dfbb5ff98..e6c58e8ae 100644 --- a/SWIG/Source/Swig/typemap.c +++ b/SWIG/Source/Swig/typemap.c @@ -577,20 +577,26 @@ Swig_typemap_search(const String_or_char *op, SwigType *type, String_or_char *na } /* Hmmm. Well, no match seems to be found at all. See if there is some kind of default mapping */ - if (!primitive) { - primitive = SwigType_default(type); - } - tm = Getattr(typemaps[ts],primitive); - if (tm && cname) { - tm1 = Getattr(tm,cname); - if (tm1) { - result = Getattr(tm1,tmop); /* See if there is a type-name match */ + + primitive = SwigType_default(type); + while (primitive) { + tm = Getattr(typemaps[ts],primitive); + if (tm && cname) { + tm1 = Getattr(tm,cname); + if (tm1) { + result = Getattr(tm1,tmop); /* See if there is a type-name match */ + if (result) goto ret_result; + } + } + if (tm) { /* See if there is simply a type match */ + result = Getattr(tm,tmop); if (result) goto ret_result; } - } - if (tm) { /* See if there is simply a type match */ - result = Getattr(tm,tmop); - if (result) goto ret_result; + { + SwigType *nprim = SwigType_default(primitive); + Delete(primitive); + primitive = nprim; + } } if (ctype != type) { Delete(ctype); ctype = 0; } ts--; /* Hmmm. Nothing found in this scope. Guess we'll go try another scope */