alsaseq: fix seg. fault when accessing `ConstantObject` extra
Closes: https://github.com/alsa-project/alsa-python/pull/10 Signed-off-by: Francesco Ceruti <ceppofrancy@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The `GETDICTEXT` macro used to perfom one pass on the provided int
list to check the actual item types brefore allocating and filling
the target buffer. The python list was not read again causing the
buffer to be filled with the last value read during the type check.
This patch performs the type check as well as buffer fill in one go.
The buffer is freed if an item is found to be of a wrong type.
Fixes: https://github.com/alsa-project/alsa-python/pull/3 Signed-off-by: François Laignel <fengalin@free.fr> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Hector Martin [Wed, 5 Aug 2020 15:42:43 +0000 (00:42 +0900)]
alsaseq: fix constant objects in Python 3
In Py3 everything is a long, so we can't get away with duplicating the
integer object layout any more. Properly subclass PyLong_Type instead,
with a bit of a hack to add an extra name field after the variable-sized
data section.
Also get rid of the enum type stuff, which seems to be unused cruft, and
the numprotocol stuff, because the base type can take care of that (and
we can't map arbitrary arithmetic results back to constants anyway).
Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Hector Martin [Sat, 10 Jan 2015 19:02:11 +0000 (04:02 +0900)]
alsaseq: fix memory leaks
Fix a bunch of dangling reference issues. Also switch to Py_BuildValue
where appropriate, since that makes it easier to build complex
dictionary/tuple structures without leaking integer/string references.
Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Jaroslav Kysela [Wed, 22 Dec 2010 07:13:21 +0000 (08:13 +0100)]
alsa-python mixer: add poll_fds property
This patch adds poll_fds property to pyalsa alsamixer. register_poll works
with Python's select.poll but not with main loop of GUI toolkits. This is
already done for hcontrol by Clemens Ladisch, patch is based on his patch.
Other patch fixes memory leak as reported by him.
From: Milan Nikolic <gen2brain@gmail.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Clemens Ladisch [Mon, 12 Oct 2009 06:47:59 +0000 (08:47 +0200)]
hcontrol: add poll_fds property
The existing register_poll function works with Python's select.poll
object, but not with the main loop of GUI toolkits that use their own
event source implementation. Therefore, add a property to get the raw
file handles.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Chris Coleman [Fri, 21 Aug 2009 09:52:09 +0000 (11:52 +0200)]
pyalsa: fix integer overflow in alsaseq.c
* Original patch description:
I've been using the alsaseq python module and I found a bug. Sometimes
the SEQ_* constants have extremely large and incorrect values. For
example, 25769803811 instead of 35. The lower 32-bits are always
correct.
Obviously, I'm running a 64-bit operating system.
The problem is that the `value` member of the `ConstantObject`
structure is an `unsigned int` whereas it should be a `long`. I've
attached a patch. It's against the latest released version, 1.0.20.
* Revised patch description:
I just noticed that `PyString_FromFormat` in Python 2.6 doesn't handle
`%lx` in format strings, so my patch breaks `repr(Constant)`.
In addition to that, it was not necessary to change the signedness of `value`.
With those two things in mind, the patch perhaps ought to look like
this (see attached).
Signed-off-by: Chris Coleman <chris.coleman83 at gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai [Tue, 18 Mar 2008 17:22:00 +0000 (18:22 +0100)]
Added python coverage doc
This is the output of the alsa-python-coverage tool for the current HG
repository. It is intented to be used by the alsa-python without the
need to call the tool.
Takashi Iwai [Tue, 18 Mar 2008 17:20:32 +0000 (18:20 +0100)]
alsa-python: API coverage documentation tool
The following patch is a python tool that shows how much of the
asoundlib API is being covered by the alsa-python binding. It works by
parsing the C source code and comparing with the official Doxygen
documentation from alsa website.
It will help the following users:
- alsa-python developers: know how is mapped the original C API, so
which python function/variable may be used.
- python binding developers: know how much of the C API is covered. It
could help for mistakes (free() instead of using
snd_ctl_card_info_free), know what is missing, and statistic interest ;)