[MPlayer-dev-eng] [PATCH] kill a few warnings (more complete patch)

Pierre Lombard p_l at gmx.fr
Thu Sep 11 15:13:46 CEST 2003


* Pierre Lombard <p_l at gmx.fr> [2003-09-10 23:46]:
> The attached patch kills a few missing C initializer warnings and an
> implicit printf() warning.
> 
> It compiles here with gcc 3.3.2.

Please ignore my previous mail+patch, the new attached patch fixes a few
glitches/warnings.

Changelog:
- force a new_line in mp_msg.c (for ultra long messages)
- removes C initializer warnings in: libao2/pl_resample.c
   libmpcodecs/ve_*.ca   libmpdemux/demux_ty_osd.c
   osdep/lrmi.c
- removes some warnings in libmpcodecs/vf_detc.c libvo/video_out_internal.h
  libvo/vo_jpeg.c loader/win32.c
- removes implicit definitions in libvo/x11_common.h 
  postproc/rgb2rgb.h
- some cleanups in libvo/vo_xv.c (remove the module static definition of
  'i' )

Compiles cleanly here with gcc 3.3.2. I'll try later with 2.95.x.

If no one shouts by tomorrow, I'll commit them if no one does before.

-- 
Best regards,
  Pierre Lombard
-------------- next part --------------
Index: mp_msg.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.c,v
retrieving revision 1.23
diff -u -r1.23 mp_msg.c
--- mp_msg.c	13 Jul 2003 14:43:28 -0000	1.23
+++ mp_msg.c	11 Sep 2003 13:25:11 -0000
@@ -68,6 +68,7 @@
     va_start(va, format);
     vsnprintf(tmp, MSGSIZE_MAX, mp_gettext(format), va);
     va_end(va);
+    tmp[MSGSIZE_MAX-2] = '\n';
     tmp[MSGSIZE_MAX-1] = 0;
 
 #if ENABLE_GUI_CODE
Index: libao2/pl_resample.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/pl_resample.c,v
retrieving revision 1.13
diff -u -r1.13 pl_resample.c
--- libao2/pl_resample.c	21 Mar 2003 16:42:50 -0000	1.13
+++ libao2/pl_resample.c	11 Sep 2003 13:25:14 -0000
@@ -90,7 +90,15 @@
   int16_t 	xs[CH][L*2]; 	// Circular buffers
 } pl_resample_t;
 
-static pl_resample_t 	pl_resample	= {NULL,NULL,1,1,1,0,W};
+static pl_resample_t 	pl_resample = {
+	.data = NULL,
+	.w = NULL,
+	.dn = 1,
+	.up = 1,
+	.channels = 1,
+ 	.len = 0,
+	.ws = W,
+};
 
 // to set/get/query special features/parameters
 static int control(int cmd,void *arg){
Index: libfaad2/huffman.h
===================================================================
RCS file: /cvsroot/mplayer/main/libfaad2/huffman.h,v
retrieving revision 1.1
diff -u -r1.1 huffman.h
--- libfaad2/huffman.h	30 Aug 2003 22:30:21 -0000	1.1
+++ libfaad2/huffman.h	11 Sep 2003 13:25:14 -0000
@@ -217,7 +217,7 @@
     return 0;
 }
 
-static huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
+static int huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
 {
     uint8_t err = huffman_2step_pair(cb, ld, sp);
     huffman_sign_bits(ld, sp, PAIR_LEN);
Index: libmpcodecs/pullup.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/pullup.c,v
retrieving revision 1.7
diff -u -r1.7 pullup.c
--- libmpcodecs/pullup.c	8 Sep 2003 17:12:31 -0000	1.7
+++ libmpcodecs/pullup.c	11 Sep 2003 13:25:14 -0000
@@ -1,5 +1,7 @@
 
 
+#include <stdio.h>
+#include <string.h>
 #include <stdlib.h>
 #include "pullup.h"
 #include "config.h"
@@ -202,15 +204,15 @@
 
 struct pullup_buffer *pullup_lock_buffer(struct pullup_buffer *b, int parity)
 {
-	if (parity+1 & 1) b->lock[0]++;
-	if (parity+1 & 2) b->lock[1]++;
+	if ((parity+1) & 1) b->lock[0]++;
+	if ((parity+1) & 2) b->lock[1]++;
 	return b;
 }
 
 void pullup_release_buffer(struct pullup_buffer *b, int parity)
 {
-	if (parity+1 & 1) b->lock[0]--;
-	if (parity+1 & 2) b->lock[1]--;
+	if ((parity+1) & 1) b->lock[0]--;
+	if ((parity+1) & 2) b->lock[1]--;
 }
 
 struct pullup_buffer *pullup_get_buffer(struct pullup_context *c, int parity)
@@ -236,8 +238,8 @@
 	
 	/* Search for any half-free buffer */
 	for (i = 0; i < c->nbuffers; i++) {
-		if (parity+1 & 1 && c->buffers[i].lock[0]) continue;
-		if (parity+1 & 2 && c->buffers[i].lock[1]) continue;
+		if (((parity+1) & 1) && c->buffers[i].lock[0]) continue;
+		if (((parity+1) & 2) && c->buffers[i].lock[1]) continue;
 		alloc_buffer(c, &c->buffers[i]);
 		return pullup_lock_buffer(&c->buffers[i], parity);
 	}
Index: libmpcodecs/ve_divx4.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_divx4.c,v
retrieving revision 1.14
diff -u -r1.14 ve_divx4.c
--- libmpcodecs/ve_divx4.c	13 Aug 2003 16:29:29 -0000	1.14
+++ libmpcodecs/ve_divx4.c	11 Sep 2003 13:25:14 -0000
@@ -482,7 +482,8 @@
     "divx4",
     "A'rpi",
     "for internal use by mencoder",
-    vf_open
+    vf_open,
+    NULL,
 };
 
 //===========================================================================//
