Browse Source

silenced compiler warnings

Wei Mingzhi 6 years ago
parent
commit
fa9227ac46
3 changed files with 25 additions and 61 deletions
  1. 22 59
      font.c
  2. 2 2
      liboggvorbis/src/lsp.c
  3. 1 0
      oggplay.c

+ 22 - 59
font.c

@@ -96,58 +96,6 @@ static void PAL_LoadISOFont(void)
     }
 }
 
-static void PAL_LoadCNFont(void)
-{
-	int         i;
-
-	for (i = 0; i < sizeof(fontglyph_cn) / sizeof(fontglyph_cn[0]); i++)
-	{
-		wchar_t w = fontglyph_cn[i].code;
-		w = (w >= unicode_upper_base) ? (w - unicode_upper_base + unicode_lower_top) : w;
-		if (w < sizeof(unicode_font) / sizeof(unicode_font[0]))
-		{
-			memcpy(unicode_font[w], fontglyph_cn[i].data, 32);
-			font_width[w] = 32;
-		}
-	}
-}
-
-static void PAL_LoadTWFont(void)
-{
-	int         i;
-
-	for (i = 0; i < sizeof(fontglyph_tw) / sizeof(fontglyph_tw[0]); i++)
-	{
-		wchar_t w = fontglyph_tw[i].code;
-		w = (w >= unicode_upper_base) ? (w - unicode_upper_base + unicode_lower_top) : w;
-		if (w < sizeof(unicode_font) / sizeof(unicode_font[0]))
-		{
-			memcpy(unicode_font[w], fontglyph_tw[i].data, 32);
-			font_width[w] = 32;
-		}
-	}
-
-	_font_height = 15;
-}
-
-static void PAL_LoadJPFont(void)
-{
-	int         i;
-
-	for (i = 0; i < sizeof(fontglyph_jp) / sizeof(fontglyph_jp[0]); i++)
-	{
-		wchar_t w = fontglyph_jp[i].code;
-		w = (w >= unicode_upper_base) ? (w - unicode_upper_base + unicode_lower_top) : w;
-		if (w < sizeof(unicode_font) / sizeof(unicode_font[0]))
-		{
-			memcpy(unicode_font[w], fontglyph_jp[i].data, 32);
-			font_width[w] = 32;
-		}
-	}
-
-	_font_height = 16;
-}
-
 static void PAL_LoadEmbeddedFont(void)
 {
 	FILE *fp;
@@ -418,9 +366,24 @@ PAL_LoadUserFont(
 
 int
 PAL_InitFont(
-	const CONFIGURATION* cfg
+   const CONFIGURATION* cfg
 )
 {
+#define PAL_LOAD_INTERNAL_FONT(fontdata, height) \
+   { \
+      for (int i = 0; i < sizeof(fontdata) / sizeof(fontdata[0]); i++) \
+      { \
+         wchar_t w = fontdata[i].code; \
+         w = (w >= unicode_upper_base) ? (w - unicode_upper_base + unicode_lower_top) : w; \
+         if (w < sizeof(unicode_font) / sizeof(unicode_font[0])) \
+         { \
+            memcpy(unicode_font[w], fontdata[i].data, 32); \
+            font_width[w] = 32; \
+         } \
+      } \
+      _font_height = height; \
+   }
+
    if (!cfg->pszMsgFile)
    {
       PAL_LoadEmbeddedFont();
@@ -443,11 +406,11 @@ PAL_InitFont(
          switch (PAL_GetCodePage())
          {
          case CP_GBK:
-            PAL_LoadCNFont();
+            PAL_LOAD_INTERNAL_FONT(fontglyph_cn, 16);
             break;
 
          case CP_BIG5:
-            PAL_LoadTWFont();
+            PAL_LOAD_INTERNAL_FONT(fontglyph_tw, 15);
             break;
 
          default:
@@ -456,20 +419,20 @@ PAL_InitFont(
          break;
 
       case kFontFlavorSimpChin:
-         PAL_LoadCNFont();
+         PAL_LOAD_INTERNAL_FONT(fontglyph_cn, 16);
          break;
 
       case kFontFlavorTradChin:
-         PAL_LoadTWFont();
+         PAL_LOAD_INTERNAL_FONT(fontglyph_tw, 15);
          break;
 
       case kFontFlavorJapanese:
-         PAL_LoadJPFont();
+         PAL_LOAD_INTERNAL_FONT(fontglyph_jp, 16);
          break;
 
       case kFontFlavorUnifont:
       default:
-         break;  
+         break;
       }
    }
 

+ 2 - 2
liboggvorbis/src/lsp.c

@@ -309,7 +309,7 @@ static int comp(const void *a,const void *b){
 #define EPSILON 10e-7
 static int Laguerre_With_Deflation(float *a,int ord,float *r){
   int i,m;
-  double lastdelta=0.f;
+  //double lastdelta=0.f;
   double *defl=alloca(sizeof(*defl)*(ord+1));
   for(i=0;i<=ord;i++)defl[i]=a[i];
 
@@ -346,7 +346,7 @@ static int Laguerre_With_Deflation(float *a,int ord,float *r){
       if(delta<0.f)delta*=-1;
 
       if(fabs(delta/new)<10e-12)break;
-      lastdelta=delta;
+      //lastdelta=delta;
     }
 
     r[m-1]=new;

+ 1 - 0
oggplay.c

@@ -31,6 +31,7 @@
 #include <math.h>
 
 #if PAL_HAS_OGG
+#define OV_EXCLUDE_STATIC_CALLBACKS
 #include <vorbis/vorbisfile.h>
 #include "resampler.h"