diff options
Diffstat (limited to 'Mac/Modules/file/filesupport.py')
-rw-r--r-- | Mac/Modules/file/filesupport.py | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/Mac/Modules/file/filesupport.py b/Mac/Modules/file/filesupport.py index dac706d..15ad8a3 100644 --- a/Mac/Modules/file/filesupport.py +++ b/Mac/Modules/file/filesupport.py @@ -254,7 +254,7 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr) if ( PyString_Check(v) || PyUnicode_Check(v)) { char *path = NULL; if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path)) - return NULL; + return 0; if ( (err=FSPathMakeRef(path, fsr, NULL)) ) { PyMac_Error(err); return 0; @@ -389,22 +389,22 @@ class FSCatalogInfoDefinition(PEP253Mixin, ObjectDefinition): ] # The same info, but in a different form INITFORMAT = "HhllO&O&O&O&O&llllllb" - INITARGS = """&((FSCatalogInfoObject *)self)->ob_itself.nodeFlags, - &((FSCatalogInfoObject *)self)->ob_itself.volume, - &((FSCatalogInfoObject *)self)->ob_itself.parentDirID, - &((FSCatalogInfoObject *)self)->ob_itself.nodeID, - UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.createDate, - UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.contentModDate, - UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.attributeModDate, - UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.accessDate, - UTCDateTime_Convert, &((FSCatalogInfoObject *)self)->ob_itself.backupDate, - &((FSCatalogInfoObject *)self)->ob_itself.valence, - &((FSCatalogInfoObject *)self)->ob_itself.dataLogicalSize, - &((FSCatalogInfoObject *)self)->ob_itself.dataPhysicalSize, - &((FSCatalogInfoObject *)self)->ob_itself.rsrcLogicalSize, - &((FSCatalogInfoObject *)self)->ob_itself.rsrcPhysicalSize, - &((FSCatalogInfoObject *)self)->ob_itself.sharingFlags, - &((FSCatalogInfoObject *)self)->ob_itself.userPrivileges""" + INITARGS = """&((FSCatalogInfoObject *)_self)->ob_itself.nodeFlags, + &((FSCatalogInfoObject *)_self)->ob_itself.volume, + &((FSCatalogInfoObject *)_self)->ob_itself.parentDirID, + &((FSCatalogInfoObject *)_self)->ob_itself.nodeID, + UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.createDate, + UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.contentModDate, + UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.attributeModDate, + UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.accessDate, + UTCDateTime_Convert, &((FSCatalogInfoObject *)_self)->ob_itself.backupDate, + &((FSCatalogInfoObject *)_self)->ob_itself.valence, + &((FSCatalogInfoObject *)_self)->ob_itself.dataLogicalSize, + &((FSCatalogInfoObject *)_self)->ob_itself.dataPhysicalSize, + &((FSCatalogInfoObject *)_self)->ob_itself.rsrcLogicalSize, + &((FSCatalogInfoObject *)_self)->ob_itself.rsrcPhysicalSize, + &((FSCatalogInfoObject *)_self)->ob_itself.sharingFlags, + &((FSCatalogInfoObject *)_self)->ob_itself.userPrivileges""" INITNAMES = """ "nodeFlags", "volume", @@ -442,7 +442,7 @@ class FSCatalogInfoDefinition(PEP253Mixin, ObjectDefinition): def output_tp_initBody(self): Output("static char *kw[] = {%s, 0};", self.INITNAMES) Output() - Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|%s\", kw, %s))", + Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|%s\", kw, %s))", self.INITFORMAT, self.INITARGS) OutLbrace() Output("return -1;") @@ -498,9 +498,9 @@ class FInfoDefinition(PEP253Mixin, ObjectDefinition): Output("%s *itself = NULL;", self.itselftype) Output("static char *kw[] = {\"itself\", 0};") Output() - Output("if (PyArg_ParseTupleAndKeywords(args, kwds, \"|O&\", kw, FInfo_Convert, &itself))") + Output("if (PyArg_ParseTupleAndKeywords(_args, _kwds, \"|O&\", kw, FInfo_Convert, &itself))") OutLbrace() - Output("if (itself) memcpy(&((%s *)self)->ob_itself, itself, sizeof(%s));", + Output("if (itself) memcpy(&((%s *)_self)->ob_itself, itself, sizeof(%s));", self.objecttype, self.itselftype) Output("return 0;") OutRbrace() @@ -540,7 +540,7 @@ class FSSpecDefinition(PEP253Mixin, ObjectDefinition): Output("int rawdatalen = 0;") Output("static char *kw[] = {\"itself\", \"rawdata\", 0};") Output() - Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))") + Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))") Output("return -1;") Output("if (v && rawdata)") OutLbrace() @@ -560,10 +560,10 @@ class FSSpecDefinition(PEP253Mixin, ObjectDefinition): self.itselftype) Output("return -1;") OutRbrace() - Output("memcpy(&((%s *)self)->ob_itself, rawdata, rawdatalen);", self.objecttype) + Output("memcpy(&((%s *)_self)->ob_itself, rawdata, rawdatalen);", self.objecttype) Output("return 0;") OutRbrace() - Output("if (PyMac_GetFSSpec(v, &((%s *)self)->ob_itself)) return 0;", self.objecttype) + Output("if (PyMac_GetFSSpec(v, &((%s *)_self)->ob_itself)) return 0;", self.objecttype) Output("return -1;") def outputRepr(self): @@ -613,7 +613,7 @@ class FSRefDefinition(PEP253Mixin, ObjectDefinition): Output("int rawdatalen = 0;") Output("static char *kw[] = {\"itself\", \"rawdata\", 0};") Output() - Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))") + Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|Os#\", kw, &v, &rawdata, &rawdatalen))") Output("return -1;") Output("if (v && rawdata)") OutLbrace() @@ -633,10 +633,10 @@ class FSRefDefinition(PEP253Mixin, ObjectDefinition): self.itselftype) Output("return -1;") OutRbrace() - Output("memcpy(&((%s *)self)->ob_itself, rawdata, rawdatalen);", self.objecttype) + Output("memcpy(&((%s *)_self)->ob_itself, rawdata, rawdatalen);", self.objecttype) Output("return 0;") OutRbrace() - Output("if (PyMac_GetFSRef(v, &((%s *)self)->ob_itself)) return 0;", self.objecttype) + Output("if (PyMac_GetFSRef(v, &((%s *)_self)->ob_itself)) return 0;", self.objecttype) Output("return -1;") class AliasDefinition(PEP253Mixin, ObjectDefinition): @@ -689,7 +689,7 @@ class AliasDefinition(PEP253Mixin, ObjectDefinition): Output("Handle h;") Output("static char *kw[] = {\"itself\", \"rawdata\", 0};") Output() - Output("if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|O&s#\", kw, %s_Convert, &itself, &rawdata, &rawdatalen))", + Output("if (!PyArg_ParseTupleAndKeywords(_args, _kwds, \"|O&s#\", kw, %s_Convert, &itself, &rawdata, &rawdatalen))", self.prefix) Output("return -1;") Output("if (itself && rawdata)") @@ -712,10 +712,10 @@ class AliasDefinition(PEP253Mixin, ObjectDefinition): Output("HLock(h);") Output("memcpy((char *)*h, rawdata, rawdatalen);") Output("HUnlock(h);") - Output("((%s *)self)->ob_itself = (%s)h;", self.objecttype, self.itselftype) + Output("((%s *)_self)->ob_itself = (%s)h;", self.objecttype, self.itselftype) Output("return 0;") OutRbrace() - Output("((%s *)self)->ob_itself = itself;", self.objecttype) + Output("((%s *)_self)->ob_itself = itself;", self.objecttype) Output("return 0;") # Alias methods come in two flavors: those with the alias as arg1 and |