mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -05:00
Convert most snprintf() calls to pa_snprintf()
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1534 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
8e83838154
commit
929526de33
30 changed files with 79 additions and 67 deletions
|
|
@ -32,6 +32,8 @@
|
|||
#include <gconf/gconf-client.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include <pulsecore/core-util.h>
|
||||
|
||||
#define PA_GCONF_ROOT "/system/pulseaudio"
|
||||
#define PA_GCONF_PATH_MODULES PA_GCONF_ROOT"/modules"
|
||||
|
||||
|
|
@ -40,13 +42,13 @@ static void handle_module(GConfClient *client, const char *name) {
|
|||
gboolean enabled, locked;
|
||||
int i;
|
||||
|
||||
snprintf(p, sizeof(p), PA_GCONF_PATH_MODULES"/%s/locked", name);
|
||||
pa_snprintf(p, sizeof(p), PA_GCONF_PATH_MODULES"/%s/locked", name);
|
||||
locked = gconf_client_get_bool(client, p, FALSE);
|
||||
|
||||
if (locked)
|
||||
return;
|
||||
|
||||
snprintf(p, sizeof(p), PA_GCONF_PATH_MODULES"/%s/enabled", name);
|
||||
pa_snprintf(p, sizeof(p), PA_GCONF_PATH_MODULES"/%s/enabled", name);
|
||||
enabled = gconf_client_get_bool(client, p, FALSE);
|
||||
|
||||
printf("%c%s%c", enabled ? '+' : '-', name, 0);
|
||||
|
|
@ -56,11 +58,11 @@ static void handle_module(GConfClient *client, const char *name) {
|
|||
for (i = 0; i < 10; i++) {
|
||||
gchar *n, *a;
|
||||
|
||||
snprintf(p, sizeof(p), PA_GCONF_PATH_MODULES"/%s/name%i", name, i);
|
||||
pa_snprintf(p, sizeof(p), PA_GCONF_PATH_MODULES"/%s/name%i", name, i);
|
||||
if (!(n = gconf_client_get_string(client, p, NULL)) || !*n)
|
||||
break;
|
||||
|
||||
snprintf(p, sizeof(p), PA_GCONF_PATH_MODULES"/%s/args%i", name, i);
|
||||
pa_snprintf(p, sizeof(p), PA_GCONF_PATH_MODULES"/%s/args%i", name, i);
|
||||
a = gconf_client_get_string(client, p, NULL);
|
||||
|
||||
printf("%s%c%s%c", n, 0, a ? a : "", 0);
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ static struct output *output_new(struct userdata *u, pa_sink *sink, int resample
|
|||
0,
|
||||
NULL);
|
||||
|
||||
snprintf(t, sizeof(t), "Output stream #%u of sink %s", u->n_outputs+1, u->sink->name);
|
||||
pa_snprintf(t, sizeof(t), "Output stream #%u of sink %s", u->n_outputs+1, u->sink->name);
|
||||
|
||||
pa_sink_input_new_data_init(&data);
|
||||
data.sink = sink;
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ static int detect_alsa(pa_core *c, int just_one) {
|
|||
if (subdevice != 0)
|
||||
continue;
|
||||
|
||||
snprintf(args, sizeof(args), "device=hw:%u", device);
|
||||
pa_snprintf(args, sizeof(args), "device=hw:%u", device);
|
||||
if (!pa_module_load(c, is_sink ? "module-alsa-sink" : "module-alsa-source", args))
|
||||
continue;
|
||||
|
||||
|
|
@ -148,16 +148,16 @@ static int detect_oss(pa_core *c, int just_one) {
|
|||
|
||||
if (sscanf(line, "%u: ", &device) == 1) {
|
||||
if (device == 0)
|
||||
snprintf(args, sizeof(args), "device=/dev/dsp");
|
||||
pa_snprintf(args, sizeof(args), "device=/dev/dsp");
|
||||
else
|
||||
snprintf(args, sizeof(args), "device=/dev/dsp%u", device);
|
||||
pa_snprintf(args, sizeof(args), "device=/dev/dsp%u", device);
|
||||
|
||||
if (!pa_module_load(c, "module-oss", args))
|
||||
continue;
|
||||
|
||||
} else if (sscanf(line, "pcm%u: ", &device) == 1) {
|
||||
/* FreeBSD support, the devices are named /dev/dsp0.0, dsp0.1 and so on */
|
||||
snprintf(args, sizeof(args), "device=/dev/dsp%u.0", device);
|
||||
pa_snprintf(args, sizeof(args), "device=/dev/dsp%u.0", device);
|
||||
|
||||
if (!pa_module_load(c, "module-oss", args))
|
||||
continue;
|
||||
|
|
@ -193,7 +193,7 @@ static int detect_solaris(pa_core *c, int just_one) {
|
|||
if (!S_ISCHR(s.st_mode))
|
||||
return 0;
|
||||
|
||||
snprintf(args, sizeof(args), "device=%s", dev);
|
||||
pa_snprintf(args, sizeof(args), "device=%s", dev);
|
||||
|
||||
if (!pa_module_load(c, "module-solaris", args))
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -182,10 +182,10 @@ static pa_module* hal_device_load_alsa(struct userdata *u, const char *udi,
|
|||
|
||||
if (type == ALSA_TYPE_SINK) {
|
||||
module_name = "module-alsa-sink";
|
||||
snprintf(args, sizeof(args), "device=hw:%u sink_name=alsa_output.%s", card, strip_udi(udi));
|
||||
pa_snprintf(args, sizeof(args), "device=hw:%u sink_name=alsa_output.%s", card, strip_udi(udi));
|
||||
} else {
|
||||
module_name = "module-alsa-source";
|
||||
snprintf(args, sizeof(args), "device=hw:%u source_name=alsa_input.%s", card, strip_udi(udi));
|
||||
pa_snprintf(args, sizeof(args), "device=hw:%u source_name=alsa_input.%s", card, strip_udi(udi));
|
||||
}
|
||||
|
||||
pa_log_debug("Loading %s with arguments '%s'", module_name, args);
|
||||
|
|
@ -244,7 +244,7 @@ static pa_module* hal_device_load_oss(struct userdata *u, const char *udi,
|
|||
if (!device || dbus_error_is_set(error))
|
||||
return NULL;
|
||||
|
||||
snprintf(args, sizeof(args), "device=%s sink_name=oss_output.%s source_name=oss_input.%s", device, strip_udi(udi), strip_udi(udi));
|
||||
pa_snprintf(args, sizeof(args), "device=%s sink_name=oss_output.%s source_name=oss_input.%s", device, strip_udi(udi), strip_udi(udi));
|
||||
libhal_free_string(device);
|
||||
|
||||
pa_log_debug("Loading module-oss with arguments '%s'", args);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <pulsecore/modargs.h>
|
||||
#include <pulsecore/namereg.h>
|
||||
#include <pulsecore/log.h>
|
||||
#include <pulsecore/core-util.h>
|
||||
|
||||
#include "module-sine-symdef.h"
|
||||
|
||||
|
|
@ -155,7 +156,7 @@ int pa__init(pa_core *c, pa_module*m) {
|
|||
calc_sine(p, pa_memblock_get_length(u->memblock), frequency);
|
||||
pa_memblock_release(u->memblock);
|
||||
|
||||
snprintf(t, sizeof(t), "Sine Generator at %u Hz", frequency);
|
||||
pa_snprintf(t, sizeof(t), "Sine Generator at %u Hz", frequency);
|
||||
|
||||
pa_sink_input_new_data_init(&data);
|
||||
data.sink = sink;
|
||||
|
|
|
|||
|
|
@ -596,12 +596,12 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t
|
|||
}
|
||||
|
||||
#ifdef TUNNEL_SINK
|
||||
snprintf(name, sizeof(name), "Tunnel from host %s, user %s, sink %s",
|
||||
pa_snprintf(name, sizeof(name), "Tunnel from host %s, user %s, sink %s",
|
||||
pa_get_host_name(hn, sizeof(hn)),
|
||||
pa_get_user_name(un, sizeof(un)),
|
||||
u->sink->name);
|
||||
#else
|
||||
snprintf(name, sizeof(name), "Tunnel from host %s, user %s, source %s",
|
||||
pa_snprintf(name, sizeof(name), "Tunnel from host %s, user %s, source %s",
|
||||
pa_get_host_name(hn, sizeof(hn)),
|
||||
pa_get_user_name(un, sizeof(un)),
|
||||
u->source->name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue