[vlc-commits] avcodec: fix sign of codec ID

Rémi Denis-Courmont git at videolan.org
Tue Jul 23 22:18:25 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jul 23 23:17:46 2013 +0300| [6006c6d4d3f8abc00b4c3b49b5def11af32e2ef0] | committer: Rémi Denis-Courmont

avcodec: fix sign of codec ID

In C, an enumeration is unsigned unless it contains an explicit negative
member.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6006c6d4d3f8abc00b4c3b49b5def11af32e2ef0
---

 modules/codec/avcodec/avcodec.c |    3 ++-
 modules/codec/avcodec/avcodec.h |    4 ++--
 modules/codec/avcodec/encoder.c |    3 ++-
 modules/codec/avcodec/fourcc.c  |   10 +++++-----
 modules/demux/avformat/mux.c    |    2 +-
 5 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index 4c9131a..d85a2ea 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -258,7 +258,8 @@ vlc_module_end ()
 static int OpenDecoder( vlc_object_t *p_this )
 {
     decoder_t *p_dec = (decoder_t*) p_this;
-    int i_cat, i_codec_id, i_result;
+    unsigned i_codec_id;
+    int i_cat, i_result;
     const char *psz_namecodec;
 
     AVCodecContext *p_context = NULL;
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index 3887983..b8b77c0 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -26,8 +26,8 @@
 
 /* VLC <-> avcodec tables */
 int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
-                    int *pi_ffmpeg_codec, const char **ppsz_name );
-int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat,
+                    unsigned *pi_ffmpeg_codec, const char **ppsz_name );
+int GetVlcFourcc( unsigned i_ffmpeg_codec, int *pi_cat,
                   vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
 vlc_fourcc_t GetVlcAudioFormat( int i_sample_fmt );
 
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 9717d09..76e46b6 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -203,7 +203,8 @@ int OpenEncoder( vlc_object_t *p_this )
     encoder_sys_t *p_sys;
     AVCodecContext *p_context;
     AVCodec *p_codec = NULL;
-    int i_codec_id, i_cat;
+    unsigned i_codec_id;
+    int i_cat;
     const char *psz_namecodec;
     float f_val;
     char *psz_val;
diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
index b33e391..34bc509 100644
--- a/modules/codec/avcodec/fourcc.c
+++ b/modules/codec/avcodec/fourcc.c
@@ -37,9 +37,9 @@
  *****************************************************************************/
 static const struct
 {
-    vlc_fourcc_t  i_fourcc;
-    int  i_codec;
-    int  i_cat;
+    vlc_fourcc_t i_fourcc;
+    unsigned i_codec;
+    int i_cat;
 } codecs_table[] =
 {
     /*
@@ -451,7 +451,7 @@ static const size_t codecs_count = sizeof (codecs_table)
                                  / sizeof (codecs_table[0]);
 
 int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
-                    int *pi_ffmpeg_codec, const char **ppsz_name )
+                    unsigned *pi_ffmpeg_codec, const char **ppsz_name )
 {
     i_fourcc = vlc_fourcc_GetCodec( UNKNOWN_ES, i_fourcc );
     for( unsigned i = 0; i < codecs_count; i++ )
@@ -468,7 +468,7 @@ int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
     return false;
 }
 
-int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat,
+int GetVlcFourcc( unsigned i_ffmpeg_codec, int *pi_cat,
                   vlc_fourcc_t *pi_fourcc, const char **ppsz_name )
 {
     for( unsigned i = 0; i < codecs_count; i++ )
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index aef7388..97f5fb3 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -164,7 +164,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     sout_mux_sys_t *p_sys = p_mux->p_sys;
     AVCodecContext *codec;
     AVStream *stream;
-    int i_codec_id;
+    unsigned i_codec_id;
 
     msg_Dbg( p_mux, "adding input" );
 



More information about the vlc-commits mailing list