From ff7041ae6a82b656deb7a8b21f6cbcb6b022d332 Mon Sep 17 00:00:00 2001 From: David Griffith Date: Fri, 10 Jun 2016 18:57:16 -0700 Subject: [PATCH] Corrected most of -Wall's complaints. --- src/blorb/blorblib.c | 6 +++--- src/common/fastmem.c | 18 +++++++++--------- src/curses/ux_audio.c | 16 ++++++++++------ src/curses/ux_blorb.c | 16 +++++++--------- src/curses/ux_frotz.h | 1 - src/curses/ux_init.c | 16 ++++++++++------ src/curses/ux_input.c | 7 ++++--- src/curses/ux_pic.c | 2 +- src/curses/ux_screen.c | 2 ++ src/curses/ux_text.c | 2 +- 10 files changed, 47 insertions(+), 39 deletions(-) diff --git a/src/blorb/blorblib.c b/src/blorb/blorblib.c index 988fa20..7ed6296 100644 --- a/src/blorb/blorblib.c +++ b/src/blorb/blorblib.c @@ -226,7 +226,7 @@ static bb_err_t bb_initialize_map(bb_map_t *map) bb_resdesc_t *resources; bb_resdesc_t **ressorted; - if (len != numres*12+4) + if (len != (unsigned int) numres*12+4) return bb_err_Format; /* bad length field */ resources = (bb_resdesc_t *)malloc(numres * sizeof(bb_resdesc_t)); @@ -362,7 +362,7 @@ static bb_err_t bb_initialize_map(bb_map_t *map) if (len) { bb_aux_pict_t *aux = (bb_aux_pict_t *)malloc(len * sizeof(bb_aux_pict_t)); - for (jx=0; jx bleepsamples ? musicsamples : bleepsamples; + floattopcm16(shortbuffer, bleepbuffer, samplecount); + ao_play(device, (char *) shortbuffer, samplecount * sizeof(short)); } if (!bleep_playing && !music_playing) { @@ -460,7 +464,7 @@ static int mypower(int base, int exp) { */ void *playaiff(EFFECT *raw_effect) { - long filestart; +// long filestart; int volcount; int volfactor; @@ -483,7 +487,7 @@ void *playaiff(EFFECT *raw_effect) sf_info.format = 0; bleepnum = myeffect.number; - filestart = ftell(myeffect.fp); +// filestart = ftell(myeffect.fp); lseek(fileno(myeffect.fp), myeffect.result.data.startpos, SEEK_SET); sndfile = sf_open_fd(fileno(myeffect.fp), SFM_READ, &sf_info, 0); @@ -742,13 +746,13 @@ static void *playogg(EFFECT *raw_effect) int current_section; short *shortbuffer; - long filestart; +// long filestart; int volcount; int volfactor; EFFECT myeffect = *raw_effect; - filestart = ftell(myeffect.fp); +// filestart = ftell(myeffect.fp); fseek(myeffect.fp, myeffect.result.data.startpos, SEEK_SET); if (ov_open_callbacks(myeffect.fp, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE) < 0) { diff --git a/src/curses/ux_blorb.c b/src/curses/ux_blorb.c index 3270e3a..ab65ca6 100644 --- a/src/curses/ux_blorb.c +++ b/src/curses/ux_blorb.c @@ -44,11 +44,11 @@ FILE *blorb_fp; bb_result_t blorb_res; bb_map_t *blorb_map; -/* uint32 *findchunk(uint32 *data, char *chunkID, int length); */ -static char *findchunk(char *pstart, char *fourcc, int n); -static unsigned short ReadShort(const unsigned char *bytes); -static unsigned long ReadLong(const unsigned char *bytes); -static double ReadExtended(const unsigned char *bytes); +// uint32 *findchunk(uint32 *data, char *chunkID, int length); +// static char *findchunk(char *pstart, char *fourcc, int n); +// static unsigned short ReadShort(const unsigned char *bytes); +// static unsigned long ReadLong(const unsigned char *bytes); +// static double ReadExtended(const unsigned char *bytes); static int isblorb(FILE *); #define UnsignedToFloat(u) (((double)((long)(u - 2147483647L - 1))) + 2147483648.0) @@ -186,7 +186,7 @@ static int isblorb(FILE *fp) return 1; } - +#ifdef CRAP static char *findchunk(char *data, char *string, int length) { char *mydata = data+12; @@ -200,7 +200,6 @@ static char *findchunk(char *data, char *string, int length) return NULL; } - static unsigned short ReadShort(const unsigned char *bytes) { return (unsigned short)( @@ -208,7 +207,6 @@ static unsigned short ReadShort(const unsigned char *bytes) ((unsigned short)(bytes[1] & 0xFF))); } - static unsigned long ReadLong(const unsigned char *bytes) { return (unsigned long)( @@ -218,7 +216,6 @@ static unsigned long ReadLong(const unsigned char *bytes) ((unsigned long)(bytes[3] & 0xFF))); } - static double ReadExtended(const unsigned char *bytes) { double f; @@ -246,3 +243,4 @@ static double ReadExtended(const unsigned char *bytes) return -f; return f; } +#endif diff --git a/src/curses/ux_frotz.h b/src/curses/ux_frotz.h index ce225be..4c15ebd 100644 --- a/src/curses/ux_frotz.h +++ b/src/curses/ux_frotz.h @@ -80,7 +80,6 @@ extern char *gamepath; /* use to find sound files */ extern f_setup_t f_setup; extern u_setup_t u_setup; - /*** Blorb related stuff ***/ extern bb_err_t blorb_err; extern bb_map_t *blorb_map; diff --git a/src/curses/ux_init.c b/src/curses/ux_init.c index ef66277..9d03cd4 100644 --- a/src/curses/ux_init.c +++ b/src/curses/ux_init.c @@ -79,8 +79,8 @@ static int getconfig(char *); static int getbool(char *); static int getcolor(char *); static int geterrmode(char *); -static void redraw(void); -static FILE *pathopen(const char *, const char *, const char *, char *); +/* static void redraw(void); */ +/* static FILE *pathopen(const char *, const char *, const char *, char *); */ /* @@ -505,6 +505,7 @@ void os_reset_screen (void) */ void os_restart_game (int stage) { + stage = stage; /* Keep -Wall quiet */ } @@ -623,6 +624,7 @@ int os_storyfile_tell(FILE * fp) } +#ifdef CRAP /* * pathopen * @@ -655,6 +657,7 @@ static FILE *pathopen(const char *name, const char *p, const char *mode, char *f } return NULL; } /* FILE *pathopen() */ +#endif /* @@ -675,7 +678,7 @@ static int getconfig(char *configfile) { FILE *fp; - int num, num2; + size_t num, num2; char varname[LINELEN + 1]; char value[LINELEN + 1]; @@ -929,6 +932,7 @@ the Z-Machine standard itself. See the file BUGS for a detailed explaination for this. Because of this trouble, this function currently does nothing. */ + sig = sig; /* Keep -Wall quiet */ } @@ -942,6 +946,7 @@ does nothing. void sigint_handler(int dummy) { signal(SIGINT, sigint_handler); + dummy = dummy; os_stop_sample(0); scrollok(stdscr, TRUE); scroll(stdscr); @@ -950,12 +955,11 @@ void sigint_handler(int dummy) exit(1); } - +/* void redraw(void) { - /* not implemented */ } - +*/ void os_init_setup(void) { diff --git a/src/curses/ux_input.c b/src/curses/ux_input.c index 0680bb7..aaf3aef 100644 --- a/src/curses/ux_input.c +++ b/src/curses/ux_input.c @@ -300,7 +300,7 @@ static int unix_history_back(zchar *str, int searchlen, int maxlen) history_view = prev; return 0; } - } while (strlen( *history_view) > maxlen + } while (strlen( *history_view) > (size_t) maxlen || (searchlen != 0 && strncmp( (char *)str, *history_view, searchlen))); strcpy((char *)str + searchlen, *history_view + searchlen); return 1; @@ -325,7 +325,7 @@ static int unix_history_forward(zchar *str, int searchlen, int maxlen) history_view = prev; return 0; } - } while (strlen( *history_view) > maxlen + } while (strlen( *history_view) > (size_t) maxlen || (searchlen != 0 && strncmp( (char *)str, *history_view, searchlen))); strcpy((char *)str + searchlen, *history_view + searchlen); return 1; @@ -615,10 +615,11 @@ zchar os_read_key (int timeout, int cursor) int os_read_file_name (char *file_name, const char *default_name, int flag) { - int saved_replay = istream_replay; int saved_record = ostream_record; + flag = flag; /*Keep -Wall quiet */ + /* Turn off playback and recording temporarily */ istream_replay = 0; diff --git a/src/curses/ux_pic.c b/src/curses/ux_pic.c index 8869da1..684a6fe 100644 --- a/src/curses/ux_pic.c +++ b/src/curses/ux_pic.c @@ -97,7 +97,7 @@ bool unix_init_pictures (void) basename = strrchr(f_setup.story_name, '/'); if (basename) basename++; else basename = f_setup.story_name; dotpos = strrchr(basename, '.'); - namelen = (dotpos ? dotpos - basename : strlen(basename)); + namelen = (dotpos ? dotpos - basename : (int) strlen(basename)); sprintf(filename, "%.*sgraphics/%.*s.mg1", (int)(basename - f_setup.story_name), f_setup.story_name, namelen, basename); diff --git a/src/curses/ux_screen.c b/src/curses/ux_screen.c index 63029fa..dfa4312 100644 --- a/src/curses/ux_screen.c +++ b/src/curses/ux_screen.c @@ -48,6 +48,8 @@ void os_erase_area (int top, int left, int bottom, int right, int win) { int y, x, i, j; + win = win; /* Keep -Wall quiet */ + /* Catch the most common situation and do things the easy way */ if ((top == 1) && (bottom == h_screen_rows) && (left == 1) && (right == h_screen_cols)) { diff --git a/src/curses/ux_text.c b/src/curses/ux_text.c index 858ba83..2aa8cfa 100644 --- a/src/curses/ux_text.c +++ b/src/curses/ux_text.c @@ -187,8 +187,8 @@ void os_set_text_style (int new_style) */ void os_set_font (int new_font) { - /* Not implemented */ + new_font = new_font; /* Keep -Wall quiet */ }/* os_set_font */ -- 2.34.1