From 64ff4876530c300aab62295a6bd84848db2ce144 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Oct 2009 02:54:48 +0000 Subject: [PATCH] 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 | 4 ++-- timidity/common.h | 4 ++-- timidity/timidity.c | 4 ++-- timidity/timidity.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/timidity/common.c b/timidity/common.c index 470760da..6a0f68f3 100644 --- a/timidity/common.c +++ b/timidity/common.c @@ -99,7 +99,7 @@ static FILE *try_to_open(char *name, int decompress, int noise_mode) /* This is meant to find and open files for reading, possibly piping them through a decompressor. */ -FILE *open_file(char *name, int decompress, int noise_mode) +FILE *open_file(const char *name, int decompress, int noise_mode) { FILE *fp; PathList *plp; @@ -219,7 +219,7 @@ void *safe_malloc(size_t count) } /* This adds a directory to the path list */ -void add_to_pathlist(char *s) +void add_to_pathlist(const char *s) { PathList *plp=safe_malloc(sizeof(PathList)); strcpy((plp->path=safe_malloc(strlen(s)+1)),s); diff --git a/timidity/common.h b/timidity/common.h index 362fc53d..20a1d00e 100644 --- a/timidity/common.h +++ b/timidity/common.h @@ -40,8 +40,8 @@ typedef struct { #define OF_NORMAL 1 #define OF_VERBOSE 2 -extern FILE *open_file(char *name, int decompress, int noise_mode); -extern void add_to_pathlist(char *s); +extern FILE *open_file(const char *name, int decompress, int noise_mode); +extern void add_to_pathlist(const char *s); extern void free_pathlist(void); extern void close_file(FILE *fp); extern void skip(FILE *fp, size_t len); diff --git a/timidity/timidity.c b/timidity/timidity.c index ba9ec4f5..623d80f9 100644 --- a/timidity/timidity.c +++ b/timidity/timidity.c @@ -45,7 +45,7 @@ int num_ochannels; #define MAXWORDS 10 -static int read_config_file(char *name) +static int read_config_file(const char *name) { FILE *fp; char tmp[1024], *w[MAXWORDS], *cp; @@ -370,7 +370,7 @@ int Timidity_Init(int rate, int format, int channels, int samples) } char timidity_error[1024] = ""; -char *Timidity_Error(void) +const char *Timidity_Error(void) { return(timidity_error); } diff --git a/timidity/timidity.h b/timidity/timidity.h index e8ac3c6e..49229e49 100644 --- a/timidity/timidity.h +++ b/timidity/timidity.h @@ -22,7 +22,7 @@ typedef struct _MidiSong MidiSong; extern int Timidity_Init(int rate, int format, int channels, int samples); -extern char *Timidity_Error(void); +extern const char *Timidity_Error(void); extern void Timidity_SetVolume(int volume); extern int Timidity_PlaySome(void *stream, int samples); extern MidiSong *Timidity_LoadSong(char *midifile);