From d89066036ba2b6d62a728540baff3c1269515c22 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 17 Aug 2006 20:02:46 +0000 Subject: modify pa_bytes_snprint() to return the string we just wrote to. This should be binary compat with older versions which returned void git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1259 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulse/sample.c | 4 +++- src/pulse/sample.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/pulse') diff --git a/src/pulse/sample.c b/src/pulse/sample.c index 87b2d7a0..7ca418e1 100644 --- a/src/pulse/sample.c +++ b/src/pulse/sample.c @@ -120,7 +120,7 @@ char *pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec) { return s; } -void pa_bytes_snprint(char *s, size_t l, unsigned v) { +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); else if (v >= ((unsigned) 1024)*1024) @@ -129,6 +129,8 @@ void pa_bytes_snprint(char *s, size_t l, unsigned v) { snprintf(s, l, "%0.1f KiB", ((double) v)/1024); else snprintf(s, l, "%u B", (unsigned) v); + + return s; } pa_sample_format_t pa_parse_sample_format(const char *format) { diff --git a/src/pulse/sample.h b/src/pulse/sample.h index 03965a99..da32fdf0 100644 --- a/src/pulse/sample.h +++ b/src/pulse/sample.h @@ -182,7 +182,7 @@ pa_sample_format_t pa_parse_sample_format(const char *format); char* pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec); /** Pretty print a byte size value. (i.e. "2.5 MiB") */ -void pa_bytes_snprint(char *s, size_t l, unsigned v); +char* pa_bytes_snprint(char *s, size_t l, unsigned v); PA_C_DECL_END -- cgit