[MPlayer-dev-eng] [PATCH] yet another batch of compiler warning fixes

Dominik Mierzejewski dominik at rangers.eu.org
Fri Nov 22 17:07:23 CET 2002


One patch to fix some warnings within GUI code.
One patch to check for -Wall option support in compiler and use it.
And one patch to fix some more warnings in mplayer code, mostly
unused variables.

One comment, though. This:
--- MPlayer-20021122/libmpcodecs/Makefile.warn  Thu Nov 14 20:08:55 2002
+++ MPlayer-20021122/libmpcodecs/Makefile       Fri Nov 22 16:22:01 2002
@@ -37,7 +37,7 @@
 SRCS2=$(ENCODER_SRCS)
 OBJS2=$(SRCS2:.c=.o)

-CFLAGS  = $(OPTFLAGS) -I. -Inative -I.. -I../libmpdemux -I../loader
+$(EXTRA_INC)
+CFLAGS  = $(OPTFLAGS) -I. -Inative -I.. -I../libmpdemux -I../loader
+$(EXTRA_INC) -D_GNU_SOURCE

 .SUFFIXES: .c .o

is required for ad_libvorbis.c to compile without complaining about
implicit declaration of vsscanf. It's not enough to include <stdarg.h>,
__ISO_C99 must also be set (and it's set by defining _GNU_SOURCE).
 
-- 
MPlayer RPMs maintainer: http://www.piorunek.pl/~dominik/linux/pkgs/mplayer/
"The Universe doesn't give you any points for doing things that are easy."
        -- Sheridan to Garibaldi in Babylon 5:"The Geometry of Shadows"
-------------- next part --------------
--- MPlayer-20021122/Gui/bitmap.h.gui	Sat Nov  2 18:07:18 2002
+++ MPlayer-20021122/Gui/bitmap.h	Fri Nov 22 13:39:53 2002
@@ -1,11 +1,12 @@
-
 #ifndef __MYSAMPLE
 #define __MYSAMPLE
 
+#include <png.h>
+
 typedef struct _txSample
 {
- unsigned int  Width;
- unsigned int  Height;
+ png_uint_32   Width;
+ png_uint_32   Height;
  unsigned int  BPP;
  unsigned long ImageSize;
  char *        Image;
--- MPlayer-20021122/Gui/cfg.c.gui	Thu Nov 14 20:08:54 2002
+++ MPlayer-20021122/Gui/cfg.c	Fri Nov 22 15:35:44 2002
@@ -7,6 +7,9 @@
 #include "../mp_msg.h"
 #include "../mplayer.h"
 #include "../cfgparser.h"
+#ifndef NEW_CONFIG
+#include "../playtree.h"
+#endif
 
 #ifdef USE_SETLOCALE
 #include <locale.h>
-------------- next part --------------
--- MPlayer-20021122/Gui/Makefile.wall	Thu Nov 14 20:08:54 2002
+++ MPlayer-20021122/Gui/Makefile	Fri Nov 22 16:09:08 2002
@@ -7,7 +7,7 @@
 INCDIR  = -I. -I../loader -I./wm -I./skin $(FREETYPE_INC) $(GTKINC) $(EXTRA_INC) 
 
 OPTIMIZE =  $(OPTFLAGS) -fomit-frame-pointer \
-            -fexpensive-optimizations -fschedule-insns2 -Wall
+            -fexpensive-optimizations -fschedule-insns2
 ifeq ($(TARGET_ARCH_X86),yes)
 OPTIMIZE += -malign-double
 endif
--- MPlayer-20021122/libaf/Makefile.wall	Thu Nov 14 20:08:54 2002
+++ MPlayer-20021122/libaf/Makefile	Fri Nov 22 16:09:08 2002
@@ -6,7 +6,7 @@
 
 OBJS=$(SRCS:.c=.o)
 
-CFLAGS  = $(OPTFLAGS) -I. -Wall 
+CFLAGS  = $(OPTFLAGS) -I.
 .SUFFIXES: .c .o
 
 .c.o:
--- MPlayer-20021122/configure.wall	Fri Nov 22 13:36:35 2002
+++ MPlayer-20021122/configure	Fri Nov 22 16:12:27 2002
@@ -2164,6 +2164,19 @@
 fi
 echores "$_sys_sysinfo"
 
+echocheck "-Wall option"
+cat > $TMPC << EOF
+int main(void) { return 0; }
+EOF
+_wall=no
+cc_check -Wall && _wall=yes
+if test "$_wall" = yes ; then
+  _ld_wall='-Wall'
+else
+  _ld_wall=''
+fi
+echores "$_wall"
+
 
 #########
 # VIDEO #
@@ -4390,9 +4403,9 @@
   _stripbinaries=no
 elif test -z "$CFLAGS" ; then
   if test "$host_arch" != "mips" ; then
-    CFLAGS="-O4 $_march $_mcpu -pipe -ffast-math -fomit-frame-pointer"
+    CFLAGS="-O4 $_march $_mcpu -pipe -ffast-math -fomit-frame-pointer $_ld_wall"
   else
-    CFLAGS="-O4 $_march $_mcpu -ffast-math -fomit-frame-pointer"
+    CFLAGS="-O4 $_march $_mcpu -ffast-math -fomit-frame-pointer $_ld_wall"
   fi
   # always compile with '-g' if .developer:
   if test -f ".developer" ; then
-------------- next part --------------
--- MPlayer-20021122/input/input.c.warn	Fri Nov 22 13:36:36 2002
+++ MPlayer-20021122/input/input.c	Fri Nov 22 16:22:01 2002
@@ -689,7 +689,7 @@
 
 void
 mp_input_add_cmd_filter(mp_input_cmd_filter func, void* ctx) {
-  mp_cmd_filter_t* filter = malloc(sizeof(mp_cmd_filter_t)), *prev;
+  mp_cmd_filter_t* filter = malloc(sizeof(mp_cmd_filter_t))/*, *prev*/;
 
   filter->filter = func;
   filter->ctx = ctx;
--- MPlayer-20021122/liba52/imdct.c.warn	Sun Feb  3 11:27:26 2002
+++ MPlayer-20021122/liba52/imdct.c	Fri Nov 22 16:22:01 2002
@@ -193,16 +193,19 @@
 void
 imdct_do_512(sample_t data[],sample_t delay[], sample_t bias)
 {
-    int i,k;
+    int i;
+#ifndef USE_AC3_C
+	int k;
     int p,q;
     int m;
     int two_m;
     int two_m_plus_one;
 
-    sample_t tmp_a_i;
-    sample_t tmp_a_r;
     sample_t tmp_b_i;
     sample_t tmp_b_r;
+#endif
+    sample_t tmp_a_i;
+    sample_t tmp_a_r;
 
     sample_t *data_ptr;
     sample_t *delay_ptr;
@@ -401,16 +404,16 @@
 void
 imdct_do_512_sse(sample_t data[],sample_t delay[], sample_t bias)
 {
-    int i,k;
-    int p,q;
+/*	int i,k;
+    int p,q;*/
     int m;
     int two_m;
     int two_m_plus_one;
 
-    sample_t tmp_a_i;
+/*  sample_t tmp_a_i;
     sample_t tmp_a_r;
     sample_t tmp_b_i;
-    sample_t tmp_b_r;
+    sample_t tmp_b_r;*/
 
     sample_t *data_ptr;
     sample_t *delay_ptr;
--- MPlayer-20021122/liba52/imdct_3dnow.h.warn	Fri Nov 22 13:36:37 2002
+++ MPlayer-20021122/liba52/imdct_3dnow.h	Fri Nov 22 16:22:01 2002
@@ -322,7 +322,8 @@
 #endif
 (sample_t data[],sample_t delay[], sample_t bias)
 {
-    int i,k;
+    int i;
+/*	int k;
     int p,q;
     int m;
     int two_m;
@@ -331,7 +332,7 @@
     sample_t tmp_a_i;
     sample_t tmp_a_r;
     sample_t tmp_b_i;
-    sample_t tmp_b_r;
+    sample_t tmp_b_r;*/
 
     sample_t *data_ptr;
     sample_t *delay_ptr;
--- MPlayer-20021122/libmpcodecs/vd_huffyuv.c.warn	Sun Sep  1 11:45:50 2002
+++ MPlayer-20021122/libmpcodecs/vd_huffyuv.c	Fri Nov 22 16:22:01 2002
@@ -595,7 +595,7 @@
 {
 	mp_image_t* mpi;
 	int pixel_ptr;
-	unsigned char y1, y2, u, v, r, g, b, a;
+	unsigned char y1, y2, u, v, r, g, b/*, a*/;
 	unsigned char left_y, left_u, left_v, left_r, left_g, left_b;
 	unsigned char tmp, mi, mx, med;
 	unsigned char *swap;
--- MPlayer-20021122/libmpcodecs/Makefile.warn	Thu Nov 14 20:08:55 2002
+++ MPlayer-20021122/libmpcodecs/Makefile	Fri Nov 22 16:22:01 2002
@@ -37,7 +37,7 @@
 SRCS2=$(ENCODER_SRCS)
 OBJS2=$(SRCS2:.c=.o)
 
-CFLAGS  = $(OPTFLAGS) -I. -Inative -I.. -I../libmpdemux -I../loader $(EXTRA_INC)
+CFLAGS  = $(OPTFLAGS) -I. -Inative -I.. -I../libmpdemux -I../loader $(EXTRA_INC) -D_GNU_SOURCE
 
 .SUFFIXES: .c .o
 
--- MPlayer-20021122/libmpdemux/tv.c.warn	Thu Nov  7 02:48:00 2002
+++ MPlayer-20021122/libmpdemux/tv.c	Fri Nov 22 16:22:01 2002
@@ -29,6 +29,7 @@
 #include "stheader.h"
 
 #include "../libao2/afmt.h"
+#include "../libao2/audio_out.h"
 #include "../libvo/img_format.h"
 #include "../libvo/fastmemcpy.h"
 
--- MPlayer-20021122/libmpdemux/demux_asf.c.warn	Fri Nov 22 13:36:37 2002
+++ MPlayer-20021122/libmpdemux/demux_asf.c	Fri Nov 22 16:22:01 2002
@@ -397,11 +397,11 @@
 }
 
 int demux_asf_control(demuxer_t *demuxer,int cmd, void *arg){
-    demux_stream_t *d_audio=demuxer->audio;
+/*  demux_stream_t *d_audio=demuxer->audio;
     demux_stream_t *d_video=demuxer->video;
     sh_audio_t *sh_audio=d_audio->sh;
     sh_video_t *sh_video=d_video->sh;
-
+*/
     switch(cmd) {
 	case DEMUXER_CTRL_GET_TIME_LENGTH:
 	    *((unsigned long *)arg)=(unsigned long)(asf_movielength);
--- MPlayer-20021122/libmpdemux/demux_mov.c.warn	Thu Nov 14 20:08:57 2002
+++ MPlayer-20021122/libmpdemux/demux_mov.c	Fri Nov 22 16:22:01 2002
@@ -527,7 +527,7 @@
 		break;
 	    }
 	    case MOV_FOURCC('s','t','t','s'): {
-		int temp=stream_read_dword(demuxer->stream);
+		stream_read_dword(demuxer->stream);
 		int len=stream_read_dword(demuxer->stream);
 		int i;
 		unsigned int pts=0;
@@ -582,7 +582,7 @@
 		break;
 	    }
 	    case MOV_FOURCC('s','t','c','o'): {
-		int temp=stream_read_dword(demuxer->stream);
+		stream_read_dword(demuxer->stream);
 		int len=stream_read_dword(demuxer->stream);
 		int i;
 		mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*sChunk offset table! (%d chunks)\n",level,"",len);
@@ -596,7 +596,7 @@
 		break;
 	    }
 	    case MOV_FOURCC('c','o','6','4'): {
-		int temp=stream_read_dword(demuxer->stream);
+		stream_read_dword(demuxer->stream);
 		int len=stream_read_dword(demuxer->stream);
 		int i;
 		mp_msg(MSGT_DEMUX,MSGL_V,"MOV: %*s64bit chunk offset table! (%d chunks)\n",level,"",len);
--- MPlayer-20021122/libmpdemux/demux_mpg.c.warn	Fri Nov 22 13:36:37 2002
+++ MPlayer-20021122/libmpdemux/demux_mpg.c	Fri Nov 22 16:22:01 2002
@@ -406,9 +406,9 @@
 }
 
 int demux_mpg_control(demuxer_t *demuxer,int cmd, void *arg){
-    demux_stream_t *d_audio=demuxer->audio;
+/*    demux_stream_t *d_audio=demuxer->audio;*/
     demux_stream_t *d_video=demuxer->video;
-    sh_audio_t *sh_audio=d_audio->sh;
+/*    sh_audio_t *sh_audio=d_audio->sh;*/
     sh_video_t *sh_video=d_video->sh;
 
     switch(cmd) {
--- MPlayer-20021122/libmpdemux/demux_pva.c.warn	Wed Oct  9 21:40:14 2002
+++ MPlayer-20021122/libmpdemux/demux_pva.c	Fri Nov 22 16:22:01 2002
@@ -280,7 +280,9 @@
 	uint16_t pack_size;
 	off_t next_offset,pva_payload_start;
 	unsigned char buffer[256];
+#ifndef PVA_NEW_PREBYTES_CODE
 	demux_packet_t * dp; 	//hack to deliver the preBytes (see PVA doc)
+#endif
 	pva_priv_t * priv=(pva_priv_t *) d->priv;
 
 	
--- MPlayer-20021122/libmpdemux/demux_viv.c.warn	Sun Sep 22 18:39:24 2002
+++ MPlayer-20021122/libmpdemux/demux_viv.c	Fri Nov 22 16:22:01 2002
@@ -708,7 +708,7 @@
 		if (vivo_param_bytesperblock != -1)
 		    sh->wf->nBlockAlign = vivo_param_bytesperblock;
 		
-sound_ok:
+/*sound_ok:*/
 		/* insert as stream */
 		demuxer->audio->sh=sh;
 		sh->ds=demuxer->audio;
--- MPlayer-20021122/libmpdemux/tvi_v4l.c.warn	Thu Nov 14 20:08:57 2002
+++ MPlayer-20021122/libmpdemux/tvi_v4l.c	Fri Nov 22 16:22:01 2002
@@ -1324,7 +1324,7 @@
     priv_t *priv = (priv_t*)data;
     struct timeval tv;
     int i, audio_skew_ptr = 0;
-    long long tmp, current_time, prev_skew = 0;
+    long long /*tmp,*/ current_time, prev_skew = 0;
 
     pthread_mutex_lock(&priv->audio_starter);
 
--- MPlayer-20021122/libmpdemux/demux_real.c.warn	Thu Nov  7 02:48:00 2002
+++ MPlayer-20021122/libmpdemux/demux_real.c	Fri Nov 22 16:22:01 2002
@@ -354,7 +354,9 @@
     int len;
     int timestamp;
     int stream_id;
+#ifdef CRACK_MATRIX
     int i;
+#endif
     int flags;
     int version;
     int reserved;
--- MPlayer-20021122/libmpdemux/audio_in.c.warn	Tue Oct 22 18:44:21 2002
+++ MPlayer-20021122/libmpdemux/audio_in.c	Fri Nov 22 16:22:01 2002
@@ -109,7 +109,9 @@
 
 int audio_in_set_device(audio_in_t *ai, char *device)
 {
+#ifdef HAVE_ALSA9	  
     int i;
+#endif
     if (ai->setup) return -1;
     switch (ai->type) {
 #ifdef HAVE_ALSA9	  
--- MPlayer-20021122/libmpdemux/demux_avi.c.warn	Fri Nov 22 13:36:37 2002
+++ MPlayer-20021122/libmpdemux/demux_avi.c	Fri Nov 22 17:01:48 2002
@@ -788,9 +788,9 @@
 
 int demux_avi_control(demuxer_t *demuxer,int cmd, void *arg){
     avi_priv_t *priv=demuxer->priv;
-    demux_stream_t *d_audio=demuxer->audio;
+/*    demux_stream_t *d_audio=demuxer->audio;*/
     demux_stream_t *d_video=demuxer->video;
-    sh_audio_t *sh_audio=d_audio->sh;
+/*    sh_audio_t *sh_audio=d_audio->sh;*/
     sh_video_t *sh_video=d_video->sh;
 
 
--- MPlayer-20021122/libvo/vo_gl2.c.warn	Thu Nov 14 20:08:58 2002
+++ MPlayer-20021122/libvo/vo_gl2.c	Fri Nov 22 16:22:01 2002
@@ -472,7 +472,7 @@
 static void drawTextureDisplay ()
 {
   struct TexSquare *square;
-  int x, y, xoff=0, yoff=0, wd, ht;
+  int x, y/*, xoff=0, yoff=0, wd, ht*/;
   GLenum err;
 
   glColor3f(1.0,1.0,1.0);
--- MPlayer-20021122/libvo/vo_xvidix.c.warn	Thu Nov 14 20:08:59 2002
+++ MPlayer-20021122/libvo/vo_xvidix.c	Fri Nov 22 16:22:01 2002
@@ -32,6 +32,7 @@
 
 #include "vosub_vidix.h"
 #include "../vidix/vidixlib.h"
+#include "../mplayer.h" /* exit_player() */
 
 #ifdef HAVE_NEW_GUI
 #include "../Gui/interface.h"
--- MPlayer-20021122/libvo/vosub_vidix.c.warn	Thu Oct 10 10:11:54 2002
+++ MPlayer-20021122/libvo/vosub_vidix.c	Fri Nov 22 16:22:01 2002
@@ -49,7 +49,7 @@
 static vidix_fourcc_t	  vidix_fourcc;
 static vo_functions_t *   vo_server;
 static vidix_yuv_t	  dstrides;
-static uint32_t (*server_control)(uint32_t request, void *data, ...);
+/*static uint32_t (*server_control)(uint32_t request, void *data, ...);*/
 
 static int  vidix_get_video_eq(vidix_video_eq_t *info);
 static int  vidix_set_video_eq(const vidix_video_eq_t *info);
--- MPlayer-20021122/libvo/geometry.c.warn	Thu Nov  7 02:48:01 2002
+++ MPlayer-20021122/libvo/geometry.c	Fri Nov 22 16:22:01 2002
@@ -2,7 +2,7 @@
 
 #include "geometry.h"
 #include "../mp_msg.h"
-// #include "../mplayer.h" /* exit_player() */
+#include "../mplayer.h" /* exit_player() */
 #include <string.h>
 #include <stdlib.h> /* strtol */
 
--- MPlayer-20021122/postproc/swscale_template.c.warn	Mon Oct 14 01:37:27 2002
+++ MPlayer-20021122/postproc/swscale_template.c	Fri Nov 22 16:22:01 2002
@@ -1256,7 +1256,9 @@
 static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *uvbuf0, uint16_t *uvbuf1,
 			    uint8_t *dest, int dstW, int uvalpha, int dstFormat, int flags, int y)
 {
+#ifdef HAVE_MMX
 	int uvalpha1=uvalpha^4095;
+#endif
 	const int yalpha1=0;
 	int i;
 	
--- MPlayer-20021122/postproc/postprocess_template.c.warn	Thu Oct 31 03:07:32 2002
+++ MPlayer-20021122/postproc/postprocess_template.c	Fri Nov 22 16:22:01 2002
@@ -2658,7 +2658,10 @@
 	int black=0, white=255; // blackest black and whitest white in the picture
 	int QPCorrecture= 256*256;
 
-	int copyAhead, i;
+	int copyAhead;
+#ifdef HAVE_MMX
+	int i;
+#endif
 
 	//FIXME remove
 	uint64_t * const yHistogram= c.yHistogram;
--- MPlayer-20021122/libmpdvdkit2/nav_read.c.warn	Sat Aug 17 00:50:22 2002
+++ MPlayer-20021122/libmpdvdkit2/nav_read.c	Fri Nov 22 16:22:01 2002
@@ -95,7 +95,7 @@
   /* pci hli btnit */
   for(i = 0; i < pci->hli.hl_gi.btngr_ns; i++) {
     for(j = 0; j < (36 / pci->hli.hl_gi.btngr_ns); j++) {
-      int n = (36 / pci->hli.hl_gi.btngr_ns) * i + j;
+/*      int n = (36 / pci->hli.hl_gi.btngr_ns) * i + j;*/
       assert(pci->hli.btnit[n].zero1 == 0);
       assert(pci->hli.btnit[n].zero2 == 0);
       assert(pci->hli.btnit[n].zero3 == 0);
--- MPlayer-20021122/divx4_vbr.c.warn	Wed Sep 25 11:36:47 2002
+++ MPlayer-20021122/divx4_vbr.c	Fri Nov 22 16:22:01 2002
@@ -62,7 +62,7 @@
 
 static int m_iCount;
 static int m_iQuant;
-static int m_iCrispness;
+/*static int m_iCrispness;*/
 static short m_bDrop;
 static float m_fQuant;
 
@@ -178,7 +178,7 @@
 
 	
 		while(!feof(m_pFile)) 
-      {  fscanf(m_pFile, "Frame %d: intra %d, quant %d, texture %d, motion %d, total %d\n",
+      {  fscanf(m_pFile, "Frame %d: intra %hd, quant %d, texture %d, motion %d, total %d\n",
          &iNumFrames, &(vFrame.is_key_frame), &(vFrame.quant), &(vFrame.text_bits), &(vFrame.motion_bits), &(vFrame.total_bits));
 
                 vFrame.total_bits+=vFrame.text_bits*(qual_multiplier-1);
@@ -208,7 +208,7 @@
 	   fseek(m_pFile, lFrameStart, SEEK_SET);		// start again
 		
 		for (i=0;i<iNumFrames;i++)
-		{  fscanf(m_pFile, "Frame %d: intra %d, quant %d, texture %d, motion %d, total %d\n",
+		{  fscanf(m_pFile, "Frame %d: intra %hd, quant %d, texture %d, motion %d, total %d\n",
          &dummy, &(m_vFrames[i].is_key_frame), &(m_vFrames[i].quant), 
 			&(m_vFrames[i].text_bits), &(m_vFrames[i].motion_bits), 
 			&(m_vFrames[i].total_bits));
@@ -227,7 +227,7 @@
 
 	if(desired_bits<=non_text_bits)
 	{
-		char s[200];
+/*		char s[200];*/
 		printf("Specified bitrate is too low for this clip.\n"
 			"Minimum possible bitrate for the clip is %.0f kbps. Overriding\n"
 			"user-specified value.\n",
--- MPlayer-20021122/mplayer.c.warn	Fri Nov 22 13:36:35 2002
+++ MPlayer-20021122/mplayer.c	Fri Nov 22 16:22:01 2002
@@ -1368,7 +1368,7 @@
 float AV_delay=0; // average of A-V timestamp differences
 double vdecode_time;
 unsigned int lastframeout_ts=0;
-float time_frame_corr_avg=0;
+/*float time_frame_corr_avg=0;*/ /* unused */
 
 float next_frame_time=0;
 int frame_time_remaining=0; // flag


More information about the MPlayer-dev-eng mailing list