mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-12-20 08:56:54 -05:00
Lot of cleanings with the help of gcc3
This commit is contained in:
parent
ce8275b943
commit
5b50ec848a
59 changed files with 669 additions and 667 deletions
|
|
@ -372,8 +372,8 @@ int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode)
|
|||
int err;
|
||||
snd_config_t *ctl_conf, *conf, *type_conf;
|
||||
snd_config_iterator_t i, next;
|
||||
const char *lib = NULL, *open = NULL;
|
||||
int (*open_func)(snd_ctl_t **ctlp, const char *name, snd_config_t *conf, int mode);
|
||||
const char *lib = NULL, *open_name = NULL;
|
||||
int (*open_func)(snd_ctl_t **, const char *, snd_config_t *, int);
|
||||
void *h;
|
||||
const char *name1;
|
||||
assert(ctlp && name);
|
||||
|
|
@ -423,7 +423,7 @@ int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode)
|
|||
continue;
|
||||
}
|
||||
if (strcmp(id, "open") == 0) {
|
||||
err = snd_config_get_string(n, &open);
|
||||
err = snd_config_get_string(n, &open_name);
|
||||
if (err < 0)
|
||||
return -EINVAL;
|
||||
continue;
|
||||
|
|
@ -433,7 +433,7 @@ int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode)
|
|||
}
|
||||
}
|
||||
if (!open) {
|
||||
open = buf;
|
||||
open_name = buf;
|
||||
snprintf(buf, sizeof(buf), "_snd_ctl_%s_open", str);
|
||||
}
|
||||
if (!lib)
|
||||
|
|
@ -443,9 +443,9 @@ int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode)
|
|||
SNDERR("Cannot open shared library %s", lib);
|
||||
return -ENOENT;
|
||||
}
|
||||
open_func = dlsym(h, open);
|
||||
open_func = dlsym(h, open_name);
|
||||
if (!open_func) {
|
||||
SNDERR("symbol %s is not defined inside %s", open, lib);
|
||||
SNDERR("symbol %s is not defined inside %s", open_name, lib);
|
||||
dlclose(h);
|
||||
return -ENXIO;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,4 +80,4 @@ struct _snd_hctl {
|
|||
|
||||
int _snd_ctl_poll_descriptor(snd_ctl_t *ctl);
|
||||
int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode);
|
||||
int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket, const char *sname, int mode);
|
||||
int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname, const char *sname, int mode);
|
||||
|
|
|
|||
|
|
@ -40,8 +40,6 @@ typedef struct {
|
|||
volatile snd_ctl_shm_ctrl_t *ctrl;
|
||||
} snd_ctl_shm_t;
|
||||
|
||||
extern int receive_fd(int socket, void *data, size_t len, int *fd);
|
||||
|
||||
static int snd_ctl_shm_action(snd_ctl_t *ctl)
|
||||
{
|
||||
snd_ctl_shm_t *shm = ctl->private_data;
|
||||
|
|
@ -402,7 +400,7 @@ static int make_inet_socket(const char *host, int port)
|
|||
}
|
||||
#endif
|
||||
|
||||
int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket, const char *sname, int mode)
|
||||
int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname, const char *sname, int mode)
|
||||
{
|
||||
snd_ctl_t *ctl;
|
||||
snd_ctl_shm_t *shm = NULL;
|
||||
|
|
@ -417,9 +415,9 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket,
|
|||
if (snamelen > 255)
|
||||
return -EINVAL;
|
||||
|
||||
result = make_local_socket(socket);
|
||||
result = make_local_socket(sockname);
|
||||
if (result < 0) {
|
||||
SNDERR("server for socket %s is not running", socket);
|
||||
SNDERR("server for socket %s is not running", sockname);
|
||||
goto _err;
|
||||
}
|
||||
sock = result;
|
||||
|
|
@ -470,7 +468,7 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket,
|
|||
goto _err;
|
||||
}
|
||||
shm = calloc(1, sizeof(snd_ctl_shm_t));
|
||||
if (!ctl) {
|
||||
if (!shm) {
|
||||
free(ctl);
|
||||
result = -ENOMEM;
|
||||
goto _err;
|
||||
|
|
@ -496,8 +494,6 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket,
|
|||
return result;
|
||||
}
|
||||
|
||||
extern int is_local(struct hostent *hent);
|
||||
|
||||
int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf, int mode)
|
||||
{
|
||||
snd_config_iterator_t i, next;
|
||||
|
|
@ -505,7 +501,7 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf, int m
|
|||
const char *sname = NULL;
|
||||
snd_config_t *sconfig;
|
||||
const char *host = NULL;
|
||||
const char *socket = NULL;
|
||||
const char *sockname = NULL;
|
||||
long port = -1;
|
||||
int err;
|
||||
int local;
|
||||
|
|
@ -567,7 +563,7 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf, int m
|
|||
continue;
|
||||
}
|
||||
if (strcmp(id, "socket") == 0) {
|
||||
err = snd_config_get_string(n, &socket);
|
||||
err = snd_config_get_string(n, &sockname);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
|
|
@ -590,7 +586,7 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf, int m
|
|||
SNDERR("host is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!socket) {
|
||||
if (!sockname) {
|
||||
SNDERR("socket is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -604,6 +600,6 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf, int m
|
|||
SNDERR("%s is not the local host", host);
|
||||
return -EINVAL;
|
||||
}
|
||||
return snd_ctl_shm_open(handlep, name, socket, sname, mode);
|
||||
return snd_ctl_shm_open(handlep, name, sockname, sname, mode);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ static int snd_hctl_elem_throw_event(snd_hctl_elem_t *elem,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int snd_hctl_compare_mixer_priority_lookup(char **name, char * const *names, int coef)
|
||||
static int snd_hctl_compare_mixer_priority_lookup(const char **name, const char * const *names, int coef)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ static int snd_hctl_compare_mixer_priority_lookup(char **name, char * const *nam
|
|||
|
||||
static int get_compare_weight(const char *name)
|
||||
{
|
||||
static char *names[] = {
|
||||
static const char *names[] = {
|
||||
"Master",
|
||||
"Hardware Master",
|
||||
"Headphone",
|
||||
|
|
@ -221,7 +221,7 @@ static int get_compare_weight(const char *name)
|
|||
"IEC958",
|
||||
NULL
|
||||
};
|
||||
static char *names1[] = {
|
||||
static const char *names1[] = {
|
||||
"Switch",
|
||||
"Volume",
|
||||
"Playback",
|
||||
|
|
@ -235,7 +235,7 @@ static int get_compare_weight(const char *name)
|
|||
"-",
|
||||
NULL
|
||||
};
|
||||
static char *names2[] = {
|
||||
static const char *names2[] = {
|
||||
"Switch",
|
||||
"Volume",
|
||||
"Bypass",
|
||||
|
|
@ -248,12 +248,12 @@ static int get_compare_weight(const char *name)
|
|||
};
|
||||
int res, res1;
|
||||
|
||||
if ((res = snd_hctl_compare_mixer_priority_lookup((char **)&name, names, 1000000)) == NOT_FOUND)
|
||||
if ((res = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names, 1000000)) == NOT_FOUND)
|
||||
return NOT_FOUND;
|
||||
if ((res1 = snd_hctl_compare_mixer_priority_lookup((char **)&name, names1, 1000)) == NOT_FOUND)
|
||||
if ((res1 = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names1, 1000)) == NOT_FOUND)
|
||||
return res;
|
||||
res += res1;
|
||||
if ((res1 = snd_hctl_compare_mixer_priority_lookup((char **)&name, names2, 1)) == NOT_FOUND)
|
||||
if ((res1 = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names2, 1)) == NOT_FOUND)
|
||||
return res;
|
||||
return res + res1;
|
||||
}
|
||||
|
|
@ -356,8 +356,8 @@ static void snd_hctl_sort(snd_hctl_t *hctl)
|
|||
{
|
||||
unsigned int k;
|
||||
int compar(const void *a, const void *b) {
|
||||
return hctl->compare(*(const snd_hctl_elem_t **) a,
|
||||
*(const snd_hctl_elem_t **) b);
|
||||
return hctl->compare(*(const snd_hctl_elem_t * const *) a,
|
||||
*(const snd_hctl_elem_t * const *) b);
|
||||
}
|
||||
assert(hctl);
|
||||
assert(hctl->compare);
|
||||
|
|
@ -625,7 +625,7 @@ static int snd_hctl_handle_event(snd_hctl_t *hctl, snd_ctl_event_t *event)
|
|||
assert(res >= 0 && dir == 0);
|
||||
if (res < 0 || dir != 0)
|
||||
return -ENOENT;
|
||||
snd_hctl_elem_remove(hctl, res);
|
||||
snd_hctl_elem_remove(hctl, (unsigned int) res);
|
||||
return 0;
|
||||
}
|
||||
if (event->data.elem.mask & SNDRV_CTL_EVENT_MASK_ADD) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue