summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/hfsplusmodule.c
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-11-06 12:06:39 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-11-06 12:06:39 (GMT)
commit24aa3cea07eba7f0011e72060ab8f0edd33ce20f (patch)
treee5faee5224086bba7b9443d43ae8feab60f6fb27 /Mac/Modules/hfsplusmodule.c
parente9b2a0597e5a364490c6ddc9e37fd3c3b2bcd4d7 (diff)
downloadcpython-24aa3cea07eba7f0011e72060ab8f0edd33ce20f.zip
cpython-24aa3cea07eba7f0011e72060ab8f0edd33ce20f.tar.gz
cpython-24aa3cea07eba7f0011e72060ab8f0edd33ce20f.tar.bz2
First couple of fixes to make it compile with Universal 3.3.2.
Diffstat (limited to 'Mac/Modules/hfsplusmodule.c')
-rw-r--r--Mac/Modules/hfsplusmodule.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/Mac/Modules/hfsplusmodule.c b/Mac/Modules/hfsplusmodule.c
index 31510b3..be1ce29 100644
--- a/Mac/Modules/hfsplusmodule.c
+++ b/Mac/Modules/hfsplusmodule.c
@@ -1,7 +1,7 @@
/*
$Log$
- Revision 1.1 2001/11/06 11:10:13 jackjansen
- HFS+ API contributed by Nitin Ganatra. This checkin is identical to what he sent me, except for the namechange (fmgr->hfsplus).
+ Revision 1.2 2001/11/06 12:06:39 jackjansen
+ First couple of fixes to make it compile with Universal 3.3.2.
Revision 1.8 2001/10/03 17:29:01 ganatra
add parent method to FSRef class
@@ -15,8 +15,12 @@
*/
-#include <CoreServices/CoreServices.h>
#include "Python.h"
+#ifdef WITHOUT_FRAMEWORKS
+#include <Files.h>
+#else
+#include <CoreServices/CoreServices.h>
+#endif
static PyObject *
dict_from_cataloginfo(FSCatalogInfoBitmap bitmap, const FSCatalogInfo *info, HFSUniStr255 *uni);
@@ -1059,7 +1063,7 @@ PyObject *fmgrmodule_getcatinfo(PyObject *self, PyObject *args)
return NULL;
Py_BEGIN_ALLOW_THREADS
- err = FSPathMakeRef(path, &ref, NULL);
+ err = FSPathMakeRef((UInt8 *)path, &ref, NULL);
Py_END_ALLOW_THREADS
if (err != noErr)
return macos_error_for_call(err, "FSPathMakeRef", path);
@@ -1096,7 +1100,7 @@ PyObject *fmgrmodule_opendir(PyObject *self, PyObject *args)
return NULL;
Py_BEGIN_ALLOW_THREADS
- err = FSPathMakeRef(path, &ref, &isdir);
+ err = FSPathMakeRef((UInt8 *)path, &ref, &isdir);
Py_END_ALLOW_THREADS
if (err != noErr)
@@ -1128,7 +1132,7 @@ PyObject *fmgrmodule_fsref(PyObject *self, PyObject *args)
return NULL;
Py_BEGIN_ALLOW_THREADS
- err = FSPathMakeRef(path, &ref, &isdir);
+ err = FSPathMakeRef((UInt8 *)path, &ref, &isdir);
Py_END_ALLOW_THREADS
if (err != noErr)
@@ -1166,7 +1170,7 @@ PyObject *fmgrmodule_openfork(PyObject *self, PyObject *args)
return NULL;
Py_BEGIN_ALLOW_THREADS
- err = FSPathMakeRef(path, &ref, &isdir);
+ err = FSPathMakeRef((UInt8 *)path, &ref, &isdir);
Py_END_ALLOW_THREADS
if (err != noErr) {
@@ -1193,10 +1197,10 @@ static PyMethodDef fmgrmodule_methods[] = {
};
//__________________________________________________________________________________________________
-// Initialization function for the module (*must* be called initfmgr)
+// Initialization function for the module (*must* be called inithfsplus)
//
DL_EXPORT(void)
-initfmgr(void)
+inithfsplus(void)
{
PyObject *m, *d;
@@ -1405,7 +1409,9 @@ static
int cataloginfo_from_dict(FSCatalogInfoBitmap bitmap, FSCatalogInfo *info, const PyObject *dict)
{
UInt32 storage;
+#if UNIVERSAL_INTERFACES_VERSION > 0x0332
FSPermissionInfo *permissions;
+#endif
// Dates
if (fetch_utcdatetime(bitmap, kFSCatInfoCreateDate, dict, _kFSCatInfoCreateDate, &info->createDate)) return NULL;
@@ -1414,6 +1420,7 @@ int cataloginfo_from_dict(FSCatalogInfoBitmap bitmap, FSCatalogInfo *info, const
if (fetch_utcdatetime(bitmap, kFSCatInfoAccessDate, dict, _kFSCatInfoAccessDate, &info->accessDate)) return NULL;
if (fetch_utcdatetime(bitmap, kFSCatInfoBackupDate, dict, _kFSCatInfoBackupDate, &info->backupDate)) return NULL;
+#if UNIVERSAL_INTERFACES_VERSION > 0x0332
// Permissions
permissions = (FSPermissionInfo *) info->permissions;
if (fetch_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoUserID, &permissions->userID)) return NULL;
@@ -1422,7 +1429,7 @@ int cataloginfo_from_dict(FSCatalogInfoBitmap bitmap, FSCatalogInfo *info, const
permissions->mode = (UInt16) storage;
if (fetch_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoUserAccess, &storage)) return NULL;
permissions->userAccess = (UInt8) storage;
-
+#endif
// IDs
if (fetch_long(bitmap, kFSCatInfoTextEncoding, dict, _kFSCatInfoTextEncoding, &info->textEncodingHint)) return NULL;
if (fetch_long(bitmap, kFSCatInfoNodeFlags, dict, _kFSCatInfoNodeFlags, &storage)) return NULL;
@@ -1453,7 +1460,9 @@ PyObject *dict_from_cataloginfo(FSCatalogInfoBitmap bitmap, const FSCatalogInfo
{
PyObject *dict;
PyObject *id;
+#if UNIVERSAL_INTERFACES_VERSION > 0x0332
FSPermissionInfo *permissions;
+#endif
char buffer[1024];
dict = PyDict_New();
@@ -1483,12 +1492,14 @@ PyObject *dict_from_cataloginfo(FSCatalogInfoBitmap bitmap, const FSCatalogInfo
if (insert_longlong(bitmap, kFSCatInfoRsrcSizes, dict, _kFSCatInfoRsrcLogical, info->rsrcLogicalSize)) return NULL;
if (insert_longlong(bitmap, kFSCatInfoRsrcSizes, dict, _kFSCatInfoRsrcPhysical, info->rsrcPhysicalSize)) return NULL;
+#if UNIVERSAL_INTERFACES_VERSION > 0x0332
// Permissions
permissions = (FSPermissionInfo *) info->permissions;
if (insert_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoUserID, permissions->userID)) return NULL;
if (insert_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoGroupID, permissions->groupID)) return NULL;
if (insert_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoUserAccess, permissions->userAccess)) return NULL;
if (insert_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoMode, permissions->mode)) return NULL;
+#endif
// Dates
if (insert_utcdatetime(bitmap, kFSCatInfoCreateDate, dict, _kFSCatInfoCreateDate, &info->createDate)) return NULL;