summaryrefslogtreecommitdiffstats
path: root/Mac/Modules
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-09-10 22:00:39 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-09-10 22:00:39 (GMT)
commit697842f58cfa15e86e92fa1c2733d7d9908a340e (patch)
tree7f5045964d5946de3f348459fb485a2463eddb69 /Mac/Modules
parentb0e8e9b72fb6eb42ecd4d9ea9e88563d1ca4528a (diff)
downloadcpython-697842f58cfa15e86e92fa1c2733d7d9908a340e.zip
cpython-697842f58cfa15e86e92fa1c2733d7d9908a340e.tar.gz
cpython-697842f58cfa15e86e92fa1c2733d7d9908a340e.tar.bz2
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.
Diffstat (limited to 'Mac/Modules')
-rw-r--r--Mac/Modules/macfsmodule.c15
-rw-r--r--Mac/Modules/macosmodule.c12
2 files changed, 16 insertions, 11 deletions
diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c
index 2c20e89..15d9f30 100644
--- a/Mac/Modules/macfsmodule.c
+++ b/Mac/Modules/macfsmodule.c
@@ -51,6 +51,12 @@ extern PyObject *_PyMac_BuildFSRef(FSRef *);
#endif
static PyObject *ErrorObject;
+#ifdef TARGET_API_MAC_OSX
+#define PATHNAMELEN 1024
+#else
+#define PATHNAMELEN 256
+#endif
+
/* ----------------------------------------------------- */
/* Declarations for objects of type Alias */
@@ -449,22 +455,17 @@ PyMac_SetFileDates(FSSpec *fss, unsigned long crdat, unsigned long mddat,
static PyObject *
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];
+ char strbuf[PATHNAMELEN];
OSErr err;
if (!PyArg_ParseTuple(args, ""))
return NULL;
- err = PyMac_GetFullPath(&self->fsspec, strbuf);
+ err = PyMac_GetFullPathname(&self->fsspec, strbuf, PATHNAMELEN);
if ( err ) {
PyErr_Mac(ErrorObject, err);
return NULL;
}
return PyString_FromString(strbuf);
-#endif
}
static PyObject *
diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c
index 0b8d856..6b8b87d 100644
--- a/Mac/Modules/macosmodule.c
+++ b/Mac/Modules/macosmodule.c
@@ -40,6 +40,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
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 */
#endif
@@ -596,15 +602,14 @@ MacOS_openrf(PyObject *self, PyObject *args)
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
** correct we let the standard i/o library handle it
*/
FILE *tfp;
- char pathname[257];
+ char pathname[PATHNAMELEN];
- if ( err=PyMac_GetFullPath(&fss, pathname) ) {
+ if ( err=PyMac_GetFullPathname(&fss, pathname, PATHNAMELEN) ) {
PyMac_Error(err);
Py_DECREF(fp);
return NULL;
@@ -618,7 +623,6 @@ MacOS_openrf(PyObject *self, PyObject *args)
fclose(tfp);
err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
}
-#endif
if ( err ) {
Py_DECREF(fp);
PyMac_Error(err);