Fixed bug #825
authorSam Lantinga <slouken@libsdl.org>
Sun, 04 Oct 2009 02:54:48 +0000
changeset 421de784f36729a
parent 420 2594a266fc8b
child 422 614c9a2f8279
Fixed bug #825

O.Sezer 2009-10-03 15:22:34 PDT

The following compiler warning

./timidity/timidity.c: In function 'Timidity_Init':
./timidity/timidity.c:298: warning: passing argument 1 of 'read_config_file'
discards qualifiers from pointer target type

.. showed that timidity needed some constification. Minor grunt work attached.
timidity/common.c
timidity/common.h
timidity/timidity.c
timidity/timidity.h
     1.1 --- a/timidity/common.c	Sun Oct 04 01:11:53 2009 +0000
     1.2 +++ b/timidity/common.c	Sun Oct 04 02:54:48 2009 +0000
     1.3 @@ -99,7 +99,7 @@
     1.4  
     1.5  /* This is meant to find and open files for reading, possibly piping
     1.6     them through a decompressor. */
     1.7 -FILE *open_file(char *name, int decompress, int noise_mode)
     1.8 +FILE *open_file(const char *name, int decompress, int noise_mode)
     1.9  {
    1.10    FILE *fp;
    1.11    PathList *plp;
    1.12 @@ -219,7 +219,7 @@
    1.13  }
    1.14  
    1.15  /* This adds a directory to the path list */
    1.16 -void add_to_pathlist(char *s)
    1.17 +void add_to_pathlist(const char *s)
    1.18  {
    1.19    PathList *plp=safe_malloc(sizeof(PathList));
    1.20    strcpy((plp->path=safe_malloc(strlen(s)+1)),s);
     2.1 --- a/timidity/common.h	Sun Oct 04 01:11:53 2009 +0000
     2.2 +++ b/timidity/common.h	Sun Oct 04 02:54:48 2009 +0000
     2.3 @@ -40,8 +40,8 @@
     2.4  #define OF_NORMAL	1
     2.5  #define OF_VERBOSE	2
     2.6  
     2.7 -extern FILE *open_file(char *name, int decompress, int noise_mode);
     2.8 -extern void add_to_pathlist(char *s);
     2.9 +extern FILE *open_file(const char *name, int decompress, int noise_mode);
    2.10 +extern void add_to_pathlist(const char *s);
    2.11  extern void free_pathlist(void);
    2.12  extern void close_file(FILE *fp);
    2.13  extern void skip(FILE *fp, size_t len);
     3.1 --- a/timidity/timidity.c	Sun Oct 04 01:11:53 2009 +0000
     3.2 +++ b/timidity/timidity.c	Sun Oct 04 02:54:48 2009 +0000
     3.3 @@ -45,7 +45,7 @@
     3.4  
     3.5  #define MAXWORDS 10
     3.6  
     3.7 -static int read_config_file(char *name)
     3.8 +static int read_config_file(const char *name)
     3.9  {
    3.10    FILE *fp;
    3.11    char tmp[1024], *w[MAXWORDS], *cp;
    3.12 @@ -370,7 +370,7 @@
    3.13  }
    3.14  
    3.15  char timidity_error[1024] = "";
    3.16 -char *Timidity_Error(void)
    3.17 +const char *Timidity_Error(void)
    3.18  {
    3.19    return(timidity_error);
    3.20  }
     4.1 --- a/timidity/timidity.h	Sun Oct 04 01:11:53 2009 +0000
     4.2 +++ b/timidity/timidity.h	Sun Oct 04 02:54:48 2009 +0000
     4.3 @@ -22,7 +22,7 @@
     4.4  typedef struct _MidiSong MidiSong;
     4.5  
     4.6  extern int Timidity_Init(int rate, int format, int channels, int samples);
     4.7 -extern char *Timidity_Error(void);
     4.8 +extern const char *Timidity_Error(void);
     4.9  extern void Timidity_SetVolume(int volume);
    4.10  extern int Timidity_PlaySome(void *stream, int samples);
    4.11  extern MidiSong *Timidity_LoadSong(char *midifile);