[MPlayer-dev-eng] [PATCH] misc small fixes (mostly gcc warnings)

Dominik 'Rathann' Mierzejewski dominik at rangers.eu.org
Thu Nov 10 01:34:33 CET 2005


Yes, it's this time of the year again. I've found a couple of small
problems, so let me explain and propose solutions.

1. mplayer.c:509: warning: implicit declaration of function 'free_osd_list'

add free_osd_list() declaration to libvo/sub.h

2. mplayer.c:1928: warning: implicit declaration of function 'cache_uninit'

add cache_uninit extern to mplayer.c
Only needed when HAS_DVBIN_SUPPORT is defined.

3. mplayer.c:2897: warning: implicit declaration of function 'mpcodecs_config_vo'

#include "libmpcodecs/vd.h"

4. stream_livedotcom.c:70: warning: assignment makes pointer from integer without a cast
   stream_livedotcom.c:77: warning: passing argument 1 of 'lseek' makes integer from pointer without a cast
   stream_livedotcom.c:78: warning: passing argument 1 of 'lseek' makes integer from pointer without a cast
   stream_livedotcom.c:84: warning: passing argument 1 of 'read' makes integer from pointer without a cast

@@ -56,7 +56,7 @@
 }

 static int open_live_sdp(stream_t *stream,int mode, void* opts, int* file_format) {
-  FILE *f;
+  int f;
   char *filename = stream->url;
   off_t len;
   char* sdpDescription;

because later, the result of open(2) is assigned to f and according to man 2 open,
it returns int.

5. stream_livedotcom.c:96: warning: control reaches end of non-void function

return STREAM_UNSUPORTED when URL doesn't begin with sdp:// (it should never
happen, but let's make the codepath behave in a sane way)

6. tv.c:870: warning: initialization from incompatible pointer type

demux_close_tv should not return any value and be declared as void

7. demux_film.c:147: warning: initialization from incompatible pointer type

cast dp->buffer to unsigned short * in assignment

8. demux_ogg.c:371: warning: implicit declaration of function '_ilog'

This one is tricky. _ilog itself isn't in any header file, but it's defined
in multiple .c files in theora/lib, so an extern in libmpdemux/demux_ogg
may be a solution (#ifdef'd HAVE_OGGTHEORA) or maybe theora should be patched.

9. demux_pva.c:532: warning: initialization from incompatible pointer type

demux_seek_* functions are declared as void everywhere else, so... why not
here?

10. demux_real.c:1882: warning: initialization from incompatible pointer type

same as the last one

11. demux_ty.c:1415: warning: initialization from incompatible pointer type

demux_close_* are declared as void everywhere else

12. muxer_mpeg.c:2315: warning: implicit declaration of function 'mp_get_mp3_header'
    muxer_mpeg.c:2339: warning: implicit declaration of function 'a52_syncinfo'

#include "mp3_hdr.h"
#include "../liba52/a52.h"

13. pnm.c:228: warning: implicit declaration of function 'usec_sleep'
    realrtsp/rtsp.c:184: warning: implicit declaration of function 'usec_sleep'
    ad_acm.c:149: warning: implicit declaration of function 'usec_sleep'

#include "osdep/timer.h" in each

14. ad_libvorbis.c:119: warning: assignment from incompatible pointer type
    ad_libvorbis.c:120: warning: assignment from incompatible pointer type
    ad_libvorbis.c:121: warning: assignment from incompatible pointer type

headers[] are unsigned int *

15. ad_libvorbis.c:127: warning: assignment from incompatible pointer type

op.packet is unsigned char *

16. vf_phase.c:101: warning: suggest parentheses around + or - inside shift
    vf_phase.c:102: warning: suggest parentheses around + or - inside shift
    vf_phase.c:105: warning: suggest parentheses around + or - inside shift
    vf_phase.c:106: warning: suggest parentheses around + or - inside shift
    vf_phase.c:112: warning: suggest parentheses around + or - inside shift
    vf_phase.c:113: warning: suggest parentheses around + or - inside shift
    vf_phase.c:116: warning: suggest parentheses around + or - inside shift
    vf_phase.c:117: warning: suggest parentheses around + or - inside shift
    vf_phase.c:123: warning: suggest parentheses around + or - inside shift
    vf_phase.c:124: warning: suggest parentheses around + or - inside shift
    vf_phase.c:127: warning: suggest parentheses around + or - inside shift
    vf_phase.c:128: warning: suggest parentheses around + or - inside shift
    vf_phase.c:134: warning: suggest parentheses around + or - inside shift
    vf_phase.c:135: warning: suggest parentheses around + or - inside shift
    vf_phase.c:136: warning: suggest parentheses around + or - inside shift
    vf_phase.c:139: warning: suggest parentheses around + or - inside shift
    vf_phase.c:140: warning: suggest parentheses around + or - inside shift
    vf_phase.c:141: warning: suggest parentheses around + or - inside shift

add parentheses in the diff() macro

17. vf_remove_logo.c:738: warning: passing argument 2 of 'memcpy_pic' discards qualifiers from pointer target type

fix our memcpy_pic definitions in fastmemcpy.h: src pointer should be const
like in regular memcpy

18. ae_lavc.c:168: warning: implicit declaration of function 'codec_get_wav_tag'

add extern, like in muxer_lavf

19. ao_alsa.c:115: warning: suggest parentheses around assignment used as truth value

add those parentheses

20. ps_dec.c:1938: warning: missing braces around initializer
    ps_dec.c:1938: warning: (near initialization for 'X_hybrid_left[0][0]')
    ps_dec.c:1939: warning: missing braces around initializer
    ps_dec.c:1939: warning: (near initialization for 'X_hybrid_right[0][0]')
    sbr_dec.c:530: warning: missing braces around initializer
    sbr_dec.c:530: warning: (near initialization for 'X_left[0][0]')
    sbr_dec.c:531: warning: missing braces around initializer
    sbr_dec.c:531: warning: (near initialization for 'X_right[0][0]')

Ah, these have been bothering me for a long time and I've finally found
a solution: simply add another brace pair, just as the message suggests. ;)

21. sysdep/pci_linux.c:93: warning: implicit declaration of function 'iopl'

Gabu said including <sys/perm.h> broke compilation on his libc5 system, but...

That's about it, patch attached.

R.

-- 
MPlayer RPMs maintainer: http://rpm.greysector.net/mplayer/
"I am Grey. I stand between the candle and the star. We are Grey.
 We stand between the darkness ... and the light."
        -- Delenn in Grey Council in Babylon 5:"Babylon Squared"
-------------- next part --------------
--- MPlayer-20051106/libao2/ao_alsa.c.warn	2005-09-04 22:36:27.000000000 +0200
+++ MPlayer-20051106/libao2/ao_alsa.c	2005-11-06 18:54:20.000000000 +0100
@@ -112,7 +112,7 @@
 	 char *test_mix_index;
 
 	 mix_name = strdup(mixer_channel);
-	 if (test_mix_index = strchr(mix_name, ',')){
+	 if ((test_mix_index = strchr(mix_name, ','))){
 		*test_mix_index = 0;
 		test_mix_index++;
 		mix_index = strtol(test_mix_index, &test_mix_index, 0);
--- MPlayer-20051106/libdha/sysdep/pci_linux.c.warn	2004-07-09 21:22:28.000000000 +0200
+++ MPlayer-20051106/libdha/sysdep/pci_linux.c	2005-11-06 18:54:20.000000000 +0100
@@ -5,7 +5,7 @@
 */
 #include <errno.h>
 #ifdef __i386__
-// is this needed? #include <sys/perm.h>
+#include <sys/perm.h>
 #else
 #if !defined(__sparc__) && !defined(__powerpc__) && !defined(__x86_64__)
 #include <sys/io.h>
--- MPlayer-20051106/libmpcodecs/vf_phase.c.warn	2004-09-03 03:42:04.000000000 +0200
+++ MPlayer-20051106/libmpcodecs/vf_phase.c	2005-11-06 18:54:20.000000000 +0100
@@ -59,7 +59,7 @@
  * (the result is actually multiplied by 25)
  */
 
-#define diff(a, as, b, bs) (t=(*a-b[bs]<<2)+a[as<<1]-b[-bs], t*t)
+#define diff(a, as, b, bs) (t=((*a-b[bs])<<2)+a[as<<1]-b[-bs], t*t)
 
 /*
  * Find which field combination has the smallest average squared difference
--- MPlayer-20051106/libmpcodecs/ad_libvorbis.c.warn	2005-08-20 19:40:06.000000000 +0200
+++ MPlayer-20051106/libmpcodecs/ad_libvorbis.c	2005-11-06 18:54:20.000000000 +0100
@@ -116,15 +116,15 @@
     hsizes[i] = length;
   }
 
-  headers[0] = &extradata[offset];
-  headers[1] = &extradata[offset + hsizes[0]];
-  headers[2] = &extradata[offset + hsizes[0] + hsizes[1]];
+  headers[0] = (unsigned int *)&extradata[offset];
+  headers[1] = (unsigned int *)&extradata[offset + hsizes[0]];
+  headers[2] = (unsigned int *)&extradata[offset + hsizes[0] + hsizes[1]];
   hsizes[2] = sh->wf->cbSize - offset - hsizes[0] - hsizes[1];
   mp_msg (MSGT_DEMUX, MSGL_V, "ad_vorbis, header sizes: %d %d %d\n", hsizes[0], hsizes[1], hsizes[2]);
 
   for(i=0; i<3; i++) {
     op.bytes = hsizes[i];
-    op.packet = headers[i];
+    op.packet = (unsigned char *)headers[i];
     op.b_o_s  = (i == 0);
     if(vorbis_synthesis_headerin(&ov->vi,&vc,&op) <0) {
       mp_msg(MSGT_DECAUDIO,MSGL_ERR,"OggVorbis: header n. %d broken! len=%d\n", i, op.bytes);
--- MPlayer-20051106/libmpcodecs/ae_lavc.c.warn	2005-05-17 23:49:48.000000000 +0200
+++ MPlayer-20051106/libmpcodecs/ae_lavc.c	2005-11-06 18:54:20.000000000 +0100
@@ -26,6 +26,9 @@
 extern int  lavc_param_atag;
 extern int  avcodec_inited;
 static int compressed_frame_size = 0;
+#ifdef USE_LIBAVFORMAT
+extern unsigned int codec_get_wav_tag(int id);
+#endif
 
 static int bind_lavc(audio_encoder_t *encoder, muxer_stream_t *mux_a)
 {
--- MPlayer-20051106/libmpdemux/tv.c.warn	2005-09-22 16:20:49.000000000 +0200
+++ MPlayer-20051106/libmpdemux/tv.c	2005-11-06 18:54:20.000000000 +0100
@@ -603,10 +603,10 @@
     return demuxer;
 }
 
-static int demux_close_tv(demuxer_t *demuxer)
+static void demux_close_tv(demuxer_t *demuxer)
 {
     tvi_handle_t *tvh=(tvi_handle_t*)(demuxer->priv);
-    return(tvh->functions->uninit(tvh->priv));
+    tvh->functions->uninit(tvh->priv);
 }
 
 /* ================== STREAM_TV ===================== */
--- MPlayer-20051106/libmpdemux/stream_livedotcom.c.warn	2005-10-03 03:10:17.000000000 +0200
+++ MPlayer-20051106/libmpdemux/stream_livedotcom.c	2005-11-06 18:54:20.000000000 +0100
@@ -56,7 +56,7 @@
 }
 
 static int open_live_sdp(stream_t *stream,int mode, void* opts, int* file_format) {
-  FILE *f;
+  int f;
   char *filename = stream->url;
   off_t len;
   char* sdpDescription;
@@ -93,6 +93,7 @@
     *file_format = DEMUXER_TYPE_RTP;
     return STREAM_OK;
   }
+  return STREAM_UNSUPORTED;
 }
 
 
--- MPlayer-20051106/libmpdemux/demux_ty.c.warn	2005-11-06 18:35:33.000000000 +0100
+++ MPlayer-20051106/libmpdemux/demux_ty.c	2005-11-06 18:54:20.000000000 +0100
@@ -1360,7 +1360,7 @@
 }
 
 
