Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
62fbdd9b
Commit
62fbdd9b
authored
Nov 07, 2010
by
Hirokazu Yamamoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatted code. (Tabify, etc)
parent
51d2fd98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
PC/winsound.c
PC/winsound.c
+15
-17
No files found.
PC/winsound.c
View file @
62fbdd9b
...
@@ -77,24 +77,23 @@ sound_playsound(PyObject *s, PyObject *args)
...
@@ -77,24 +77,23 @@ sound_playsound(PyObject *s, PyObject *args)
int
length
;
int
length
;
int
ok
;
int
ok
;
if
(
!
PyArg_ParseTuple
(
args
,
"z#i:PlaySound"
,
&
sound
,
&
length
,
&
flags
))
{
if
(
!
PyArg_ParseTuple
(
args
,
"z#i:PlaySound"
,
&
sound
,
&
length
,
&
flags
))
{
return
NULL
;
return
NULL
;
}
}
if
(
flags
&
SND_ASYNC
&&
flags
&
SND_MEMORY
)
{
if
(
flags
&
SND_ASYNC
&&
flags
&
SND_MEMORY
)
{
/* Sidestep reference counting headache; unfortunately this also
/* Sidestep reference counting headache; unfortunately this also
prevent SND_LOOP from memory. */
prevent SND_LOOP from memory. */
PyErr_SetString
(
PyExc_RuntimeError
,
"Cannot play asynchronously from memory"
);
PyErr_SetString
(
PyExc_RuntimeError
,
"Cannot play asynchronously from memory"
);
return
NULL
;
return
NULL
;
}
}
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
ok
=
PlaySound
(
sound
,
NULL
,
flags
);
ok
=
PlaySound
(
sound
,
NULL
,
flags
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
if
(
!
ok
)
if
(
!
ok
)
{
{
PyErr_SetString
(
PyExc_RuntimeError
,
"Failed to play sound"
);
PyErr_SetString
(
PyExc_RuntimeError
,
"Failed to play sound"
);
return
NULL
;
return
NULL
;
}
}
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
...
@@ -151,11 +150,10 @@ static struct PyMethodDef sound_methods[] =
...
@@ -151,11 +150,10 @@ static struct PyMethodDef sound_methods[] =
static
void
static
void
add_define
(
PyObject
*
dict
,
const
char
*
key
,
long
value
)
add_define
(
PyObject
*
dict
,
const
char
*
key
,
long
value
)
{
{
PyObject
*
k
=
PyUnicode_FromString
(
key
);
PyObject
*
k
=
PyUnicode_FromString
(
key
);
PyObject
*
v
=
PyLong_FromLong
(
value
);
PyObject
*
v
=
PyLong_FromLong
(
value
);
if
(
v
&&
k
)
if
(
v
&&
k
)
{
{
PyDict_SetItem
(
dict
,
k
,
v
);
PyDict_SetItem
(
dict
,
k
,
v
);
}
}
Py_XDECREF
(
k
);
Py_XDECREF
(
k
);
Py_XDECREF
(
v
);
Py_XDECREF
(
v
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment