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

Skip to content

Commit a239a92

Browse files
committed
Reindented some of the C code
1 parent df3c6ab commit a239a92

2 files changed

Lines changed: 46 additions & 40 deletions

File tree

Mac/Modules/snd/Sndmodule.c

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -398,26 +398,29 @@ static int SPBObj_setattr(self, name, value)
398398
PyObject *value;
399399
{
400400

401-
if (strcmp(name, "inRefNum") == 0)
402-
return PyArg_Parse(value, "l", &self->ob_spb.inRefNum);
403-
else if (strcmp(name, "count") == 0)
404-
return PyArg_Parse(value, "l", &self->ob_spb.count);
405-
else if (strcmp(name, "milliseconds") == 0)
406-
return PyArg_Parse(value, "l", &self->ob_spb.milliseconds);
407-
else if (strcmp(name, "buffer") == 0)
408-
return PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength);
409-
else if (strcmp(name, "completionRoutine") == 0) {
410-
self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion);
411-
self->ob_completion = value;
412-
Py_INCREF(value);
413-
return 0;
414-
} else if (strcmp(name, "interruptRoutine") == 0) {
415-
self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt);
416-
self->ob_interrupt = value;
417-
Py_INCREF(value);
418-
return 0;
419-
}
420-
return -1;
401+
int rv = 0;
402+
403+
if (strcmp(name, "inRefNum") == 0)
404+
rv = PyArg_Parse(value, "l", &self->ob_spb.inRefNum);
405+
else if (strcmp(name, "count") == 0)
406+
rv = PyArg_Parse(value, "l", &self->ob_spb.count);
407+
else if (strcmp(name, "milliseconds") == 0)
408+
rv = PyArg_Parse(value, "l", &self->ob_spb.milliseconds);
409+
else if (strcmp(name, "buffer") == 0)
410+
rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength);
411+
else if (strcmp(name, "completionRoutine") == 0) {
412+
self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion);
413+
self->ob_completion = value;
414+
Py_INCREF(value);
415+
rv = 1;
416+
} else if (strcmp(name, "interruptRoutine") == 0) {
417+
self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt);
418+
self->ob_interrupt = value;
419+
Py_INCREF(value);
420+
rv = 1;
421+
}
422+
if ( rv ) return 0;
423+
else return -1;
421424
}
422425

423426
staticforward PyTypeObject SPB_Type = {

Mac/Modules/snd/sndsupport.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -303,26 +303,29 @@ def outputSetattr(self):
303303

304304
def outputSetattrBody(self):
305305
Output("""
306-
if (strcmp(name, "inRefNum") == 0)
307-
return PyArg_Parse(value, "l", &self->ob_spb.inRefNum);
308-
else if (strcmp(name, "count") == 0)
309-
return PyArg_Parse(value, "l", &self->ob_spb.count);
310-
else if (strcmp(name, "milliseconds") == 0)
311-
return PyArg_Parse(value, "l", &self->ob_spb.milliseconds);
312-
else if (strcmp(name, "buffer") == 0)
313-
return PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength);
314-
else if (strcmp(name, "completionRoutine") == 0) {
315-
self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion);
316-
self->ob_completion = value;
317-
Py_INCREF(value);
318-
return 0;
319-
} else if (strcmp(name, "interruptRoutine") == 0) {
320-
self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt);
321-
self->ob_interrupt = value;
322-
Py_INCREF(value);
323-
return 0;
324-
}
325-
return -1;""")
306+
int rv = 0;
307+
308+
if (strcmp(name, "inRefNum") == 0)
309+
rv = PyArg_Parse(value, "l", &self->ob_spb.inRefNum);
310+
else if (strcmp(name, "count") == 0)
311+
rv = PyArg_Parse(value, "l", &self->ob_spb.count);
312+
else if (strcmp(name, "milliseconds") == 0)
313+
rv = PyArg_Parse(value, "l", &self->ob_spb.milliseconds);
314+
else if (strcmp(name, "buffer") == 0)
315+
rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength);
316+
else if (strcmp(name, "completionRoutine") == 0) {
317+
self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion);
318+
self->ob_completion = value;
319+
Py_INCREF(value);
320+
rv = 1;
321+
} else if (strcmp(name, "interruptRoutine") == 0) {
322+
self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt);
323+
self->ob_interrupt = value;
324+
Py_INCREF(value);
325+
rv = 1;
326+
}
327+
if ( rv ) return 0;
328+
else return -1;""")
326329

327330
def outputGetattrHook(self):
328331
Output("""

0 commit comments

Comments
 (0)