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

Skip to content

Commit 62fbdd9

Browse files
author
Hirokazu Yamamoto
committed
Formatted code. (Tabify, etc)
1 parent 51d2fd9 commit 62fbdd9

1 file changed

Lines changed: 15 additions & 17 deletions

File tree

PC/winsound.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,23 @@ sound_playsound(PyObject *s, PyObject *args)
7777
int length;
7878
int ok;
7979

80-
if(!PyArg_ParseTuple(args,"z#i:PlaySound",&sound,&length,&flags)) {
81-
return NULL;
80+
if (!PyArg_ParseTuple(args, "z#i:PlaySound", &sound, &length, &flags)) {
81+
return NULL;
8282
}
8383

84-
if(flags&SND_ASYNC && flags &SND_MEMORY) {
85-
/* Sidestep reference counting headache; unfortunately this also
86-
prevent SND_LOOP from memory. */
87-
PyErr_SetString(PyExc_RuntimeError,"Cannot play asynchronously from memory");
88-
return NULL;
84+
if (flags & SND_ASYNC && flags & SND_MEMORY) {
85+
/* Sidestep reference counting headache; unfortunately this also
86+
prevent SND_LOOP from memory. */
87+
PyErr_SetString(PyExc_RuntimeError, "Cannot play asynchronously from memory");
88+
return NULL;
8989
}
9090

9191
Py_BEGIN_ALLOW_THREADS
92-
ok = PlaySound(sound,NULL,flags);
92+
ok = PlaySound(sound, NULL, flags);
9393
Py_END_ALLOW_THREADS
94-
if(!ok)
95-
{
96-
PyErr_SetString(PyExc_RuntimeError,"Failed to play sound");
97-
return NULL;
94+
if (!ok) {
95+
PyErr_SetString(PyExc_RuntimeError, "Failed to play sound");
96+
return NULL;
9897
}
9998

10099
Py_INCREF(Py_None);
@@ -151,11 +150,10 @@ static struct PyMethodDef sound_methods[] =
151150
static void
152151
add_define(PyObject *dict, const char *key, long value)
153152
{
154-
PyObject *k=PyUnicode_FromString(key);
155-
PyObject *v=PyLong_FromLong(value);
156-
if(v&&k)
157-
{
158-
PyDict_SetItem(dict,k,v);
153+
PyObject *k = PyUnicode_FromString(key);
154+
PyObject *v = PyLong_FromLong(value);
155+
if (v && k) {
156+
PyDict_SetItem(dict,k,v);
159157
}
160158
Py_XDECREF(k);
161159
Py_XDECREF(v);

0 commit comments

Comments
 (0)