-static int demux_close_ty( demuxer_t *demux )
+static void demux_close_ty( demuxer_t *demux )
 {
    TiVoInfo         *tivo = 0;
 
@@ -1371,7 +1371,6 @@
       demux->a_streams[ MAX_A_STREAMS - 1 ] = 0;
 	   sub_justify = 0;
    }
-   return( 0 );
 }
 
 
--- MPlayer-20051106/libmpdemux/demux_film.c.warn	2005-08-06 02:41:22.000000000 +0200
+++ MPlayer-20051106/libmpdemux/demux_film.c	2005-11-06 18:54:20.000000000 +0100
@@ -144,7 +144,7 @@
         memcpy( tmp, buf, film_chunk.chunk_size );
       }
       else {/* for 16bit */
-        unsigned short* tmp = dp->buffer;
+        unsigned short* tmp = (unsigned short *)(dp->buffer);
         unsigned short  buf[film_chunk.chunk_size/2];
         for(i = 0; i < film_chunk.chunk_size/4; i++) {
           buf[i*2] = tmp[i];
--- MPlayer-20051106/libmpdemux/demux_real.c.warn	2005-11-06 18:35:33.000000000 +0100
+++ MPlayer-20051106/libmpdemux/demux_real.c	2005-11-06 18:55:01.000000000 +0100
@@ -1749,7 +1749,7 @@
 }
 
 /* please upload RV10 samples WITH INDEX CHUNK */
-static int demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, int flags)
+static void demux_seek_real(demuxer_t *demuxer, float rel_seek_secs, int flags)
 {
     real_priv_t *priv = demuxer->priv;
     demux_stream_t *d_audio = demuxer->audio;
@@ -1771,7 +1771,7 @@
 //    printf("streams: %d\n", streams);
 
     if (!streams)
-	return 0;
+	return;
 
     if (flags & 1)
 	/* seek absolute */
@@ -1838,7 +1838,6 @@
         stream_seek(demuxer->stream, next_offset);
 
     demux_real_fill_buffer(demuxer, NULL);
-    return 1;
 }
 
 static int demux_real_control(demuxer_t *demuxer, int cmd, void *arg)
