huge correction of tabulators and whitespaces

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-11-07 14:27:38 +01:00
parent b37ac0982b
commit 66a3d542ac
157 changed files with 2008 additions and 2008 deletions

View file

@ -75,7 +75,7 @@ int alsa_mixer_simple_init(snd_mixer_class_t *class)
{
struct bclass_base_ops *ops;
int err;
err = mixer_simple_basic_dlopen(class, &ops);
if (err < 0)
return 0;

View file

@ -76,7 +76,7 @@ int alsa_mixer_simple_init(snd_mixer_class_t *class)
{
struct bclass_base_ops *ops;
int err;
err = mixer_simple_basic_dlopen(class, &ops);
if (err < 0)
return 0;

View file

@ -68,24 +68,24 @@ static PyInterpreterState *main_interpreter;
static inline int get_long(PyObject *o, long *val)
{
#if PY_MAJOR_VERSION < 3
if (PyInt_Check(o)) {
*val = PyInt_AsLong(o);
return 0;
}
if (PyInt_Check(o)) {
*val = PyInt_AsLong(o);
return 0;
}
#endif
if (PyLong_Check(o)) {
*val = PyLong_AsLong(o);
return 0;
}
return 1;
if (PyLong_Check(o)) {
*val = PyLong_AsLong(o);
return 0;
}
return 1;
}
static inline PyObject *InternFromString(const char *name)
{
#if PY_MAJOR_VERSION < 3
return PyString_InternFromString(name);
return PyString_InternFromString(name);
#else
return PyUnicode_InternFromString(name);
return PyUnicode_InternFromString(name);
#endif
}
@ -191,12 +191,12 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
}
static int get_x_range_ops(snd_mixer_elem_t *elem, int dir,
long *min, long *max, const char *attr)
long *min, long *max, const char *attr)
{
PyObject *obj1, *t1, *t2, *res;
struct pymelem *pymelem = melem_to_pymelem(elem);
int err;
obj1 = PyTuple_New(1);
PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
err = pcall(pymelem, attr, obj1, &res);
@ -225,13 +225,13 @@ static int get_x_range_ops(snd_mixer_elem_t *elem, int dir,
}
static int get_range_ops(snd_mixer_elem_t *elem, int dir,
long *min, long *max)
long *min, long *max)
{
return get_x_range_ops(elem, dir, min, max, "opsGetRange");
}
static int set_range_ops(snd_mixer_elem_t *elem, int dir,
long min, long max)
long min, long max)
{
PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem);
@ -244,13 +244,13 @@ static int set_range_ops(snd_mixer_elem_t *elem, int dir,
}
static int get_x_ops(snd_mixer_elem_t *elem, int dir,
long channel, long *value,
const char *attr)
long channel, long *value,
const char *attr)
{
PyObject *obj1, *t1, *res;
struct pymelem *pymelem = melem_to_pymelem(elem);
int err;
obj1 = PyTuple_New(2);
PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(channel));
@ -283,7 +283,7 @@ static int get_volume_ops(snd_mixer_elem_t *elem, int dir,
}
static int get_switch_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, int *value)
snd_mixer_selem_channel_id_t channel, int *value)
{
long value1;
int res;
@ -309,7 +309,7 @@ static int ask_dB_vol_ops(snd_mixer_elem_t *elem,
PyObject *obj1, *t1, *res;
struct pymelem *pymelem = melem_to_pymelem(elem);
int err;
obj1 = PyTuple_New(3);
PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir));
PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(value));
@ -337,21 +337,21 @@ static int ask_dB_vol_ops(snd_mixer_elem_t *elem,
}
static int get_dB_ops(snd_mixer_elem_t *elem,
int dir,
snd_mixer_selem_channel_id_t channel,
long *value)
int dir,
snd_mixer_selem_channel_id_t channel,
long *value)
{
return get_x_ops(elem, dir, channel, value, "opsGetDB");
}
static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir,
long *min, long *max)
long *min, long *max)
{
return get_x_range_ops(elem, dir, min, max, "opsGetDBRange");
}
static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, long value)
snd_mixer_selem_channel_id_t channel, long value)
{
PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem);
@ -364,7 +364,7 @@ static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
}
static int set_switch_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, int value)
snd_mixer_selem_channel_id_t channel, int value)
{
PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem);
@ -377,8 +377,8 @@ static int set_switch_ops(snd_mixer_elem_t *elem, int dir,
}
static int set_dB_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel,
long db_gain, int xdir)
snd_mixer_selem_channel_id_t channel,
long db_gain, int xdir)
{
PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem);
@ -392,15 +392,15 @@ static int set_dB_ops(snd_mixer_elem_t *elem, int dir,
}
static int enum_item_name_ops(snd_mixer_elem_t *elem,
unsigned int item,
size_t maxlen, char *buf)
unsigned int item,
size_t maxlen, char *buf)
{
PyObject *obj1, *obj2, *t1, *res;
struct pymelem *pymelem = melem_to_pymelem(elem);
int err;
unsigned int len;
char *s;
obj1 = PyTuple_New(1);
PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(item));
err = pcall(pymelem, "opsGetEnumItemName", obj1, &res);
@ -441,13 +441,13 @@ errlbl:
}
static int get_enum_item_ops(snd_mixer_elem_t *elem,
snd_mixer_selem_channel_id_t channel,
unsigned int *itemp)
snd_mixer_selem_channel_id_t channel,
unsigned int *itemp)
{
PyObject *obj1, *t1, *res;
struct pymelem *pymelem = melem_to_pymelem(elem);
int err;
obj1 = PyTuple_New(1);
PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(channel));
err = pcall(pymelem, "opsGetEnumItem", obj1, &res);
@ -473,8 +473,8 @@ static int get_enum_item_ops(snd_mixer_elem_t *elem,
}
static int set_enum_item_ops(snd_mixer_elem_t *elem,
snd_mixer_selem_channel_id_t channel,
unsigned int item)
snd_mixer_selem_channel_id_t channel,
unsigned int item)
{
PyObject *obj1;
struct pymelem *pymelem = melem_to_pymelem(elem);
@ -486,21 +486,21 @@ static int set_enum_item_ops(snd_mixer_elem_t *elem,
}
static struct sm_elem_ops simple_python_ops = {
.is = is_ops,
.get_range = get_range_ops,
.get_dB_range = get_dB_range_ops,
.set_range = set_range_ops,
.ask_vol_dB = ask_vol_dB_ops,
.ask_dB_vol = ask_dB_vol_ops,
.get_volume = get_volume_ops,
.get_dB = get_dB_ops,
.set_volume = set_volume_ops,
.set_dB = set_dB_ops,
.get_switch = get_switch_ops,
.set_switch = set_switch_ops,
.enum_item_name = enum_item_name_ops,
.get_enum_item = get_enum_item_ops,
.set_enum_item = set_enum_item_ops
.is = is_ops,
.get_range = get_range_ops,
.get_dB_range = get_dB_range_ops,
.set_range = set_range_ops,
.ask_vol_dB = ask_vol_dB_ops,
.ask_dB_vol = ask_dB_vol_ops,
.get_volume = get_volume_ops,
.get_dB = get_dB_ops,
.set_volume = set_volume_ops,
.set_dB = set_dB_ops,
.get_switch = get_switch_ops,
.set_switch = set_switch_ops,
.enum_item_name = enum_item_name_ops,
.get_enum_item = get_enum_item_ops,
.set_enum_item = set_enum_item_ops
};
static void selem_free(snd_mixer_elem_t *elem)
@ -578,7 +578,7 @@ pymelem_attach(struct pymelem *pymelem, PyObject *args)
PyObject *obj;
snd_hctl_elem_t *helem;
int err;
if (!PyArg_ParseTuple(args, "O", &obj))
return NULL;
helem = (snd_hctl_elem_t *)get_C_ptr(obj, "get_C_helem");
@ -587,7 +587,7 @@ pymelem_attach(struct pymelem *pymelem, PyObject *args)
err = snd_mixer_elem_attach(pymelem->melem, helem);
if (err < 0) {
PyErr_Format(PyExc_RuntimeError, "Cannot attach hcontrol element to mixer element: %s", snd_strerror(err));
return NULL;
return NULL;
}
Py_RETURN_NONE;
}
@ -598,7 +598,7 @@ pymelem_detach(struct pymelem *pymelem, PyObject *args)
PyObject *obj;
snd_hctl_elem_t *helem;
int err;
if (!PyArg_ParseTuple(args, "O", &obj))
return NULL;
helem = (snd_hctl_elem_t *)get_C_ptr(obj, "get_C_helem");
@ -607,7 +607,7 @@ pymelem_detach(struct pymelem *pymelem, PyObject *args)
err = snd_mixer_elem_detach(pymelem->melem, helem);
if (err < 0) {
PyErr_Format(PyExc_RuntimeError, "Cannot detach hcontrol element to mixer element: %s", snd_strerror(err));
return NULL;
return NULL;
}
Py_RETURN_NONE;
}
@ -679,14 +679,14 @@ static PyGetSetDef pymelem_getseters[] = {
{"name", (getter)pymelem_get_name, NULL, NULL, NULL},
{"index", (getter)pymelem_get_index, NULL, NULL, NULL},
{NULL,NULL,NULL,NULL,NULL}
};
static PyMethodDef pymelem_methods[] = {
{"attach", (PyCFunction)pymelem_attach, METH_VARARGS, NULL},
{"detach", (PyCFunction)pymelem_detach, METH_VARARGS, NULL},
/* "default" functions - no functionality */
{"opsIsActive", (PyCFunction)pymelem_ignore1, METH_VARARGS, NULL},
{"opsIsMono", (PyCFunction)pymelem_ignore, METH_VARARGS, NULL},
@ -695,7 +695,7 @@ static PyMethodDef pymelem_methods[] = {
{"opsIsEnumCnt", (PyCFunction)pymelem_ignore, METH_VARARGS, NULL},
{"opsGetDB", (PyCFunction)pymelem_error, METH_VARARGS, NULL},
{"eventInfo", (PyCFunction)pymelem_event_info, METH_VARARGS, NULL},
{"eventValue", (PyCFunction)pymelem_event_value, METH_VARARGS, NULL},
@ -703,18 +703,18 @@ static PyMethodDef pymelem_methods[] = {
};
static PyTypeObject pymelem_type = {
PyVarObject_HEAD_INIT(NULL, 0)
tp_name: "smixer_python.InternalMElement",
tp_basicsize: sizeof(struct pymelem),
tp_dealloc: (destructor)pymelem_dealloc,
tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
tp_doc: NULL /* mixerinit__doc__ */,
tp_getset: pymelem_getseters,
tp_init: (initproc)pymelem_init,
tp_alloc: PyType_GenericAlloc,
tp_new: PyType_GenericNew,
tp_free: PyObject_Del,
tp_methods: pymelem_methods,
PyVarObject_HEAD_INIT(NULL, 0)
tp_name: "smixer_python.InternalMElement",
tp_basicsize: sizeof(struct pymelem),
tp_dealloc: (destructor)pymelem_dealloc,
tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
tp_doc: NULL /* mixerinit__doc__ */,
tp_getset: pymelem_getseters,
tp_init: (initproc)pymelem_init,
tp_alloc: PyType_GenericAlloc,
tp_new: PyType_GenericNew,
tp_free: PyObject_Del,
tp_methods: pymelem_methods,
};
static PyObject *
@ -724,7 +724,7 @@ pymixer_attach_hctl(struct pymixer *pymixer, PyObject *args)
snd_hctl_t *hctl;
void **hctls;
int err;
if (!PyArg_ParseTuple(args, "O", &obj))
return NULL;
hctl = (snd_hctl_t *)get_C_ptr(obj, "get_C_hctl");
@ -752,7 +752,7 @@ static PyObject *
pymixer_register(struct pymixer *pymixer, PyObject *args)
{
int err;
if (!PyArg_ParseTuple(args, ""))
return NULL;
err = snd_mixer_class_register(pymixer->class, pymixer->mixer);
@ -769,7 +769,7 @@ pymixer_melement_new(struct pymixer *pymixer, PyObject *args)
PyObject *obj, *obj1, *obj2;
char *class, *name;
long index, weight;
if (!PyArg_ParseTuple(args, "ssii", &class, &name, &index, &weight))
return NULL;
obj = PyDict_GetItemString(pymixer->mdict, class);
@ -808,14 +808,14 @@ pymixer_melement_add(struct pymixer *pymixer, PyObject *args)
PyObject *obj;
struct pymelem *pymelem;
int err;
if (!PyArg_ParseTuple(args, "O", &obj))
return NULL;
pymelem = (struct pymelem *)obj;
err = snd_mixer_elem_add(pymelem->melem, pymixer->class);
if (err < 0) {
PyErr_Format(PyExc_RuntimeError, "Cannot add mixer element: %s", snd_strerror(err));
return NULL;
return NULL;
}
Py_RETURN_NONE;
}
@ -842,7 +842,7 @@ static void
pymixer_free(struct pymixer *self)
{
int idx;
for (idx = 0; idx < self->hctl_count; idx++) {
snd_mixer_detach_hctl(self->mixer, self->hctl[idx*2]);
Py_DECREF((PyObject *)self->hctl[idx*2+1]);
@ -884,18 +884,18 @@ static PyMethodDef pymixer_methods[] = {
};
static PyTypeObject pymixer_type = {
PyVarObject_HEAD_INIT(NULL, 0)
tp_name: "smixer_python.InternalMixer",
tp_basicsize: sizeof(struct pymixer),
tp_dealloc: (destructor)pymixer_dealloc,
tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
tp_doc: NULL /* mixerinit__doc__ */,
tp_getset: pymixer_getseters,
tp_init: (initproc)pymixer_init,
tp_alloc: PyType_GenericAlloc,
tp_new: PyType_GenericNew,
tp_free: PyObject_Del,
tp_methods: pymixer_methods,
PyVarObject_HEAD_INIT(NULL, 0)
tp_name: "smixer_python.InternalMixer",
tp_basicsize: sizeof(struct pymixer),
tp_dealloc: (destructor)pymixer_dealloc,
tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
tp_doc: NULL /* mixerinit__doc__ */,
tp_getset: pymixer_getseters,
tp_init: (initproc)pymixer_init,
tp_alloc: PyType_GenericAlloc,
tp_new: PyType_GenericNew,
tp_free: PyObject_Del,
tp_methods: pymixer_methods,
};
static PyMethodDef python_methods[] = {
@ -984,20 +984,20 @@ int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask,
tstate = PyThreadState_New(main_interpreter);
PyThreadState_Swap(tstate);
t = PyTuple_New(3);
if (t) {
PyTuple_SET_ITEM(t, 0, (PyObject *)PyInt_FromLong(mask));
o = find_helem(priv, helem);
if (mask & SND_CTL_EVENT_MASK_ADD) {
if (o == NULL)
o = new_helem(priv, helem);
t = PyTuple_New(3);
if (t) {
PyTuple_SET_ITEM(t, 0, (PyObject *)PyInt_FromLong(mask));
o = find_helem(priv, helem);
if (mask & SND_CTL_EVENT_MASK_ADD) {
if (o == NULL)
o = new_helem(priv, helem);
}
if (o == NULL)
return 0;
if (o == NULL)
return 0;
PyTuple_SET_ITEM(t, 1, o);
Py_INCREF(o);
o = melem ? find_melem(priv, melem) : Py_None;
o = melem ? find_melem(priv, melem) : Py_None;
PyTuple_SET_ITEM(t, 2, o);
Py_INCREF(o);
r = PyObject_CallObject(priv->py_event_func, t);
@ -1019,7 +1019,7 @@ int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask,
res = -EIO;
}
}
return res;
}
@ -1039,8 +1039,8 @@ static void alsa_mixer_simple_free(snd_mixer_class_t *class)
}
static int alsa_mixer_simple_pyinit(struct python_priv *priv,
PyObject *py_mod,
FILE *fp,
PyObject *py_mod,
FILE *fp,
const char *file,
snd_mixer_class_t *class,
snd_mixer_t *mixer,
@ -1091,15 +1091,15 @@ static int alsa_mixer_simple_pyinit(struct python_priv *priv,
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef smixer_python_module = {
PyModuleDef_HEAD_INIT,
"smixer_python",
NULL,
0,
python_methods,
NULL,
NULL,
NULL,
NULL
PyModuleDef_HEAD_INIT,
"smixer_python",
NULL,
0,
python_methods,
NULL,
NULL,
NULL,
NULL
};
#endif
@ -1131,7 +1131,7 @@ int alsa_mixer_simple_finit(snd_mixer_class_t *class,
snd_error(MIXER, "Unable to find python module '%s'", file);
return -ENODEV;
}
Py_Initialize();
if (PyType_Ready(&pymelem_type) < 0 ||
PyType_Ready(&pymixer_type) < 0) {

View file

@ -43,7 +43,7 @@ static int selem_read(snd_mixer_elem_t *elem);
static unsigned int chanmap_to_channels(unsigned int chanmap)
{
unsigned int i, res;
for (i = 0, res = 0; i < MAX_CHANNEL; i++)
if (chanmap & (1 << i))
res++;
@ -61,11 +61,11 @@ static long to_user(struct selem_base *s, int dir, struct helem_base *c, long va
}
static long from_user(struct selem_base *s, int dir, struct helem_base *c, long value)
{
int64_t n;
{
int64_t n;
if (s->dir[dir].max == s->dir[dir].min)
return c->min;
n = (int64_t) (value - s->dir[dir].min) * (c->max - c->min);
n = (int64_t) (value - s->dir[dir].min) * (c->max - c->min);
return c->min + (n + (s->dir[dir].max - s->dir[dir].min) / 2) / (s->dir[dir].max - s->dir[dir].min);
}
#endif
@ -77,7 +77,7 @@ static void update_ranges(struct selem_base *s)
unsigned int dir, ok_flag;
struct list_head *pos;
struct helem_base *helem;
for (dir = 0; dir < 2; dir++) {
s->dir[dir].min = 0;
s->dir[dir].max = 0;
@ -139,7 +139,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
helem = list_entry(s->helems.next, struct helem_base, list);
return !!(helem->purpose == PURPOSE_ENUMLIST);
}
case SM_OPS_IS_ENUMCNT: {
struct helem_base *helem;
helem = list_entry(s->helems.next, struct helem_base, list);
@ -147,7 +147,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
}
}
return 1;
}
@ -155,7 +155,7 @@ static int get_range_ops(snd_mixer_elem_t *elem, int dir,
long *min, long *max)
{
struct selem_base *s = snd_mixer_elem_get_private(elem);
*min = s->dir[dir].min;
*max = s->dir[dir].max;
@ -179,7 +179,7 @@ static int set_range_ops(snd_mixer_elem_t *elem, int dir,
s->dir[dir].forced_range = 1;
s->dir[dir].min = min;
s->dir[dir].max = max;
if ((err = selem_read(elem)) < 0)
return err;
return 0;
@ -189,7 +189,7 @@ static int get_volume_ops(snd_mixer_elem_t *elem, int dir,
snd_mixer_selem_channel_id_t channel, long *value)
{
struct selem_base *s = snd_mixer_elem_get_private(elem);
*value = s->dir[dir].vol[channel];
return 0;
}
@ -330,7 +330,7 @@ static int simple_event_add1(snd_mixer_class_t *class,
struct bclass_sid *bsid;
struct melem_sids *sid;
unsigned int ui;
list_for_each(pos, &priv->sids) {
bsid = list_entry(pos, struct bclass_sid, list);
for (ui = 0; ui < bsid->count; ui++) {
@ -361,7 +361,7 @@ static int simple_event_add1(snd_mixer_class_t *class,
min = max = 0;
break;
}
printf("event add: %p, %p (%s)\n", helem, sel, snd_hctl_elem_get_name(helem));
if (snd_mixer_selem_id_malloc(&id))
return -ENOMEM;
@ -374,7 +374,7 @@ static int simple_event_add1(snd_mixer_class_t *class,
case PURPOSE_SWITCH:
if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN) {
__invalid_type:
snd_mixer_selem_id_free(id);
snd_mixer_selem_id_free(id);
free(hsimple);
return -EINVAL;
}
@ -446,9 +446,9 @@ static int simple_event_add1(snd_mixer_class_t *class,
err = snd_mixer_elem_value(melem);
return err;
__error:
if (new)
snd_mixer_elem_free(melem);
return -EINVAL;
if (new)
snd_mixer_elem_free(melem);
return -EINVAL;
}
static int simple_event_add(snd_mixer_class_t *class, snd_hctl_elem_t *helem)

View file

@ -97,8 +97,8 @@ int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
return 1;
__error:
if (initflag)
free(priv);
if (initflag)
free(priv);
if (h)
snd_dlclose(h);
free(xlib);