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.
This commit is contained in:
Max Kellermann
2008-09-07 19:14:39 +02:00
parent b67bb05d05
commit 4dd9d4b2fd
6 changed files with 43 additions and 33 deletions

View File

@@ -48,14 +48,21 @@ static BOOL mod_mpd_IsThere(void)
return 1;
}
static char drv_name[] = "MPD";
static char drv_version[] = "MPD Output Driver v0.1";
#if (LIBMIKMOD_VERSION > 0x030106)
static char drv_alias[] = "mpd";
#endif
static MDRIVER drv_mpd = {
NULL,
"MPD",
"MPD Output Driver v0.1",
drv_name,
drv_version,
0,
255,
#if (LIBMIKMOD_VERSION > 0x030106)
"mpd", /* Alias */
drv_alias,
#if (LIBMIKMOD_VERSION >= 0x030200)
NULL, /* CmdLineHelp */
#endif
@@ -92,6 +99,8 @@ static int mod_mikModInitError;
static int mod_initMikMod(void)
{
static char params[] = "";
if (mod_mikModInitError)
return -1;
@@ -110,7 +119,7 @@ static int mod_initMikMod(void)
md_mode = (DMODE_SOFT_MUSIC | DMODE_INTERP | DMODE_STEREO |
DMODE_16BITS);
if (MikMod_Init("")) {
if (MikMod_Init(params)) {
ERROR("Could not init MikMod: %s\n",
MikMod_strerror(MikMod_errno));
mod_mikModInitError = 1;

View File

@@ -235,34 +235,38 @@ static char *wavpack_tag(WavpackContext *wpc, char *key)
static ReplayGainInfo *wavpack_replaygain(WavpackContext *wpc)
{
static char replaygain_track_gain[] = "replaygain_track_gain";
static char replaygain_album_gain[] = "replaygain_album_gain";
static char replaygain_track_peak[] = "replaygain_track_peak";
static char replaygain_album_peak[] = "replaygain_album_peak";
ReplayGainInfo *replayGainInfo;
int found = 0;
char *value;
replayGainInfo = newReplayGainInfo();
value = wavpack_tag(wpc, "replaygain_track_gain");
value = wavpack_tag(wpc, replaygain_track_gain);
if (value) {
replayGainInfo->trackGain = atof(value);
free(value);
found = 1;
}
value = wavpack_tag(wpc, "replaygain_album_gain");
value = wavpack_tag(wpc, replaygain_album_gain);
if (value) {
replayGainInfo->albumGain = atof(value);
free(value);
found = 1;
}
value = wavpack_tag(wpc, "replaygain_track_peak");
value = wavpack_tag(wpc, replaygain_track_peak);
if (value) {
replayGainInfo->trackPeak = atof(value);
free(value);
found = 1;
}
value = wavpack_tag(wpc, "replaygain_album_peak");
value = wavpack_tag(wpc, replaygain_album_peak);
if (value) {
replayGainInfo->albumPeak = atof(value);
free(value);