mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
First couple of fixes to make it compile with Universal 3.3.2.
This commit is contained in:
parent
e9b2a0597e
commit
24aa3cea07
1 changed files with 21 additions and 10 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue