changeset 31545:4500ce87a70c

Give functions proper prototypes.
author reimar
date Thu, 01 Jul 2010 21:11:10 +0000
parents bce9cacbdeb7
children e7aa0fde4e34
files libmpcodecs/vd_xanim.c
diffstat 1 files changed, 23 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_xanim.c	Thu Jul 01 20:57:40 2010 +0000
+++ b/libmpcodecs/vd_xanim.c	Thu Jul 01 21:11:10 2010 +0000
@@ -70,12 +70,19 @@
 #endif
 #endif
 
+struct XA_CODEC_HDR;
+struct XA_DEC_INFO;
+
+typedef long init_function(struct XA_CODEC_HDR *);
+typedef unsigned int decode_function(unsigned char *, unsigned char *,
+                                      unsigned int, struct XA_DEC_INFO *);
+
 typedef struct
 {
   unsigned int		what;
   unsigned int		id;
-  int			(*iq_func)();	/* init/query function */
-  unsigned int		(*dec_func)();  /* opt decode function */
+  init_function        *iq_func;    /* init/query function */
+  decode_function      *dec_func;   /* opt decode function */
 } XAVID_FUNC_HDR;
 
 #define XAVID_WHAT_NO_MORE	0x0000
@@ -98,7 +105,7 @@
 } XAVID_MOD_HDR;
 
 /* XA CODEC .. */
-typedef struct
+typedef struct XA_CODEC_HDR
 {
   void			*anim_hdr;
   unsigned int		compression;
@@ -106,10 +113,10 @@
   unsigned int		depth;
   void			*extra;
   unsigned int		xapi_rev;
-  unsigned int		(*decoder)();
+  decode_function	*decoder;
   char			*description;
   unsigned int		avi_ctab_flag;
-  unsigned int		(*avi_read_ext)();
+  unsigned int		(*avi_read_ext)(void);
 } XA_CODEC_HDR;
 
 #define CODEC_SUPPORTED 1
@@ -149,7 +156,7 @@
   struct XA_CHDR_STRUCT	*new_chdr;
 } XA_CHDR;
 
-typedef struct
+typedef struct XA_DEC_INFO
 {
   unsigned int		cmd;
   unsigned int		skip_flag;
@@ -177,9 +184,8 @@
 typedef struct {
     XA_DEC_INFO *decinfo;
     void *file_handler;
-    long (*iq_func)(XA_CODEC_HDR *codec_hdr);
-    unsigned int (*dec_func)(unsigned char *image, unsigned char *delta,
-	unsigned int dsize, XA_DEC_INFO *dec_info);
+    init_function *iq_func;
+    decode_function *dec_func;
     mp_image_t *mpi;
 } vd_xanim_ctx;
 
@@ -212,7 +218,7 @@
 static int xacodec_load(sh_video_t *sh, char *filename)
 {
     vd_xanim_ctx *priv = sh->context;
-    void *(*what_the)();
+    void *(*what_the)(void);
     char *error;
     XAVID_MOD_HDR *mod_hdr;
     XAVID_FUNC_HDR *func;
@@ -282,19 +288,19 @@
 	{
 	    mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " %p: avi init/query func (id: %d)\n",
 		func[i].iq_func, func[i].id);
-	    priv->iq_func = (void *)func[i].iq_func;
+	    priv->iq_func = func[i].iq_func;
 	}
 	if (func[i].what & XAVID_QT_QUERY)
 	{
 	    mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " %p: qt init/query func (id: %d)\n",
 		func[i].iq_func, func[i].id);
-	    priv->iq_func = (void *)func[i].iq_func;
+	    priv->iq_func = func[i].iq_func;
 	}
 	if (func[i].what & XAVID_DEC_FUNC)
 	{
 	    mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " %p: decoder func (init/query: %p) (id: %d)\n",
 		func[i].dec_func, func[i].iq_func, func[i].id);
-	    priv->dec_func = (void *)func[i].dec_func;
+	    priv->dec_func = func[i].dec_func;
 	}
     }
     return 1;
@@ -319,7 +325,7 @@
     switch(ret)
     {
 	case CODEC_SUPPORTED:
-	    priv->dec_func = (void *)codec_hdr->decoder;
+	    priv->dec_func = codec_hdr->decoder;
 	    mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "Codec is supported: found decoder for %s at %p\n",
 		codec_hdr->description, codec_hdr->decoder);
 	    return 1;
@@ -339,7 +345,7 @@
  * Add forward declarations to avoid warnings with -Wmissing-prototypes. */
 void XA_Print(char *fmt, ...);
 void TheEnd1(char *err_mess);
-void XA_Add_Func_To_Free_Chain(XA_ANIM_HDR *anim_hdr, void (*function)());
+void XA_Add_Func_To_Free_Chain(XA_ANIM_HDR *anim_hdr, void (*function)(void));
 unsigned long XA_Time_Read(void);
 void XA_Gen_YUV_Tabs(XA_ANIM_HDR *anim_hdr);
 void JPG_Setup_Samp_Limit_Table(XA_ANIM_HDR *anim_hdr);
@@ -375,7 +381,7 @@
     return;
 }
 
-void XA_Add_Func_To_Free_Chain(XA_ANIM_HDR *anim_hdr, void (*function)())
+void XA_Add_Func_To_Free_Chain(XA_ANIM_HDR *anim_hdr, void (*function)(void))
 {
 //    XA_Print("XA_Add_Func_To_Free_Chain('anim_hdr: %08x', 'function: %08x')",
 //	    anim_hdr, function);
@@ -756,7 +762,7 @@
 {
     vd_xanim_ctx *priv = sh->context;
     int i;
-    void (*close_func)();
+    void (*close_func)(void);
 
     for (i=0; i < XA_CLOSE_FUNCS; i++)
 	if (xa_close_func[i])