aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm_utils.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 19:14:39 +0200
committerMax Kellermann <max@duempel.org>2008-09-07 19:14:39 +0200
commit4dd9d4b2fdfb6adde66920d4fd1bb65a1cf0695a (patch)
treefe980e309ed81201e44f612968d4bf04825bf36f /src/pcm_utils.c
parentb67bb05d05aef568a2614943625386a8cd67690d (diff)
downloadmpd-4dd9d4b2fdfb6adde66920d4fd1bb65a1cf0695a.tar.gz
mpd-4dd9d4b2fdfb6adde66920d4fd1bb65a1cf0695a.tar.xz
mpd-4dd9d4b2fdfb6adde66920d4fd1bb65a1cf0695a.zip
fix -Wcast-qual -Wwrite-strings warnings
The previous patch enabled these warnings. In Eric's branch, they were worked around with a generic deconst_ptr() function. There are several places where we can add "const" to pointers, and in others, libraries want non-const strings. In the latter, convert string literals to "static char[]" variables - this takes the same space, and seems safer than deconsting a string literal.
Diffstat (limited to '')
-rw-r--r--src/pcm_utils.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/pcm_utils.c b/src/pcm_utils.c
index f716c279d..90856fa1d 100644
--- a/src/pcm_utils.c
+++ b/src/pcm_utils.c
@@ -149,6 +149,7 @@ static int pcm_getSampleRateConverter(void)
const char *conf = getConfigParamValue(CONF_SAMPLERATE_CONVERTER);
long convalgo;
char *test;
+ const char *test2;
size_t len;
if (!conf) {
@@ -162,12 +163,12 @@ static int pcm_getSampleRateConverter(void)
len = strlen(conf);
for (convalgo = 0 ; ; convalgo++) {
- test = (char *)src_get_name(convalgo);
- if (!test) {
+ test2 = src_get_name(convalgo);
+ if (!test2) {
convalgo = SRC_SINC_FASTEST;
break;
}
- if (strncasecmp(test, conf, len) == 0)
+ if (strncasecmp(test2, conf, len) == 0)
goto out;
}
@@ -239,7 +240,7 @@ static size_t pcm_convertSampleRate(mpd_sint8 channels, mpd_uint32 inSampleRate,
data->data_out = xrealloc(data->data_out, dataOutSize);
}
- src_short_to_float_array((short *)inBuffer, data->data_in,
+ src_short_to_float_array((const short *)inBuffer, data->data_in,
data->input_frames * channels);
error = src_process(convState->state, data);
@@ -305,7 +306,7 @@ static char *pcm_convertChannels(mpd_sint8 channels, const char *inBuffer,
static char *buf;
static size_t len;
char *outBuffer = NULL;
- mpd_sint16 *in;
+ const mpd_sint16 *in;
mpd_sint16 *out;
int inSamples, i;
@@ -320,7 +321,7 @@ static char *pcm_convertChannels(mpd_sint8 channels, const char *inBuffer,
outBuffer = buf;
inSamples = inSize >> 1;
- in = (mpd_sint16 *)inBuffer;
+ in = (const mpd_sint16 *)inBuffer;
out = (mpd_sint16 *)outBuffer;
for (i = 0; i < inSamples; i++) {
*out++ = *in;
@@ -338,7 +339,7 @@ static char *pcm_convertChannels(mpd_sint8 channels, const char *inBuffer,
outBuffer = buf;
inSamples = inSize >> 2;
- in = (mpd_sint16 *)inBuffer;
+ in = (const mpd_sint16 *)inBuffer;
out = (mpd_sint16 *)outBuffer;
for (i = 0; i < inSamples; i++) {
*out = (*in++) / 2;
@@ -359,7 +360,7 @@ static const char *pcm_convertTo16bit(mpd_sint8 bits, const char *inBuffer,
static char *buf;
static size_t len;
char *outBuffer = NULL;
- mpd_sint8 *in;
+ const mpd_sint8 *in;
mpd_sint16 *out;
size_t i;
@@ -372,7 +373,7 @@ static const char *pcm_convertTo16bit(mpd_sint8 bits, const char *inBuffer,
}
outBuffer = buf;
- in = (mpd_sint8 *)inBuffer;
+ in = (const mpd_sint8 *)inBuffer;
out = (mpd_sint16 *)outBuffer;
for (i = 0; i < inSize; i++)
*out++ = (*in++) << 8;