Commit 24aa3cea authored by Jack Jansen's avatar Jack Jansen

First couple of fixes to make it compile with Universal 3.3.2.

parent e9b2a059
/* /*
$Log$ $Log$
Revision 1.1 2001/11/06 11:10:13 jackjansen Revision 1.2 2001/11/06 12:06:39 jackjansen
HFS+ API contributed by Nitin Ganatra. This checkin is identical to what he sent me, except for the namechange (fmgr->hfsplus). First couple of fixes to make it compile with Universal 3.3.2.
Revision 1.8 2001/10/03 17:29:01 ganatra Revision 1.8 2001/10/03 17:29:01 ganatra
add parent method to FSRef class add parent method to FSRef class
...@@ -15,8 +15,12 @@ ...@@ -15,8 +15,12 @@
*/ */
#include <CoreServices/CoreServices.h>
#include "Python.h" #include "Python.h"
#ifdef WITHOUT_FRAMEWORKS
#include <Files.h>
#else
#include <CoreServices/CoreServices.h>
#endif
static PyObject * static PyObject *
dict_from_cataloginfo(FSCatalogInfoBitmap bitmap, const FSCatalogInfo *info, HFSUniStr255 *uni); dict_from_cataloginfo(FSCatalogInfoBitmap bitmap, const FSCatalogInfo *info, HFSUniStr255 *uni);
...@@ -1059,7 +1063,7 @@ PyObject *fmgrmodule_getcatinfo(PyObject *self, PyObject *args) ...@@ -1059,7 +1063,7 @@ PyObject *fmgrmodule_getcatinfo(PyObject *self, PyObject *args)
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
err = FSPathMakeRef(path, &ref, NULL); err = FSPathMakeRef((UInt8 *)path, &ref, NULL);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (err != noErr) if (err != noErr)
return macos_error_for_call(err, "FSPathMakeRef", path); return macos_error_for_call(err, "FSPathMakeRef", path);
...@@ -1096,7 +1100,7 @@ PyObject *fmgrmodule_opendir(PyObject *self, PyObject *args) ...@@ -1096,7 +1100,7 @@ PyObject *fmgrmodule_opendir(PyObject *self, PyObject *args)
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
err = FSPathMakeRef(path, &ref, &isdir); err = FSPathMakeRef((UInt8 *)path, &ref, &isdir);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (err != noErr) if (err != noErr)
...@@ -1128,7 +1132,7 @@ PyObject *fmgrmodule_fsref(PyObject *self, PyObject *args) ...@@ -1128,7 +1132,7 @@ PyObject *fmgrmodule_fsref(PyObject *self, PyObject *args)
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
err = FSPathMakeRef(path, &ref, &isdir); err = FSPathMakeRef((UInt8 *)path, &ref, &isdir);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (err != noErr) if (err != noErr)
...@@ -1166,7 +1170,7 @@ PyObject *fmgrmodule_openfork(PyObject *self, PyObject *args) ...@@ -1166,7 +1170,7 @@ PyObject *fmgrmodule_openfork(PyObject *self, PyObject *args)
return NULL; return NULL;
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
err = FSPathMakeRef(path, &ref, &isdir); err = FSPathMakeRef((UInt8 *)path, &ref, &isdir);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (err != noErr) { if (err != noErr) {
...@@ -1193,10 +1197,10 @@ static PyMethodDef fmgrmodule_methods[] = { ...@@ -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) DL_EXPORT(void)
initfmgr(void) inithfsplus(void)
{ {
PyObject *m, *d; PyObject *m, *d;
...@@ -1405,7 +1409,9 @@ static ...@@ -1405,7 +1409,9 @@ static
int cataloginfo_from_dict(FSCatalogInfoBitmap bitmap, FSCatalogInfo *info, const PyObject *dict) int cataloginfo_from_dict(FSCatalogInfoBitmap bitmap, FSCatalogInfo *info, const PyObject *dict)
{ {
UInt32 storage; UInt32 storage;
#if UNIVERSAL_INTERFACES_VERSION > 0x0332
FSPermissionInfo *permissions; FSPermissionInfo *permissions;
#endif
// Dates // Dates
if (fetch_utcdatetime(bitmap, kFSCatInfoCreateDate, dict, _kFSCatInfoCreateDate, &info->createDate)) return NULL; if (fetch_utcdatetime(bitmap, kFSCatInfoCreateDate, dict, _kFSCatInfoCreateDate, &info->createDate)) return NULL;
...@@ -1414,6 +1420,7 @@ int cataloginfo_from_dict(FSCatalogInfoBitmap bitmap, FSCatalogInfo *info, const ...@@ -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, kFSCatInfoAccessDate, dict, _kFSCatInfoAccessDate, &info->accessDate)) return NULL;
if (fetch_utcdatetime(bitmap, kFSCatInfoBackupDate, dict, _kFSCatInfoBackupDate, &info->backupDate)) return NULL; if (fetch_utcdatetime(bitmap, kFSCatInfoBackupDate, dict, _kFSCatInfoBackupDate, &info->backupDate)) return NULL;
#if UNIVERSAL_INTERFACES_VERSION > 0x0332
// Permissions // Permissions
permissions = (FSPermissionInfo *) info->permissions; permissions = (FSPermissionInfo *) info->permissions;
if (fetch_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoUserID, &permissions->userID)) return NULL; if (fetch_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoUserID, &permissions->userID)) return NULL;
...@@ -1422,7 +1429,7 @@ int cataloginfo_from_dict(FSCatalogInfoBitmap bitmap, FSCatalogInfo *info, const ...@@ -1422,7 +1429,7 @@ int cataloginfo_from_dict(FSCatalogInfoBitmap bitmap, FSCatalogInfo *info, const
permissions->mode = (UInt16) storage; permissions->mode = (UInt16) storage;
if (fetch_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoUserAccess, &storage)) return NULL; if (fetch_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoUserAccess, &storage)) return NULL;
permissions->userAccess = (UInt8) storage; permissions->userAccess = (UInt8) storage;
#endif
// IDs // IDs
if (fetch_long(bitmap, kFSCatInfoTextEncoding, dict, _kFSCatInfoTextEncoding, &info->textEncodingHint)) return NULL; if (fetch_long(bitmap, kFSCatInfoTextEncoding, dict, _kFSCatInfoTextEncoding, &info->textEncodingHint)) return NULL;
if (fetch_long(bitmap, kFSCatInfoNodeFlags, dict, _kFSCatInfoNodeFlags, &storage)) return NULL; if (fetch_long(bitmap, kFSCatInfoNodeFlags, dict, _kFSCatInfoNodeFlags, &storage)) return NULL;
...@@ -1453,7 +1460,9 @@ PyObject *dict_from_cataloginfo(FSCatalogInfoBitmap bitmap, const FSCatalogInfo ...@@ -1453,7 +1460,9 @@ PyObject *dict_from_cataloginfo(FSCatalogInfoBitmap bitmap, const FSCatalogInfo
{ {
PyObject *dict; PyObject *dict;
PyObject *id; PyObject *id;
#if UNIVERSAL_INTERFACES_VERSION > 0x0332
FSPermissionInfo *permissions; FSPermissionInfo *permissions;
#endif
char buffer[1024]; char buffer[1024];
dict = PyDict_New(); dict = PyDict_New();
...@@ -1483,12 +1492,14 @@ PyObject *dict_from_cataloginfo(FSCatalogInfoBitmap bitmap, const FSCatalogInfo ...@@ -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, _kFSCatInfoRsrcLogical, info->rsrcLogicalSize)) return NULL;
if (insert_longlong(bitmap, kFSCatInfoRsrcSizes, dict, _kFSCatInfoRsrcPhysical, info->rsrcPhysicalSize)) return NULL; if (insert_longlong(bitmap, kFSCatInfoRsrcSizes, dict, _kFSCatInfoRsrcPhysical, info->rsrcPhysicalSize)) return NULL;
#if UNIVERSAL_INTERFACES_VERSION > 0x0332
// Permissions // Permissions
permissions = (FSPermissionInfo *) info->permissions; permissions = (FSPermissionInfo *) info->permissions;
if (insert_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoUserID, permissions->userID)) return NULL; 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, _kFSCatInfoGroupID, permissions->groupID)) return NULL;
if (insert_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoUserAccess, permissions->userAccess)) return NULL; if (insert_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoUserAccess, permissions->userAccess)) return NULL;
if (insert_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoMode, permissions->mode)) return NULL; if (insert_long(bitmap, kFSCatInfoPermissions, dict, _kFSCatInfoMode, permissions->mode)) return NULL;
#endif
// Dates // Dates
if (insert_utcdatetime(bitmap, kFSCatInfoCreateDate, dict, _kFSCatInfoCreateDate, &info->createDate)) return NULL; if (insert_utcdatetime(bitmap, kFSCatInfoCreateDate, dict, _kFSCatInfoCreateDate, &info->createDate)) return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment