summaryrefslogtreecommitdiff
path: root/Mac
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2009-01-02 14:10:20 +0000
committerRonald Oussoren <ronaldoussoren@mac.com>2009-01-02 14:10:20 +0000
commit464a4de477983abdfe27f13e630c88f8ef02231a (patch)
tree257f50cc2bee13f311858df403128cb3a2b1649a /Mac
parentd07bcd51fe5f69d1fa4aca0f17f812eda00a0bb6 (diff)
downloadcpython-464a4de477983abdfe27f13e630c88f8ef02231a.tar.gz
Fix for issue1594
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/MacOS.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Mac/Modules/MacOS.c b/Mac/Modules/MacOS.c
index 272fe8d55d..bef7f88cee 100644
--- a/Mac/Modules/MacOS.c
+++ b/Mac/Modules/MacOS.c
@@ -30,6 +30,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <Carbon/Carbon.h>
#include <ApplicationServices/ApplicationServices.h>
+#include <arpa/inet.h> /* for ntohl, htonl */
+
+
#ifndef HAVE_OSX105_SDK
typedef SInt16 FSIORefNum;
#endif
@@ -310,6 +313,10 @@ MacOS_GetCreatorAndType(PyObject *self, PyObject *args)
if ((err = FSpGetFInfo(&fss, &info)) != noErr) {
return PyErr_Mac(MacOS_Error, err);
}
+
+ info.fdCreator = ntohl(info.fdCreator);
+ info.fdType = ntohl(info.fdType);
+
creator = PyString_FromStringAndSize(
(char *)&info.fdCreator, 4);
type = PyString_FromStringAndSize((char *)&info.fdType, 4);
@@ -341,6 +348,8 @@ MacOS_GetCreatorAndType(PyObject *self, PyObject *args)
}
finfo = (FileInfo*)&(cataloginfo.finderInfo);
+ finfo->fileCreator = ntohl(finfo->fileCreator);
+ finfo->fileType = ntohl(finfo->fileType);
creator = PyString_FromStringAndSize((char*)&(finfo->fileCreator), 4);
type = PyString_FromStringAndSize((char*)&(finfo->fileType), 4);