Merge pull request #40 from sezero/write-strings

add -Wwrite-strings to CFLAGS if it's available, and fix warnings.
master
Alice R 5 years ago committed by GitHub
commit 22f92ed569
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      configure.ac
  2. 10
      src/common.h
  3. 2
      src/getopt_long.c
  4. 8
      src/main.c
  5. 6
      src/read_config.c
  6. 2
      src/sound.c
  7. 2
      src/sound.h
  8. 3
      src/sound_file.c
  9. 3
      src/sound_wav.c

@ -259,6 +259,12 @@ XMP_TRY_COMPILE(whether compiler understands -Wall,
int main(){}],
CFLAGS="${CFLAGS} -Wall")
XMP_TRY_COMPILE(whether compiler understands -Wwrite-strings,
ac_cv_c_flag_w_write_strings,
-Wwrite-strings,[
int main(){}],
CFLAGS="${CFLAGS} -Wwrite-strings")
XMP_TRY_COMPILE(whether compiler understands -Wunused-result,
ac_cv_c_flag_w_unused_result,
-Wunused-result,[

@ -19,8 +19,8 @@
#define MAX_DRV_PARM 20
struct player_mode {
char *name;
char *desc;
const char *name;
const char *desc;
int mode;
};
@ -53,8 +53,8 @@ struct options {
int show_comment; /* show module comment text */
int player_mode; /* force tracker emulation */
int amiga_mixer; /* enable amiga mixer */
char *driver_id; /* sound driver ID */
char *out_file; /* output file name */
const char *driver_id; /* sound driver ID */
const char *out_file; /* output file name */
char *ins_path; /* instrument path */
char *driver_parm[MAX_DRV_PARM]; /* driver parameters */
char mute[XMP_MAX_CHANNELS];
@ -82,7 +82,7 @@ void delay_ms(int msec);
/* option */
void get_options(int, char **, struct options *);
int read_config(struct options *);
void read_modconf(struct options *, unsigned char *);
void read_modconf(struct options *, const unsigned char *);
/* terminal */
int set_tty(void);

@ -75,7 +75,7 @@ char *optarg = NULL; /* argument associated with option */
#define BADARG ((*options == ':') ? (int)':' : (int)'?')
#define INORDER (int)1
#define EMSG ""
static char EMSG[] = {0,0,0,0}; /* #define EMSG "" */
static int getopt_internal(int, char * const *, const char *,
const struct option *, int *, int);

@ -178,13 +178,13 @@ static void check_pause(xmp_context xc, struct control *ctl,
static void get_mixer_type(int t, struct options *opt, char *buf, size_t size)
{
char *fmt;
const char *fmt;
fmt = opt->format & XMP_FORMAT_MONO ? "mono" : "stereo";
switch (t) {
case XMP_MIXER_STANDARD: {
char *itp;
const char *itp;
switch (opt->interp) {
case XMP_INTERP_NEAREST:
itp = "non-interpolated";
@ -211,9 +211,9 @@ static void get_mixer_type(int t, struct options *opt, char *buf, size_t size)
}
}
static void load_error(char *name, char *filename, int val)
static void load_error(const char *name, const char *filename, int val)
{
char *msg;
const char *msg;
val = -val;
switch (val) {

@ -174,7 +174,7 @@ int read_config(struct options *o)
}
static int compare_md5(unsigned char *d, char *digest)
static int compare_md5(const unsigned char *d, const char *digest)
{
int i;
@ -191,7 +191,7 @@ static int compare_md5(unsigned char *d, char *digest)
return 0;
}
static void parse_modconf(struct options *o, char *confname, unsigned char *md5)
static void parse_modconf(struct options *o, const char *confname, const unsigned char *md5)
{
FILE *rc;
char *hash, *var, *val, line[256];
@ -281,7 +281,7 @@ static void parse_modconf(struct options *o, char *confname, unsigned char *md5)
}
void read_modconf(struct options *o, unsigned char *md5)
void read_modconf(struct options *o, const unsigned char *md5)
{
#if defined(__OS2__) || defined(__EMX__)
char myrc[PATH_MAX];

@ -102,7 +102,7 @@ struct sound_driver *select_sound_driver(struct options *options)
{
struct list_head *head;
struct sound_driver *sd;
char *pref = options->driver_id;
const char *pref = options->driver_id;
if (pref) {
list_for_each(head, &sound_driver_list) {

@ -8,7 +8,7 @@
struct sound_driver {
const char *id;
char *description;
const char *description;
const char *const *help;
int (*init)(struct options *);
void (*deinit)(void);

@ -75,7 +75,7 @@ static void play(void *b, int len)
static void deinit(void)
{
free(sound_file.description);
free((void *)sound_file.description);
}
static void flush(void)
@ -107,4 +107,3 @@ struct sound_driver sound_file = {
onpause,
onresume
};

@ -148,7 +148,7 @@ static void deinit(void)
close(fd);
}
free(sound_wav.description);
free((void *)sound_wav.description);
}
static void flush(void)
@ -175,4 +175,3 @@ struct sound_driver sound_wav = {
onpause,
onresume
};

Loading…
Cancel
Save