[Python-checkins] python/dist/src/Mac/Modules/cf _CFmodule.c,1.20,1.20.2.1

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Fri, 18 Apr 2003 01:59:07 -0700


Update of /cvsroot/python/python/dist/src/Mac/Modules/cf
In directory sc8-pr-cvs1:/tmp/cvs-serv28363/Mac/Modules/cf

Modified Files:
      Tag: getargs_mask_mods
	_CFmodule.c 
Log Message:
Fixes for the new PyArg_ParseTuple k and K format chars, and the
changed semantics of h. Only lightly tested, but the IDE works
again.

These changes may not be needed anymore now that the semantic change
to h has been reverted, so I'm checking it in on a branch.


Index: _CFmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/_CFmodule.c,v
retrieving revision 1.20
retrieving revision 1.20.2.1
diff -C2 -d -r1.20 -r1.20.2.1
*** _CFmodule.c	3 Mar 2003 13:12:58 -0000	1.20
--- _CFmodule.c	18 Apr 2003 08:58:34 -0000	1.20.2.1
***************
*** 1458,1462 ****
  	if (v == Py_None) { *p_itself = NULL; return 1; }
  	if (PyString_Check(v)) {
! 	    char *cStr = PyString_AsString(v);
  		*p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII);
  		return 1;
--- 1458,1464 ----
  	if (v == Py_None) { *p_itself = NULL; return 1; }
  	if (PyString_Check(v)) {
! 	    char *cStr;
! 	    if (!PyArg_Parse(v, "es", "ascii", &cStr))
! 	    	return NULL;
  		*p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII);
  		return 1;
***************
*** 3931,3935 ****
  		return NULL;
  	_rv = CFStringConvertEncodingToNSStringEncoding(encoding);
! 	_res = Py_BuildValue("l",
  	                     _rv);
  	return _res;
--- 3933,3937 ----
  		return NULL;
  	_rv = CFStringConvertEncodingToNSStringEncoding(encoding);
! 	_res = Py_BuildValue("k",
  	                     _rv);
  	return _res;
***************
*** 3944,3948 ****
  	PyMac_PRECHECK(CFStringConvertNSStringEncodingToEncoding);
  #endif
! 	if (!PyArg_ParseTuple(_args, "l",
  	                      &encoding))
  		return NULL;
--- 3946,3950 ----
  	PyMac_PRECHECK(CFStringConvertNSStringEncodingToEncoding);
  #endif
! 	if (!PyArg_ParseTuple(_args, "k",
  	                      &encoding))
  		return NULL;
***************
*** 3965,3969 ****
  		return NULL;
  	_rv = CFStringConvertEncodingToWindowsCodepage(encoding);
! 	_res = Py_BuildValue("l",
  	                     _rv);
  	return _res;
--- 3967,3971 ----
  		return NULL;
  	_rv = CFStringConvertEncodingToWindowsCodepage(encoding);
! 	_res = Py_BuildValue("k",
  	                     _rv);
  	return _res;
***************
*** 3978,3982 ****
  	PyMac_PRECHECK(CFStringConvertWindowsCodepageToEncoding);
  #endif
! 	if (!PyArg_ParseTuple(_args, "l",
  	                      &codepage))
  		return NULL;
--- 3980,3984 ----
  	PyMac_PRECHECK(CFStringConvertWindowsCodepageToEncoding);
  #endif
! 	if (!PyArg_ParseTuple(_args, "k",
  	                      &codepage))
  		return NULL;