--- MPlayer-20051106/libmpdemux/muxer_mpeg.c.warn	2005-11-06 18:35:33.000000000 +0100
+++ MPlayer-20051106/libmpdemux/muxer_mpeg.c	2005-11-06 18:54:20.000000000 +0100
@@ -19,6 +19,8 @@
 #include "stheader.h"
 #include "../m_option.h"
 #include "mpeg_hdr.h"
+#include "mp3_hdr.h"
+#include "../liba52/a52.h"
 
 #define PACK_HEADER_START_CODE 0x01ba
 #define SYSTEM_HEADER_START_CODE 0x01bb
--- MPlayer-20051106/libmpdemux/demux_ogg.c.warn	2005-11-06 18:35:33.000000000 +0100
+++ MPlayer-20051106/libmpdemux/demux_ogg.c	2005-11-06 18:54:20.000000000 +0100
@@ -29,6 +29,7 @@
 
 #ifdef HAVE_OGGTHEORA
 #include <theora/theora.h>
+extern int _ilog (unsigned int); /* defined in many places in theora/lib/ */
 #endif
 
 #define BLOCK_SIZE 4096
--- MPlayer-20051106/libmpdemux/demux_pva.c.warn	2005-08-06 02:41:23.000000000 +0200
+++ MPlayer-20051106/libmpdemux/demux_pva.c	2005-11-06 18:54:20.000000000 +0100
@@ -466,7 +466,7 @@
 	return 1;
 }
 
