reduce the aliasing warnings (when compiling with CFLAGS='-O2 -Wstrict-aliasing=2') to the minimum, ie, enums and pointer to functions

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8885 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-02-23 22:24:30 +00:00
commit b92bf84691

View file

@ -24,10 +24,10 @@ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
} else {
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
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;
void* vptr = 0;
if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
if (cptr) *cptr = (char *)vptr;
if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
if (alloc) *alloc = SWIG_OLDOBJ;
return SWIG_OK;
}