summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-07-25 16:23:03 +0000
committerLennart Poettering <lennart@poettering.net>2007-07-25 16:23:03 +0000
commit929526de33b60ba48e47071be60619616661c97f (patch)
tree581112fa58632254fc22c69893605fa6d1b815e1 /src/modules
parent8e838381541d090b5bfd0d68acefd2d6676f0d64 (diff)
Convert most snprintf() calls to pa_snprintf()
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1534 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/gconf/gconf-helper.c10
-rw-r--r--src/modules/module-combine.c2
-rw-r--r--src/modules/module-detect.c10
-rw-r--r--src/modules/module-hal-detect.c6
-rw-r--r--src/modules/module-sine.c3
-rw-r--r--src/modules/module-tunnel.c4
6 files changed, 19 insertions, 16 deletions
diff --git a/src/modules/gconf/gconf-helper.c b/src/modules/gconf/gconf-helper.c
index 3483b845..abd13287 100644
--- a/src/modules/gconf/gconf-helper.c
+++ b/src/modules/gconf/gconf-helper.c
@@ -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);
diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c
index 716c20b2..b6d718de 100644
--- a/src/modules/module-combine.c
+++ b/src/modules/module-combine.c
@@ -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;
diff --git a/src/modules/module-detect.c b/src/modules/module-detect.c
index 29d6fc27..190cda9d 100644
--- a/src/modules/module-detect.c
+++ b/src/modules/module-detect.c
@@ -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;
diff --git a/src/modules/module-hal-detect.c b/src/modules/module-hal-detect.c
index 1f48a452..6ae9cd0c 100644
--- a/src/modules/module-hal-detect.c
+++ b/src/modules/module-hal-detect.c
@@ -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);
diff --git a/src/modules/module-sine.c b/src/modules/module-sine.c
index a784f218..797ba440 100644
--- a/src/modules/module-sine.c
+++ b/src/modules/module-sine.c
@@ -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;
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index 288e049e..b96d46b3 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -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);