-static int demux_seek_pva(demuxer_t * demuxer,float rel_seek_secs,int flags)
+static void demux_seek_pva(demuxer_t * demuxer,float rel_seek_secs,int flags)
 {
 	int total_bitrate=0;
 	off_t dest_offset;
@@ -490,7 +490,7 @@
 	if(!pva_sync(demuxer))
 	{
 		mp_msg(MSGT_DEMUX,MSGL_V,"demux_pva: Couldn't seek!\n");
-		return 0;
+		return;
 	}
 	
 	/*
@@ -501,8 +501,6 @@
 	
 	priv->last_video_pts=-1;
 	priv->last_audio_pts=-1;
-	
-	return 1;
 }
 
 
--- MPlayer-20051106/libvo/sub.h.warn	2004-11-01 15:47:55.000000000 +0100
+++ MPlayer-20051106/libvo/sub.h	2005-11-06 18:54:20.000000000 +0100
@@ -117,6 +117,7 @@
 int vo_update_osd(int dxs,int dys);
 int vo_osd_changed(int new_value);
 int vo_osd_check_range_update(int,int,int,int);
+void free_osd_list();
 
 extern int vo_osd_changed_flag;
 
--- MPlayer-20051106/libvo/fastmemcpy.h.warn	2005-04-10 19:11:47.000000000 +0200
+++ MPlayer-20051106/libvo/fastmemcpy.h	2005-11-06 18:54:20.000000000 +0100
@@ -20,7 +20,7 @@
 #define mem2agpcpy(a,b,c) memcpy(a,b,c)
 #endif
 
-static inline void * mem2agpcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
+static inline void * mem2agpcpy_pic(void * dst, const void * src, int bytesPerLine, int height, int dstStride, int srcStride)
 {
 	int i;
 	void *retval=dst;
@@ -48,7 +48,7 @@
 	return retval;
 }
 
-static inline void * memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
+static inline void * memcpy_pic(void * dst, const void * src, int bytesPerLine, int height, int dstStride, int srcStride)
 {
 	int i;
 	void *retval=dst;
--- MPlayer-20051106/libfaad2/ps_dec.c.warn	2005-02-28 01:17:11.000000000 +0100
+++ MPlayer-20051106/libfaad2/ps_dec.c	2005-11-06 18:54:20.000000000 +0100
@@ -1935,8 +1935,8 @@
 /* main Parametric Stereo decoding function */
 uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
 {
-    qmf_t X_hybrid_left[32][32] = {{0}};
-    qmf_t X_hybrid_right[32][32] = {{0}};
+    qmf_t X_hybrid_left[32][32] = {{{0}}};
+    qmf_t X_hybrid_right[32][32] = {{{0}}};
 
     /* delta decoding of the bitstream data */
     ps_data_decode(ps);
--- MPlayer-20051106/libfaad2/sbr_dec.c.warn	2005-02-28 01:17:11.000000000 +0100
+++ MPlayer-20051106/libfaad2/sbr_dec.c	2005-11-06 18:54:20.000000000 +0100
@@ -527,8 +527,8 @@
     uint8_t l, k;
     uint8_t dont_process = 0;
     uint8_t ret = 0;
-    ALIGN qmf_t X_left[38][64] = {{0}};
-    ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */
+    ALIGN qmf_t X_left[38][64] = {{{0}}};
+    ALIGN qmf_t X_right[38][64] = {{{0}}}; /* must set this to 0 */
 
     if (sbr == NULL)
         return 20;
--- MPlayer-20051106/libfaad2/specrec.c.warn	2005-02-28 01:17:12.000000000 +0100
+++ MPlayer-20051106/libfaad2/specrec.c	2005-11-06 18:54:20.000000000 +0100
@@ -409,7 +409,7 @@
     }
 }
 