Index: libmpcodecs/ve_lavc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_lavc.c,v
retrieving revision 1.73
diff -u -r1.73 ve_lavc.c
--- libmpcodecs/ve_lavc.c	11 Sep 2003 07:09:25 -0000	1.73
+++ libmpcodecs/ve_lavc.c	11 Sep 2003 13:25:14 -0000
@@ -850,7 +850,8 @@
     "lavc",
     "A'rpi, Alex, Michael",
     "for internal use by mencoder",
-    vf_open
+    vf_open,
+    NULL,
 };
 
 //===========================================================================//
Index: libmpcodecs/ve_libdv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_libdv.c,v
retrieving revision 1.7
diff -u -r1.7 ve_libdv.c
--- libmpcodecs/ve_libdv.c	19 Jan 2003 01:48:52 -0000	1.7
+++ libmpcodecs/ve_libdv.c	11 Sep 2003 13:25:14 -0000
@@ -110,7 +110,8 @@
     "libdv",
     "A'rpi",
     "for internal use by mencoder",
-    vf_open
+    vf_open,
+    NULL,
 };
 
 //===========================================================================//
Index: libmpcodecs/ve_nuv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_nuv.c,v
retrieving revision 1.2
diff -u -r1.2 ve_nuv.c
--- libmpcodecs/ve_nuv.c	4 Mar 2003 13:26:09 -0000	1.2
+++ libmpcodecs/ve_nuv.c	11 Sep 2003 13:25:14 -0000
@@ -224,7 +224,8 @@
   "nuv",
   "Albeu",
   "for internal use by mencoder",
-  vf_open
+  vf_open,
+  NULL,
 };
 
 //===========================================================================//
Index: libmpcodecs/ve_qtvideo.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_qtvideo.c,v
retrieving revision 1.7
diff -u -r1.7 ve_qtvideo.c
--- libmpcodecs/ve_qtvideo.c	15 Feb 2003 17:45:10 -0000	1.7
+++ libmpcodecs/ve_qtvideo.c	11 Sep 2003 13:25:14 -0000
@@ -323,7 +323,8 @@
     "qtvideo",
     "Sascha Sommer",
     "for internal use by mencoder",
-    vf_open
+    vf_open,
+    NULL,
 };
 
 //===========================================================================//
Index: libmpcodecs/ve_rawrgb.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_rawrgb.c,v
retrieving revision 1.9
diff -u -r1.9 ve_rawrgb.c
--- libmpcodecs/ve_rawrgb.c	19 Jan 2003 01:48:52 -0000	1.9
+++ libmpcodecs/ve_rawrgb.c	11 Sep 2003 13:25:14 -0000
@@ -77,7 +77,8 @@
     "rawrgb",
     "A'rpi",
     "for internal use by mencoder",
-    vf_open
+    vf_open,
+    NULL,
 };
 
 //===========================================================================//
Index: libmpcodecs/ve_vfw.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_vfw.c,v
retrieving revision 1.15
diff -u -r1.15 ve_vfw.c
--- libmpcodecs/ve_vfw.c	13 Aug 2003 16:29:29 -0000	1.15
+++ libmpcodecs/ve_vfw.c	11 Sep 2003 13:25:14 -0000
@@ -284,7 +284,8 @@
     "vfw",
     "A'rpi",
     "for internal use by mencoder",
