[MPlayer-dev-eng] [PATCH] trivial warning fixes

Pierre Lombard p_l at gmx.fr
Fri Jul 29 17:05:55 CEST 2005


Hi,

The 5 trivial patches attached should make gcc slightly happier.

Best regards,
-- 
Pierre Lombard
-------------- next part --------------
Fix for:
libmpdemux/../bswap.h:120: warning: 'inline' is not at beginning of declaration
libmpdemux/../bswap.h:127: warning: 'inline' is not at beginning of declaration
libmpdemux/../bswap.h:134: warning: 'inline' is not at beginning of declaration


Index: bswap.h
===================================================================
RCS file: /cvsroot/mplayer/main/bswap.h,v
retrieving revision 1.6
diff -u -r1.6 bswap.h
--- bswap.h	13 Jul 2005 17:24:41 -0000	1.6
+++ bswap.h	29 Jul 2005 14:28:28 -0000
@@ -117,21 +117,21 @@
 
 #endif	/* !HAVE_BYTESWAP_H */
 
-static float inline bswap_flt(float x) {
+static inline float bswap_flt(float x) {
   union {uint32_t i; float f;} u;
   u.f = x;
   u.i = bswap_32(u.i);
   return u.f;
 }
 
-static double inline bswap_dbl(double x) {
+static inline double bswap_dbl(double x) {
   union {uint64_t i; double d;} u;
   u.d = x;
   u.i = bswap_64(u.i);
   return u.d;
 }
 
-static long double inline bswap_ldbl(long double x) {
+static inline long double bswap_ldbl(long double x) {
   union {char d[10]; long double ld;} uin;
   union {char d[10]; long double ld;} uout;
   uin.ld = x;
-------------- next part --------------
Fix all the :
demux_mov.c:...: warning: format '%.4s' expects type 'char *', but argument ... has type 'unsigned int *'


Index: libmpdemux/demux_mov.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mov.c,v
retrieving revision 1.125
diff -u -r1.125 demux_mov.c
--- libmpdemux/demux_mov.c	10 Jul 2005 09:05:14 -0000	1.125
+++ libmpdemux/demux_mov.c	29 Jul 2005 14:37:26 -0000
@@ -372,7 +372,7 @@
      	      break;
 	    default:
 	      tmp = be2me_32(tmp);  
-	      mp_msg(MSGT_DEMUX,MSGL_WARN,"ISO: Unknown File Type Major Brand: %.4s\n",&tmp);
+	      mp_msg(MSGT_DEMUX,MSGL_WARN,"ISO: Unknown File Type Major Brand: %.4s\n", (char*)&tmp);
 	  }
 	  mp_msg(MSGT_DEMUX,MSGL_V,"ISO: File Type Minor Version: %d\n",
 	      stream_read_dword(demuxer->stream));
@@ -380,7 +380,7 @@
 	  // List all compatible brands
 	  for(i = 0; i < ((len-16)/4); i++) {
 	    tmp = be2me_32(stream_read_dword(demuxer->stream));
-	    mp_msg(MSGT_DEMUX,MSGL_V,"ISO: File Type Compatible Brand #%d: %.4s\n",i,&tmp);
+	    mp_msg(MSGT_DEMUX,MSGL_V,"ISO: File Type Compatible Brand #%d: %.4s\n",i,(char*)&tmp);
 	    skipped += 4;
 	  }
 #endif	  
@@ -427,7 +427,7 @@
 		      flags|=4;
 		      mp_msg(MSGT_DEMUX,MSGL_V,"Added reference to playlist\n");
 		      //s[slen]=0;
-		      //mp_msg(MSGT_DEMUX,MSGL_INFO,"REF: [%.4s] %s\n",&type,s);
+		      //mp_msg(MSGT_DEMUX,MSGL_INFO,"REF: [%.4s] %s\n",(char*)&type,s);
 		      len-=12+slen;i-=12+slen; break;
 		    }
 		  case MOV_FOURCC('r','m','d','r'): {
@@ -476,7 +476,7 @@
 	default:
 	  if(no==0){ free(priv); return 0;} // first chunk is bad!
 	  id = be2me_32(id);
-	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: unknown chunk: %.4s %d\n",&id,(int)len);
+	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: unknown chunk: %.4s %d\n",(char*)&id,(int)len);
 	}
 skip_chunk:
 	if(!stream_skip(demuxer->stream,len-skipped)) break;
@@ -544,7 +544,7 @@
 	len-=8;
 	id=stream_read_dword(demuxer->stream);
 	//
-	mp_msg(MSGT_DEMUX,MSGL_DBG2,"lschunks %.4s  %d\n",&id,(int)len);
+	mp_msg(MSGT_DEMUX,MSGL_DBG2,"lschunks %.4s  %d\n",(char*)&id,(int)len);
 	//
 	if(trak){
 	  if (lschunks_intrak(demuxer, level, id, pos, len, trak) < 0)
@@ -759,7 +759,7 @@
 			    atom_len);
 		    }
 		}  
