Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 43c2de2

Browse files
committed
fixed SetEventParameter() signature: removed unneccesary length arg.
1 parent 8edfc54 commit 43c2de2

3 files changed

Lines changed: 18 additions & 9 deletions

File tree

Mac/Modules/carbonevt/CarbonEvtscan.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ def makeblacklistnames(self):
107107
# ]
108108

109109
def makerepairinstructions(self):
110-
return []
110+
return [
111+
([("UInt32", 'inSize', "InMode"), ("void_ptr", 'inDataPtr', "InMode")],
112+
[("MyInBuffer", 'inDataPtr', "InMode")])
113+
]
111114

112115
if __name__ == "__main__":
113116
main()

Mac/Modules/carbonevt/CarbonEvtsupport.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
void_ptr = stringptr
3535
# here are some types that are really other types
3636

37+
class MyVarInputBufferType(VarInputBufferType):
38+
def passInput(self, name):
39+
return "%s__len__, %s__in__" % (name, name)
40+
41+
MyInBuffer = MyVarInputBufferType('char', 'long', 'l') # (buf, len)
42+
3743
EventTime = double
3844
EventTimeout = EventTime
3945
EventTimerInterval = EventTime

Mac/Modules/carbonevt/_CarbonEvtmodule.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,19 +215,19 @@ static PyObject *EventRef_SetEventParameter(EventRefObject *_self, PyObject *_ar
215215
OSStatus _err;
216216
OSType inName;
217217
OSType inType;
218-
UInt32 inSize;
219-
char* inDataPtr;
220-
if (!PyArg_ParseTuple(_args, "O&O&ls",
218+
char *inDataPtr__in__;
219+
long inDataPtr__len__;
220+
int inDataPtr__in_len__;
221+
if (!PyArg_ParseTuple(_args, "O&O&s#",
221222
PyMac_GetOSType, &inName,
222223
PyMac_GetOSType, &inType,
223-
&inSize,
224-
&inDataPtr))
224+
&inDataPtr__in__, &inDataPtr__in_len__))
225225
return NULL;
226+
inDataPtr__len__ = inDataPtr__in_len__;
226227
_err = SetEventParameter(_self->ob_itself,
227228
inName,
228229
inType,
229-
inSize,
230-
inDataPtr);
230+
inDataPtr__len__, inDataPtr__in__);
231231
if (_err != noErr) return PyMac_Error(_err);
232232
Py_INCREF(Py_None);
233233
_res = Py_None;
@@ -386,7 +386,7 @@ static PyMethodDef EventRef_methods[] = {
386386
{"ReleaseEvent", (PyCFunction)EventRef_ReleaseEvent, 1,
387387
"() -> None"},
388388
{"SetEventParameter", (PyCFunction)EventRef_SetEventParameter, 1,
389-
"(OSType inName, OSType inType, UInt32 inSize, char* inDataPtr) -> None"},
389+
"(OSType inName, OSType inType, Buffer inDataPtr) -> None"},
390390
{"GetEventClass", (PyCFunction)EventRef_GetEventClass, 1,
391391
"() -> (UInt32 _rv)"},
392392
{"GetEventKind", (PyCFunction)EventRef_GetEventKind, 1,

0 commit comments

Comments
 (0)