_CFmodule.c.patch   [plain text]


--- _CFmodule.c.orig	2007-09-12 11:29:21.000000000 -0700
+++ _CFmodule.c	2011-03-02 18:08:21.000000000 -0800
@@ -236,7 +236,7 @@ static PyObject *CFTypeRefObj_CFEqual(CF
 		return NULL;
 	_rv = CFEqual(_self->ob_itself,
 	              cf2);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("B",
 	                     _rv);
 	return _res;
 }
@@ -379,6 +379,12 @@ static PyMethodDef CFTypeRefObj_methods[
 
 #define CFTypeRefObj_getsetlist NULL
 
+#ifdef __LP64__
+#define PRN_PTRFMT	"%016lx"
+#else // !__LP64__
+#define PRN_PTRFMT	"%08lx"
+#endif // !__LP64__
+#define PRN_PTRTYPE	long
 
 static int CFTypeRefObj_compare(CFTypeRefObject *self, CFTypeRefObject *other)
 {
@@ -391,14 +397,14 @@ static int CFTypeRefObj_compare(CFTypeRe
 static PyObject * CFTypeRefObj_repr(CFTypeRefObject *self)
 {
 	char buf[100];
-	sprintf(buf, "<CFTypeRef type-%d object at 0x%8.8x for 0x%8.8x>", (int)CFGetTypeID(self->ob_itself), (unsigned)self, (unsigned)self->ob_itself);
+	sprintf(buf, "<CFTypeRef type-%d object at 0x" PRN_PTRFMT " for 0x" PRN_PTRFMT ">", (int)CFGetTypeID(self->ob_itself), (PRN_PTRTYPE)self, (PRN_PTRTYPE)self->ob_itself);
 	return PyString_FromString(buf);
 }
 
 static int CFTypeRefObj_hash(CFTypeRefObject *self)
 {
 	/* XXXX Or should we use CFHash?? */
-	return (int)self->ob_itself;
+	return (int)(long)self->ob_itself;
 }
 static int CFTypeRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
 {
@@ -595,14 +601,14 @@ static int CFArrayRefObj_compare(CFArray
 static PyObject * CFArrayRefObj_repr(CFArrayRefObject *self)
 {
 	char buf[100];
-	sprintf(buf, "<CFArrayRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+	sprintf(buf, "<CFArrayRef object at 0x" PRN_PTRFMT " for 0x" PRN_PTRFMT ">", (PRN_PTRTYPE)self, (PRN_PTRTYPE)self->ob_itself);
 	return PyString_FromString(buf);
 }
 
 static int CFArrayRefObj_hash(CFArrayRefObject *self)
 {
 	/* XXXX Or should we use CFHash?? */
-	return (int)self->ob_itself;
+	return (int)(long)self->ob_itself;
 }
 static int CFArrayRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
 {
@@ -835,14 +841,14 @@ static int CFMutableArrayRefObj_compare(
 static PyObject * CFMutableArrayRefObj_repr(CFMutableArrayRefObject *self)
 {
 	char buf[100];
-	sprintf(buf, "<CFMutableArrayRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+	sprintf(buf, "<CFMutableArrayRef object at 0x" PRN_PTRFMT " for 0x" PRN_PTRFMT ">", (PRN_PTRTYPE)self, (PRN_PTRTYPE)self->ob_itself);
 	return PyString_FromString(buf);
 }
 
 static int CFMutableArrayRefObj_hash(CFMutableArrayRefObject *self)
 {
 	/* XXXX Or should we use CFHash?? */
-	return (int)self->ob_itself;
+	return (int)(long)self->ob_itself;
 }
 static int CFMutableArrayRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
 {
@@ -1028,14 +1034,14 @@ static int CFDictionaryRefObj_compare(CF
 static PyObject * CFDictionaryRefObj_repr(CFDictionaryRefObject *self)
 {
 	char buf[100];
-	sprintf(buf, "<CFDictionaryRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+	sprintf(buf, "<CFDictionaryRef object at 0x" PRN_PTRFMT " for 0x" PRN_PTRFMT ">", (PRN_PTRTYPE)self, (PRN_PTRTYPE)self->ob_itself);
 	return PyString_FromString(buf);
 }
 
 static int CFDictionaryRefObj_hash(CFDictionaryRefObject *self)
 {
 	/* XXXX Or should we use CFHash?? */
-	return (int)self->ob_itself;
+	return (int)(long)self->ob_itself;
 }
 static int CFDictionaryRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
 {
@@ -1205,14 +1211,14 @@ static int CFMutableDictionaryRefObj_com
 static PyObject * CFMutableDictionaryRefObj_repr(CFMutableDictionaryRefObject *self)
 {
 	char buf[100];
-	sprintf(buf, "<CFMutableDictionaryRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+	sprintf(buf, "<CFMutableDictionaryRef object at 0x" PRN_PTRFMT " for 0x" PRN_PTRFMT ">", (PRN_PTRTYPE)self, (PRN_PTRTYPE)self->ob_itself);
 	return PyString_FromString(buf);
 }
 
 static int CFMutableDictionaryRefObj_hash(CFMutableDictionaryRefObject *self)
 {
 	/* XXXX Or should we use CFHash?? */
-	return (int)self->ob_itself;
+	return (int)(long)self->ob_itself;
 }
 static int CFMutableDictionaryRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
 {
@@ -1387,7 +1393,7 @@ static PyObject *CFDataRefObj_CFStringCr
 	PyObject *_res = NULL;
 	CFStringRef _rv;
 	CFStringEncoding encoding;
-	if (!PyArg_ParseTuple(_args, "l",
+	if (!PyArg_ParseTuple(_args, "I",
 	                      &encoding))
 		return NULL;
 	_rv = CFStringCreateFromExternalRepresentation((CFAllocatorRef)NULL,
@@ -1402,7 +1408,7 @@ static PyObject *CFDataRefObj_CFDataGetD
 {
 	PyObject *_res = NULL;
 
-	int size = CFDataGetLength(_self->ob_itself);
+	int size = (int)CFDataGetLength(_self->ob_itself);
 	char *data = (char *)CFDataGetBytePtr(_self->ob_itself);
 
 	_res = (PyObject *)PyString_FromStringAndSize(data, size);
@@ -1436,14 +1442,14 @@ static int CFDataRefObj_compare(CFDataRe
 static PyObject * CFDataRefObj_repr(CFDataRefObject *self)
 {
 	char buf[100];
-	sprintf(buf, "<CFDataRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+	sprintf(buf, "<CFDataRef object at 0x" PRN_PTRFMT " for 0x" PRN_PTRFMT ">", (PRN_PTRTYPE)self, (PRN_PTRTYPE)self->ob_itself);
 	return PyString_FromString(buf);
 }
 
 static int CFDataRefObj_hash(CFDataRefObject *self)
 {
 	/* XXXX Or should we use CFHash?? */
-	return (int)self->ob_itself;
+	return (int)(long)self->ob_itself;
 }
 static int CFDataRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
 {
@@ -1701,14 +1707,14 @@ static int CFMutableDataRefObj_compare(C
 static PyObject * CFMutableDataRefObj_repr(CFMutableDataRefObject *self)
 {
 	char buf[100];
-	sprintf(buf, "<CFMutableDataRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+	sprintf(buf, "<CFMutableDataRef object at 0x" PRN_PTRFMT " for 0x" PRN_PTRFMT ">", (PRN_PTRTYPE)self, (PRN_PTRTYPE)self->ob_itself);
 	return PyString_FromString(buf);
 }
 
 static int CFMutableDataRefObj_hash(CFMutableDataRefObject *self)
 {
 	/* XXXX Or should we use CFHash?? */
-	return (int)self->ob_itself;
+	return (int)(long)self->ob_itself;
 }
 static int CFMutableDataRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
 {
@@ -1918,7 +1924,7 @@ static PyObject *CFStringRefObj_CFString
 #ifndef CFStringGetBytes
 	PyMac_PRECHECK(CFStringGetBytes);
 #endif
-	if (!PyArg_ParseTuple(_args, "O&lbll",
+	if (!PyArg_ParseTuple(_args, "O&IBBl",
 	                      CFRange_Convert, &range,
 	                      &encoding,
 	                      &lossByte,
@@ -1933,7 +1939,7 @@ static PyObject *CFStringRefObj_CFString
 	                       &buffer,
 	                       maxBufLen,
 	                       &usedBufLen);
-	_res = Py_BuildValue("lbl",
+	_res = Py_BuildValue("lBl",
 	                     _rv,
 	                     buffer,
 	                     usedBufLen);
@@ -1946,7 +1952,7 @@ static PyObject *CFStringRefObj_CFString
 	CFDataRef _rv;
 	CFStringEncoding encoding;
 	UInt8 lossByte;
-	if (!PyArg_ParseTuple(_args, "lb",
+	if (!PyArg_ParseTuple(_args, "IB",
 	                      &encoding,
 	                      &lossByte))
 		return NULL;
@@ -1969,7 +1975,7 @@ static PyObject *CFStringRefObj_CFString
 	if (!PyArg_ParseTuple(_args, ""))
 		return NULL;
 	_rv = CFStringGetSmallestEncoding(_self->ob_itself);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("I",
 	                     _rv);
 	return _res;
 }
@@ -1984,7 +1990,7 @@ static PyObject *CFStringRefObj_CFString
 	if (!PyArg_ParseTuple(_args, ""))
 		return NULL;
 	_rv = CFStringGetFastestEncoding(_self->ob_itself);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("I",
 	                     _rv);
 	return _res;
 }
@@ -2055,7 +2061,7 @@ static PyObject *CFStringRefObj_CFString
 	                              rangeToSearch,
 	                              searchOptions,
 	                              &result);
-	_res = Py_BuildValue("lO&",
+	_res = Py_BuildValue("BO&",
 	                     _rv,
 	                     CFRange_New, result);
 	return _res;
@@ -2117,7 +2123,7 @@ static PyObject *CFStringRefObj_CFString
 		return NULL;
 	_rv = CFStringHasPrefix(_self->ob_itself,
 	                        prefix);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("B",
 	                     _rv);
 	return _res;
 }
@@ -2135,7 +2141,7 @@ static PyObject *CFStringRefObj_CFString
 		return NULL;
 	_rv = CFStringHasSuffix(_self->ob_itself,
 	                        suffix);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("B",
 	                     _rv);
 	return _res;
 }
@@ -2221,7 +2227,7 @@ static PyObject *CFStringRefObj_CFString
 	if (!PyArg_ParseTuple(_args, ""))
 		return NULL;
 	_rv = CFStringConvertIANACharSetNameToEncoding(_self->ob_itself);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("I",
 	                     _rv);
 	return _res;
 }
@@ -2262,7 +2268,7 @@ static PyObject *CFStringRefObj_CFURLCre
 	CFURLRef _rv;
 	CFURLPathStyle pathStyle;
 	Boolean isDirectory;
-	if (!PyArg_ParseTuple(_args, "ll",
+	if (!PyArg_ParseTuple(_args, "lB",
 	                      &pathStyle,
 	                      &isDirectory))
 		return NULL;
@@ -2282,7 +2288,7 @@ static PyObject *CFStringRefObj_CFURLCre
 	CFURLPathStyle pathStyle;
 	Boolean isDirectory;
 	CFURLRef baseURL;
-	if (!PyArg_ParseTuple(_args, "llO&",
+	if (!PyArg_ParseTuple(_args, "lBO&",
 	                      &pathStyle,
 	                      &isDirectory,
 	                      OptionalCFURLRefObj_Convert, &baseURL))
@@ -2320,7 +2326,7 @@ static PyObject *CFStringRefObj_CFURLCre
 	CFStringRef charactersToLeaveUnescaped;
 	CFStringRef legalURLCharactersToBeEscaped;
 	CFStringEncoding encoding;
-	if (!PyArg_ParseTuple(_args, "O&O&l",
+	if (!PyArg_ParseTuple(_args, "O&O&I",
 	                      CFStringRefObj_Convert, &charactersToLeaveUnescaped,
 	                      CFStringRefObj_Convert, &legalURLCharactersToBeEscaped,
 	                      &encoding))
@@ -2339,7 +2345,7 @@ static PyObject *CFStringRefObj_CFString
 {
 	PyObject *_res = NULL;
 
-	int size = CFStringGetLength(_self->ob_itself)+1;
+	int size = (int)CFStringGetLength(_self->ob_itself)+1;
 	char *data = malloc(size);
 
 	if( data == NULL ) return PyErr_NoMemory();
@@ -2358,7 +2364,7 @@ static PyObject *CFStringRefObj_CFString
 {
 	PyObject *_res = NULL;
 
-	int size = CFStringGetLength(_self->ob_itself)+1;
+	int size = (int)CFStringGetLength(_self->ob_itself)+1;
 	Py_UNICODE *data = malloc(size*sizeof(Py_UNICODE));
 	CFRange range;
 
@@ -2444,14 +2450,14 @@ static int CFStringRefObj_compare(CFStri
 static PyObject * CFStringRefObj_repr(CFStringRefObject *self)
 {
 	char buf[100];
-	sprintf(buf, "<CFStringRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+	sprintf(buf, "<CFStringRef object at 0x" PRN_PTRFMT " for 0x" PRN_PTRFMT ">", (PRN_PTRTYPE)self, (PRN_PTRTYPE)self->ob_itself);
 	return PyString_FromString(buf);
 }
 
 static int CFStringRefObj_hash(CFStringRefObject *self)
 {
 	/* XXXX Or should we use CFHash?? */
-	return (int)self->ob_itself;
+	return (int)(long)self->ob_itself;
 }
 static int CFStringRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
 {
@@ -2632,7 +2638,7 @@ static PyObject *CFMutableStringRefObj_C
 #ifndef CFStringAppendPascalString
 	PyMac_PRECHECK(CFStringAppendPascalString);
 #endif
-	if (!PyArg_ParseTuple(_args, "O&l",
+	if (!PyArg_ParseTuple(_args, "O&I",
 	                      PyMac_GetStr255, pStr,
 	                      &encoding))
 		return NULL;
@@ -2652,7 +2658,7 @@ static PyObject *CFMutableStringRefObj_C
 #ifndef CFStringAppendCString
 	PyMac_PRECHECK(CFStringAppendCString);
 #endif
-	if (!PyArg_ParseTuple(_args, "sl",
+	if (!PyArg_ParseTuple(_args, "sI",
 	                      &cStr,
 	                      &encoding))
 		return NULL;
@@ -2832,14 +2838,14 @@ static int CFMutableStringRefObj_compare
 static PyObject * CFMutableStringRefObj_repr(CFMutableStringRefObject *self)
 {
 	char buf[100];
-	sprintf(buf, "<CFMutableStringRef object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+	sprintf(buf, "<CFMutableStringRef object at 0x" PRN_PTRFMT " for 0x" PRN_PTRFMT ">", (PRN_PTRTYPE)self, (PRN_PTRTYPE)self->ob_itself);
 	return PyString_FromString(buf);
 }
 
 static int CFMutableStringRefObj_hash(CFMutableStringRefObject *self)
 {
 	/* XXXX Or should we use CFHash?? */
-	return (int)self->ob_itself;
+	return (int)(long)self->ob_itself;
 }
 static int CFMutableStringRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
 {
@@ -2981,7 +2987,7 @@ static PyObject *CFURLRefObj_CFURLCreate
 	CFDataRef _rv;
 	CFStringEncoding encoding;
 	Boolean escapeWhitespace;
-	if (!PyArg_ParseTuple(_args, "ll",
+	if (!PyArg_ParseTuple(_args, "IB",
 	                      &encoding,
 	                      &escapeWhitespace))
 		return NULL;
@@ -3004,7 +3010,7 @@ static PyObject *CFURLRefObj_CFURLGetFil
 #ifndef CFURLGetFileSystemRepresentation
 	PyMac_PRECHECK(CFURLGetFileSystemRepresentation);
 #endif
-	if (!PyArg_ParseTuple(_args, "ll",
+	if (!PyArg_ParseTuple(_args, "Bl",
 	                      &resolveAgainstBase,
 	                      &maxBufLen))
 		return NULL;
@@ -3012,7 +3018,7 @@ static PyObject *CFURLRefObj_CFURLGetFil
 	                                       resolveAgainstBase,
 	                                       &buffer,
 	                                       maxBufLen);
-	_res = Py_BuildValue("lb",
+	_res = Py_BuildValue("BB",
 	                     _rv,
 	                     buffer);
 	return _res;
@@ -3073,7 +3079,7 @@ static PyObject *CFURLRefObj_CFURLCanBeD
 	if (!PyArg_ParseTuple(_args, ""))
 		return NULL;
 	_rv = CFURLCanBeDecomposed(_self->ob_itself);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("B",
 	                     _rv);
 	return _res;
 }
@@ -3135,7 +3141,7 @@ static PyObject *CFURLRefObj_CFURLCopySt
 		return NULL;
 	_rv = CFURLCopyStrictPath(_self->ob_itself,
 	                          &isAbsolute);
-	_res = Py_BuildValue("O&l",
+	_res = Py_BuildValue("O&B",
 	                     CFStringRefObj_New, _rv,
 	                     isAbsolute);
 	return _res;
@@ -3169,7 +3175,7 @@ static PyObject *CFURLRefObj_CFURLHasDir
 	if (!PyArg_ParseTuple(_args, ""))
 		return NULL;
 	_rv = CFURLHasDirectoryPath(_self->ob_itself);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("B",
 	                     _rv);
 	return _res;
 }
@@ -3339,7 +3345,7 @@ static PyObject *CFURLRefObj_CFURLCreate
 	CFURLRef _rv;
 	CFStringRef pathComponent;
 	Boolean isDirectory;
-	if (!PyArg_ParseTuple(_args, "O&l",
+	if (!PyArg_ParseTuple(_args, "O&B",
 	                      CFStringRefObj_Convert, &pathComponent,
 	                      &isDirectory))
 		return NULL;
@@ -3406,7 +3412,7 @@ static PyObject *CFURLRefObj_CFURLGetFSR
 		return NULL;
 	_rv = CFURLGetFSRef(_self->ob_itself,
 	                    &fsRef);
-	_res = Py_BuildValue("lO&",
+	_res = Py_BuildValue("BO&",
 	                     _rv,
 	                     PyMac_BuildFSRef, &fsRef);
 	return _res;
@@ -3484,14 +3490,14 @@ static int CFURLRefObj_compare(CFURLRefO
 static PyObject * CFURLRefObj_repr(CFURLRefObject *self)
 {
 	char buf[100];
-	sprintf(buf, "<CFURL object at 0x%8.8x for 0x%8.8x>", (unsigned)self, (unsigned)self->ob_itself);
+	sprintf(buf, "<CFURL object at 0x" PRN_PTRFMT " for 0x" PRN_PTRFMT ">", (PRN_PTRTYPE)self, (PRN_PTRTYPE)self->ob_itself);
 	return PyString_FromString(buf);
 }
 
 static int CFURLRefObj_hash(CFURLRefObject *self)
 {
 	/* XXXX Or should we use CFHash?? */
-	return (int)self->ob_itself;
+	return (int)(long)self->ob_itself;
 }
 static int CFURLRefObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
 {
@@ -3892,7 +3898,7 @@ static PyObject *CF_CFPreferencesGetAppB
 	_rv = CFPreferencesGetAppBooleanValue(key,
 	                                      applicationID,
 	                                      &keyExistsAndHasValidFormat);
-	_res = Py_BuildValue("ll",
+	_res = Py_BuildValue("BB",
 	                     _rv,
 	                     keyExistsAndHasValidFormat);
 	return _res;
@@ -3915,7 +3921,7 @@ static PyObject *CF_CFPreferencesGetAppI
 	_rv = CFPreferencesGetAppIntegerValue(key,
 	                                      applicationID,
 	                                      &keyExistsAndHasValidFormat);
-	_res = Py_BuildValue("ll",
+	_res = Py_BuildValue("lB",
 	                     _rv,
 	                     keyExistsAndHasValidFormat);
 	return _res;
@@ -3993,7 +3999,7 @@ static PyObject *CF_CFPreferencesAppSync
 	                      CFStringRefObj_Convert, &applicationID))
 		return NULL;
 	_rv = CFPreferencesAppSynchronize(applicationID);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("B",
 	                     _rv);
 	return _res;
 }
@@ -4124,7 +4130,7 @@ static PyObject *CF_CFPreferencesSynchro
 	_rv = CFPreferencesSynchronize(applicationID,
 	                               userName,
 	                               hostName);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("B",
 	                     _rv);
 	return _res;
 }
@@ -4196,7 +4202,7 @@ static PyObject *CF_CFStringCreateWithPa
 #ifndef CFStringCreateWithPascalString
 	PyMac_PRECHECK(CFStringCreateWithPascalString);
 #endif
-	if (!PyArg_ParseTuple(_args, "O&l",
+	if (!PyArg_ParseTuple(_args, "O&I",
 	                      PyMac_GetStr255, pStr,
 	                      &encoding))
 		return NULL;
@@ -4217,7 +4223,7 @@ static PyObject *CF_CFStringCreateWithCS
 #ifndef CFStringCreateWithCString
 	PyMac_PRECHECK(CFStringCreateWithCString);
 #endif
-	if (!PyArg_ParseTuple(_args, "sl",
+	if (!PyArg_ParseTuple(_args, "sI",
 	                      &cStr,
 	                      &encoding))
 		return NULL;
@@ -4259,7 +4265,7 @@ static PyObject *CF_CFStringCreateWithPa
 #ifndef CFStringCreateWithPascalStringNoCopy
 	PyMac_PRECHECK(CFStringCreateWithPascalStringNoCopy);
 #endif
-	if (!PyArg_ParseTuple(_args, "O&l",
+	if (!PyArg_ParseTuple(_args, "O&I",
 	                      PyMac_GetStr255, pStr,
 	                      &encoding))
 		return NULL;
@@ -4281,7 +4287,7 @@ static PyObject *CF_CFStringCreateWithCS
 #ifndef CFStringCreateWithCStringNoCopy
 	PyMac_PRECHECK(CFStringCreateWithCStringNoCopy);
 #endif
-	if (!PyArg_ParseTuple(_args, "sl",
+	if (!PyArg_ParseTuple(_args, "sI",
 	                      &cStr,
 	                      &encoding))
 		return NULL;
@@ -4367,7 +4373,7 @@ static PyObject *CF_CFStringCreateWithBy
 #ifndef CFStringCreateWithBytes
 	PyMac_PRECHECK(CFStringCreateWithBytes);
 #endif
-	if (!PyArg_ParseTuple(_args, "s#ll",
+	if (!PyArg_ParseTuple(_args, "s#IB",
 	                      &bytes__in__, &bytes__in_len__,
 	                      &encoding,
 	                      &isExternalRepresentation))
@@ -4392,7 +4398,7 @@ static PyObject *CF_CFStringGetSystemEnc
 	if (!PyArg_ParseTuple(_args, ""))
 		return NULL;
 	_rv = CFStringGetSystemEncoding();
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("I",
 	                     _rv);
 	return _res;
 }
@@ -4406,7 +4412,7 @@ static PyObject *CF_CFStringGetMaximumSi
 #ifndef CFStringGetMaximumSizeForEncoding
 	PyMac_PRECHECK(CFStringGetMaximumSizeForEncoding);
 #endif
-	if (!PyArg_ParseTuple(_args, "ll",
+	if (!PyArg_ParseTuple(_args, "lI",
 	                      &length,
 	                      &encoding))
 		return NULL;
@@ -4425,11 +4431,11 @@ static PyObject *CF_CFStringIsEncodingAv
 #ifndef CFStringIsEncodingAvailable
 	PyMac_PRECHECK(CFStringIsEncodingAvailable);
 #endif
-	if (!PyArg_ParseTuple(_args, "l",
+	if (!PyArg_ParseTuple(_args, "I",
 	                      &encoding))
 		return NULL;
 	_rv = CFStringIsEncodingAvailable(encoding);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("B",
 	                     _rv);
 	return _res;
 }
@@ -4442,7 +4448,7 @@ static PyObject *CF_CFStringGetNameOfEnc
 #ifndef CFStringGetNameOfEncoding
 	PyMac_PRECHECK(CFStringGetNameOfEncoding);
 #endif
-	if (!PyArg_ParseTuple(_args, "l",
+	if (!PyArg_ParseTuple(_args, "I",
 	                      &encoding))
 		return NULL;
 	_rv = CFStringGetNameOfEncoding(encoding);
@@ -4459,11 +4465,11 @@ static PyObject *CF_CFStringConvertEncod
 #ifndef CFStringConvertEncodingToNSStringEncoding
 	PyMac_PRECHECK(CFStringConvertEncodingToNSStringEncoding);
 #endif
-	if (!PyArg_ParseTuple(_args, "l",
+	if (!PyArg_ParseTuple(_args, "I",
 	                      &encoding))
 		return NULL;
-	_rv = CFStringConvertEncodingToNSStringEncoding(encoding);
-	_res = Py_BuildValue("l",
+	_rv = (UInt32)CFStringConvertEncodingToNSStringEncoding(encoding);
+	_res = Py_BuildValue("I",
 	                     _rv);
 	return _res;
 }
@@ -4476,7 +4482,7 @@ static PyObject *CF_CFStringConvertNSStr
 #ifndef CFStringConvertNSStringEncodingToEncoding
 	PyMac_PRECHECK(CFStringConvertNSStringEncodingToEncoding);
 #endif
-	if (!PyArg_ParseTuple(_args, "l",
+	if (!PyArg_ParseTuple(_args, "I",
 	                      &encoding))
 		return NULL;
 	_rv = CFStringConvertNSStringEncodingToEncoding(encoding);
@@ -4493,11 +4499,11 @@ static PyObject *CF_CFStringConvertEncod
 #ifndef CFStringConvertEncodingToWindowsCodepage
 	PyMac_PRECHECK(CFStringConvertEncodingToWindowsCodepage);
 #endif
-	if (!PyArg_ParseTuple(_args, "l",
+	if (!PyArg_ParseTuple(_args, "I",
 	                      &encoding))
 		return NULL;
 	_rv = CFStringConvertEncodingToWindowsCodepage(encoding);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("I",
 	                     _rv);
 	return _res;
 }
@@ -4510,11 +4516,11 @@ static PyObject *CF_CFStringConvertWindo
 #ifndef CFStringConvertWindowsCodepageToEncoding
 	PyMac_PRECHECK(CFStringConvertWindowsCodepageToEncoding);
 #endif
-	if (!PyArg_ParseTuple(_args, "l",
+	if (!PyArg_ParseTuple(_args, "I",
 	                      &codepage))
 		return NULL;
 	_rv = CFStringConvertWindowsCodepageToEncoding(codepage);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("I",
 	                     _rv);
 	return _res;
 }
@@ -4527,7 +4533,7 @@ static PyObject *CF_CFStringConvertEncod
 #ifndef CFStringConvertEncodingToIANACharSetName
 	PyMac_PRECHECK(CFStringConvertEncodingToIANACharSetName);
 #endif
-	if (!PyArg_ParseTuple(_args, "l",
+	if (!PyArg_ParseTuple(_args, "I",
 	                      &encoding))
 		return NULL;
 	_rv = CFStringConvertEncodingToIANACharSetName(encoding);
@@ -4548,7 +4554,7 @@ static PyObject *CF_CFStringGetMostCompa
 	                      &encoding))
 		return NULL;
 	_rv = CFStringGetMostCompatibleMacStringEncoding(encoding);
-	_res = Py_BuildValue("l",
+	_res = Py_BuildValue("I",
 	                     _rv);
 	return _res;
 }
@@ -4597,7 +4603,7 @@ static PyObject *CF_CFURLCreateWithBytes
 #ifndef CFURLCreateWithBytes
 	PyMac_PRECHECK(CFURLCreateWithBytes);
 #endif
-	if (!PyArg_ParseTuple(_args, "s#lO&",
+	if (!PyArg_ParseTuple(_args, "s#IO&",
 	                      &URLBytes__in__, &URLBytes__in_len__,
 	                      &encoding,
 	                      OptionalCFURLRefObj_Convert, &baseURL))
@@ -4623,7 +4629,7 @@ static PyObject *CF_CFURLCreateFromFileS
 #ifndef CFURLCreateFromFileSystemRepresentation
 	PyMac_PRECHECK(CFURLCreateFromFileSystemRepresentation);
 #endif
-	if (!PyArg_ParseTuple(_args, "s#l",
+	if (!PyArg_ParseTuple(_args, "s#B",
 	                      &buffer__in__, &buffer__in_len__,
 	                      &isDirectory))
 		return NULL;
@@ -4648,7 +4654,7 @@ static PyObject *CF_CFURLCreateFromFileS
 #ifndef CFURLCreateFromFileSystemRepresentationRelativeToBase
 	PyMac_PRECHECK(CFURLCreateFromFileSystemRepresentationRelativeToBase);
 #endif
-	if (!PyArg_ParseTuple(_args, "s#lO&",
+	if (!PyArg_ParseTuple(_args, "s#BO&",
 	                      &buffer__in__, &buffer__in_len__,
 	                      &isDirectory,
 	                      OptionalCFURLRefObj_Convert, &baseURL))