-		mp_msg(MSGT_DEMUX, MSGL_INFO, "Fourcc: %.4s\n",&trak->fourcc);
+		mp_msg(MSGT_DEMUX, MSGL_INFO, "Fourcc: %.4s\n",(char*)&trak->fourcc);
 #if 0
 		{ FILE* f=fopen("stdata.dat","wb");
 		  fwrite(trak->stdata,trak->stdata_len,1,f);
@@ -1103,7 +1103,7 @@
 		mp_msg(MSGT_DEMUX, MSGL_INFO, "Display size: %d x %d\n",
 		    trak->tkdata[77]|(trak->tkdata[76]<<8),
 		    trak->tkdata[81]|(trak->tkdata[80]<<8));
-		mp_msg(MSGT_DEMUX, MSGL_INFO, "Fourcc: %.4s  Codec: '%.*s'\n",&trak->fourcc,trak->stdata[42]&31,trak->stdata+43);
+		mp_msg(MSGT_DEMUX, MSGL_INFO, "Fourcc: %.4s  Codec: '%.*s'\n",(char*)&trak->fourcc,trak->stdata[42]&31,trak->stdata+43);
 		
 //		if(demuxer->video->id==-1 || demuxer->video->id==priv->track_db){
 //		    // (auto)selected video track:
@@ -1184,7 +1184,7 @@
 	case MOV_FOURCC('d','c','o','m'): {
 //	    int temp=stream_read_dword(demuxer->stream);
 	    unsigned int algo=be2me_32(stream_read_dword(demuxer->stream));
-	    mp_msg(MSGT_DEMUX, MSGL_INFO, "Compressed header uses %.4s algo!\n",&algo);
+	    mp_msg(MSGT_DEMUX, MSGL_INFO, "Compressed header uses %.4s algo!\n",(char*)&algo);
 	    break;
 	}
 	case MOV_FOURCC('c','m','v','d'): {
@@ -1256,7 +1256,7 @@
 		udta_len = stream_read_dword(demuxer->stream);
 		udta_id = stream_read_dword(demuxer->stream);
 		udta_size -= 8;
-		mp_msg(MSGT_DEMUX, MSGL_DBG2, "udta_id: %.4s (len: %d)\n", &udta_id, udta_len);
+		mp_msg(MSGT_DEMUX, MSGL_DBG2, "udta_id: %.4s (len: %d)\n", (char*)&udta_id, udta_len);
 		switch (udta_id)
 		{
 		    case MOV_FOURCC(0xa9,'c','p','y'):
@@ -1359,7 +1359,7 @@
 	} /* eof udta */
 	default:
 	  id = be2me_32(id);
-	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: unknown chunk: %.4s %d\n",&id,(int)len);
+	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: unknown chunk: %.4s %d\n",(char*)&id,(int)len);
 	} /* endof switch */
 	} /* endof else */
 
@@ -1435,7 +1435,7 @@
       str[len] = 0;
       mp_msg(MSGT_DEMUX, MSGL_V,
              "MOV: %*sHandler header: %.4s/%.4s (%.4s) %s\n", level, "",
-             &type, &subtype, &manufact, str);
+             (char*)&type, (char*)&subtype, (char*)&manufact, str);
       free(str);
       switch(bswap_32(type)) {
         case MOV_FOURCC('m','h','l','r'):
@@ -1447,7 +1447,7 @@
         default:
           mp_msg(MSGT_DEMUX, MSGL_V,
                  "MOV: unknown handler class: 0x%X (%.4s)\n",
-                 bswap_32(type), &type);
+                 bswap_32(type), (char*)&type);
       }
       break;
     }
@@ -1490,7 +1490,7 @@
           break; // error
         mp_msg(MSGT_DEMUX, MSGL_V,
                "MOV: %*s desc #%d: %.4s  (%d bytes)\n", level, "",
-               i, &fourcc, len - 16);
+               i, (char*)&fourcc, len - 16);
         if (fourcc != trak->fourcc && i)
           mp_msg(MSGT_DEMUX, MSGL_WARN, MSGTR_MOVvariableFourCC);
 //      if(!i)
@@ -1675,7 +1675,7 @@
     }
     default:
       id = be2me_32(id);
-      mp_msg(MSGT_DEMUX,MSGL_V,"MOV: unknown chunk: %.4s %d\n",&id,(int)len);
+      mp_msg(MSGT_DEMUX,MSGL_V,"MOV: unknown chunk: %.4s %d\n",(char*)&id,(int)len);
       break;
   }//switch(id)
   return 0;
-------------- next part --------------
demux_mpg.c:740: warning: 'sh_a' may be used uninitialized in this function
(crashing on NULL is better than on random value)