-/* iquant() *
+/* iquant() */
 /* output = sign(input)*abs(input)^(4/3) */
 /**/
 static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error)
--- MPlayer-20051106/mplayer.c.warn	2005-11-06 18:35:23.000000000 +0100
+++ MPlayer-20051106/mplayer.c	2005-11-06 20:59:14.000000000 +0100
@@ -114,6 +114,7 @@
 #ifdef HAS_DVBIN_SUPPORT
 #include "libmpdemux/dvbin.h"
 static int last_dvb_step = 1;
+extern void cache_uninit(stream_t *s);
 #endif
 
 //**************************************************************************//
@@ -186,6 +187,7 @@
 #include "libmpcodecs/dec_video.h"
 #include "libmpcodecs/mp_image.h"
 #include "libmpcodecs/vf.h"
+#include "libmpcodecs/vd.h"
 
 extern void vf_list_plugins();
 
--- MPlayer-20051106/libmpcodecs/ad_acm.c.warn	2005-11-06 18:57:15.000000000 +0100
+++ MPlayer-20051106/libmpcodecs/ad_acm.c	2005-11-06 20:53:30.000000000 +0100
@@ -11,6 +11,7 @@
 #include "wineacm.h"
 
 #include "ad_internal.h"
+#include "osdep/timer.h"
 
 static ad_info_t info = 
 {
--- MPlayer-20051106/libmpdemux/realrtsp/rtsp.c.warn	2005-09-04 22:36:29.000000000 +0200
+++ MPlayer-20051106/libmpdemux/realrtsp/rtsp.c	2005-11-06 20:52:42.000000000 +0100
@@ -52,6 +52,7 @@
 #include "../stream.h"
 #include "../demuxer.h"
 #include "rtsp_session.h"
+#include "osdep/timer.h"
 
 /*
 #define LOG
--- MPlayer-20051106/libmpdemux/pnm.c.warn	2005-09-04 22:36:28.000000000 +0200
+++ MPlayer-20051106/libmpdemux/pnm.c	2005-11-06 20:52:00.000000000 +0100
@@ -47,6 +47,7 @@
 #include "stream.h"
 #include "demuxer.h"
 #include "help_mp.h"
+#include "osdep/timer.h"
 
 #include "pnm.h"
 //#include "libreal/rmff.h"


More information about the MPlayer-dev-eng mailing list