Huge trailing whitespace cleanup. Let's keep the tree pure from here on,

mmmkay?


git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1418 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Pierre Ossman 2007-01-04 13:43:45 +00:00
parent 1a460ee40a
commit 521daf6f0a
283 changed files with 3742 additions and 3742 deletions

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -48,7 +48,7 @@ struct pa_anotify {
static void dispatch_event(pa_anotify *a) {
assert(a);
assert(a->queue_index < a->n_queued_events);
a->callback(a->queued_events[a->queue_index++], a->userdata);
if (a->queue_index >= a->n_queued_events) {
@ -69,14 +69,14 @@ static void io_callback(
int fd,
pa_io_event_flags_t events,
void *userdata) {
pa_anotify *a = userdata;
ssize_t r;
assert(a);
assert(events == PA_IO_EVENT_INPUT);
assert(a->n_queued_events == 0);
r = read(fd, a->queued_events, sizeof(a->queued_events));
assert(r > 0);
@ -96,7 +96,7 @@ static void defer_callback(pa_mainloop_api *api, pa_defer_event *e, void *userda
pa_anotify *pa_anotify_new(pa_mainloop_api*api, pa_anotify_cb_t cb, void *userdata) {
pa_anotify *a;
assert(api);
assert(cb);
@ -106,7 +106,7 @@ pa_anotify *pa_anotify_new(pa_mainloop_api*api, pa_anotify_cb_t cb, void *userda
pa_xfree(a);
return NULL;
}
a->api = api;
a->callback = cb;
a->userdata = userdata;
@ -130,7 +130,7 @@ void pa_anotify_free(pa_anotify *a) {
close(a->fds[0]);
if (a->fds[1] >= 0)
close(a->fds[1]);
pa_xfree(a);
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -37,7 +37,7 @@ struct authkey_data {
int pa_authkey_prop_get(pa_core *c, const char *name, void *data, size_t len) {
struct authkey_data *a;
assert(c && name && data && len > 0);
if (!(a = pa_property_get(c, name)))
return -1;
@ -59,7 +59,7 @@ int pa_authkey_prop_put(pa_core *c, const char *name, const void *data, size_t l
memcpy(a+1, data, len);
pa_property_set(c, name, a);
return 0;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -91,25 +91,25 @@ static int load(const char *fn, void *data, size_t length) {
if ((size_t) r != length) {
pa_log_debug("got %d bytes from cookie file '%s', expected %d", (int)r, fn, (int)length);
if (!writable) {
pa_log("unable to write cookie to read only file");
goto finish;
}
if (generate(fd, data, length) < 0)
goto finish;
}
ret = 0;
finish:
if (fd >= 0) {
if (unlock)
pa_lock_fd(fd, 0);
close(fd);
}
@ -144,7 +144,7 @@ static const char *normalize_path(const char *fn, char *s, size_t l) {
char homedir[PATH_MAX];
if (!pa_get_home_dir(homedir, sizeof(homedir)))
return NULL;
#ifndef OS_IS_WIN32
snprintf(s, l, "%s/%s", homedir, fn);
#else
@ -165,7 +165,7 @@ int pa_authkey_load_auto(const char *fn, void *data, size_t length) {
if (!(p = normalize_path(fn, path, sizeof(path))))
return -2;
return pa_authkey_load(p, data, length);
}
@ -194,14 +194,14 @@ int pa_authkey_save(const char *fn, const void *data, size_t length) {
}
ret = 0;
finish:
if (fd >= 0) {
if (unlock)
pa_lock_fd(fd, 0);
close(fd);
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -58,20 +58,20 @@ static void entry_remove_and_free(pa_autoload_entry *e) {
static pa_autoload_entry* entry_new(pa_core *c, const char *name) {
pa_autoload_entry *e = NULL;
assert(c && name);
if (c->autoload_hashmap && (e = pa_hashmap_get(c->autoload_hashmap, name)))
return NULL;
e = pa_xmalloc(sizeof(pa_autoload_entry));
e->core = c;
e->name = pa_xstrdup(name);
e->module = e->argument = NULL;
e->in_action = 0;
if (!c->autoload_hashmap)
c->autoload_hashmap = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
assert(c->autoload_hashmap);
pa_hashmap_put(c->autoload_hashmap, e->name, e);
if (!c->autoload_idxset)
@ -79,24 +79,24 @@ static pa_autoload_entry* entry_new(pa_core *c, const char *name) {
pa_idxset_put(c->autoload_idxset, e, &e->index);
pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_AUTOLOAD|PA_SUBSCRIPTION_EVENT_NEW, e->index);
return e;
}
int pa_autoload_add(pa_core *c, const char*name, pa_namereg_type_t type, const char*module, const char *argument, uint32_t *idx) {
pa_autoload_entry *e = NULL;
assert(c && name && module && (type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE));
if (!(e = entry_new(c, name)))
return -1;
e->module = pa_xstrdup(module);
e->argument = pa_xstrdup(argument);
e->type = type;
if (idx)
*idx = e->index;
return 0;
}
@ -139,7 +139,7 @@ void pa_autoload_request(pa_core *c, const char *name, pa_namereg_type_t type) {
if ((m = pa_module_load(c, e->module, e->argument)))
m->auto_unload = 1;
}
e->in_action = 0;
}
@ -154,7 +154,7 @@ void pa_autoload_free(pa_core *c) {
pa_hashmap_free(c->autoload_hashmap, free_func, NULL);
c->autoload_hashmap = NULL;
}
if (c->autoload_idxset) {
pa_idxset_free(c->autoload_idxset, NULL, NULL);
c->autoload_idxset = NULL;
@ -164,7 +164,7 @@ void pa_autoload_free(pa_core *c) {
const pa_autoload_entry* pa_autoload_get_by_name(pa_core *c, const char*name, pa_namereg_type_t type) {
pa_autoload_entry *e;
assert(c && name);
if (!c->autoload_hashmap || !(e = pa_hashmap_get(c->autoload_hashmap, name)) || e->type != type)
return NULL;
@ -174,7 +174,7 @@ const pa_autoload_entry* pa_autoload_get_by_name(pa_core *c, const char*name, pa
const pa_autoload_entry* pa_autoload_get_by_index(pa_core *c, uint32_t idx) {
pa_autoload_entry *e;
assert(c && idx != PA_IDXSET_INVALID);
if (!c->autoload_idxset || !(e = pa_idxset_get_by_index(c->autoload_idxset, idx)))
return NULL;

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -36,7 +36,7 @@ typedef struct pa_autoload_entry {
char *name;
pa_namereg_type_t type; /* Type of the autoload entry */
int in_action; /* Currently loaded */
char *module, *argument;
char *module, *argument;
} pa_autoload_entry;
/* Add a new autoload entry of the given time, with the speicified

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -58,7 +58,7 @@ static pa_io_event_flags_t translate_io_flags(AvahiWatchEvent e) {
static void watch_callback(pa_mainloop_api*a, pa_io_event* e, int fd, pa_io_event_flags_t events, void *userdata) {
AvahiWatch *w = userdata;
assert(a);
assert(e);
assert(w);
@ -75,7 +75,7 @@ static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event
assert(api);
assert(fd >= 0);
assert(callback);
p = api->userdata;
assert(p);
@ -88,19 +88,19 @@ static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event
return w;
}
static void watch_update(AvahiWatch *w, AvahiWatchEvent event) {
assert(w);
w->avahi_poll->mainloop->io_enable(w->io_event, translate_io_flags(event));
}
static AvahiWatchEvent watch_get_events(AvahiWatch *w) {
assert(w);
return w->current_event;
}
static void watch_free(AvahiWatch *w) {
assert(w);
@ -117,7 +117,7 @@ struct AvahiTimeout {
static void timeout_callback(pa_mainloop_api*a, pa_time_event* e, const struct timeval *tv, void *userdata) {
AvahiTimeout *t = userdata;
assert(a);
assert(e);
assert(t);
@ -131,7 +131,7 @@ static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv,
assert(api);
assert(callback);
p = api->userdata;
assert(p);
@ -139,12 +139,12 @@ static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv,
t->avahi_poll = p;
t->callback = callback;
t->userdata = userdata;
t->time_event = tv ? p->mainloop->time_new(p->mainloop, tv, timeout_callback, t) : NULL;
return t;
}
static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
assert(t);
@ -157,7 +157,7 @@ static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
t->time_event = NULL;
}
}
static void timeout_free(AvahiTimeout *t) {
assert(t);
@ -170,9 +170,9 @@ AvahiPoll* pa_avahi_poll_new(pa_mainloop_api *m) {
pa_avahi_poll *p;
assert(m);
p = pa_xnew(pa_avahi_poll, 1);
p->api.userdata = p;
p->api.watch_new = watch_new;
p->api.watch_update = watch_update;
@ -182,7 +182,7 @@ AvahiPoll* pa_avahi_poll_new(pa_mainloop_api *m) {
p->api.timeout_update = timeout_update;
p->api.timeout_free = timeout_free;
p->mainloop = m;
return &p->api;
}
@ -191,7 +191,7 @@ void pa_avahi_poll_free(AvahiPoll *api) {
assert(api);
p = api->userdata;
assert(p);
pa_xfree(p);
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -172,7 +172,7 @@ static int pa_cli_command_help(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
assert(c && t && buf);
pa_strbuf_puts(buf, "Available commands:\n");
for (command = commands; command->name; command++)
if (command->help)
pa_strbuf_printf(buf, " %-25s %s\n", command->name, command->help);
@ -252,12 +252,12 @@ static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
[PA_MEMBLOCK_FIXED] = "FIXED",
[PA_MEMBLOCK_IMPORTED] = "IMPORTED",
};
assert(c);
assert(t);
stat = pa_mempool_get_stat(c->mempool);
pa_strbuf_printf(buf, "Memory blocks currently allocated: %u, size: %s.\n",
(unsigned) AO_load_acquire_read((AO_t*) &stat->n_allocated),
pa_bytes_snprint(s, sizeof(s), (size_t) AO_load_acquire_read((AO_t*) &stat->allocated_size)));
@ -291,7 +291,7 @@ static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
type_table[k],
(unsigned) AO_load_acquire_read(&stat->n_allocated_by_type[k]),
(unsigned) AO_load_acquire_read(&stat->n_accumulated_by_type[k]));
return 0;
}
@ -318,7 +318,7 @@ static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
pa_strbuf_puts(buf, "You need to specify the module name and optionally arguments.\n");
return -1;
}
if (!(m = pa_module_load(c, name, pa_tokenizer_get(t, 2)))) {
pa_strbuf_puts(buf, "Module load failed.\n");
return -1;
@ -724,14 +724,14 @@ static int pa_cli_command_autoload_add(pa_core *c, pa_tokenizer *t, pa_strbuf *b
}
pa_autoload_add(c, a, strstr(pa_tokenizer_get(t, 0), "sink") ? PA_NAMEREG_SINK : PA_NAMEREG_SOURCE, b, pa_tokenizer_get(t, 3), NULL);
return 0;
}
static int pa_cli_command_autoload_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, int *fail) {
const char *name;
assert(c && t && buf && fail);
if (!(name = pa_tokenizer_get(t, 1))) {
pa_strbuf_puts(buf, "You need to specify a device name\n");
return -1;
@ -742,7 +742,7 @@ static int pa_cli_command_autoload_remove(pa_core *c, pa_tokenizer *t, pa_strbuf
return -1;
}
return 0;
return 0;
}
static int pa_cli_command_autoload_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_GCC_UNUSED int *fail) {
@ -766,7 +766,7 @@ static int pa_cli_command_vacuum(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, in
assert(t);
pa_mempool_vacuum(c->mempool);
return 0;
}
@ -857,7 +857,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
time_t now;
void *i;
pa_autoload_entry *a;
assert(c && t);
time(&now);
@ -868,7 +868,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
pa_strbuf_printf(buf, "### Configuration dump generated at %s\n", ctime(&now));
#endif
for (m = pa_idxset_first(c->modules, &idx); m; m = pa_idxset_next(c->modules, &idx)) {
if (m->auto_unload)
continue;
@ -912,7 +912,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
if (c->autoload_hashmap) {
nl = 0;
i = NULL;
while ((a = pa_hashmap_iterate(c->autoload_hashmap, &i, NULL))) {
@ -920,18 +920,18 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
pa_strbuf_puts(buf, "\n");
nl = 1;
}
pa_strbuf_printf(buf, "add-autoload-%s %s %s", a->type == PA_NAMEREG_SINK ? "sink" : "source", a->name, a->module);
if (a->argument)
pa_strbuf_printf(buf, " %s", a->argument);
pa_strbuf_puts(buf, "\n");
}
}
nl = 0;
if ((p = pa_namereg_get_default_sink_name(c))) {
if (!nl) {
pa_strbuf_puts(buf, "\n");
@ -955,7 +955,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, PA_G
int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, int *fail) {
const char *cs;
cs = s+strspn(s, whitespace);
if (*cs == '#' || !*cs)
@ -983,10 +983,10 @@ int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, int *
const struct command*command;
int unknown = 1;
size_t l;
l = strcspn(cs, whitespace);
for (command = commands; command->name; command++)
for (command = commands; command->name; command++)
if (strlen(command->name) == l && !strncmp(cs, command->name, l)) {
int ret;
pa_tokenizer *t = pa_tokenizer_new(cs, command->args);
@ -997,7 +997,7 @@ int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, int *
if (ret < 0 && *fail)
return -1;
break;
}
@ -1049,7 +1049,7 @@ int pa_cli_command_execute(pa_core *c, const char *s, pa_strbuf *buf, int *fail)
while (*p) {
size_t l = strcspn(p, linebreak);
char *line = pa_xstrndup(p, l);
if (pa_cli_command_execute_line(c, line, buf, fail) < 0&& *fail) {
pa_xfree(line);
return -1;

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -52,10 +52,10 @@ char *pa_module_list_to_string(pa_core *c) {
assert(s);
pa_strbuf_printf(s, "%u module(s) loaded.\n", pa_idxset_size(c->modules));
for (m = pa_idxset_first(c->modules, &idx); m; m = pa_idxset_next(c->modules, &idx))
pa_strbuf_printf(s, " index: %u\n\tname: <%s>\n\targument: <%s>\n\tused: %i\n\tauto unload: %s\n", m->index, m->name, m->argument, m->n_used, m->auto_unload ? "yes" : "no");
return pa_strbuf_tostring_free(s);
}
@ -69,14 +69,14 @@ char *pa_client_list_to_string(pa_core *c) {
assert(s);
pa_strbuf_printf(s, "%u client(s) logged in.\n", pa_idxset_size(c->clients));
for (client = pa_idxset_first(c->clients, &idx); client; client = pa_idxset_next(c->clients, &idx)) {
pa_strbuf_printf(s, " index: %u\n\tname: <%s>\n\tdriver: <%s>\n", client->index, client->name, client->driver);
if (client->owner)
pa_strbuf_printf(s, "\towner module: <%u>\n", client->owner->index);
}
return pa_strbuf_tostring_free(s);
}
@ -93,7 +93,7 @@ char *pa_sink_list_to_string(pa_core *c) {
for (sink = pa_idxset_first(c->sinks, &idx); sink; sink = pa_idxset_next(c->sinks, &idx)) {
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
pa_strbuf_printf(
s,
" %c index: %u\n"
@ -118,7 +118,7 @@ char *pa_sink_list_to_string(pa_core *c) {
if (sink->description)
pa_strbuf_printf(s, "\tdescription: <%s>\n", sink->description);
}
return pa_strbuf_tostring_free(s);
}
@ -135,8 +135,8 @@ char *pa_source_list_to_string(pa_core *c) {
for (source = pa_idxset_first(c->sources, &idx); source; source = pa_idxset_next(c->sources, &idx)) {
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
pa_strbuf_printf(
s,
" %c index: %u\n"
@ -153,14 +153,14 @@ char *pa_source_list_to_string(pa_core *c) {
pa_sample_spec_snprint(ss, sizeof(ss), &source->sample_spec),
pa_channel_map_snprint(cm, sizeof(cm), &source->channel_map));
if (source->monitor_of)
if (source->monitor_of)
pa_strbuf_printf(s, "\tmonitor_of: <%u>\n", source->monitor_of->index);
if (source->owner)
pa_strbuf_printf(s, "\towner module: <%u>\n", source->owner->index);
if (source->description)
pa_strbuf_printf(s, "\tdescription: <%s>\n", source->description);
}
return pa_strbuf_tostring_free(s);
}
@ -183,9 +183,9 @@ char *pa_source_output_list_to_string(pa_core *c) {
for (o = pa_idxset_first(c->source_outputs, &idx); o; o = pa_idxset_next(c->source_outputs, &idx)) {
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
assert(o->source);
pa_strbuf_printf(
s,
" index: %u\n"
@ -209,7 +209,7 @@ char *pa_source_output_list_to_string(pa_core *c) {
if (o->client)
pa_strbuf_printf(s, "\tclient: <%u> '%s'\n", o->client->index, o->client->name);
}
return pa_strbuf_tostring_free(s);
}
@ -233,7 +233,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
assert(i->sink);
pa_strbuf_printf(
s,
" index: %u\n"
@ -262,7 +262,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
if (i->client)
pa_strbuf_printf(s, "\tclient: <%u> '%s'\n", i->client->index, i->client->name);
}
return pa_strbuf_tostring_free(s);
}
@ -282,13 +282,13 @@ char *pa_scache_list_to_string(pa_core *c) {
for (e = pa_idxset_first(c->scache, &idx); e; e = pa_idxset_next(c->scache, &idx)) {
double l = 0;
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX] = "n/a", cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX] = "n/a";
if (e->memchunk.memblock) {
pa_sample_spec_snprint(ss, sizeof(ss), &e->sample_spec);
pa_channel_map_snprint(cm, sizeof(cm), &e->channel_map);
l = (double) e->memchunk.length / pa_bytes_per_second(&e->sample_spec);
}
pa_strbuf_printf(
s,
" name: <%s>\n"
@ -351,9 +351,9 @@ char *pa_full_status_string(pa_core *c) {
for (i = 0; i < 8; i++) {
char *t = NULL;
switch (i) {
case 0:
case 0:
t = pa_sink_list_to_string(c);
break;
case 1:
@ -365,7 +365,7 @@ char *pa_full_status_string(pa_core *c) {
case 3:
t = pa_source_output_list_to_string(c);
break;
case 4:
case 4:
t = pa_client_list_to_string(c);
break;
case 5:

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -82,12 +82,12 @@ pa_cli* pa_cli_new(pa_core *core, pa_iochannel *io, pa_module *m) {
c->client->kill = client_kill;
c->client->userdata = c;
c->client->owner = m;
pa_ioline_set_callback(c->line, line_callback, c);
pa_ioline_puts(c->line, "Welcome to PulseAudio! Use \"help\" for usage information.\n"PROMPT);
c->fail = c->kill_requested = c->defer_kill = 0;
return c;
}
@ -103,7 +103,7 @@ static void client_kill(pa_client *client) {
pa_cli *c;
assert(client && client->userdata);
c = client->userdata;
pa_log_debug("CLI client killed.");
if (c->defer_kill)
c->kill_requested = 1;
@ -138,7 +138,7 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
if (c->kill_requested) {
if (c->eof_callback)
c->eof_callback(c, c->userdata);
} else
} else
pa_ioline_puts(line, PROMPT);
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -56,7 +56,7 @@ pa_client *pa_client_new(pa_core *core, const char *driver, const char *name) {
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_NEW, c->index);
pa_core_check_quit(core);
return c;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -42,24 +42,24 @@
/* Run the user supplied parser for an assignment */
static int next_assignment(const char *filename, unsigned line, const pa_config_item *t, const char *lvalue, const char *rvalue, void *userdata) {
assert(filename && t && lvalue && rvalue);
for (; t->parse; t++)
if (!strcmp(lvalue, t->lvalue))
return t->parse(filename, line, lvalue, rvalue, t->data, userdata);
pa_log("[%s:%u] Unknown lvalue '%s'.", filename, line, lvalue);
return -1;
}
/* Returns non-zero when c is contained in s */
static int in_string(char c, const char *s) {
assert(s);
for (; *s; s++)
if (*s == c)
return 1;
return 0;
}
@ -85,7 +85,7 @@ static int parse_line(const char *filename, unsigned line, const pa_config_item
if ((c = strpbrk(b, COMMENTS)))
*c = 0;
if (!*b)
return 0;
@ -106,13 +106,13 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, void
unsigned line = 0;
int do_close = !f;
assert(filename && t);
if (!f && !(f = fopen(filename, "r"))) {
if (errno == ENOENT) {
r = 0;
goto finish;
}
pa_log_warn("WARNING: failed to open configuration file '%s': %s",
filename, pa_cstrerror(errno));
goto finish;
@ -123,23 +123,23 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, void
if (!fgets(l, sizeof(l), f)) {
if (feof(f))
break;
pa_log_warn("WARNING: failed to read configuration file '%s': %s",
filename, pa_cstrerror(errno));
goto finish;
}
if (parse_line(filename, ++line, t, l, userdata) < 0)
goto finish;
}
r = 0;
finish:
if (do_close && f)
fclose(f);
return r;
}
@ -152,22 +152,22 @@ int pa_config_parse_int(const char *filename, unsigned line, const char *lvalue,
pa_log("[%s:%u] Failed to parse numeric value: %s", filename, line, rvalue);
return -1;
}
*i = (int) k;
return 0;
return 0;
}
int pa_config_parse_bool(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
int *b = data, k;
assert(filename && lvalue && rvalue && data);
if ((k = pa_parse_boolean(rvalue)) < 0) {
pa_log("[%s:%u] Failed to parse boolean value: %s", filename, line, rvalue);
return -1;
}
*b = k;
return 0;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -94,7 +94,7 @@ static pa_scache_entry* scache_add_item(pa_core *c, const char *name) {
pa_memblock_unref(e->memchunk.memblock);
pa_xfree(e->filename);
assert(e->core == c);
pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE|PA_SUBSCRIPTION_EVENT_CHANGE, e->index);
@ -178,7 +178,7 @@ int pa_scache_add_file(pa_core *c, const char *name, const char *filename, uint3
if (pa_sound_file_load(c->mempool, filename, &ss, &map, &chunk) < 0)
return -1;
r = pa_scache_add_item(c, name, &ss, &map, &chunk, idx);
pa_memblock_unref(chunk.memblock);
@ -202,7 +202,7 @@ int pa_scache_add_file_lazy(pa_core *c, const char *name, const char *filename,
e->lazy = 1;
e->filename = pa_xstrdup(filename);
if (!c->scache_auto_unload_event) {
struct timeval ntv;
pa_gettimeofday(&ntv);
@ -252,7 +252,7 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t
pa_scache_entry *e;
char *t;
pa_cvolume r;
assert(c);
assert(name);
assert(sink);
@ -269,7 +269,7 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t
if (e->volume.channels > e->sample_spec.channels)
e->volume.channels = e->sample_spec.channels;
}
if (!e->memchunk.memblock)
return -1;
@ -287,7 +287,7 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t
if (e->lazy)
time(&e->last_used_time);
return 0;
}
@ -318,7 +318,7 @@ uint32_t pa_scache_total_size(pa_core *c) {
if (!c->scache || !pa_idxset_size(c->scache))
return 0;
for (e = pa_idxset_first(c->scache, &idx); e; e = pa_idxset_next(c->scache, &idx))
if (e->memchunk.memblock)
sum += e->memchunk.length;
@ -334,7 +334,7 @@ void pa_scache_unload_unused(pa_core *c) {
if (!c->scache || !pa_idxset_size(c->scache))
return;
time(&now);
for (e = pa_idxset_first(c->scache, &idx); e; e = pa_idxset_next(c->scache, &idx)) {
@ -344,7 +344,7 @@ void pa_scache_unload_unused(pa_core *c) {
if (e->last_used_time + c->scache_idle_time > now)
continue;
pa_memblock_unref(e->memchunk.memblock);
e->memchunk.memblock = NULL;
e->memchunk.index = e->memchunk.length = 0;
@ -358,7 +358,7 @@ static void add_file(pa_core *c, const char *pathname) {
const char *e;
e = pa_path_get_filename(pathname);
if (stat(pathname, &st) < 0) {
pa_log("stat('%s'): %s", pathname, pa_cstrerror(errno));
return;
@ -388,7 +388,7 @@ int pa_scache_add_directory_lazy(pa_core *c, const char *pathname) {
for (i = 0; i < p.gl_pathc; i++)
add_file(c, p.gl_pathv[i]);
globfree(&p);
#else
return -1;

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -32,14 +32,14 @@ typedef struct pa_scache_entry {
pa_core *core;
uint32_t index;
char *name;
pa_cvolume volume;
pa_sample_spec sample_spec;
pa_channel_map channel_map;
pa_memchunk memchunk;
char *filename;
int lazy;
time_t last_used_time;
} pa_scache_entry;

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -65,7 +65,7 @@ static void sched_event(pa_core *c);
/* Allocate a new subscription object for the given subscription mask. Use the specified callback function and user data */
pa_subscription* pa_subscription_new(pa_core *c, pa_subscription_mask_t m, pa_subscription_cb_t callback, void *userdata) {
pa_subscription *s;
assert(c);
assert(m);
assert(callback);
@ -85,7 +85,7 @@ pa_subscription* pa_subscription_new(pa_core *c, pa_subscription_mask_t m, pa_su
void pa_subscription_free(pa_subscription*s) {
assert(s);
assert(!s->dead);
s->dead = 1;
sched_event(s->core);
}
@ -104,7 +104,7 @@ static void free_event(pa_subscription_event *s) {
if (!s->next)
s->core->subscription_event_last = s->prev;
PA_LLIST_REMOVE(pa_subscription_event, s->core->subscription_event_queue, s);
pa_xfree(s);
}
@ -112,7 +112,7 @@ static void free_event(pa_subscription_event *s) {
/* Free all subscription objects */
void pa_subscription_free_all(pa_core *c) {
assert(c);
while (c->subscriptions)
free_subscription(c->subscriptions);
@ -157,7 +157,7 @@ static void dump_event(const char * prefix, pa_subscription_event*e) {
static void defer_cb(pa_mainloop_api *m, pa_defer_event *de, void *userdata) {
pa_core *c = userdata;
pa_subscription *s;
assert(c->mainloop == m);
assert(c);
assert(c->subscription_defer_event == de);
@ -170,7 +170,7 @@ static void defer_cb(pa_mainloop_api *m, pa_defer_event *de, void *userdata) {
pa_subscription_event *e = c->subscription_event_queue;
for (s = c->subscriptions; s; s = s->next) {
if (!s->dead && pa_subscription_match_flags(s->mask, e->type))
s->callback(c, e->type, e->index, s->userdata);
}
@ -182,7 +182,7 @@ static void defer_cb(pa_mainloop_api *m, pa_defer_event *de, void *userdata) {
}
/* Remove dead subscriptions */
s = c->subscriptions;
while (s) {
pa_subscription *n = s->next;
@ -200,7 +200,7 @@ static void sched_event(pa_core *c) {
c->subscription_defer_event = c->mainloop->defer_new(c->mainloop, defer_cb, c);
assert(c->subscription_defer_event);
}
c->mainloop->defer_enable(c->subscription_defer_event, 1);
}
@ -212,18 +212,18 @@ void pa_subscription_post(pa_core *c, pa_subscription_event_type_t t, uint32_t i
/* No need for queuing subscriptions of noone is listening */
if (!c->subscriptions)
return;
if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) != PA_SUBSCRIPTION_EVENT_NEW) {
pa_subscription_event *i, *n;
/* Check for duplicates */
for (i = c->subscription_event_last; i; i = n) {
n = i->prev;
/* not the same object type */
if (((t ^ i->type) & PA_SUBSCRIPTION_EVENT_FACILITY_MASK))
continue;
/* not the same object */
if (i->index != index)
continue;
@ -253,7 +253,7 @@ void pa_subscription_post(pa_core *c, pa_subscription_event_type_t t, uint32_t i
e->type = t;
e->index = index;
PA_LLIST_INSERT_AFTER(pa_subscription_event, c->subscription_event_queue, c->subscription_event_last, e);
PA_LLIST_INSERT_AFTER(pa_subscription_event, c->subscription_event_queue, c->subscription_event_last, e);
c->subscription_event_last = e;
#ifdef DEBUG

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -139,7 +139,7 @@ void pa_make_nonblock_fd(int fd) {
int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
struct stat st;
int r;
assert(dir);
#ifdef OS_IS_WIN32
@ -152,7 +152,7 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
umask(u);
}
#endif
if (r < 0 && errno != EEXIST)
return -1;
@ -163,18 +163,18 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
gid = getgid();
chown(dir, uid, gid);
#endif
#ifdef HAVE_CHMOD
chmod(dir, m);
#endif
#ifdef HAVE_LSTAT
if (lstat(dir, &st) < 0)
#else
if (stat(dir, &st) < 0)
#endif
goto fail;
#ifndef OS_IS_WIN32
if (!S_ISDIR(st.st_mode) ||
(st.st_uid != uid) ||
@ -186,9 +186,9 @@ int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid) {
#else
pa_log_warn("secure directory creation not supported on Win32.");
#endif
return 0;
fail:
rmdir(dir);
return -1;
@ -214,12 +214,12 @@ int pa_make_secure_parent_dir(const char *fn, mode_t m, uid_t uid, gid_t gid) {
if (!(dir = pa_parent_dir(fn)))
goto finish;
if (pa_make_secure_dir(dir, m, uid, gid) < 0)
goto finish;
ret = 0;
finish:
pa_xfree(dir);
return ret;
@ -237,7 +237,7 @@ ssize_t pa_read(int fd, void *buf, size_t count, int *type) {
if (!type || *type == 0) {
ssize_t r;
if ((r = recv(fd, buf, count, 0)) >= 0)
return r;
@ -251,7 +251,7 @@ ssize_t pa_read(int fd, void *buf, size_t count, int *type) {
}
#endif
return read(fd, buf, count);
}
@ -263,7 +263,7 @@ ssize_t pa_write(int fd, const void *buf, size_t count, int *type) {
if ((r = send(fd, buf, count, MSG_NOSIGNAL)) >= 0)
return r;
#ifdef OS_IS_WIN32
if (WSAGetLastError() != WSAENOTSOCK) {
errno = WSAGetLastError();
@ -286,7 +286,7 @@ ssize_t pa_write(int fd, const void *buf, size_t count, int *type) {
ssize_t pa_loop_read(int fd, void*data, size_t size, int *type) {
ssize_t ret = 0;
int _type;
assert(fd >= 0);
assert(data);
assert(size);
@ -304,7 +304,7 @@ ssize_t pa_loop_read(int fd, void*data, size_t size, int *type) {
if (r == 0)
break;
ret += r;
data = (uint8_t*) data + r;
size -= r;
@ -335,7 +335,7 @@ ssize_t pa_loop_write(int fd, const void*data, size_t size, int *type) {
if (r == 0)
break;
ret += r;
data = (const uint8_t*) data + r;
size -= r;
@ -354,8 +354,8 @@ void pa_check_signal_is_blocked(int sig) {
/* If POSIX threads are supported use thread-aware
* pthread_sigmask() function, to check if the signal is
* blocked. Otherwise fall back to sigprocmask() */
#ifdef HAVE_PTHREAD
#ifdef HAVE_PTHREAD
if (pthread_sigmask(SIG_SETMASK, NULL, &set) < 0) {
#endif
if (sigprocmask(SIG_SETMASK, NULL, &set) < 0) {
@ -370,15 +370,15 @@ void pa_check_signal_is_blocked(int sig) {
return;
/* Check whether the signal is trapped */
if (sigaction(sig, NULL, &sa) < 0) {
pa_log("sigaction(): %s", pa_cstrerror(errno));
return;
}
if (sa.sa_handler != SIG_DFL)
return;
pa_log("WARNING: %s is not trapped. This might cause malfunction!", pa_strsignal(sig));
#else /* HAVE_SIGACTION */
pa_log("WARNING: %s might not be trapped. This might cause malfunction!", pa_strsignal(sig));
@ -390,9 +390,9 @@ void pa_check_signal_is_blocked(int sig) {
char *pa_sprintf_malloc(const char *format, ...) {
int size = 100;
char *c = NULL;
assert(format);
for(;;) {
int r;
va_list ap;
@ -402,12 +402,12 @@ char *pa_sprintf_malloc(const char *format, ...) {
va_start(ap, format);
r = vsnprintf(c, size, format, ap);
va_end(ap);
if (r > -1 && r < size)
return c;
if (r > -1) /* glibc 2.1 */
size = r+1;
size = r+1;
else /* glibc 2.0 */
size *= 2;
}
@ -418,9 +418,9 @@ char *pa_sprintf_malloc(const char *format, ...) {
char *pa_vsprintf_malloc(const char *format, va_list ap) {
int size = 100;
char *c = NULL;
assert(format);
for(;;) {
int r;
va_list aq;
@ -431,12 +431,12 @@ char *pa_vsprintf_malloc(const char *format, va_list ap) {
r = vsnprintf(c, size, format, aq);
va_end(aq);
if (r > -1 && r < size)
return c;
if (r > -1) /* glibc 2.1 */
size = r+1;
size = r+1;
else /* glibc 2.0 */
size *= 2;
}
@ -461,10 +461,10 @@ void pa_raise_priority(void) {
#ifdef HAVE_SYS_RESOURCE_H
if (setpriority(PRIO_PROCESS, 0, NICE_LEVEL) < 0)
pa_log_warn("setpriority(): %s", pa_cstrerror(errno));
else
pa_log_info("Successfully gained nice level %i.", NICE_LEVEL);
else
pa_log_info("Successfully gained nice level %i.", NICE_LEVEL);
#endif
#ifdef _POSIX_PRIORITY_SCHEDULING
{
struct sched_param sp;
@ -473,14 +473,14 @@ void pa_raise_priority(void) {
pa_log("sched_getparam(): %s", pa_cstrerror(errno));
return;
}
sp.sched_priority = 1;
if (sched_setscheduler(0, SCHED_FIFO, &sp) < 0) {
pa_log_warn("sched_setscheduler(): %s", pa_cstrerror(errno));
return;
}
pa_log_info("Successfully enabled SCHED_FIFO scheduling.");
pa_log_info("Successfully enabled SCHED_FIFO scheduling.");
}
#endif
@ -488,7 +488,7 @@ void pa_raise_priority(void) {
if (!SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS))
pa_log_warn("SetPriorityClass() failed: 0x%08X", GetLastError());
else
pa_log_info("Successfully gained high priority class.");
pa_log_info("Successfully gained high priority class.");
#endif
}
@ -521,19 +521,19 @@ int pa_fd_set_cloexec(int fd, int b) {
if ((v = fcntl(fd, F_GETFD, 0)) < 0)
return -1;
v = (v & ~FD_CLOEXEC) | (b ? FD_CLOEXEC : 0);
if (fcntl(fd, F_SETFD, v) < 0)
return -1;
#endif
#endif
return 0;
}
/* Try to parse a boolean string value.*/
int pa_parse_boolean(const char *v) {
if (!strcmp(v, "1") || v[0] == 'y' || v[0] == 'Y' || v[0] == 't' || v[0] == 'T' || !strcasecmp(v, "on"))
return 1;
else if (!strcmp(v, "0") || v[0] == 'n' || v[0] == 'N' || v[0] == 'f' || v[0] == 'F' || !strcasecmp(v, "off"))
@ -552,7 +552,7 @@ char *pa_split(const char *c, const char *delimiter, const char**state) {
if (!*current)
return NULL;
l = strcspn(current, delimiter);
*state = current+l;
@ -632,7 +632,7 @@ static int is_group(gid_t gid, const char *name) {
}
r = strcmp(name, result->gr_name) == 0;
finish:
pa_xfree(data);
#else
@ -647,7 +647,7 @@ finish:
finish:
#endif
return r;
}
@ -658,9 +658,9 @@ int pa_own_uid_in_group(const char *name, gid_t *gid) {
int r = -1, i;
assert(n > 0);
gids = pa_xmalloc(sizeof(GETGROUPS_T)*n);
if ((n = getgroups(n, gids)) < 0) {
pa_log("getgroups(): %s", pa_cstrerror(errno));
goto finish;
@ -681,7 +681,7 @@ int pa_own_uid_in_group(const char *name, gid_t *gid) {
}
r = 0;
finish:
pa_xfree(gids);
@ -695,20 +695,20 @@ int pa_uid_in_group(uid_t uid, const char *name) {
struct group grbuf, *gr;
char **i;
int r = -1;
g_n = sysconf(_SC_GETGR_R_SIZE_MAX);
g_buf = pa_xmalloc(g_n);
p_n = sysconf(_SC_GETPW_R_SIZE_MAX);
p_buf = pa_xmalloc(p_n);
if (getgrnam_r(name, &grbuf, g_buf, (size_t) g_n, &gr) != 0 || !gr)
goto finish;
r = 0;
for (i = gr->gr_mem; *i; i++) {
struct passwd pwbuf, *pw;
if (getpwnam_r(*i, &pwbuf, p_buf, (size_t) p_n, &pw) != 0 || !pw)
continue;
@ -763,7 +763,7 @@ int pa_check_in_group(gid_t g) {
int pa_own_uid_in_group(const char *name, gid_t *gid) {
return -1;
}
int pa_uid_in_group(uid_t uid, const char *name) {
@ -787,7 +787,7 @@ int pa_lock_fd(int fd, int b) {
struct flock flock;
/* Try a R/W lock first */
flock.l_type = b ? F_WRLCK : F_UNLCK;
flock.l_whence = SEEK_SET;
flock.l_start = 0;
@ -802,7 +802,7 @@ int pa_lock_fd(int fd, int b) {
if (fcntl(fd, F_SETLKW, &flock) >= 0)
return 0;
}
pa_log("%slock: %s", !b? "un" : "",
pa_cstrerror(errno));
#endif
@ -836,18 +836,18 @@ int pa_lock_lockfile(const char *fn) {
for (;;) {
struct stat st;
if ((fd = open(fn, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR)) < 0) {
pa_log("failed to create lock file '%s': %s", fn,
pa_cstrerror(errno));
goto fail;
}
if (pa_lock_fd(fd, 1) < 0) {
pa_log("failed to lock file '%s'.", fn);
goto fail;
}
if (fstat(fd, &st) < 0) {
pa_log("failed to fstat() file '%s'.", fn);
goto fail;
@ -856,12 +856,12 @@ int pa_lock_lockfile(const char *fn) {
/* Check wheter the file has been removed meanwhile. When yes, restart this loop, otherwise, we're done */
if (st.st_nlink >= 1)
break;
if (pa_lock_fd(fd, 0) < 0) {
pa_log("failed to unlock file '%s'.", fn);
goto fail;
}
if (close(fd) < 0) {
pa_log("failed to close file '%s'.", fn);
goto fail;
@ -869,7 +869,7 @@ int pa_lock_lockfile(const char *fn) {
fd = -1;
}
return fd;
fail:
@ -890,7 +890,7 @@ int pa_unlock_lockfile(const char *fn, int fd) {
fn, pa_cstrerror(errno));
r = -1;
}
if (pa_lock_fd(fd, 0) < 0) {
pa_log_warn("WARNING: failed to unlock file '%s'.", fn);
r = -1;
@ -946,20 +946,20 @@ FILE *pa_open_config_file(const char *global, const char *local, const char *env
if (lfn) {
FILE *f;
#ifdef OS_IS_WIN32
if (!ExpandEnvironmentStrings(lfn, buf, PATH_MAX))
return NULL;
fn = buf;
#endif
if ((f = fopen(fn, mode)) || errno != ENOENT) {
if (result)
*result = pa_xstrdup(fn);
pa_xfree(lfn);
return f;
}
pa_xfree(lfn);
}
}
@ -979,10 +979,10 @@ FILE *pa_open_config_file(const char *global, const char *local, const char *env
if (result)
*result = pa_xstrdup(global);
return fopen(global, mode);
}
/* Format the specified data as a hexademical string */
char *pa_hexstr(const uint8_t* d, size_t dlength, char *s, size_t slength) {
size_t i = 0, j = 0;
@ -1025,7 +1025,7 @@ size_t pa_parsehex(const char *p, uint8_t *d, size_t dlength) {
if ((b = hexc(*(p++))) < 0)
return (size_t) -1;
d[j] = (uint8_t) (b << 4);
if (!*p)
@ -1044,10 +1044,10 @@ size_t pa_parsehex(const char *p, uint8_t *d, size_t dlength) {
/* Returns nonzero when *s starts with *pfx */
int pa_startswith(const char *s, const char *pfx) {
size_t l;
assert(s);
assert(pfx);
l = strlen(pfx);
return strlen(s) >= l && strncmp(s, pfx, l) == 0;
@ -1056,10 +1056,10 @@ int pa_startswith(const char *s, const char *pfx) {
/* Returns nonzero when *s ends with *sfx */
int pa_endswith(const char *s, const char *sfx) {
size_t l1, l2;
assert(s);
assert(sfx);
l1 = strlen(s);
l2 = strlen(sfx);
@ -1081,20 +1081,20 @@ char *pa_runtime_path(const char *fn, char *s, size_t l) {
if ((e = getenv("PULSE_RUNTIME_PATH"))) {
if (fn)
if (fn)
snprintf(s, l, "%s%c%s", e, PATH_SEP, fn);
else
snprintf(s, l, "%s", e);
} else {
char u[256];
if (fn)
if (fn)
snprintf(s, l, "%s%s%c%s", PA_USER_RUNTIME_PATH_PREFIX, pa_get_user_name(u, sizeof(u)), PATH_SEP, fn);
else
snprintf(s, l, "%s%s", PA_USER_RUNTIME_PATH_PREFIX, pa_get_user_name(u, sizeof(u)));
}
#ifdef OS_IS_WIN32
{
@ -1119,7 +1119,7 @@ int pa_atoi(const char *s, int32_t *ret_i) {
return -1;
*ret_i = (int32_t) l;
return 0;
}
@ -1135,6 +1135,6 @@ int pa_atou(const char *s, uint32_t *ret_u) {
return -1;
*ret_u = (uint32_t) l;
return 0;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -116,7 +116,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
pa_property_init(c);
pa_random(&c->cookie, sizeof(c->cookie));
#ifdef SIGPIPE
pa_check_signal_is_blocked(SIGPIPE);
#endif
@ -131,16 +131,16 @@ void pa_core_free(pa_core *c) {
assert(pa_idxset_isempty(c->clients));
pa_idxset_free(c->clients, NULL, NULL);
assert(pa_idxset_isempty(c->sinks));
pa_idxset_free(c->sinks, NULL, NULL);
assert(pa_idxset_isempty(c->sources));
pa_idxset_free(c->sources, NULL, NULL);
assert(pa_idxset_isempty(c->source_outputs));
pa_idxset_free(c->source_outputs, NULL, NULL);
assert(pa_idxset_isempty(c->sink_inputs));
pa_idxset_free(c->sink_inputs, NULL, NULL);
@ -163,8 +163,8 @@ void pa_core_free(pa_core *c) {
pa_hook_free(&c->hook_sink_disconnect);
pa_hook_free(&c->hook_source_output_new);
pa_hook_free(&c->hook_source_disconnect);
pa_xfree(c);
pa_xfree(c);
}
static void quit_callback(pa_mainloop_api*m, pa_time_event *e, PA_GCC_UNUSED const struct timeval *tv, void *userdata) {

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -46,7 +46,7 @@ struct pa_core {
/* A random value which may be used to identify this instance of
* PulseAudio. Not cryptographically secure in any way. */
uint32_t cookie;
pa_mainloop_api *mainloop;
/* idxset of all kinds of entities */

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -111,12 +111,12 @@ pa_flist *pa_flist_new(unsigned size) {
size = FLIST_SIZE;
assert(is_power_of_two(size));
l = pa_xnew(pa_flist, 1);
l->size = size;
l->cells = pa_xnew0(struct cell, size);
pa_atomic_store(&l->read_idx, 0);
pa_atomic_store(&l->write_idx, 0);
pa_atomic_store(&l->length, 0);
@ -133,10 +133,10 @@ void pa_flist_free(pa_flist *l, pa_free_cb_t free_cb) {
if (free_cb) {
int len, idx;
idx = reduce(l, pa_atomic_load(&l->read_idx));
len = pa_atomic_load(&l->length);
for (; len > 0; len--) {
if (pa_atomic_load(&l->cells[idx].state) == STATE_USED)
@ -152,7 +152,7 @@ void pa_flist_free(pa_flist *l, pa_free_cb_t free_cb) {
int pa_flist_push(pa_flist*l, void *p) {
int idx, len, n;
assert(l);
assert(p);
@ -183,13 +183,13 @@ int pa_flist_push(pa_flist*l, void *p) {
if (len > N_EXTRA_SCAN)
pa_log("WARNING: Didn't find free cell after %u iterations.", len);
#endif
return -1;
}
void* pa_flist_pop(pa_flist*l) {
int idx, len, n;
assert(l);
n = len = pa_atomic_load(&l->length) + N_EXTRA_SCAN;
@ -221,6 +221,6 @@ void* pa_flist_pop(pa_flist*l) {
if (len > N_EXTRA_SCAN)
pa_log("WARNING: Didn't find used cell after %u iterations.", len);
#endif
return NULL;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -33,7 +33,7 @@ extern int16_t _st_ulaw2linear16[256];
#define st_14linear2ulaw(sw) (_st_14linear2ulaw[(sw + 0x2000)])
#define st_ulaw2linear16(uc) (_st_ulaw2linear16[uc])
#else
unsigned char st_14linear2ulaw(int16_t pcm_val);
unsigned char st_14linear2ulaw(int16_t pcm_val);
int16_t st_ulaw2linear16(unsigned char);
#endif

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -47,7 +47,7 @@ struct pa_hashmap {
unsigned size;
struct hashmap_entry **data;
struct hashmap_entry *first_entry;
unsigned n_entries;
pa_hash_func_t hash_func;
pa_compare_func_t compare_func;
@ -55,14 +55,14 @@ struct pa_hashmap {
pa_hashmap *pa_hashmap_new(pa_hash_func_t hash_func, pa_compare_func_t compare_func) {
pa_hashmap *h;
h = pa_xnew(pa_hashmap, 1);
h->data = pa_xnew0(struct hashmap_entry*, h->size = BUCKETS);
h->first_entry = NULL;
h->n_entries = 0;
h->hash_func = hash_func ? hash_func : pa_idxset_trivial_hash_func;
h->compare_func = compare_func ? compare_func : pa_idxset_trivial_compare_func;
return h;
}
@ -98,7 +98,7 @@ void pa_hashmap_free(pa_hashmap*h, void (*free_func)(void *p, void *userdata), v
free_func(h->first_entry->value, userdata);
remove(h, h->first_entry);
}
pa_xfree(h->data);
pa_xfree(h);
}
@ -124,24 +124,24 @@ int pa_hashmap_put(pa_hashmap *h, const void *key, void *value) {
if ((e = get(h, hash, key)))
return -1;
e = pa_xnew(struct hashmap_entry, 1);
e->hash = hash;
e->key = key;
e->value = value;
e->previous = NULL;
e->next = h->first_entry;
if (h->first_entry)
h->first_entry->previous = e;
h->first_entry = e;
e->bucket_previous = NULL;
e->bucket_next = h->data[hash];
if (h->data[hash])
h->data[hash]->bucket_previous = e;
h->data[hash] = e;
h->n_entries ++;
return 0;
}
@ -164,7 +164,7 @@ void* pa_hashmap_remove(pa_hashmap *h, const void *key) {
struct hashmap_entry *e;
unsigned hash;
void *data;
assert(h);
hash = h->hash_func(key) % h->size;
@ -185,7 +185,7 @@ void *pa_hashmap_iterate(pa_hashmap *h, void **state, const void **key) {
assert(h);
assert(state);
if (!*state)
if (!*state)
*state = h->first_entry;
else
*state = ((struct hashmap_entry*) *state)->next;
@ -198,13 +198,13 @@ void *pa_hashmap_iterate(pa_hashmap *h, void **state, const void **key) {
if (key)
*key = ((struct hashmap_entry*) *state)->key;
return ((struct hashmap_entry*) *state)->value;
}
void* pa_hashmap_steal_first(pa_hashmap *h) {
void *data;
assert(h);
if (!h->first_entry)

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -36,9 +36,9 @@ static void slot_free(pa_hook *hook, pa_hook_slot *slot) {
if (hook->last == slot)
hook->last = slot->prev;
PA_LLIST_REMOVE(pa_hook_slot, hook->slots, slot);
pa_xfree(slot);
}
@ -48,13 +48,13 @@ void pa_hook_free(pa_hook *hook) {
while (hook->slots)
slot_free(hook, hook->slots);
pa_hook_init(hook, NULL);
}
pa_hook_slot* pa_hook_connect(pa_hook *hook, pa_hook_cb_t cb, void *data) {
pa_hook_slot *slot;
assert(cb);
slot = pa_xnew(pa_hook_slot, 1);
@ -62,17 +62,17 @@ pa_hook_slot* pa_hook_connect(pa_hook *hook, pa_hook_cb_t cb, void *data) {
slot->dead = 0;
slot->callback = cb;
slot->data = data;
PA_LLIST_INSERT_AFTER(pa_hook_slot, hook->slots, hook->last, slot);
hook->last = slot;
return slot;
}
void pa_hook_slot_free(pa_hook_slot *slot) {
assert(slot);
assert(!slot->dead);
if (slot->hook->firing > 0) {
slot->dead = 1;
slot->hook->n_dead++;
@ -83,7 +83,7 @@ void pa_hook_slot_free(pa_hook_slot *slot) {
pa_hook_result_t pa_hook_fire(pa_hook *hook, void *data) {
pa_hook_slot *slot, *next;
pa_hook_result_t result = PA_HOOK_OK;
assert(hook);
hook->firing ++;
@ -91,16 +91,16 @@ pa_hook_result_t pa_hook_fire(pa_hook *hook, void *data) {
for (slot = hook->slots; slot; slot = slot->next) {
if (slot->dead)
continue;
if ((result = slot->callback(hook->data, data, slot->data)) != PA_HOOK_OK)
break;
}
hook->firing --;
for (slot = hook->slots; hook->n_dead > 0 && slot; slot = next) {
next = slot->next;
if (slot->dead) {
slot_free(hook, slot);
hook->n_dead--;

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -44,7 +44,7 @@ typedef struct idxset_entry {
struct pa_idxset {
pa_hash_func_t hash_func;
pa_compare_func_t compare_func;
unsigned hash_table_size, n_entries;
idxset_entry **hash_table, **array, *iterate_list_head, *iterate_list_tail;
uint32_t index, start_index, array_size;
@ -53,7 +53,7 @@ struct pa_idxset {
unsigned pa_idxset_string_hash_func(const void *p) {
unsigned hash = 0;
const char *c;
for (c = p; *c; c++)
hash = 31 * hash + *c;
@ -97,7 +97,7 @@ void pa_idxset_free(pa_idxset *s, void (*free_func) (void *p, void *userdata), v
while (s->iterate_list_head) {
idxset_entry *e = s->iterate_list_head;
s->iterate_list_head = s->iterate_list_head->iterate_next;
if (free_func)
free_func(e->data, userdata);
pa_xfree(e);
@ -133,12 +133,12 @@ static void extend_array(pa_idxset *s, uint32_t idx) {
l = idx - s->start_index - i + 100;
n = pa_xnew0(idxset_entry*, l);
for (j = 0; j < s->array_size-i; j++)
n[j] = s->array[i+j];
pa_xfree(s->array);
s->array = n;
s->array_size = l;
s->start_index += i;
@ -147,17 +147,17 @@ static void extend_array(pa_idxset *s, uint32_t idx) {
static idxset_entry** array_index(pa_idxset*s, uint32_t idx) {
if (idx >= s->start_index + s->array_size)
return NULL;
if (idx < s->start_index)
return NULL;
return s->array + idx - s->start_index;
}
int pa_idxset_put(pa_idxset*s, void *p, uint32_t *idx) {
unsigned h;
idxset_entry *e, **a;
assert(s);
assert(p);
@ -168,7 +168,7 @@ int pa_idxset_put(pa_idxset*s, void *p, uint32_t *idx) {
if ((e = hash_scan(s, s->hash_table[h], p))) {
if (idx)
*idx = e->index;
return -1;
}
@ -201,10 +201,10 @@ int pa_idxset_put(pa_idxset*s, void *p, uint32_t *idx) {
s->iterate_list_head = e;
}
s->iterate_list_tail = e;
s->n_entries++;
assert(s->n_entries >= 1);
if (idx)
*idx = e->index;
@ -214,7 +214,7 @@ int pa_idxset_put(pa_idxset*s, void *p, uint32_t *idx) {
void* pa_idxset_get_by_index(pa_idxset*s, uint32_t idx) {
idxset_entry **a;
assert(s);
if (!(a = array_index(s, idx)))
return NULL;
@ -228,7 +228,7 @@ void* pa_idxset_get_by_data(pa_idxset*s, const void *p, uint32_t *idx) {
unsigned h;
idxset_entry *e;
assert(s && p);
assert(s->hash_func);
h = s->hash_func(p) % s->hash_table_size;
@ -250,13 +250,13 @@ static void remove_entry(pa_idxset *s, idxset_entry *e) {
a = array_index(s, e->index);
assert(a && *a && *a == e);
*a = NULL;
/* Remove from linked list */
if (e->iterate_next)
e->iterate_next->iterate_prev = e->iterate_prev;
else
s->iterate_list_tail = e->iterate_prev;
if (e->iterate_prev)
e->iterate_prev->iterate_next = e->iterate_next;
else
@ -280,7 +280,7 @@ static void remove_entry(pa_idxset *s, idxset_entry *e) {
void* pa_idxset_remove_by_index(pa_idxset*s, uint32_t idx) {
idxset_entry **a;
void *data;
assert(s);
if (!(a = array_index(s, idx)))
@ -291,15 +291,15 @@ void* pa_idxset_remove_by_index(pa_idxset*s, uint32_t idx) {
data = (*a)->data;
remove_entry(s, *a);
return data;
return data;
}
void* pa_idxset_remove_by_data(pa_idxset*s, const void *data, uint32_t *idx) {
idxset_entry *e;
unsigned h;
void *r;
assert(s->hash_func);
h = s->hash_func(data) % s->hash_table_size;
@ -328,7 +328,7 @@ void* pa_idxset_rrobin(pa_idxset *s, uint32_t *idx) {
if (!e)
return NULL;
*idx = e->index;
return e->data;
}
@ -351,7 +351,7 @@ void *pa_idxset_next(pa_idxset *s, uint32_t *idx) {
if ((a = array_index(s, *idx)) && *a)
e = (*a)->iterate_next;
if (e) {
*idx = e->index;
return e->data;
@ -380,7 +380,7 @@ int pa_idxset_foreach(pa_idxset*s, int (*func)(void *p, uint32_t idx, int *del,
e = n;
}
return 0;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -54,11 +54,11 @@ struct pa_iochannel {
pa_iochannel_cb_t callback;
void*userdata;
int readable;
int writable;
int hungup;
int no_close;
pa_io_event* input_event, *output_event;
@ -70,7 +70,7 @@ static void enable_mainloop_sources(pa_iochannel *io) {
if (io->input_event == io->output_event && io->input_event) {
pa_io_event_flags_t f = PA_IO_EVENT_NULL;
assert(io->input_event);
if (!io->readable)
f |= PA_IO_EVENT_INPUT;
if (!io->writable)
@ -88,7 +88,7 @@ static void enable_mainloop_sources(pa_iochannel *io) {
static void callback(pa_mainloop_api* m, pa_io_event *e, int fd, pa_io_event_flags_t f, void *userdata) {
pa_iochannel *io = userdata;
int changed = 0;
assert(m);
assert(e);
assert(fd >= 0);
@ -104,7 +104,7 @@ static void callback(pa_mainloop_api* m, pa_io_event *e, int fd, pa_io_event_fla
changed = 1;
assert(e == io->input_event);
}
if ((f & PA_IO_EVENT_OUTPUT) && !io->writable) {
io->writable = 1;
changed = 1;
@ -113,7 +113,7 @@ static void callback(pa_mainloop_api* m, pa_io_event *e, int fd, pa_io_event_fla
if (changed) {
enable_mainloop_sources(io);
if (io->callback)
io->callback(io, io->userdata);
}
@ -121,7 +121,7 @@ static void callback(pa_mainloop_api* m, pa_io_event *e, int fd, pa_io_event_fla
pa_iochannel* pa_iochannel_new(pa_mainloop_api*m, int ifd, int ofd) {
pa_iochannel *io;
assert(m);
assert(ifd >= 0 || ofd >= 0);
@ -165,42 +165,42 @@ void pa_iochannel_free(pa_iochannel*io) {
if (io->input_event)
io->mainloop->io_free(io->input_event);
if (io->output_event && (io->output_event != io->input_event))
io->mainloop->io_free(io->output_event);
if (!io->no_close) {
if (io->ifd >= 0)
close(io->ifd);
if (io->ofd >= 0 && io->ofd != io->ifd)
close(io->ofd);
}
pa_xfree(io);
}
int pa_iochannel_is_readable(pa_iochannel*io) {
assert(io);
return io->readable || io->hungup;
}
int pa_iochannel_is_writable(pa_iochannel*io) {
assert(io);
return io->writable && !io->hungup;
}
int pa_iochannel_is_hungup(pa_iochannel*io) {
assert(io);
return io->hungup;
}
ssize_t pa_iochannel_write(pa_iochannel*io, const void*data, size_t l) {
ssize_t r;
assert(io);
assert(data);
assert(l);
@ -217,7 +217,7 @@ ssize_t pa_iochannel_write(pa_iochannel*io, const void*data, size_t l) {
ssize_t pa_iochannel_read(pa_iochannel*io, void*data, size_t l) {
ssize_t r;
assert(io);
assert(data);
assert(io->ifd >= 0);
@ -236,13 +236,13 @@ ssize_t pa_iochannel_read(pa_iochannel*io, void*data, size_t l) {
int pa_iochannel_creds_supported(pa_iochannel *io) {
struct sockaddr_un sa;
socklen_t l;
assert(io);
assert(io->ifd >= 0);
assert(io->ofd == io->ifd);
l = sizeof(sa);
if (getsockname(io->ifd, (struct sockaddr*) &sa, &l) < 0)
return 0;
@ -254,7 +254,7 @@ int pa_iochannel_creds_enable(pa_iochannel *io) {
assert(io);
assert(io->ifd >= 0);
if (setsockopt(io->ifd, SOL_SOCKET, SO_PASSCRED, &t, sizeof(t)) < 0) {
pa_log_error("setsockopt(SOL_SOCKET, SO_PASSCRED): %s", pa_cstrerror(errno));
return -1;
@ -270,7 +270,7 @@ ssize_t pa_iochannel_write_with_creds(pa_iochannel*io, const void*data, size_t l
uint8_t cmsg_data[CMSG_SPACE(sizeof(struct ucred))];
struct ucred *u;
struct cmsghdr *cmsg;
assert(io);
assert(data);
assert(l);
@ -296,7 +296,7 @@ ssize_t pa_iochannel_write_with_creds(pa_iochannel*io, const void*data, size_t l
u->uid = getuid();
u->gid = getgid();
}
memset(&mh, 0, sizeof(mh));
mh.msg_name = NULL;
mh.msg_namelen = 0;
@ -319,7 +319,7 @@ ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_cr
struct msghdr mh;
struct iovec iov;
uint8_t cmsg_data[CMSG_SPACE(sizeof(struct ucred))];
assert(io);
assert(data);
assert(l);
@ -346,9 +346,9 @@ ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_cr
struct cmsghdr *cmsg;
*creds_valid = 0;
for (cmsg = CMSG_FIRSTHDR(&mh); cmsg; cmsg = CMSG_NXTHDR(&mh, cmsg)) {
if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_CREDENTIALS) {
struct ucred u;
assert(cmsg->cmsg_len == CMSG_LEN(sizeof(struct ucred)));
@ -364,7 +364,7 @@ ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_cr
io->readable = 0;
enable_mainloop_sources(io);
}
return r;
}
@ -372,14 +372,14 @@ ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_cr
void pa_iochannel_set_callback(pa_iochannel*io, pa_iochannel_cb_t _callback, void *userdata) {
assert(io);
io->callback = _callback;
io->userdata = userdata;
}
void pa_iochannel_set_noclose(pa_iochannel*io, int b) {
assert(io);
io->no_close = b;
}
@ -387,25 +387,25 @@ void pa_iochannel_socket_peer_to_string(pa_iochannel*io, char*s, size_t l) {
assert(io);
assert(s);
assert(l);
pa_socket_peer_to_string(io->ifd, s, l);
}
int pa_iochannel_socket_set_rcvbuf(pa_iochannel *io, size_t l) {
assert(io);
return pa_socket_set_rcvbuf(io->ifd, l);
}
int pa_iochannel_socket_set_sndbuf(pa_iochannel *io, size_t l) {
assert(io);
return pa_socket_set_sndbuf(io->ofd, l);
}
pa_mainloop_api* pa_iochannel_get_mainloop_api(pa_iochannel *io) {
assert(io);
return io->mainloop;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -64,7 +64,7 @@ static void defer_callback(pa_mainloop_api*m, pa_defer_event*e, void *userdata);
pa_ioline* pa_ioline_new(pa_iochannel *io) {
pa_ioline *l;
assert(io);
l = pa_xnew(pa_ioline, 1);
l->io = io;
l->dead = 0;
@ -85,9 +85,9 @@ pa_ioline* pa_ioline_new(pa_iochannel *io) {
l->mainloop->defer_enable(l->defer_event, 0);
l->defer_close = 0;
pa_iochannel_set_callback(io, io_callback, l);
return l;
}
@ -126,7 +126,7 @@ void pa_ioline_close(pa_ioline *l) {
assert(l->ref >= 1);
l->dead = 1;
if (l->io) {
pa_iochannel_free(l->io);
l->io = NULL;
@ -143,21 +143,21 @@ void pa_ioline_close(pa_ioline *l) {
void pa_ioline_puts(pa_ioline *l, const char *c) {
size_t len;
assert(l);
assert(l->ref >= 1);
assert(c);
if (l->dead)
return;
len = strlen(c);
if (len > BUFFER_LIMIT - l->wbuf_valid_length)
len = BUFFER_LIMIT - l->wbuf_valid_length;
if (len) {
assert(l->wbuf_length >= l->wbuf_valid_length);
/* In case the allocated buffer is too small, enlarge it. */
if (l->wbuf_valid_length + len > l->wbuf_length) {
size_t n = l->wbuf_valid_length+len;
@ -170,14 +170,14 @@ void pa_ioline_puts(pa_ioline *l, const char *c) {
l->wbuf_length = n;
l->wbuf_index = 0;
} else if (l->wbuf_index + l->wbuf_valid_length + len > l->wbuf_length) {
/* In case the allocated buffer fits, but the current index is too far from the start, move it to the front. */
memmove(l->wbuf, l->wbuf+l->wbuf_index, l->wbuf_valid_length);
l->wbuf_index = 0;
}
assert(l->wbuf_index + l->wbuf_valid_length + len <= l->wbuf_length);
/* Append the new string */
memcpy(l->wbuf + l->wbuf_index + l->wbuf_valid_length, c, len);
l->wbuf_valid_length += len;
@ -189,7 +189,7 @@ void pa_ioline_puts(pa_ioline *l, const char *c) {
void pa_ioline_set_callback(pa_ioline*l, void (*callback)(pa_ioline*io, const char *s, void *userdata), void *userdata) {
assert(l);
assert(l->ref >= 1);
l->callback = callback;
l->userdata = userdata;
}
@ -213,7 +213,7 @@ static void failure(pa_ioline *l, int process_leftover) {
l->callback(l, NULL, l->userdata);
l->callback = NULL;
}
pa_ioline_close(l);
}
@ -223,12 +223,12 @@ static void scan_for_lines(pa_ioline *l, size_t skip) {
while (!l->dead && l->rbuf_valid_length > skip) {
char *e, *p;
size_t m;
if (!(e = memchr(l->rbuf + l->rbuf_index + skip, '\n', l->rbuf_valid_length - skip)))
break;
*e = 0;
p = l->rbuf + l->rbuf_index;
m = strlen(p);
@ -260,14 +260,14 @@ static int do_read(pa_ioline *l) {
size_t len;
len = l->rbuf_length - l->rbuf_index - l->rbuf_valid_length;
/* Check if we have to enlarge the read buffer */
if (len < READ_SIZE) {
size_t n = l->rbuf_valid_length+READ_SIZE;
if (n >= BUFFER_LIMIT)
n = BUFFER_LIMIT;
if (l->rbuf_length >= n) {
/* The current buffer is large enough, let's just move the data to the front */
if (l->rbuf_valid_length)
@ -281,14 +281,14 @@ static int do_read(pa_ioline *l) {
l->rbuf = new;
l->rbuf_length = n;
}
l->rbuf_index = 0;
}
len = l->rbuf_length - l->rbuf_index - l->rbuf_valid_length;
assert(len >= READ_SIZE);
/* Read some data */
if ((r = pa_iochannel_read(l->io, l->rbuf+l->rbuf_index+l->rbuf_valid_length, len)) <= 0) {
if (r < 0) {
@ -296,16 +296,16 @@ static int do_read(pa_ioline *l) {
failure(l, 0);
} else
failure(l, 1);
return -1;
}
l->rbuf_valid_length += r;
/* Look if a line has been terminated in the newly read data */
scan_for_lines(l, l->rbuf_valid_length - r);
}
return 0;
}
@ -315,21 +315,21 @@ static int do_write(pa_ioline *l) {
assert(l && l->ref >= 1);
while (!l->dead && pa_iochannel_is_writable(l->io) && l->wbuf_valid_length) {
if ((r = pa_iochannel_write(l->io, l->wbuf+l->wbuf_index, l->wbuf_valid_length)) < 0) {
pa_log("write(): %s", r < 0 ? pa_cstrerror(errno) : "EOF");
failure(l, 0);
return -1;
}
l->wbuf_index += r;
l->wbuf_valid_length -= r;
/* A shortcut for the next time */
if (l->wbuf_valid_length == 0)
l->wbuf_index = 0;
}
return 0;
}
@ -341,7 +341,7 @@ static void do_work(pa_ioline *l) {
pa_ioline_ref(l);
l->mainloop->defer_enable(l->defer_event, 0);
if (!l->dead)
do_read(l);
@ -371,7 +371,7 @@ static void defer_callback(pa_mainloop_api*m, pa_defer_event*e, void *userdata)
void pa_ioline_defer_close(pa_ioline *l) {
assert(l);
assert(l->ref >= 1);
l->defer_close = 1;
if (!l->wbuf_valid_length)
@ -381,7 +381,7 @@ void pa_ioline_defer_close(pa_ioline *l) {
void pa_ioline_printf(pa_ioline *l, const char *format, ...) {
char *t;
va_list ap;
assert(l);
assert(l->ref >= 1);

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -59,7 +59,7 @@
struct acl_entry {
PA_LLIST_FIELDS(struct acl_entry);
int family;
int family;
struct in_addr address_ipv4;
struct in6_addr address_ipv6;
int bits;
@ -75,10 +75,10 @@ pa_ip_acl* pa_ip_acl_new(const char *s) {
pa_ip_acl *acl;
assert(s);
acl = pa_xnew(pa_ip_acl, 1);
PA_LLIST_HEAD_INIT(struct acl_entry, acl->entries);
while ((a = pa_split(s, ";", &state))) {
char *slash;
struct acl_entry e, *n;
@ -97,7 +97,7 @@ pa_ip_acl* pa_ip_acl_new(const char *s) {
if (inet_pton(AF_INET, a, &e.address_ipv4) > 0) {
e.bits = bits == (uint32_t) -1 ? 32 : (int) bits;
if (e.bits > 32) {
pa_log("number of bits out of range: %i", e.bits);
goto fail;
@ -107,7 +107,7 @@ pa_ip_acl* pa_ip_acl_new(const char *s) {
if (e.bits < 32 && (uint32_t) (ntohl(e.address_ipv4.s_addr) << e.bits) != 0)
pa_log_warn("WARNING: Host part of ACL entry '%s/%u' is not zero!", a, e.bits);
} else if (inet_pton(AF_INET6, a, &e.address_ipv6) > 0) {
e.bits = bits == (uint32_t) -1 ? 128 : (int) bits;
@ -123,7 +123,7 @@ pa_ip_acl* pa_ip_acl_new(const char *s) {
for (i = 0, bits = e.bits; i < 16; i++) {
if (bits >= 8)
if (bits >= 8)
bits -= 8;
else {
if ((uint8_t) ((e.address_ipv6.s6_addr[i]) << bits) != 0) {
@ -137,7 +137,7 @@ pa_ip_acl* pa_ip_acl_new(const char *s) {
if (t)
pa_log_warn("WARNING: Host part of ACL entry '%s/%u' is not zero!", a, e.bits);
}
} else {
pa_log("failed to parse address: %s", a);
goto fail;
@ -145,16 +145,16 @@ pa_ip_acl* pa_ip_acl_new(const char *s) {
n = pa_xmemdup(&e, sizeof(struct acl_entry));
PA_LLIST_PREPEND(struct acl_entry, acl->entries, n);
pa_xfree(a);
}
return acl;
fail:
pa_xfree(a);
pa_ip_acl_free(acl);
return NULL;
}
@ -166,7 +166,7 @@ void pa_ip_acl_free(pa_ip_acl *acl) {
PA_LLIST_REMOVE(struct acl_entry, acl->entries, e);
pa_xfree(e);
}
pa_xfree(acl);
}
@ -174,7 +174,7 @@ int pa_ip_acl_check(pa_ip_acl *acl, int fd) {
struct sockaddr_storage sa;
struct acl_entry *e;
socklen_t salen;
assert(acl);
assert(fd >= 0);
@ -190,7 +190,7 @@ int pa_ip_acl_check(pa_ip_acl *acl, int fd) {
if (sa.ss_family == AF_INET6 && salen != sizeof(struct sockaddr_in6))
return -1;
for (e = acl->entries; e; e = e->next) {
if (e->family != sa.ss_family)
@ -198,7 +198,7 @@ int pa_ip_acl_check(pa_ip_acl *acl, int fd) {
if (e->family == AF_INET) {
struct sockaddr_in *sai = (struct sockaddr_in*) &sa;
if (e->bits == 0 || /* this needs special handling because >> takes the right-hand side modulo 32 */
(ntohl(sai->sin_addr.s_addr ^ e->address_ipv4.s_addr) >> (32 - e->bits)) == 0)
return 1;
@ -211,7 +211,7 @@ int pa_ip_acl_check(pa_ip_acl *acl, int fd) {
if (e->bits == 0)
return 1;
for (i = 0, bits = e->bits; i < 16; i++) {
if (bits >= 8) {

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -75,7 +75,7 @@ do { \
assert(_head); \
while ((*_head)->prev) \
*_head = (*_head)->prev; \
} while (0)
} while (0)
#define PA_LLIST_INSERT_AFTER(t,head,a,b) \
do { \
@ -92,7 +92,7 @@ do { \
_b->prev = _a; \
_a->next = _b; \
} \
} while (0)
} while (0)
#endif

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -89,16 +89,16 @@ void pa_log_levelv_meta(
const char *func,
const char *format,
va_list ap) {
const char *e;
char *text, *t, *n, *location;
assert(level < PA_LOG_LEVEL_MAX);
assert(format);
if ((e = getenv(ENV_LOGLEVEL)))
maximal_level = atoi(e);
if (level > maximal_level)
return;
@ -122,13 +122,13 @@ void pa_log_levelv_meta(
if (!*t)
continue;
switch (log_target) {
case PA_LOG_STDERR: {
const char *prefix = "", *suffix = "";
char *local_t;
#ifndef OS_IS_WIN32
#ifndef OS_IS_WIN32
/* Yes indeed. Useless, but fun! */
if (isatty(STDERR_FILENO)) {
if (level <= PA_LOG_ERROR) {
@ -151,8 +151,8 @@ void pa_log_levelv_meta(
break;
}
#ifdef HAVE_SYSLOG_H
#ifdef HAVE_SYSLOG_H
case PA_LOG_SYSLOG: {
char *local_t;
@ -167,20 +167,20 @@ void pa_log_levelv_meta(
}
closelog();
break;
break;
}
#endif
case PA_LOG_USER: {
char *x;
x = pa_sprintf_malloc("%s%s", location, t);
user_log_func(level, x);
pa_xfree(x);
break;
}
case PA_LOG_NULL:
default:
break;
@ -197,7 +197,7 @@ void pa_log_level_meta(
int line,
const char *func,
const char *format, ...) {
va_list ap;
va_start(ap, format);
pa_log_levelv_meta(level, file, line, func, format, ap);

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -42,11 +42,11 @@ pa_mcalign *pa_mcalign_new(size_t base) {
assert(base);
m = pa_xnew(pa_mcalign, 1);
m->base = base;
pa_memchunk_reset(&m->leftover);
pa_memchunk_reset(&m->current);
return m;
}
@ -58,22 +58,22 @@ void pa_mcalign_free(pa_mcalign *m) {
if (m->current.memblock)
pa_memblock_unref(m->current.memblock);
pa_xfree(m);
}
void pa_mcalign_push(pa_mcalign *m, const pa_memchunk *c) {
assert(m);
assert(c);
assert(c->memblock);
assert(c->length > 0);
assert(!m->current.memblock);
/* Append to the leftover memory block */
if (m->leftover.memblock) {
/* Try to merge */
if (m->leftover.memblock == c->memblock &&
m->leftover.index + m->leftover.length == c->index) {
@ -85,7 +85,7 @@ void pa_mcalign_push(pa_mcalign *m, const pa_memchunk *c) {
if (m->leftover.length >= m->base) {
m->current = m->leftover;
pa_memchunk_reset(&m->leftover);
}
}
} else {
size_t l;
@ -93,7 +93,7 @@ void pa_mcalign_push(pa_mcalign *m, const pa_memchunk *c) {
/* We have to copy */
assert(m->leftover.length < m->base);
l = m->base - m->leftover.length;
if (l > c->length)
l = c->length;
@ -115,7 +115,7 @@ void pa_mcalign_push(pa_mcalign *m, const pa_memchunk *c) {
}
} else {
/* Nothing to merge or copy, just store it */
if (c->length >= m->base)
m->current = *c;
else
@ -146,7 +146,7 @@ int pa_mcalign_pop(pa_mcalign *m, pa_memchunk *c) {
m->leftover = m->current;
pa_memchunk_reset(&m->current);
}
return 0;
}
@ -182,13 +182,13 @@ int pa_mcalign_pop(pa_mcalign *m, pa_memchunk *c) {
}
pa_memchunk_reset(&m->current);
return 0;
}
/* There's simply nothing */
return -1;
}
size_t pa_mcalign_csize(pa_mcalign *m, size_t l) {
@ -196,9 +196,9 @@ size_t pa_mcalign_csize(pa_mcalign *m, size_t l) {
assert(l > 0);
assert(!m->current.memblock);
if (m->leftover.memblock)
l += m->leftover.length;
return (l/m->base)*m->base;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -41,11 +41,11 @@
* for (;;) {
* pa_memchunk input;
*
* ... fill input ...
* ... fill input ...
*
* pa_mcalign_push(m, &input);
* pa_memblock_unref(input.memblock);
*
*
* for (;;) {
* pa_memchunk output;
*

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -71,7 +71,7 @@ struct memexport_slot {
struct pa_memexport {
pa_mempool *pool;
struct memexport_slot slots[PA_MEMEXPORT_SLOTS_MAX];
PA_LLIST_HEAD(struct memexport_slot, free_slots);
PA_LLIST_HEAD(struct memexport_slot, used_slots);
@ -101,7 +101,7 @@ struct pa_mempool {
/* A list of free slots that may be reused */
PA_LLIST_HEAD(struct mempool_slot, free_slots);
pa_mempool_stat stat;
};
@ -132,14 +132,14 @@ static void stat_remove(pa_memblock *b) {
assert(AO_load_acquire_read(&b->pool->stat.n_allocated) > 0);
assert(AO_load_acquire_read(&b->pool->stat.allocated_size) >= (AO_t) b->length);
AO_fetch_and_sub1_release_write(&b->pool->stat.n_allocated);
AO_fetch_and_add_release_write(&b->pool->stat.allocated_size, (AO_t) (-b->length));
if (b->type == PA_MEMBLOCK_IMPORTED) {
assert(AO_load_acquire_read(&b->pool->stat.n_imported) > 0);
assert(AO_load_acquire_read(&b->pool->stat.imported_size) >= (AO_t) b->length);
AO_fetch_and_sub1_release_write(&b->pool->stat.n_imported);
AO_fetch_and_add_release_write(&b->pool->stat.imported_size, (AO_t) (-b->length));
}
@ -151,10 +151,10 @@ static pa_memblock *memblock_new_appended(pa_mempool *p, size_t length);
pa_memblock *pa_memblock_new(pa_mempool *p, size_t length) {
pa_memblock *b;
assert(p);
assert(length > 0);
if (!(b = pa_memblock_new_pool(p, length)))
b = memblock_new_appended(p, length);
@ -231,16 +231,16 @@ pa_memblock *pa_memblock_new_pool(pa_mempool *p, size_t length) {
if (!(slot = mempool_allocate_slot(p)))
return NULL;
b = mempool_slot_data(slot);
b->type = PA_MEMBLOCK_POOL;
b->data = (uint8_t*) b + sizeof(pa_memblock);
} else if (p->block_size - sizeof(struct mempool_slot) >= length) {
if (!(slot = mempool_allocate_slot(p)))
return NULL;
b = pa_xnew(pa_memblock, 1);
b->type = PA_MEMBLOCK_POOL_EXTERNAL;
b->data = mempool_slot_data(slot);
@ -285,7 +285,7 @@ pa_memblock *pa_memblock_new_user(pa_mempool *p, void *d, size_t length, void (*
assert(d);
assert(length > 0);
assert(free_cb);
b = pa_xnew(pa_memblock, 1);
b->type = PA_MEMBLOCK_USER;
b->read_only = read_only;
@ -313,7 +313,7 @@ void pa_memblock_unref(pa_memblock*b) {
if (PA_REFCNT_DEC(b) > 0)
return;
stat_remove(b);
switch (b->type) {
@ -334,13 +334,13 @@ void pa_memblock_unref(pa_memblock*b) {
segment = b->per_type.imported.segment;
assert(segment);
assert(segment->import);
pa_hashmap_remove(segment->import->blocks, PA_UINT32_TO_PTR(b->per_type.imported.id));
segment->import->release_cb(segment->import, b->per_type.imported.id, segment->import->userdata);
if (-- segment->n_blocks <= 0)
segment_detach(segment);
pa_xfree(b);
break;
}
@ -351,9 +351,9 @@ void pa_memblock_unref(pa_memblock*b) {
slot = mempool_slot_by_ptr(b->pool, b->data);
assert(slot);
PA_LLIST_PREPEND(struct mempool_slot, b->pool->free_slots, slot);
if (b->type == PA_MEMBLOCK_POOL_EXTERNAL)
pa_xfree(b);
@ -377,7 +377,7 @@ static void memblock_make_local(pa_memblock *b) {
if ((slot = mempool_allocate_slot(b->pool))) {
void *new_data;
/* We can move it into a local pool, perfect! */
b->type = PA_MEMBLOCK_POOL_EXTERNAL;
b->read_only = 0;
@ -412,7 +412,7 @@ void pa_memblock_unref_fixed(pa_memblock *b) {
static void memblock_replace_import(pa_memblock *b) {
pa_memimport_segment *seg;
assert(b);
assert(b->type == PA_MEMBLOCK_IMPORTED);
@ -453,7 +453,7 @@ pa_mempool* pa_mempool_new(int shared) {
if (p->block_size < ps)
p->block_size = ps;
p->n_blocks = PA_MEMPOOL_SLOTS_MAX;
assert(p->block_size > sizeof(struct mempool_slot));
@ -464,7 +464,7 @@ pa_mempool* pa_mempool_new(int shared) {
}
p->n_init = 0;
PA_LLIST_HEAD_INIT(pa_memimport, p->imports);
PA_LLIST_HEAD_INIT(pa_memexport, p->exports);
PA_LLIST_HEAD_INIT(struct mempool_slot, p->free_slots);
@ -485,7 +485,7 @@ void pa_mempool_free(pa_mempool *p) {
if (AO_load_acquire_read(&p->stat.n_allocated) > 0)
pa_log_warn("WARNING! Memory pool destroyed but not all memory blocks freed!");
pa_shm_free(&p->memory);
pa_xfree(p);
}
@ -498,7 +498,7 @@ const pa_mempool_stat* pa_mempool_get_stat(pa_mempool *p) {
void pa_mempool_vacuum(pa_mempool *p) {
struct mempool_slot *slot;
assert(p);
for (slot = p->free_slots; slot; slot = slot->next)
@ -512,7 +512,7 @@ int pa_mempool_get_shm_id(pa_mempool *p, uint32_t *id) {
return -1;
*id = p->memory.id;
return 0;
}
@ -528,14 +528,14 @@ pa_memimport* pa_memimport_new(pa_mempool *p, pa_memimport_release_cb_t cb, void
assert(p);
assert(cb);
i = pa_xnew(pa_memimport, 1);
i->pool = p;
i->segments = pa_hashmap_new(NULL, NULL);
i->blocks = pa_hashmap_new(NULL, NULL);
i->release_cb = cb;
i->userdata = userdata;
PA_LLIST_PREPEND(pa_memimport, p->imports, i);
return i;
}
@ -549,7 +549,7 @@ static pa_memimport_segment* segment_attach(pa_memimport *i, uint32_t shm_id) {
return NULL;
seg = pa_xnew(pa_memimport_segment, 1);
if (pa_shm_attach_ro(&seg->memory, shm_id) < 0) {
pa_xfree(seg);
return NULL;
@ -557,7 +557,7 @@ static pa_memimport_segment* segment_attach(pa_memimport *i, uint32_t shm_id) {
seg->import = i;
seg->n_blocks = 0;
pa_hashmap_put(i->segments, PA_UINT32_TO_PTR(shm_id), seg);
return seg;
}
@ -573,7 +573,7 @@ static void segment_detach(pa_memimport_segment *seg) {
void pa_memimport_free(pa_memimport *i) {
pa_memexport *e;
pa_memblock *b;
assert(i);
/* If we've exported this block further we need to revoke that export */
@ -587,7 +587,7 @@ void pa_memimport_free(pa_memimport *i) {
pa_hashmap_free(i->blocks, NULL, NULL);
pa_hashmap_free(i->segments, NULL, NULL);
PA_LLIST_REMOVE(pa_memimport, i->pool->imports, i);
pa_xfree(i);
}
@ -595,19 +595,19 @@ void pa_memimport_free(pa_memimport *i) {
pa_memblock* pa_memimport_get(pa_memimport *i, uint32_t block_id, uint32_t shm_id, size_t offset, size_t size) {
pa_memblock *b;
pa_memimport_segment *seg;
assert(i);
if (pa_hashmap_size(i->blocks) >= PA_MEMIMPORT_SLOTS_MAX)
return NULL;
if (!(seg = pa_hashmap_get(i->segments, PA_UINT32_TO_PTR(shm_id))))
if (!(seg = pa_hashmap_get(i->segments, PA_UINT32_TO_PTR(shm_id))))
if (!(seg = segment_attach(i, shm_id)))
return NULL;
if (offset+size > seg->memory.size)
return NULL;
b = pa_xnew(pa_memblock, 1);
b->type = PA_MEMBLOCK_IMPORTED;
b->read_only = 1;
@ -621,9 +621,9 @@ pa_memblock* pa_memimport_get(pa_memimport *i, uint32_t block_id, uint32_t shm_i
pa_hashmap_put(i->blocks, PA_UINT32_TO_PTR(block_id), b);
seg->n_blocks++;
stat_add(b);
return b;
}
@ -633,7 +633,7 @@ int pa_memimport_process_revoke(pa_memimport *i, uint32_t id) {
if (!(b = pa_hashmap_get(i->blocks, PA_UINT32_TO_PTR(id))))
return -1;
memblock_replace_import(b);
return 0;
}
@ -641,13 +641,13 @@ int pa_memimport_process_revoke(pa_memimport *i, uint32_t id) {
/* For sending blocks to other nodes */
pa_memexport* pa_memexport_new(pa_mempool *p, pa_memexport_revoke_cb_t cb, void *userdata) {
pa_memexport *e;
assert(p);
assert(cb);
if (!p->memory.shared)
return NULL;
e = pa_xnew(pa_memexport, 1);
e->pool = p;
PA_LLIST_HEAD_INIT(struct memexport_slot, e->free_slots);
@ -655,7 +655,7 @@ pa_memexport* pa_memexport_new(pa_mempool *p, pa_memexport_revoke_cb_t cb, void
e->n_init = 0;
e->revoke_cb = cb;
e->userdata = userdata;
PA_LLIST_PREPEND(pa_memexport, p->exports, e);
return e;
}
@ -683,10 +683,10 @@ int pa_memexport_process_release(pa_memexport *e, uint32_t id) {
assert(AO_load_acquire_read(&e->pool->stat.n_exported) > 0);
assert(AO_load_acquire_read(&e->pool->stat.exported_size) >= (AO_t) e->slots[id].block->length);
AO_fetch_and_sub1_release_write(&e->pool->stat.n_exported);
AO_fetch_and_add_release_write(&e->pool->stat.exported_size, (AO_t) -e->slots[id].block->length);
pa_memblock_unref(e->slots[id].block);
e->slots[id].block = NULL;
@ -704,7 +704,7 @@ static void memexport_revoke_blocks(pa_memexport *e, pa_memimport *i) {
for (slot = e->used_slots; slot; slot = next) {
uint32_t idx;
next = slot->next;
if (slot->block->type != PA_MEMBLOCK_IMPORTED ||
slot->block->per_type.imported.segment->import != i)
continue;
@ -720,7 +720,7 @@ static pa_memblock *memblock_shared_copy(pa_mempool *p, pa_memblock *b) {
assert(p);
assert(b);
if (b->type == PA_MEMBLOCK_IMPORTED ||
b->type == PA_MEMBLOCK_POOL ||
b->type == PA_MEMBLOCK_POOL_EXTERNAL) {
@ -738,7 +738,7 @@ static pa_memblock *memblock_shared_copy(pa_mempool *p, pa_memblock *b) {
int pa_memexport_put(pa_memexport *e, pa_memblock *b, uint32_t *block_id, uint32_t *shm_id, size_t *offset, size_t * size) {
pa_shm *memory;
struct memexport_slot *slot;
assert(e);
assert(b);
assert(block_id);
@ -774,10 +774,10 @@ int pa_memexport_put(pa_memexport *e, pa_memblock *b, uint32_t *block_id, uint32
assert(b->pool);
memory = &b->pool->memory;
}
assert(b->data >= memory->ptr);
assert((uint8_t*) b->data + b->length <= (uint8_t*) memory->ptr + memory->size);
*shm_id = memory->id;
*offset = (uint8_t*) b->data - (uint8_t*) memory->ptr;
*size = b->length;

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -37,7 +37,7 @@
typedef enum pa_memblock_type {
PA_MEMBLOCK_POOL, /* Memory is part of the memory pool */
PA_MEMBLOCK_POOL_EXTERNAL, /* Data memory is part of the memory pool but the pa_memblock structure itself not */
PA_MEMBLOCK_APPENDED, /* the data is appended to the memory block */
PA_MEMBLOCK_APPENDED, /* the data is appended to the memory block */
PA_MEMBLOCK_USER, /* User supplied memory, to be freed with free_cb */
PA_MEMBLOCK_FIXED, /* data is a pointer to fixed memory that needs not to be freed */
PA_MEMBLOCK_IMPORTED, /* Memory is imported from another process via shm */
@ -66,7 +66,7 @@ struct pa_memblock {
struct {
void (*free_cb)(void *p); /* If type == PA_MEMBLOCK_USER this points to a function for freeing this memory block */
} user;
struct {
uint32_t id;
pa_memimport_segment *segment;

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -61,12 +61,12 @@ pa_memblockq* pa_memblockq_new(
size_t prebuf,
size_t minreq,
pa_memblock *silence) {
pa_memblockq* bq;
assert(base > 0);
assert(maxlength >= base);
bq = pa_xnew(pa_memblockq, 1);
bq->blocks = bq->blocks_tail = NULL;
bq->n_blocks = 0;
@ -90,20 +90,20 @@ pa_memblockq* pa_memblockq_new(
bq->prebuf = bq->maxlength;
bq->minreq = (minreq/base)*base;
if (bq->minreq > bq->tlength - bq->prebuf)
bq->minreq = bq->tlength - bq->prebuf;
if (!bq->minreq)
bq->minreq = 1;
pa_log_debug("memblockq sanitized: maxlength=%lu, tlength=%lu, base=%lu, prebuf=%lu, minreq=%lu",
(unsigned long)bq->maxlength, (unsigned long)bq->tlength, (unsigned long)bq->base, (unsigned long)bq->prebuf, (unsigned long)bq->minreq);
bq->state = bq->prebuf ? PREBUF : RUNNING;
bq->silence = silence ? pa_memblock_ref(silence) : NULL;
bq->mcalign = NULL;
return bq;
}
@ -117,7 +117,7 @@ void pa_memblockq_free(pa_memblockq* bq) {
if (bq->mcalign)
pa_mcalign_free(bq->mcalign);
pa_xfree(bq);
}
@ -126,12 +126,12 @@ static void drop_block(pa_memblockq *bq, struct memblock_list *q) {
assert(q);
assert(bq->n_blocks >= 1);
if (q->prev)
q->prev->next = q->next;
else
bq->blocks = q->next;
if (q->next)
q->next->prev = q->prev;
else
@ -168,10 +168,10 @@ static int can_push(pa_memblockq *bq, size_t l) {
}
int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
struct memblock_list *q, *n;
pa_memchunk chunk;
assert(bq);
assert(uchunk);
assert(uchunk->memblock);
@ -185,7 +185,7 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
return -1;
chunk = *uchunk;
if (bq->read_index > bq->write_index) {
/* We currently have a buffer underflow, we need to drop some
@ -203,7 +203,7 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
return 0;
}
}
/* We go from back to front to look for the right place to add
* this new entry. Drop data we will overwrite on the way */
@ -275,29 +275,29 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
assert(bq->write_index + (int64_t)chunk.length > q->index &&
bq->write_index + (int64_t)chunk.length < q->index + (int64_t)q->chunk.length &&
bq->write_index < q->index);
/* The job overwrites the current entry at the end, so let's drop the beginning of this entry */
d = bq->write_index + chunk.length - q->index;
q->index += d;
q->chunk.index += d;
q->chunk.length -= d;
q = q->prev;
}
}
if (q) {
assert(bq->write_index >= q->index + (int64_t)q->chunk.length);
assert(!q->next || (bq->write_index + (int64_t)chunk.length <= q->next->index));
/* Try to merge memory blocks */
if (q->chunk.memblock == chunk.memblock &&
q->chunk.index + (int64_t)q->chunk.length == chunk.index &&
bq->write_index == q->index + (int64_t)q->chunk.length) {
q->chunk.length += chunk.length;
bq->write_index += chunk.length;
return 0;
@ -324,7 +324,7 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
n->prev->next = n;
else
bq->blocks = n;
bq->n_blocks++;
return 0;
}
@ -347,7 +347,7 @@ int pa_memblockq_peek(pa_memblockq* bq, pa_memchunk *chunk) {
bq->state = PREBUF;
return -1;
}
/* Do we need to spit out silence? */
if (!bq->blocks || bq->blocks->index > bq->read_index) {
@ -362,7 +362,7 @@ int pa_memblockq_peek(pa_memblockq* bq, pa_memchunk *chunk) {
if (!length || length > chunk->memblock->length)
length = chunk->memblock->length;
chunk->length = length;
} else {
@ -370,7 +370,7 @@ int pa_memblockq_peek(pa_memblockq* bq, pa_memchunk *chunk) {
* the time to sleep */
if (!bq->blocks)
return -1;
chunk->memblock = NULL;
chunk->length = length;
}
@ -381,7 +381,7 @@ int pa_memblockq_peek(pa_memblockq* bq, pa_memchunk *chunk) {
/* Ok, let's pass real data to the caller */
assert(bq->blocks->index == bq->read_index);
*chunk = bq->blocks->chunk;
pa_memblock_ref(chunk->memblock);
@ -432,14 +432,14 @@ void pa_memblockq_drop(pa_memblockq *bq, const pa_memchunk *chunk, size_t length
assert(bq->blocks->index >= bq->read_index);
d = (size_t) (bq->blocks->index - bq->read_index);
if (d >= length) {
/* The first block is too far in the future */
bq->read_index += length;
break;
} else {
length -= d;
bq->read_index += d;
}
@ -462,7 +462,7 @@ void pa_memblockq_drop(pa_memblockq *bq, const pa_memchunk *chunk, size_t length
bq->read_index += length;
break;
}
} else {
/* The list is empty, there's nothing we could drop */
@ -477,7 +477,7 @@ int pa_memblockq_is_readable(pa_memblockq *bq) {
if (bq->prebuf > 0) {
size_t l = pa_memblockq_get_length(bq);
if (bq->state == PREBUF && l < bq->prebuf)
return 0;
@ -493,7 +493,7 @@ int pa_memblockq_is_writable(pa_memblockq *bq, size_t length) {
if (length % bq->base)
return 0;
return pa_memblockq_get_length(bq) + length <= bq->tlength;
}
@ -502,7 +502,7 @@ size_t pa_memblockq_get_length(pa_memblockq *bq) {
if (bq->write_index <= bq->read_index)
return 0;
return (size_t) (bq->write_index - bq->read_index);
}
@ -546,7 +546,7 @@ void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek) {
void pa_memblockq_flush(pa_memblockq *bq) {
assert(bq);
while (bq->blocks)
drop_block(bq, bq->blocks);
@ -559,7 +559,7 @@ void pa_memblockq_flush(pa_memblockq *bq) {
size_t pa_memblockq_get_tlength(pa_memblockq *bq) {
assert(bq);
return bq->tlength;
}
@ -578,18 +578,18 @@ int pa_memblockq_push_align(pa_memblockq* bq, const pa_memchunk *chunk) {
assert(bq);
assert(chunk && bq->base);
if (bq->base == 1)
return pa_memblockq_push(bq, chunk);
if (!bq->mcalign)
bq->mcalign = pa_mcalign_new(bq->base);
if (!can_push(bq, pa_mcalign_csize(bq->mcalign, chunk->length)))
return -1;
pa_mcalign_push(bq->mcalign, chunk);
while (pa_mcalign_pop(bq->mcalign, &rchunk) >= 0) {
int r;
r = pa_memblockq_push(bq, &rchunk);

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -39,27 +39,27 @@ typedef struct pa_memblockq pa_memblockq;
/* Parameters:
- idx: start value for both read and write index
- maxlength: maximum length of queue. If more data is pushed into
the queue, the operation will fail. Must not be 0.
- tlength: the target length of the queue. Pass 0 for the default.
- base: a base value for all metrics. Only multiples of this value
are popped from the queue or should be pushed into
it. Must not be 0.
- prebuf: If the queue runs empty wait until this many bytes are in
queue again before passing the first byte out. If set
to 0 pa_memblockq_pop() will return a silence memblock
if no data is in the queue and will never fail. Pass
(size_t) -1 for the default.
- minreq: pa_memblockq_missing() will only return values greater
than this value. Pass 0 for the default.
- silence: return this memblock whzen reading unitialized data
*/
pa_memblockq* pa_memblockq_new(
@ -67,7 +67,7 @@ pa_memblockq* pa_memblockq_new(
size_t maxlength,
size_t tlength,
size_t base,
size_t prebuf,
size_t prebuf,
size_t minreq,
pa_memblock *silence);

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -35,7 +35,7 @@
void pa_memchunk_make_writable(pa_memchunk *c, size_t min) {
pa_memblock *n;
size_t l;
assert(c);
assert(c->memblock);
assert(PA_REFCNT_VALUE(c->memblock) > 0);
@ -48,7 +48,7 @@ void pa_memchunk_make_writable(pa_memchunk *c, size_t min) {
l = c->length;
if (l < min)
l = min;
n = pa_memblock_new(c->memblock->pool, l);
memcpy(n->data, (uint8_t*) c->memblock->data + c->index, c->length);
pa_memblock_unref(c->memblock);

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -60,7 +60,7 @@ static int add_key_value(pa_hashmap *map, char *key, char *value, const char* co
return -1;
}
}
e = pa_xmalloc(sizeof(struct entry));
e->key = key;
e->value = value;
@ -78,7 +78,7 @@ pa_modargs *pa_modargs_new(const char *args, const char* const* valid_keys) {
enum { WHITESPACE, KEY, VALUE_START, VALUE_SIMPLE, VALUE_DOUBLE_QUOTES, VALUE_TICKS } state;
const char *p, *key, *value;
size_t key_len = 0, value_len = 0;
key = value = NULL;
state = WHITESPACE;
for (p = args; *p; p++) {
@ -160,7 +160,7 @@ fail:
if (map)
pa_modargs_free((pa_modargs*) map);
return NULL;
}
@ -210,7 +210,7 @@ int pa_modargs_get_value_s32(pa_modargs *ma, const char *key, int32_t *value) {
if (pa_atoi(v, value) < 0)
return -1;
return 0;
}
@ -239,7 +239,7 @@ int pa_modargs_get_sample_spec(pa_modargs *ma, pa_sample_spec *rss) {
assert(ma && rss);
/* DEBUG_TRAP;*/
ss = *rss;
if ((pa_modargs_get_value_u32(ma, "rate", &ss.rate)) < 0)
return -1;
@ -257,14 +257,14 @@ int pa_modargs_get_sample_spec(pa_modargs *ma, pa_sample_spec *rss) {
return -1;
*rss = ss;
return 0;
}
int pa_modargs_get_channel_map(pa_modargs *ma, pa_channel_map *rmap) {
pa_channel_map map;
const char *cm;
assert(ma);
assert(rmap);
@ -284,7 +284,7 @@ int pa_modargs_get_channel_map(pa_modargs *ma, pa_channel_map *rmap) {
int pa_modargs_get_sample_spec_and_channel_map(pa_modargs *ma, pa_sample_spec *rss, pa_channel_map *rmap, pa_channel_map_def_t def) {
pa_sample_spec ss;
pa_channel_map map;
assert(ma);
assert(rss);
assert(rmap);

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -100,17 +100,17 @@ static inline fnptr load_sym(lt_dlhandle handle, const char *module, const char
pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
pa_module *m = NULL;
int r;
assert(c && name);
if (c->disallow_module_loading)
goto fail;
m = pa_xmalloc(sizeof(pa_module));
m->name = pa_xstrdup(name);
m->argument = pa_xstrdup(argument);
if (!(m->dl = lt_dlopenext(name))) {
pa_log("Failed to open module \"%s\": %s", name, lt_dlerror());
goto fail;
@ -125,7 +125,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
pa_log("Failed to load module \"%s\": symbol \""PA_SYMBOL_DONE"\" not found.", name);
goto fail;
}
m->userdata = NULL;
m->core = c;
m->n_used = -1;
@ -148,23 +148,23 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
c->module_auto_unload_event = c->mainloop->time_new(c->mainloop, &ntv, timeout_callback, c);
}
assert(c->module_auto_unload_event);
assert(c->modules);
r = pa_idxset_put(c->modules, m, &m->index);
assert(r >= 0 && m->index != PA_IDXSET_INVALID);
pa_log_info("Loaded \"%s\" (index: #%u; argument: \"%s\").", m->name, m->index, m->argument ? m->argument : "");
pa_log_info("Loaded \"%s\" (index: #%u; argument: \"%s\").", m->name, m->index, m->argument ? m->argument : "");
pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_NEW, m->index);
return m;
fail:
if (m) {
pa_xfree(m->argument);
pa_xfree(m->name);
if (m->dl)
lt_dlclose(m->dl);
@ -180,16 +180,16 @@ static void pa_module_free(pa_module *m) {
if (m->core->disallow_module_loading)
return;
pa_log_info("Unloading \"%s\" (index: #%u).", m->name, m->index);
pa_log_info("Unloading \"%s\" (index: #%u).", m->name, m->index);
m->done(m->core, m);
lt_dlclose(m->dl);
pa_log_info("Unloaded \"%s\" (index: #%u).", m->name, m->index);
pa_log_info("Unloaded \"%s\" (index: #%u).", m->name, m->index);
pa_subscription_post(m->core, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_REMOVE, m->index);
pa_xfree(m->name);
pa_xfree(m->argument);
pa_xfree(m);
@ -250,7 +250,7 @@ static int unused_callback(void *p, PA_GCC_UNUSED uint32_t idx, int *del, void *
pa_module *m = p;
time_t *now = userdata;
assert(p && del && now);
if (m->n_used == 0 && m->auto_unload && m->last_used_time+m->core->module_idle_time <= *now) {
pa_module_free(m);
*del = 1;
@ -265,7 +265,7 @@ void pa_module_unload_unused(pa_core *c) {
if (!c->modules)
return;
time(&now);
pa_idxset_foreach(c->modules, unused_callback, &now);
}
@ -309,7 +309,7 @@ void pa_module_set_used(pa_module*m, int used) {
if (m->n_used != used)
pa_subscription_post(m->core, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_CHANGE, m->index);
if (m->n_used != used && used == 0)
time(&m->last_used_time);

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -36,7 +36,7 @@ struct pa_module {
uint32_t index;
lt_dlhandle dl;
int (*init)(pa_core *c, pa_module*m);
void (*done)(pa_core *c, pa_module*m);

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -59,14 +59,14 @@ static int is_valid_name(const char *name) {
if (*name == 0)
return 0;
for (c = name; *c && (c-name < PA_NAME_MAX); c++)
if (!is_valid_char(*c))
return 0;
if (*c)
return 0;
return 1;
}
@ -78,7 +78,7 @@ static char* cleanup_name(const char *name) {
return NULL;
n = pa_xnew(char, strlen(name)+1);
for (a = name, b = n; *a && (a-name < PA_NAME_MAX); a++, b++)
*b = is_valid_char(*a) ? *a : '_';
@ -89,10 +89,10 @@ static char* cleanup_name(const char *name) {
void pa_namereg_free(pa_core *c) {
assert(c);
if (!c->namereg)
return;
assert(pa_hashmap_size(c->namereg) == 0);
pa_hashmap_free(c->namereg, NULL, NULL);
}
@ -101,17 +101,17 @@ const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t
struct namereg_entry *e;
char *n = NULL;
int r;
assert(c);
assert(name);
assert(data);
if (!*name)
return NULL;
if ((type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE) &&
!is_valid_name(name) ) {
if (fail)
return NULL;
@ -136,9 +136,9 @@ const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t
pa_xfree(n);
return NULL;
}
k = pa_xnew(char, l+4);
for (i = 2; i <= 99; i++) {
snprintf(k, l+4, "%s.%u", name, i);
@ -151,11 +151,11 @@ const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t
pa_xfree(k);
return NULL;
}
pa_xfree(n);
n = k;
}
e = pa_xnew(struct namereg_entry, 1);
e->type = type;
e->name = n ? n : pa_xstrdup(name);
@ -169,7 +169,7 @@ const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t
void pa_namereg_unregister(pa_core *c, const char *name) {
struct namereg_entry *e;
assert(c);
assert(name);
@ -184,26 +184,26 @@ void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type, int a
struct namereg_entry *e;
uint32_t idx;
assert(c);
if (!name) {
if (type == PA_NAMEREG_SOURCE)
name = pa_namereg_get_default_source_name(c);
else if (type == PA_NAMEREG_SINK)
name = pa_namereg_get_default_sink_name(c);
} else if (strcmp(name, "@DEFAULT_SINK@") == 0) {
if (type == PA_NAMEREG_SINK)
name = pa_namereg_get_default_sink_name(c);
} else if (strcmp(name, "@DEFAULT_SOURCE@") == 0) {
if (type == PA_NAMEREG_SOURCE)
name = pa_namereg_get_default_source_name(c);
} else if (strcmp(name, "@DEFAULT_MONITOR@") == 0) {
if (type == PA_NAMEREG_SOURCE) {
pa_sink *k;
if ((k = pa_namereg_get(c, NULL, PA_NAMEREG_SINK, autoload)))
return k->monitor_source;
}
@ -212,7 +212,7 @@ void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type, int a
if (!name)
return NULL;
if (c->namereg && (e = pa_hashmap_get(c->namereg, name)))
if (e->type == type)
return e->data;
@ -221,12 +221,12 @@ void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type, int a
if (autoload) {
pa_autoload_request(c, name, type);
if (c->namereg && (e = pa_hashmap_get(c->namereg, name)))
if (e->type == type)
return e->data;
}
return NULL;
}
@ -242,7 +242,7 @@ void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type, int a
int pa_namereg_set_default(pa_core*c, const char *name, pa_namereg_type_t type) {
char **s;
assert(c);
assert(type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE);
@ -256,7 +256,7 @@ int pa_namereg_set_default(pa_core*c, const char *name, pa_namereg_type_t type)
if (!is_valid_name(name))
return -1;
pa_xfree(*s);
*s = pa_xstrdup(name);
pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_SERVER|PA_SUBSCRIPTION_EVENT_CHANGE, PA_INVALID_INDEX);
@ -266,12 +266,12 @@ int pa_namereg_set_default(pa_core*c, const char *name, pa_namereg_type_t type)
const char *pa_namereg_get_default_sink_name(pa_core *c) {
pa_sink *s;
assert(c);
if (c->default_sink_name)
return c->default_sink_name;
if ((s = pa_idxset_first(c->sinks, NULL)))
pa_namereg_set_default(c, s->name, PA_NAMEREG_SINK);
@ -281,7 +281,7 @@ const char *pa_namereg_get_default_sink_name(pa_core *c) {
const char *pa_namereg_get_default_source_name(pa_core *c) {
pa_source *s;
uint32_t idx;
assert(c);
if (c->default_source_name)

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -51,7 +51,7 @@ enum {
PA_COMMAND_FINISH_UPLOAD_STREAM,
PA_COMMAND_PLAY_SAMPLE,
PA_COMMAND_REMOVE_SAMPLE,
PA_COMMAND_GET_SERVER_INFO,
PA_COMMAND_GET_SINK_INFO,
PA_COMMAND_GET_SINK_INFO_LIST,
@ -68,24 +68,24 @@ enum {
PA_COMMAND_GET_SAMPLE_INFO,
PA_COMMAND_GET_SAMPLE_INFO_LIST,
PA_COMMAND_SUBSCRIBE,
PA_COMMAND_SET_SINK_VOLUME,
PA_COMMAND_SET_SINK_INPUT_VOLUME,
PA_COMMAND_SET_SOURCE_VOLUME,
PA_COMMAND_SET_SINK_MUTE,
PA_COMMAND_SET_SOURCE_MUTE,
PA_COMMAND_CORK_PLAYBACK_STREAM,
PA_COMMAND_FLUSH_PLAYBACK_STREAM,
PA_COMMAND_TRIGGER_PLAYBACK_STREAM,
PA_COMMAND_SET_DEFAULT_SINK,
PA_COMMAND_SET_DEFAULT_SOURCE,
PA_COMMAND_SET_PLAYBACK_STREAM_NAME,
PA_COMMAND_SET_RECORD_STREAM_NAME,
PA_COMMAND_KILL_CLIENT,
PA_COMMAND_KILL_SINK_INPUT,
PA_COMMAND_KILL_SOURCE_OUTPUT,

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -35,22 +35,22 @@
assert(_r == 0); \
} while(0)
static pa_mutex *global_mutex;
static pa_mutex *global_mutex;
static pthread_once_t global_mutex_once = PTHREAD_ONCE_INIT;
static void global_mutex_once_func(void) {
global_mutex = pa_mutex_new(0);
}
static void global_mutex_once_func(void) {
global_mutex = pa_mutex_new(0);
}
void pa_once(pa_once_t *control, pa_once_func_t func) {
assert(control);
assert(func);
void pa_once(pa_once_t *control, pa_once_func_t func) {
assert(control);
assert(func);
/* Create the global mutex */
ASSERT_SUCCESS(pthread_once(&global_mutex_once, global_mutex_once_func));
ASSERT_SUCCESS(pthread_once(&global_mutex_once, global_mutex_once_func));
/* Create the local mutex */
pa_mutex_lock(global_mutex);
pa_mutex_lock(global_mutex);
if (!control->mutex)
control->mutex = pa_mutex_new(1);
pa_mutex_unlock(global_mutex);
@ -61,9 +61,9 @@ void pa_once(pa_once_t *control, pa_once_func_t func) {
control->once_value = 1;
func();
}
pa_mutex_unlock(control->mutex);
pa_mutex_unlock(control->mutex);
/* Caveat: We have to make sure that the once func has completed
* before returning, even if the once func is not actually
* executed by us. Hence the awkward locking. */
}
}

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -59,7 +59,7 @@ void pa_once(pa_once_t *control, pa_once_func_t func) {
control->once_value = 1;
func();
}
pa_mutex_unlock(control->mutex);
pa_mutex_unlock(control->mutex);
/* Caveat: We have to make sure that the once func has completed
* before returning, even if the once func is not actually

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -40,7 +40,7 @@ pa_packet* pa_packet_new(size_t length) {
p->length = length;
p->data = (uint8_t*) (p+1);
p->type = PA_PACKET_APPENDED;
return p;
}
@ -55,14 +55,14 @@ pa_packet* pa_packet_new_dynamic(void* data, size_t length) {
p->length = length;
p->data = data;
p->type = PA_PACKET_DYNAMIC;
return p;
}
pa_packet* pa_packet_ref(pa_packet *p) {
assert(p);
assert(p->ref >= 1);
p->ref++;
return p;
}
@ -70,7 +70,7 @@ pa_packet* pa_packet_ref(pa_packet *p) {
void pa_packet_unref(pa_packet *p) {
assert(p);
assert(p->ref >= 1);
if (--p->ref == 0) {
if (p->type == PA_PACKET_DYNAMIC)
pa_xfree(p->data);

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -53,11 +53,11 @@ static char *parse_host(const char *s, uint16_t *ret_port) {
*ret_port = atoi(e+2);
else if (e[1] != 0)
return NULL;
return pa_xstrndup(s+1, e-s-1);
} else {
char *e;
if (!(e = strrchr(s, ':')))
return pa_xstrdup(s);
@ -75,22 +75,22 @@ int pa_parse_address(const char *name, pa_parsed_address *ret_p) {
if (*name == '{') {
char hn[256], *pfx;
/* The URL starts with a host specification for detecting local connections */
if (!pa_get_host_name(hn, sizeof(hn)))
return -1;
pfx = pa_sprintf_malloc("{%s}", hn);
if (!pa_startswith(name, pfx)) {
pa_xfree(pfx);
/* Not local */
return -1;
}
p = name + strlen(pfx);
pa_xfree(pfx);
} else
p = name;
if (*p == '/')
ret_p->type = PA_PARSED_ADDRESS_UNIX;
else if (pa_startswith(p, "unix:")) {
@ -109,7 +109,7 @@ int pa_parse_address(const char *name, pa_parsed_address *ret_p) {
else
if (!(ret_p->path_or_host = parse_host(p, &ret_p->port)))
return -1;
return 0;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -120,9 +120,9 @@ static void reply_info_free(struct reply_info *r) {
if (r->time_event)
r->pdispatch->mainloop->time_free(r->time_event);
PA_LLIST_REMOVE(struct reply_info, r->pdispatch->replies, r);
pa_xfree(r);
}
@ -131,7 +131,7 @@ pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *mainloop, const pa_pdispatch_cb_
assert(mainloop);
assert((entries && table) || (!entries && !table));
pd = pa_xmalloc(sizeof(pa_pdispatch));
pd->ref = 1;
pd->mainloop = mainloop;
@ -141,7 +141,7 @@ pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *mainloop, const pa_pdispatch_cb_
pd->drain_callback = NULL;
pd->drain_userdata = NULL;
pd->creds = NULL;
return pd;
}
@ -154,7 +154,7 @@ static void pdispatch_free(pa_pdispatch *pd) {
reply_info_free(pd->replies);
}
pa_xfree(pd);
}
@ -165,13 +165,13 @@ static void run_action(pa_pdispatch *pd, struct reply_info *r, uint32_t command,
assert(r);
pa_pdispatch_ref(pd);
callback = r->callback;
userdata = r->userdata;
tag = r->tag;
reply_info_free(r);
callback(pd, command, tag, ts, userdata);
if (pd->drain_callback && !pa_pdispatch_is_pending(pd))
@ -187,24 +187,24 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, const pa_creds *creds,
assert(pd && packet && packet->data);
pa_pdispatch_ref(pd);
if (packet->length <= 8)
goto finish;
ts = pa_tagstruct_new(packet->data, packet->length);
assert(ts);
if (pa_tagstruct_getu32(ts, &command) < 0 ||
pa_tagstruct_getu32(ts, &tag) < 0)
goto finish;
#ifdef DEBUG_OPCODES
{
char t[256];
char const *p;
if (!(p = command_names[command]))
snprintf((char*) (p = t), sizeof(t), "%u", command);
pa_log("Recieved opcode <%s>", p);
}
#endif
@ -231,10 +231,10 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, const pa_creds *creds,
}
ret = 0;
finish:
pd->creds = NULL;
if (ts)
pa_tagstruct_free(ts);
@ -261,7 +261,7 @@ void pa_pdispatch_register_reply(pa_pdispatch *pd, uint32_t tag, int timeout, pa
r->userdata = userdata;
r->free_cb = free_cb;
r->tag = tag;
pa_gettimeofday(&tv);
tv.tv_sec += timeout;
@ -292,7 +292,7 @@ void pa_pdispatch_unregister_reply(pa_pdispatch *pd, void *userdata) {
for (r = pd->replies; r; r = n) {
n = r->next;
if (r->userdata == userdata)
if (r->userdata == userdata)
reply_info_free(r);
}
}
@ -313,6 +313,6 @@ pa_pdispatch* pa_pdispatch_ref(pa_pdispatch *pd) {
const pa_creds * pa_pdispatch_creds(pa_pdispatch *pd) {
assert(pd);
assert(pd->ref >= 1);
return pd->creds;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -64,7 +64,7 @@ static pid_t read_pid(const char *fn, int fd) {
if (r == 0)
return (pid_t) 0;
t[r] = 0;
if ((e = strchr(t, '\n')))
*e = 0;
@ -79,10 +79,10 @@ static pid_t read_pid(const char *fn, int fd) {
static int open_pid_file(const char *fn, int mode) {
int fd = -1;
for (;;) {
struct stat st;
if ((fd = open(fn, mode, S_IRUSR|S_IWUSR)) < 0) {
if (mode != O_RDONLY || errno != ENOENT)
pa_log_warn("WARNING: failed to open PID file '%s': %s",
@ -93,7 +93,7 @@ static int open_pid_file(const char *fn, int mode) {
/* Try to lock the file. If that fails, go without */
if (pa_lock_fd(fd, 1) < 0)
goto fail;
if (fstat(fd, &st) < 0) {
pa_log_warn("WARNING: failed to fstat() PID file '%s': %s",
fn, pa_cstrerror(errno));
@ -168,23 +168,23 @@ int pa_pid_file_create(void) {
fn, pa_cstrerror(errno));
goto fail;
}
snprintf(t, sizeof(t), "%lu\n", (unsigned long) getpid());
l = strlen(t);
if (pa_loop_write(fd, t, l, NULL) != (ssize_t) l) {
pa_log("failed to write PID file.");
goto fail;
}
ret = 0;
fail:
if (fd >= 0) {
pa_lock_fd(fd, 0);
close(fd);
}
return ret;
}
@ -230,7 +230,7 @@ int pa_pid_file_remove(void) {
}
ret = 0;
fail:
if (fd >= 0) {
@ -262,26 +262,26 @@ int pa_pid_file_kill(int sig, pid_t *pid) {
if (!pid)
pid = &_pid;
pa_runtime_path("pid", fn, sizeof(fn));
if ((fd = open_pid_file(fn, O_RDONLY)) < 0)
goto fail;
if ((*pid = read_pid(fn, fd)) == (pid_t) -1)
goto fail;
ret = kill(*pid, sig);
fail:
if (fd >= 0) {
pa_lock_fd(fd, 0);
close(fd);
}
return ret;
}
#else /* OS_IS_WIN32 */

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -65,11 +65,11 @@ static void si_kill(PA_GCC_UNUSED pa_mainloop_api *m, void *i) {
static void sink_input_drop(pa_sink_input *i, const pa_memchunk*chunk, size_t length) {
pa_memblockq *q;
assert(i);
assert(length > 0);
assert( i->userdata);
q = i->userdata;
pa_memblockq_drop(q, chunk, length);
@ -85,7 +85,7 @@ int pa_play_memblockq(
const pa_channel_map *map,
pa_memblockq *q,
pa_cvolume *volume) {
pa_sink_input *si;
pa_sink_input_new_data data;
@ -110,17 +110,17 @@ int pa_play_memblockq(
pa_sink_input_new_data_set_channel_map(&data, map);
pa_sink_input_new_data_set_sample_spec(&data, ss);
pa_sink_input_new_data_set_volume(&data, volume);
if (!(si = pa_sink_input_new(sink->core, &data, 0)))
return -1;
si->peek = sink_input_peek;
si->drop = sink_input_drop;
si->kill = sink_input_kill;
si->userdata = q;
pa_sink_notify(si->sink);
return 0;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -54,7 +54,7 @@ static int sink_input_peek(pa_sink_input *i, pa_memchunk *chunk) {
if (c->length <= 0)
return -1;
assert(c->memblock && c->memblock->length);
*chunk = *c;
pa_memblock_ref(c->memblock);
@ -88,7 +88,7 @@ int pa_play_memchunk(
const pa_channel_map *map,
const pa_memchunk *chunk,
pa_cvolume *volume) {
pa_sink_input *si;
pa_memchunk *nchunk;
pa_sink_input_new_data data;
@ -107,20 +107,20 @@ int pa_play_memchunk(
pa_sink_input_new_data_set_sample_spec(&data, ss);
pa_sink_input_new_data_set_channel_map(&data, map);
pa_sink_input_new_data_set_volume(&data, volume);
if (!(si = pa_sink_input_new(sink->core, &data, 0)))
return -1;
si->peek = sink_input_peek;
si->drop = sink_input_drop;
si->kill = sink_input_kill;
si->userdata = nchunk = pa_xnew(pa_memchunk, 1);
*nchunk = *chunk;
pa_memblock_ref(chunk->memblock);
pa_sink_notify(si->sink);
return 0;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -9,17 +9,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -10,17 +10,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -36,7 +36,7 @@ typedef struct pa_property {
static pa_property* property_new(const char *name, void *data) {
pa_property* p;
assert(name && data);
p = pa_xmalloc(sizeof(pa_property));
p->name = pa_xstrdup(name);
p->data = data;
@ -80,7 +80,7 @@ int pa_property_remove(pa_core *c, const char *name) {
if (!(p = pa_hashmap_remove(c->properties, name)))
return -1;
property_free(p);
return 0;
}
@ -101,7 +101,7 @@ void pa_property_cleanup(pa_core *c) {
pa_hashmap_free(c->properties, NULL, NULL);
c->properties = NULL;
}
void pa_property_dump(pa_core *c, pa_strbuf *s) {

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

View file

@ -2,17 +2,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@ -60,7 +60,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
pa_iochannel_free(io);
return;
}
c = pa_cli_new(p->core, io, p->module);
assert(c);
pa_cli_set_eof_callback(c, cli_eof_cb, p);
@ -79,7 +79,7 @@ pa_protocol_cli* pa_protocol_cli_new(pa_core *core, pa_socket_server *server, pa
p->connections = pa_idxset_new(NULL, NULL);
pa_socket_server_set_callback(p->server, on_connection, p);
return p;
}

View file

@ -5,17 +5,17 @@
/***
This file is part of PulseAudio.
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307

Some files were not shown because too many files have changed in this diff Show more