diff options
| author | Ronald Oussoren <ronaldoussoren@mac.com> | 2006-10-08 17:41:25 +0000 |
|---|---|---|
| committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2006-10-08 17:41:25 +0000 |
| commit | 392cafba4fb899f8a205f7962302b77db8c61980 (patch) | |
| tree | 74ec202946b517aac1a4bbcccdd1eac9b6223f8b /Python | |
| parent | 16ca35a2a59712400b1326166f26a689b646e6bb (diff) | |
| download | cpython-git-392cafba4fb899f8a205f7962302b77db8c61980.tar.gz | |
Port of universal binary support for Mac OSX from python 2.5. This takes away
the need for the out-of-tree universal binary support that was used to build
the 2.4.3 installer.
Missing here relative to that tree are some changes to IDLE, IMHO those patches
aren't appropriate for the 2.4 branch and users are better of using 2.5's IDLE.
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/mactoolboxglue.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Python/mactoolboxglue.c b/Python/mactoolboxglue.c index 406b00238f..c751543926 100644 --- a/Python/mactoolboxglue.c +++ b/Python/mactoolboxglue.c @@ -25,7 +25,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "Python.h" #include "pymactoolbox.h" - +#include <arpa/inet.h> /* for ntohl, htonl */ /* Like strerror() but for Mac OS error numbers */ char * @@ -156,12 +156,14 @@ PyMac_GetFullPathname(FSSpec *fss, char *path, int len) int PyMac_GetOSType(PyObject *v, OSType *pr) { + int32_t tmp; if (!PyString_Check(v) || PyString_Size(v) != 4) { PyErr_SetString(PyExc_TypeError, "OSType arg must be string of 4 chars"); return 0; } - memcpy((char *)pr, PyString_AsString(v), 4); + memcpy((char *)&tmp, PyString_AsString(v), 4); + *pr = (OSType)ntohl(tmp); return 1; } @@ -169,7 +171,8 @@ PyMac_GetOSType(PyObject *v, OSType *pr) PyObject * PyMac_BuildOSType(OSType t) { - return PyString_FromStringAndSize((char *)&t, 4); + uint32_t tmp = htonl((uint32_t)t); + return PyString_FromStringAndSize((char *)&tmp, 4); } /* Convert an NumVersion value to a 4-element tuple */ @@ -363,10 +366,10 @@ int (*PyMacGluePtr_##routinename)(PyObject *, object *); \ \ int routinename(PyObject *pyobj, object *cobj) { \ if (!PyMacGluePtr_##routinename) { \ - if (!PyImport_ImportModule(module)) return NULL; \ + if (!PyImport_ImportModule(module)) return 0; \ if (!PyMacGluePtr_##routinename) { \ PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \ - return NULL; \ + return 0; \ } \ } \ return (*PyMacGluePtr_##routinename)(pyobj, cobj); \ |
