mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-14 06:59:53 -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
|
|
@ -112,10 +112,10 @@ static void resolve_callback(
|
|||
assert(opcode >= 0);
|
||||
|
||||
if (aa->proto == AVAHI_PROTO_INET)
|
||||
snprintf(a, sizeof(a), "tcp:%s:%u", avahi_address_snprint(ip, sizeof(ip), aa), port);
|
||||
pa_snprintf(a, sizeof(a), "tcp:%s:%u", avahi_address_snprint(ip, sizeof(ip), aa), port);
|
||||
else {
|
||||
assert(aa->proto == AVAHI_PROTO_INET6);
|
||||
snprintf(a, sizeof(a), "tcp6:%s:%u", avahi_address_snprint(ip, sizeof(ip), aa), port);
|
||||
pa_snprintf(a, sizeof(a), "tcp6:%s:%u", avahi_address_snprint(ip, sizeof(ip), aa), port);
|
||||
}
|
||||
i.server = a;
|
||||
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ char* pa_channel_map_snprint(char *s, size_t l, const pa_channel_map *map) {
|
|||
*(e = s) = 0;
|
||||
|
||||
for (channel = 0; channel < map->channels && l > 1; channel++) {
|
||||
l -= snprintf(e, l, "%s%s",
|
||||
l -= pa_snprintf(e, l, "%s%s",
|
||||
first ? "" : ",",
|
||||
pa_channel_position_to_string(map->map[channel]));
|
||||
|
||||
|
|
|
|||
|
|
@ -535,7 +535,7 @@ static int context_connect_spawn(pa_context *c) {
|
|||
argv[n++] = c->conf->daemon_binary;
|
||||
argv[n++] = "--daemonize=yes";
|
||||
|
||||
snprintf(t, sizeof(t), "-Lmodule-native-protocol-fd fd=%i", fds[1]);
|
||||
pa_snprintf(t, sizeof(t), "-Lmodule-native-protocol-fd fd=%i", fds[1]);
|
||||
argv[n++] = strdup(t);
|
||||
|
||||
while (n < MAX_ARGS) {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <pulsecore/core-util.h>
|
||||
#include "sample.h"
|
||||
|
||||
size_t pa_sample_size(const pa_sample_spec *spec) {
|
||||
|
|
@ -117,22 +118,22 @@ char *pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec) {
|
|||
assert(s && l && spec);
|
||||
|
||||
if (!pa_sample_spec_valid(spec))
|
||||
snprintf(s, l, "Invalid");
|
||||
pa_snprintf(s, l, "Invalid");
|
||||
else
|
||||
snprintf(s, l, "%s %uch %uHz", pa_sample_format_to_string(spec->format), spec->channels, spec->rate);
|
||||
pa_snprintf(s, l, "%s %uch %uHz", pa_sample_format_to_string(spec->format), spec->channels, spec->rate);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
char* pa_bytes_snprint(char *s, size_t l, unsigned v) {
|
||||
if (v >= ((unsigned) 1024)*1024*1024)
|
||||
snprintf(s, l, "%0.1f GiB", ((double) v)/1024/1024/1024);
|
||||
pa_snprintf(s, l, "%0.1f GiB", ((double) v)/1024/1024/1024);
|
||||
else if (v >= ((unsigned) 1024)*1024)
|
||||
snprintf(s, l, "%0.1f MiB", ((double) v)/1024/1024);
|
||||
pa_snprintf(s, l, "%0.1f MiB", ((double) v)/1024/1024);
|
||||
else if (v >= (unsigned) 1024)
|
||||
snprintf(s, l, "%0.1f KiB", ((double) v)/1024);
|
||||
pa_snprintf(s, l, "%0.1f KiB", ((double) v)/1024);
|
||||
else
|
||||
snprintf(s, l, "%u B", (unsigned) v);
|
||||
pa_snprintf(s, l, "%u B", (unsigned) v);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ char *pa_get_user_name(char *s, size_t l) {
|
|||
* that do not support getpwuid_r. */
|
||||
if ((r = getpwuid(getuid())) == NULL) {
|
||||
#endif
|
||||
snprintf(s, l, "%lu", (unsigned long) getuid());
|
||||
pa_snprintf(s, l, "%lu", (unsigned long) getuid());
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <pulsecore/core-util.h>
|
||||
#include "volume.h"
|
||||
|
||||
int pa_cvolume_equal(const pa_cvolume *a, const pa_cvolume *b) {
|
||||
|
|
@ -125,7 +126,7 @@ char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c) {
|
|||
*(e = s) = 0;
|
||||
|
||||
for (channel = 0; channel < c->channels && l > 1; channel++) {
|
||||
l -= snprintf(e, l, "%s%u: %3u%%",
|
||||
l -= pa_snprintf(e, l, "%s%u: %3u%%",
|
||||
first ? "" : " ",
|
||||
channel,
|
||||
(c->values[channel]*100)/PA_VOLUME_NORM);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue