more on the TypeQuery fix

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7971 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-12-10 23:53:53 +00:00
commit ea47af15fe
6 changed files with 81 additions and 36 deletions

View file

@ -39,13 +39,15 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
if (psize) *psize = len + 1;
return SWIG_OK;
} else {
char* vptr = 0;
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
if (pchar_descriptor && (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK)) {
if (cptr) *cptr = vptr;
if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
if (alloc) *alloc = SWIG_OLDOBJ;
return SWIG_OK;
if (pchar_descriptor) {
char* vptr = 0;
if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
if (cptr) *cptr = vptr;
if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
if (alloc) *alloc = SWIG_OLDOBJ;
return SWIG_OK;
}
}
}
return SWIG_TypeError;

View file

@ -27,11 +27,13 @@ SWIG_AsWCharPtrAndSize(PyObject *obj, wchar_t **cptr, size_t *psize, int *alloc)
return SWIG_OK;
} else {
swig_type_info* pwchar_descriptor = SWIG_pwchar_descriptor();
wchar_t * vptr = 0;
if (pwchar_descriptor && (SWIG_ConvertPtr(obj, (void**)&vptr, pwchar_descriptor, 0) == SWIG_OK)) {
if (cptr) *cptr = vptr;
if (psize) *psize = vptr ? (wcslen(vptr) + 1) : 0;
return SWIG_OK;
if (pwchar_descriptor) {
wchar_t * vptr = 0;
if (SWIG_ConvertPtr(obj, (void**)&vptr, pwchar_descriptor, 0) == SWIG_OK) {
if (cptr) *cptr = vptr;
if (psize) *psize = vptr ? (wcslen(vptr) + 1) : 0;
return SWIG_OK;
}
}
}
return SWIG_TypeError;