Index: libmpdemux/demux_mpg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mpg.c,v
retrieving revision 1.59
diff -u -r1.59 demux_mpg.c
--- libmpdemux/demux_mpg.c	25 Jun 2005 13:25:27 -0000	1.59
+++ libmpdemux/demux_mpg.c	29 Jul 2005 14:40:41 -0000
@@ -737,7 +737,7 @@
             if (mpg_d && mpg_d->num_a_streams > 1 && demuxer->audio && demuxer->audio->sh) {
               demux_stream_t *d_audio = demuxer->audio;
               sh_audio_t *sh_audio = d_audio->sh;
-              sh_audio_t *sh_a;
+              sh_audio_t *sh_a = NULL;
               int i;
               if (*((int*)arg) < 0)
               {
-------------- next part --------------
demux_mpg.c:740: warning: 'sh_a' may be used uninitialized in this function
(crashing on NULL is better than on random value)

Index: libmpdemux/demux_mpg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mpg.c,v
retrieving revision 1.59
diff -u -r1.59 demux_mpg.c
--- libmpdemux/demux_mpg.c	25 Jun 2005 13:25:27 -0000	1.59
+++ libmpdemux/demux_mpg.c	29 Jul 2005 14:40:41 -0000
@@ -737,7 +737,7 @@
             if (mpg_d && mpg_d->num_a_streams > 1 && demuxer->audio && demuxer->audio->sh) {
               demux_stream_t *d_audio = demuxer->audio;
               sh_audio_t *sh_audio = d_audio->sh;
-              sh_audio_t *sh_a;
+              sh_audio_t *sh_a = NULL;
               int i;
               if (*((int*)arg) < 0)
               {
-------------- next part --------------
asfheader.c:377: warning: statement with no effect

Index: libmpdemux/asfheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asfheader.c,v
retrieving revision 1.42
diff -u -r1.42 asfheader.c
--- libmpdemux/asfheader.c	21 Jun 2005 19:56:47 -0000	1.42
+++ libmpdemux/asfheader.c	29 Jul 2005 14:52:52 -0000
@@ -374,7 +374,7 @@
   }
   // read length of chunk
   stream_read(demuxer->stream, (char *)&data_len, sizeof(data_len));
-  le2me_64(data_len);
+  
   demuxer->movi_start = stream_tell(demuxer->stream) + 26;
   demuxer->movi_end = start + data_len;
   mp_msg(MSGT_HEADER, MSGL_V, "Found movie at 0x%X - 0x%X\n",
-------------- next part --------------
demux_real.c:1728: warning: format '%.4s' expects type 'char *', but argument 3 has type 'unsigned int *'

Index: libmpdemux/demux_real.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_real.c,v
retrieving revision 1.71
diff -u -r1.71 demux_real.c
--- libmpdemux/demux_real.c	3 Mar 2005 10:23:28 -0000	1.71
+++ libmpdemux/demux_real.c	29 Jul 2005 14:55:24 -0000
@@ -1134,7 +1134,7 @@
 		len=codec_data_size;
 		tmp = stream_read_dword(demuxer->stream);
 //		mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_real: type_spec: len=%d  fpos=0x%X  first_dword=0x%X (%.4s)  \n",
-//		    (int)codec_data_size,(int)codec_pos,tmp,&tmp);
+//		    (int)codec_data_size,(int)codec_pos,tmp,(char*)&tmp);
 		while(--len>=8){
 			if(tmp==MKTAG(0xfd, 'a', 'r', '.')) break; // audio
 			tmp=(tmp<<8)|stream_read_char(demuxer->stream);
@@ -1434,7 +1434,7 @@
 	  if (strstr(mimet,"x-pn-realvideo") || strstr(mimet,"x-pn-multirate-realvideo")) {
 		tmp = stream_read_dword(demuxer->stream);
 //		mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_real: type_spec: len=%d  fpos=0x%X  first_dword=0x%X (%.4s)  \n",
-//		    (int)codec_data_size,(int)codec_pos,tmp,&tmp);
+//		    (int)codec_data_size,(int)codec_pos,tmp,(char*)&tmp);
 		// skip unknown shit - FIXME: find a better/cleaner way!
 		len=codec_data_size;
 		while(--len>=8){
@@ -1726,7 +1726,7 @@
     if(demuxer->video->sh){
 	sh_video_t *sh=demuxer->video->sh;
 	mp_msg(MSGT_DEMUX,MSGL_V,"VIDEO:  %.4s [%08X,%08X]  %dx%d  (aspect %4.2f)  %4.2f fps\n",
-	    &sh->format,((unsigned int*)(sh->bih+1))[1],((unsigned int*)(sh->bih+1))[0],
+	    (char *)&sh->format,((unsigned int*)(sh->bih+1))[1],((unsigned int*)(sh->bih+1))[0],
 	    sh->disp_w,sh->disp_h,sh->aspect,sh->fps);
     }
 


More information about the MPlayer-dev-eng mailing list