From: Jack Jansen Date: Wed, 8 May 2002 22:13:51 +0000 (+0000) Subject: Fixed string and dict conversion, and implemented booleans and numbers (int and float... X-Git-Tag: v2.3c1~5701 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=42251323b4d0a25b2b0a5697d6ee2cdc60427a12;p=python Fixed string and dict conversion, and implemented booleans and numbers (int and float). I think we now have enough CFType support to start on plists and CFpreferences! Transparent handling of unknown CFType objects still TBD. --- diff --git a/Mac/Modules/cf/pycfbridge.c b/Mac/Modules/cf/pycfbridge.c index a44c404120..1b7d7c5950 100644 --- a/Mac/Modules/cf/pycfbridge.c +++ b/Mac/Modules/cf/pycfbridge.c @@ -4,6 +4,7 @@ #ifdef WITHOUT_FRAMEWORKS #include +#include #include #include #include @@ -66,25 +67,30 @@ err: PyObject * PyCF_CF2Python_mapping(CFTypeRef src) { int size = CFDictionaryGetCount(src); - PyObject *rv; - CFTypeRef *allkeys, *allvalues; + PyObject *rv = NULL; + CFTypeRef *allkeys = NULL, *allvalues = NULL; CFTypeRef key_cf, value_cf; PyObject *key_py = NULL, *value_py = NULL; int i; allkeys = malloc(size*sizeof(CFTypeRef *)); - if (allkeys == NULL) return PyErr_NoMemory(); + if (allkeys == NULL) { + PyErr_NoMemory(); + goto err; + } allvalues = malloc(size*sizeof(CFTypeRef *)); - if (allvalues == NULL) return PyErr_NoMemory(); - if ( (rv=PyDict_New()) == NULL ) - return NULL; + if (allvalues == NULL) { + PyErr_NoMemory(); + goto err; + } + if ( (rv=PyDict_New()) == NULL ) goto err; CFDictionaryGetKeysAndValues(src, allkeys, allvalues); for(i=0; iob_type->tp_name);