-    vf_open
+    vf_open,
+    NULL,
 };
 
 //===========================================================================//
Index: libmpcodecs/ve_xvid.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_xvid.c,v
retrieving revision 1.25
diff -u -r1.25 ve_xvid.c
--- libmpcodecs/ve_xvid.c	13 Aug 2003 16:29:29 -0000	1.25
+++ libmpcodecs/ve_xvid.c	11 Sep 2003 13:25:14 -0000
@@ -574,7 +574,8 @@
     "xvid",
     "Kim Minh Kaplan & R?mi Guyomarch",
     "for internal use by mencoder",
-    vf_open
+    vf_open,
+    NULL,
 };
 
 //===========================================================================//
Index: libmpcodecs/vf_detc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_detc.c,v
retrieving revision 1.6
diff -u -r1.6 vf_detc.c
--- libmpcodecs/vf_detc.c	23 Mar 2003 16:10:06 -0000	1.6
+++ libmpcodecs/vf_detc.c	11 Sep 2003 13:25:14 -0000
@@ -177,7 +177,7 @@
 
 static int analyze_aggressive(struct vf_priv_s *p, mp_image_t *new, mp_image_t *old)
 {
-	int i;
+	//int i;
 	struct metrics m, pm;
 	
 	if (p->frame >= 0) p->frame = (p->frame+1)%5;
@@ -305,7 +305,7 @@
 static int do_put_image(struct vf_instance_s* vf, mp_image_t *dmpi)
 {
 	struct vf_priv_s *p = vf->priv;
-	int dropflag;
+	int dropflag = 0;
 
 	switch (p->drop) {
 	case 0:
Index: libmpdemux/demux_ty_osd.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_ty_osd.c,v
retrieving revision 1.2
diff -u -r1.2 demux_ty_osd.c
--- libmpdemux/demux_ty_osd.c	19 Jun 2003 18:20:15 -0000	1.2
+++ libmpdemux/demux_ty_osd.c	11 Sep 2003 13:25:15 -0000
@@ -779,15 +779,15 @@
 #define DST               ( ( TY_XDS[ 3 ][ 4 ][ 0 ] & 0x20 ) >> 5 )
                struct tm tm = 
                {
-                  0,                                 // sec
-                  ( TY_XDS_ptr[ 0 ] & 0x3F ),        // min
-                  ( TY_XDS_ptr[ 1 ] & 0x1F ),        // hour
-                  ( TY_XDS_ptr[ 2 ] & 0x1F ),        // day
-                  ( TY_XDS_ptr[ 3 ] & 0x1f ) - 1,    // month
-                  ( TY_XDS_ptr[ 5 ] & 0x3f ) + 90,   // year
-                  0,                                 // day of week
-                  0,                                 // day of year
-                  0,                                 // DST
+                  .tm_sec = 0,                                // sec
+                  .tm_min = ( TY_XDS_ptr[ 0 ] & 0x3F ),       // min
+                  .tm_hour = ( TY_XDS_ptr[ 1 ] & 0x1F ),      // hour
+                  .tm_mday = ( TY_XDS_ptr[ 2 ] & 0x1F ),      // day
+                  .tm_mon = ( TY_XDS_ptr[ 3 ] & 0x1f ) - 1,   // month
+                  .tm_year = ( TY_XDS_ptr[ 5 ] & 0x3f ) + 90, // year
+                  .tm_wday = 0,                               // day of week
+                  .tm_yday = 0,                               // day of year
+                  .tm_isdst = 0,                              // DST
                };
 
                time_t time_t = mktime( &tm );
Index: libvo/video_out_internal.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out_internal.h,v
retrieving revision 1.14
diff -u -r1.14 video_out_internal.h
--- libvo/video_out_internal.h	11 Nov 2002 15:20:25 -0000	1.14
+++ libvo/video_out_internal.h	11 Sep 2003 13:25:15 -0000
@@ -36,7 +36,8 @@
 static void flip_page(void);
 static void check_events(void);
 static void uninit(void);
-static uint32_t query_format(uint32_t format);
+// Now used in control():
+// static uint32_t query_format(uint32_t format);
 static uint32_t preinit(const char *);
 
 #define LIBVO_EXTERN(x) vo_functions_t video_out_##x =\
Index: libvo/vo_jpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_jpeg.c,v
retrieving revision 1.11
diff -u -r1.11 vo_jpeg.c
--- libvo/vo_jpeg.c	25 Apr 2003 20:37:26 -0000	1.11
+++ libvo/vo_jpeg.c	11 Sep 2003 13:25:15 -0000
@@ -92,7 +92,7 @@
 static uint32_t draw_frame(uint8_t * src[])
 {
  char buf[256];
- uint8_t *dst= src[0];
+// uint8_t *dst= src[0];
     
  snprintf (buf, 256, "%s/%08d.jpg", jpeg_outdir, ++framenum);
 

Index: libvo/x11_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.h,v
retrieving revision 1.32
diff -u -r1.32 x11_common.h
--- libvo/x11_common.h	31 Aug 2003 23:13:45 -0000	1.32
+++ libvo/x11_common.h	11 Sep 2003 13:25:15 -0000
@@ -59,6 +59,7 @@
 	int depth, Colormap col_map);
 extern void vo_x11_clearwindow_part(Display *mDisplay, Window vo_window,
 	int img_width, int img_height, int use_fs);
+void vo_x11_clearwindow( Display *mDisplay, Window vo_window );
 
 #endif
 
Index: loader/driver.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/driver.c,v
retrieving revision 1.12
diff -u -r1.12 driver.c
--- loader/driver.c	24 Apr 2003 18:48:18 -0000	1.12
+++ loader/driver.c	11 Sep 2003 13:25:15 -0000
@@ -142,7 +142,7 @@
 HDRVR DrvOpen(LPARAM lParam2)
 {
     NPDRVR hDriver;
-    int i;
+    //int i;
     char unknown[0x124];
     const char* filename = (const char*) ((ICOPEN*) lParam2)->pV1Reserved;
 
Index: loader/win32.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/win32.c,v
retrieving revision 1.82
diff -u -r1.82 win32.c
--- loader/win32.c	5 Sep 2003 22:08:23 -0000	1.82
+++ loader/win32.c	11 Sep 2003 13:25:15 -0000
@@ -245,6 +245,10 @@
 static tls_t* g_tls=NULL;
 static th_list* list=NULL;
 
+#undef MEMORY_DEBUG
+
+#ifdef MEMORY_DEBUG
+
 static void test_heap(void)
 {
     int offset=0;
@@ -265,9 +269,6 @@
 	    printf("Free heap corruption at address %d\n", offset);
 	}
 }
-#undef MEMORY_DEBUG
-
-#ifdef MEMORY_DEBUG
 
 static void* my_mreq(int size, int to_zero)
 {
@@ -1879,7 +1880,7 @@
                                          LPDWORD values, LPDWORD max_value, LPDWORD max_data,
                                          LPDWORD security, FILETIME *modif )
 {
-    return;
+    return 0;
 }
 
 /*
@@ -2143,7 +2144,7 @@
 
 static int WINAPI expGetStartupInfoA(STARTUPINFOA *s)
 {
-    int i;
+    //int i;
     dbgprintf("GetStartupInfoA(0x%x) => 1\n");
     memset(s, 0, sizeof(*s));
     s->cb=sizeof(*s);
@@ -2254,7 +2255,7 @@
 {
     int result = 0;
     char* lastbc;
-    int i;
+    //int i;
     if (!name)
 	return -1;
     // we skip to the last backslash
@@ -2739,7 +2740,7 @@
 						const char* string,
 						const char* filename)
 {
-    int size=256;
+    //int size=256;
     char* fullname;
     dbgprintf("WritePrivateProfileStringA('%s', '%s', '%s', '%s')", appname, keyname, string, filename );
     if(!(appname && keyname && filename) )
@@ -3089,7 +3090,7 @@
 #define SECS_1601_TO_1970  ((369 * 365 + 89) * 86400ULL)
 static void WINAPI expGetSystemTimeAsFileTime(FILETIME* systime)
 {
-    struct tm *local_tm;
+    //struct tm *local_tm;
     struct timeval tv;
     unsigned long long secs;
 
@@ -3103,7 +3104,7 @@
 
 static int WINAPI expGetEnvironmentVariableA(const char* name, char* field, int size)
 {
-    char *p;
+    //char *p;
     //    printf("%s %x %x\n", name, field, size);
     if(field)field[0]=0;
     /*
@@ -4177,11 +4178,13 @@
     return cos(x);
 }
 
-/* doens't work */
+#if 0
+/* doesn't work */
 static long exp_ftol_wrong(double x)
 {
     return (long) x;
 }
+#endif
 
 #else
 
@@ -5170,7 +5173,7 @@
 
 void* LookupExternalByName(const char* library, const char* name)
 {
-    char* answ;
+    //char* answ;
     int i,j;
     //   return (void*)ext_unknown;
     if(library==0)
Index: osdep/lrmi.c
===================================================================
RCS file: /cvsroot/mplayer/main/osdep/lrmi.c,v
retrieving revision 1.1
diff -u -r1.1 lrmi.c
--- osdep/lrmi.c	15 Oct 2001 16:59:35 -0000	1.1
+++ osdep/lrmi.c	11 Sep 2003 13:25:15 -0000
@@ -43,7 +43,7 @@
 	int ready;
 	int count;
 	struct mem_block blocks[REAL_MEM_BLOCKS];
-	} mem_info = { 0 };
+	} mem_info = { .ready = 0, };
 
 static int
 real_mem_init(void)
@@ -181,7 +181,7 @@
 	unsigned short ret_seg, ret_off;
 	unsigned short stack_seg, stack_off;
 	struct vm86_struct vm;
-	} context = { 0 };
+	} context = { .ready = 0, };
 
 
 static inline void
