Corrected most of -Wall's complaints.
authorDavid Griffith <dave@661.org>
Sat, 11 Jun 2016 01:57:16 +0000 (18:57 -0700)
committerDavid Griffith <dave@661.org>
Sat, 11 Jun 2016 01:57:16 +0000 (18:57 -0700)
src/blorb/blorblib.c
src/common/fastmem.c
src/curses/ux_audio.c
src/curses/ux_blorb.c
src/curses/ux_frotz.h
src/curses/ux_init.c
src/curses/ux_input.c
src/curses/ux_pic.c
src/curses/ux_screen.c
src/curses/ux_text.c

index 988fa206bded55e49d4403550f9c1203dade3248..7ed6296a9c81ce651648e60dcb42e9945642c2cc 100644 (file)
@@ -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<len; jx++, ptr += 7) {
+                    for (jx=0; (unsigned int) jx<len; jx++, ptr += 7) {
                         bb_result_t res;
 
                         err = bb_load_resource(map, bb_method_DontLoad, &res,
@@ -403,7 +403,7 @@ static bb_err_t bb_initialize_map(bb_map_t *map)
                 if (len) {
                     bb_aux_sound_t *aux = (bb_aux_sound_t *)malloc(len * sizeof(bb_aux_sound_t));
 
-                    for (jx=0; jx<len; jx++, ptr += 2) {
+                    for (jx=0; (unsigned int) jx<len; jx++, ptr += 2) {
                         bb_result_t res;
 
                         err = bb_load_resource(map, bb_method_DontLoad, &res,
index 8e56bbcdd0ea5f8b69d23f8c7d6e8b77c0d6b45b..5d770c41538692cd6442e4e9995077c2d6df908f 100644 (file)
@@ -643,10 +643,10 @@ void z_restore (void)
 
     } else {
 
-       long pc;
-       zword release;
-       zword addr;
-       int i;
+//     long pc;
+//     zword release;
+//     zword addr;
+//     int i;
 
        /* Get the file name */
 
@@ -881,11 +881,11 @@ void z_save (void)
 
     } else {
 
-       long pc;
-       zword addr;
-       zword nsp, nfp;
-       int skip;
-       int i;
+//     long pc;
+//     zword addr;
+//     zword nsp, nfp;
+//     int skip;
+//     int i;
 
        /* Get the file name */
 
index b3c38285eb8b188f1947cbf00bcaa59b10f7a499..a9a1ac10f5819fbdd11b7236cdce5a2151f571b2 100644 (file)
@@ -318,8 +318,11 @@ static void *mixer(void *arg)
     int default_driver;
     ao_device *device;
     ao_sample_format format;
+    int samplecount;
     int i;
 
+    arg = arg;         /* Keep -Wall quiet */
+
     ao_initialize();
     default_driver = ao_default_driver_id();
 
@@ -363,8 +366,9 @@ static void *mixer(void *arg)
            for (i = 0; i < BUFFSIZE; i++) {
                bleepbuffer[i] += musicbuffer[i];
            }
-           floattopcm16(shortbuffer, bleepbuffer, MAX(musicsamples, bleepsamples));
-           ao_play(device, (char *) shortbuffer, MAX(musicsamples, bleepsamples) * sizeof(short));
+           samplecount = musicsamples > 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) {
index 3270e3a0eb24c68738897972c003cb6f80dc7a1d..ab65ca64ee4ff7b36688cb9571a0a3274d44e8aa 100644 (file)
@@ -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
index ce225be908682d5989f12ef8e6511bb4843cadc5..4c15ebdee5c6e4f5222bf8b700b4efd50c02367a 100644 (file)
@@ -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;
index ef6627726c70eabf2fb498ca97c932f8be2fb0a7..9d03cd49e3b1ab951d66efbf76a3e2e86d9b470c 100644 (file)
@@ -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)
 {
index 0680bb7619a95c960395437ae7ef2d72b0b33f05..aaf3aef5f247775f47636a4f97f1d35c5454629d 100644 (file)
@@ -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;
index 8869da1c3ee0196b64402b7209f027cd2f5fa5d1..684a6fe39d83fe4be625039466d1d0b95c341d64 100644 (file)
@@ -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);
 
index 63029fa5e9f816dbc3663ac12aa85251415427a6..dfa4312ebe36b87e94753e1a4795dc0e12aa8016 100644 (file)
@@ -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)) {
index 858ba83d009c021c1a83a1681b1191aa3949dbe3..2aa8cfad90696ff03895c04fba897ecbfe21f789 100644 (file)
@@ -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 */