Clean up compiler warnings.
authorTimo Korvola <tkorvola@iki.fi>
Sat, 10 Mar 2018 17:10:22 +0000 (19:10 +0200)
committerDavid Griffith <dave@661.org>
Sun, 11 Mar 2018 11:48:51 +0000 (04:48 -0700)
src/sdl/sf_font3.c
src/sdl/sf_fonts.c
src/sdl/sf_ftype.c
src/sdl/sf_osfdlg.c
src/sdl/sf_sig.c
src/sdl/sf_sound.c
src/sdl/sf_util.c

index f04312e749aac7fa3336a6bc0eafffd9103a4b77..2220993a29d9cf2d9a28fdb4803f342fdee0f47c 100644 (file)
@@ -113,7 +113,9 @@ static int mydescent(SFONT *s){ return 2;}
 static int myminchar(SFONT *s){ return 32;}
 static int mymaxchar(SFONT *s){ return 126;}
 static int myhasglyph(SFONT *s, word c, int allowdef)
-  { if (c >= 32 && c <= 126) return 1; if (allowdef) return 1;}
+{
+    return (c >= 32 && c <= 126) || allowdef;
+}
 static SF_glyph * mygetglyph(SFONT *s, word c, int allowdef)
   {
   byte *src;
index 4174ef7830e61f1ab9daf1aff74e6fe0f6c269ac..832819d9ada751333f61a02b4b6037af96c82607 100644 (file)
@@ -740,9 +740,8 @@ SFONT *sf_VGA_SFONT;
 void sf_initfonts()
   {
   int i, j, size=0;
-  int w,h,nby,m,nocc;
   byte *cfont, *bmp; SF_glyph *g;
-  SF_bdffont *b, *norm, *emph, *bold, *bemp;
+  SF_bdffont *norm, *emph, *bold, *bemp;
   SFONT *Norm, *Emph=NULL, *Bold=NULL, *Bemp=NULL;
 
   norm = SF_defaultfont;
@@ -763,13 +762,11 @@ void sf_initfonts()
        // emphasize (underline)...
   cfont = (byte *)emph;
   for (i = norm->minchar;i <= norm->maxchar;i++){
-       m = norm->glyphs[i-norm->minchar];
+       int m = norm->glyphs[i-norm->minchar];
        if (!m) continue;
        g = (SF_glyph *)(cfont + m);
-       w = g->dx;
-       h = g->h; nby = (g->w+7)/8;
        bmp = (byte *)(&(g->bitmap[0]));
-       bmp[h-2] = 0xff;
+       bmp[g->h - 2] = 0xff;
        }
        // make a copy for bold
   bold = malloc(size);
@@ -780,15 +777,13 @@ void sf_initfonts()
        // boldify...
   cfont = (byte *)bold;
   for (i = norm->minchar;i <= norm->maxchar;i++){
-       int c;
-       m = norm->glyphs[i-norm->minchar];
+       int h, m = norm->glyphs[i-norm->minchar];
        if (!m) continue;
        g = (SF_glyph *)(cfont + m);
-       w = g->dx;
-       h = g->h; nby = (g->w+7)/8;
+       h = g->h;
        bmp = (byte *)(&(g->bitmap[0]));
        for (j=0;j<h;j++){
-         c = bmp[j];
+         int c = bmp[j];
          bmp[j] = (c) | (c >> 1);
          }
        }
@@ -801,13 +796,11 @@ void sf_initfonts()
        // emphasize (underline)...
   cfont = (byte *)bemp;
   for (i = norm->minchar;i <= norm->maxchar;i++){
-       m = norm->glyphs[i-norm->minchar];
+       int m = norm->glyphs[i-norm->minchar];
        if (!m) continue;
        g = (SF_glyph *)(cfont + m);
-       w = g->dx;
-       h = g->h; nby = (g->w+7)/8;
        bmp = (byte *)(&(g->bitmap[0]));
-       bmp[h-2] = 0xff;
+       bmp[g->h - 2] = 0xff;
        }
 
   myfonts[0] = myfonts[4] = Norm;
@@ -842,11 +835,12 @@ void sf_initfonts()
 
   if (ttfontsdone) ttfontsdone();
        // now set the graphics font
-  if (!myfonts[8])
+  if (!myfonts[8]) {
       if (myfonts[4]->height(myfonts[4]) < 16)
           myfonts[8] = SF_font3;
       else
           myfonts[8] = SF_font3double;
+  }
 
 //for (i=0;i<8;i++){ SFONT *s = myfonts[i]; printf("%d %p %d %d %d %d %d\n",
 //i,s,s->minchar(s),s->maxchar(s),s->ascent(s),s->descent(s),s->height(s));}
index e074bef6ee2507589cba5c1530b7d6dd6818f6ef..46ed61ee2ebc3fcfab2179fe7bf155cac3799579 100644 (file)
@@ -96,7 +96,7 @@ static SF_glyph *getglyph( SFONT *s, word c, int allowdef)
   {
   if (s)
     {
-    int i; MYFONT *f = (MYFONT *)s;
+    MYFONT *f = (MYFONT *)s;
     if (c < f->minchar || c > f->maxchar)
        {
        if (allowdef) c = 0;
@@ -164,8 +164,7 @@ static void setglyph( MYFONT *f, FT_Face face, int ch)
   int mode = FT_RENDER_MODE_MONO;
   SF_glyph *res;
   FT_GlyphSlot slot = face->glyph;
-  int i,j, nbypr, pitch;
-  unsigned char *s;
+  int i,j, nbypr;
   FT_Bitmap *bitmap;
 
   if (m_aafonts) mode = FT_RENDER_MODE_NORMAL;
index 7e246d759447cc232e5169edb476463120f756e7..24bd0093c92cee54deb8254250da8e1503ca4ddb 100644 (file)
@@ -653,7 +653,7 @@ static unsigned char docbmp[] = {
 \r
 STATIC void drawit( int x, int y, ENTRY *e, int w, int issub)\r
   {\r
-  int i,j,n,sw,dy,color;\r
+  int i, j, n, color;\r
   unsigned char *bmp;\r
   char *s = e->value;\r
   bmp = (issub ? folderbmp : docbmp);\r
@@ -841,7 +841,7 @@ STATIC zword yesnoover( int xc, int yc)
 // (lib does not guarantee correct behaviour in that case)\r
 static void mystrcpy( char *d, const char *s)\r
   {\r
-  while (*d++ = *s++);\r
+  while ((*d++ = *s++));\r
   }\r
 \r
 STATIC zword Zentry( int x, int y)\r
index 9a50c509bce79af5dd179dcaab1e158d3bb5ee36..31cd54794bdafaa9879745b3a474f80c7d8cbdef 100644 (file)
@@ -76,7 +76,6 @@ static void bt_sighandler(int sig, siginfo_t *info,
                                    void *secret) {
 
   void *trace[16];
-  char **messages = (char **)NULL;
   char *nam;
   int i, trace_size = 0;
   ucontext_t *uc = (ucontext_t *)secret;
@@ -88,7 +87,7 @@ static void bt_sighandler(int sig, siginfo_t *info,
 
   printf("\nInterpreter bug!\nSignal %d ", sig);
   if ((nam = getsigname(sig))) printf("[%s] ",nam);
-  printf("from %p", uc->uc_mcontext.gregs[_PROG_COUNTER]);
+  printf("from %p", (void *)uc->uc_mcontext.gregs[_PROG_COUNTER]);
 
   if (sig == SIGSEGV)
         printf(" [faulty address is %p]",info->si_addr);
index ac9c0ed9f6def639e1d722e13c651b49c261aaab..504c00d0d9053919e2ba93eab11ecdb2b7f833c2 100644 (file)
@@ -46,7 +46,7 @@ static int audio_rate, audio_channels;
                // the higher it is, the more FPS shown and CPU needed
 static int audio_buffers=512;
 static Uint16 audio_format;
-static int volume = SDL_MIX_MAXVOLUME;
+//static int volume = SDL_MIX_MAXVOLUME;
 static int bits;
 
 static void finishaudio()
@@ -243,7 +243,7 @@ static EFFECT *getmodule( FILE *f, size_t pos, int len, int num)
   return res;
   }
 
-static EFFECT *geteffect( num)
+static EFFECT *geteffect(int num)
   {
   myresource res;
   EFFECT *result = NULL;
index 162d3ef87449a609cfa2f6b54c6ec9715a4379ea..175b70316422e446776885831c3aa2875f5827f5 100644 (file)
@@ -177,11 +177,6 @@ static void usage()
 
 static const char *progname = NULL;
 
-extern char script_name[];
-extern char command_name[];
-extern char save_name[];
-extern char auxilary_name[];
-
 char stripped_story_name[100];
 
 extern char *optarg;
@@ -334,14 +329,8 @@ static char *new_basename(const char *path)
 void os_process_arguments (int argc, char *argv[])
 {
   char *p;
-  int i;
-
-       // install signal handlers
 
   sf_installhandlers();
-
-    /* Parse command line options */
-
   parse_options(argc, argv);
 
   if (optind != argc - 1) 
@@ -349,13 +338,9 @@ void os_process_arguments (int argc, char *argv[])
        usage();
        exit (EXIT_FAILURE);
        }
-
-    /* Set the story file name */
-
   f_setup.story_file = strdup(argv[optind]);
 
-       // load resources
-       // it's useless to test the retval, as in case of error it does not return
+  // it's useless to test the retval, as in case of error it does not return
   sf_load_resources( f_setup.story_file);
 
     /* Strip path and extension off the story file name */
@@ -553,7 +538,6 @@ int os_read_file_name (char *file_name, const char *default_name, int flag)
   {
   int st;
   const char *initname = default_name;
-  char *ext = ".aux";
 
   if (newfile(flag))
     {
@@ -790,12 +774,13 @@ static char * findsect( const char *sect)
     if (strncmp(r,sect,ns)) continue;
     return (r+ns);
     }
+  return NULL;
   }
 
 static char * findid( const char *sect, const char *id)
   {
   int nid = strlen(id);
-  char *p, *r, *sav, *rq, *fnd = NULL;
+  char *r, *sav, *rq, *fnd = NULL;
   r = findsect(sect);
 //printf("findsect(%s) %p\n",sect,r);
   if (!r) return NULL;
@@ -924,7 +909,7 @@ static int myunzip( int csize, byte *cdata, byte *udata)
 
 int sf_pkread( FILE *f, int foffs,  void ** out, int *size)
   {
-  byte hd[30], *dest;
+  byte hd[30];
   byte *data, *cdata;
   int csize, usize, cmet, skip, st;