Index: postproc/rgb2rgb.h
===================================================================
RCS file: /cvsroot/mplayer/main/postproc/rgb2rgb.h,v
retrieving revision 1.28
diff -u -r1.28 rgb2rgb.h
--- postproc/rgb2rgb.h	1 Jun 2003 21:59:01 -0000	1.28
+++ postproc/rgb2rgb.h	11 Sep 2003 13:25:15 -0000
@@ -9,6 +9,8 @@
 #ifndef RGB2RGB_INCLUDED
 #define RGB2RGB_INCLUDED
 
+#include <stdio.h>
+
 /* A full collection of rgb to rgb(bgr) convertors */
 extern void (*rgb24to32)(const uint8_t *src,uint8_t *dst,unsigned src_size);
 extern void (*rgb24to16)(const uint8_t *src,uint8_t *dst,unsigned src_size);
Index: libvo/vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.148
diff -u -r1.148 vo_xv.c
--- libvo/vo_xv.c	7 Sep 2003 18:58:56 -0000	1.148
+++ libvo/vo_xv.c	11 Sep 2003 13:29:46 -0000
@@ -50,12 +50,26 @@
 
 LIBVO_EXTERN(xv)
 
+#ifdef HAVE_SHM
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <X11/extensions/XShm.h>
+
+/* since it doesn't seem to be defined on some platforms */
+int XShmGetEventBase(Display*);
+
+static XShmSegmentInfo Shminfo[NUM_BUFFERS];
+static int Shmem_Flag;
+#endif
+
+// Note: depends on the inclusion of X11/extensions/XShm.h
 #include <X11/extensions/Xv.h>
 #include <X11/extensions/Xvlib.h>
