[Python-checkins] CVS: python/dist/src/Mac/Modules macfsmodule.c,1.44,1.45 macosmodule.c,1.56,1.57

Jack Jansen jackjansen@users.sourceforge.net
2001年9月10日 15:00:41 -0700


Update of /cvsroot/python/python/dist/src/Mac/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv10457/Mac/Modules
Modified Files:
	macfsmodule.c macosmodule.c 
Log Message:
Replaced PyMac_FullPath by PyMac_FullPathname, which has an extra 'length'
parameter for the return string (as unix pathnames are not limited
by the 255 char pstring limit).
Implemented the function for MachO-Python, where it returns unix pathnames.
Index: macfsmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macfsmodule.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** macfsmodule.c	2001年09月02日 00:09:35	1.44
--- macfsmodule.c	2001年09月10日 22:00:39	1.45
***************
*** 52,55 ****
--- 52,61 ----
 static PyObject *ErrorObject;
 
+ #ifdef TARGET_API_MAC_OSX
+ #define PATHNAMELEN 1024
+ #else
+ #define PATHNAMELEN 256
+ #endif
+ 
 /* ----------------------------------------------------- */
 /* Declarations for objects of type Alias */
***************
*** 450,463 ****
 mfss_as_pathname(mfssobject *self, PyObject *args)
 {
! #if TARGET_API_MAC_OSX
! 	PyErr_SetString(PyExc_NotImplementedError, "FSSpec.as_pathname not supported on this platform");
! 	return 0;
! #else
! 	char strbuf[257];
 	OSErr err;
 
 	if (!PyArg_ParseTuple(args, ""))
 		return NULL;
! 	err = PyMac_GetFullPath(&self->fsspec, strbuf);
 	if ( err ) {
 		PyErr_Mac(ErrorObject, err);
--- 456,465 ----
 mfss_as_pathname(mfssobject *self, PyObject *args)
 {
! 	char strbuf[PATHNAMELEN];
 	OSErr err;
 
 	if (!PyArg_ParseTuple(args, ""))
 		return NULL;
! 	err = PyMac_GetFullPathname(&self->fsspec, strbuf, PATHNAMELEN);
 	if ( err ) {
 		PyErr_Mac(ErrorObject, err);
***************
*** 465,469 ****
 	}
 	return PyString_FromString(strbuf);
- #endif
 }
 
--- 467,470 ----
Index: macosmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macosmodule.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** macosmodule.c	2001年08月08日 13:46:49	1.56
--- macosmodule.c	2001年09月10日 22:00:39	1.57
***************
*** 41,44 ****
--- 41,50 ----
 static PyObject *MacOS_Error; /* Exception MacOS.Error */
 
+ #ifdef TARGET_API_MAC_OSX
+ #define PATHNAMELEN 1024
+ #else
+ #define PATHNAMELEN 256
+ #endif
+ 
 #ifdef MPW
 #define bufferIsSmall -607	/*error returns from Post and Accept */
***************
*** 597,601 ****
 	err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
 	
- #if !TARGET_API_MAC_OSX
 	if ( err == fnfErr ) {
 		/* In stead of doing complicated things here to get creator/type
--- 603,606 ----
***************
*** 603,609 ****
 		*/
 		FILE *tfp;
! 		char pathname[257];
 		
! 		if ( err=PyMac_GetFullPath(&fss, pathname) ) {
 			PyMac_Error(err);
 			Py_DECREF(fp);
--- 608,614 ----
 		*/
 		FILE *tfp;
! 		char pathname[PATHNAMELEN];
 		
! 		if ( err=PyMac_GetFullPathname(&fss, pathname, PATHNAMELEN) ) {
 			PyMac_Error(err);
 			Py_DECREF(fp);
***************
*** 619,623 ****
 		err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
 	}
- #endif
 	if ( err ) {
 		Py_DECREF(fp);
--- 624,627 ----

AltStyle によって変換されたページ (->オリジナル) /