+
 // FIXME: dynamically allocate this stuff
 static void allocate_xvimage(int);
 static unsigned int ver,rel,req,ev,err;
-static unsigned int formats, adaptors,i,xv_port,xv_format;
+static unsigned int formats, adaptors, xv_port, xv_format;
 static XvAdaptorInfo        *ai = NULL;
 static XvImageFormatValues  *fo;
 
@@ -64,17 +78,6 @@
 static int num_buffers=1; // default
 static XvImage* xvimage[NUM_BUFFERS];
 
-#ifdef HAVE_SHM
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <X11/extensions/XShm.h>
-
-/* since it doesn't seem to be defined on some platforms */
-int XShmGetEventBase(Display*);
-
-static XShmSegmentInfo Shminfo[NUM_BUFFERS];
-static int Shmem_Flag;
-#endif
 
 static uint32_t image_width;
 static uint32_t image_height;
@@ -163,13 +166,16 @@
  num_buffers=vo_doublebuffering?(vo_directrendering?NUM_BUFFERS:2):1;
 
    /* check image formats */
+   {
+     unsigned int i;
+
      xv_format=0;
      for(i = 0; i < formats; i++){
        mp_msg(MSGT_VO,MSGL_V,"Xvideo image format: 0x%x (%4.4s) %s\n", fo[i].id,(char*)&fo[i].id, (fo[i].format == XvPacked) ? "packed" : "planar");
        if (fo[i].id == format) xv_format = fo[i].id;
      }
      if (!xv_format) return -1;
- 
+   }
  aspect_save_screenres(vo_screenwidth,vo_screenheight);
 
 #ifdef HAVE_NEW_GUI
@@ -565,6 +571,7 @@
 
 static uint32_t query_format(uint32_t format)
 {
+    uint32_t i;
     int flag=VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|
 	    VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN|VFCAP_OSD|VFCAP_ACCEPT_STRIDE; // FIXME! check for DOWN
    /* check image formats */
@@ -592,6 +599,7 @@
 {
     XvPortID xv_p;
     int busy_ports=0;
+    unsigned int i;
     
     xv_port = 0;
 


More information about the MPlayer-dev-eng mailing list