[x264-devel] Cosmetics: fix some signedness issues found by -Wsign-compare

Jason Garrett-Glaser git at videolan.org
Wed Apr 13 04:04:27 CEST 2011


x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Sun Apr 10 04:39:51 2011 -0700| [62dfb25fe3599ff2b28fcc3c59f0e290d061b1ab] | committer: Jason Garrett-Glaser

Cosmetics: fix some signedness issues found by -Wsign-compare

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=62dfb25fe3599ff2b28fcc3c59f0e290d061b1ab
---

 common/common.c   |    2 +-
 common/cpu.h      |    2 +-
 encoder/me.c      |    3 +--
 filters/filters.c |    2 +-
 filters/filters.h |    2 +-
 input/y4m.c       |    2 +-
 x264.c            |    4 ++--
 x264cli.h         |    4 ++--
 8 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/common/common.c b/common/common.c
index 69941de..e6d605a 100644
--- a/common/common.c
+++ b/common/common.c
@@ -1160,7 +1160,7 @@ REDUCE_FRACTION( x264_reduce_fraction64, uint64_t )
 char *x264_slurp_file( const char *filename )
 {
     int b_error = 0;
-    int i_size;
+    size_t i_size;
     char *buf;
     FILE *fh = fopen( filename, "rb" );
     if( !fh )
diff --git a/common/cpu.h b/common/cpu.h
index 5438f92..6408566 100644
--- a/common/cpu.h
+++ b/common/cpu.h
@@ -56,7 +56,7 @@ int x264_stack_align( void (*func)(), ... );
 typedef struct
 {
     const char name[16];
-    int flags;
+    uint32_t flags;
 } x264_cpu_name_t;
 extern const x264_cpu_name_t x264_cpu_names[];
 
diff --git a/encoder/me.c b/encoder/me.c
index 54de887..72e486a 100644
--- a/encoder/me.c
+++ b/encoder/me.c
@@ -1135,8 +1135,7 @@ void x264_me_refine_qpel_rd( x264_t *h, x264_me_t *m, int i_lambda2, int i4, int
     int bmx = m->mv[0];
     int bmy = m->mv[1];
     int omx, omy, pmx, pmy;
-    unsigned bsatd;
-    int satd;
+    int satd, bsatd;
     int dir = -2;
     int i8 = i4>>2;
     uint16_t amvd;
diff --git a/filters/filters.c b/filters/filters.c
index 4998f8f..5dd32dc 100644
--- a/filters/filters.c
+++ b/filters/filters.c
@@ -27,7 +27,7 @@
 #include "filters.h"
 #define RETURN_IF_ERROR( cond, ... ) RETURN_IF_ERR( cond, "options", NULL, __VA_ARGS__ )
 
-char **x264_split_string( char *string, char *sep, uint32_t limit )
+char **x264_split_string( char *string, char *sep, int limit )
 {
     if( !string )
         return NULL;
diff --git a/filters/filters.h b/filters/filters.h
index f34a32f..9f15e20 100644
--- a/filters/filters.h
+++ b/filters/filters.h
@@ -30,7 +30,7 @@
 #include "x264cli.h"
 #include "filters/video/video.h"
 
-char **x264_split_string( char *string, char *sep, uint32_t limit );
+char **x264_split_string( char *string, char *sep, int limit );
 void   x264_free_string_array( char **array );
 
 char **x264_split_options( const char *opt_str, const char *options[] );
diff --git a/input/y4m.c b/input/y4m.c
index 4967fe8..cec3425 100644
--- a/input/y4m.c
+++ b/input/y4m.c
@@ -201,7 +201,7 @@ static int open_file( char *psz_filename, hnd_t *p_handle, video_info_t *info, c
 
 static int read_frame_internal( cli_pic_t *pic, y4m_hnd_t *h )
 {
-    int slen = strlen( Y4M_FRAME_MAGIC );
+    size_t slen = strlen( Y4M_FRAME_MAGIC );
     int i = 0;
     char header[16];
 
diff --git a/x264.c b/x264.c
index 0cc88af..08b998a 100644
--- a/x264.c
+++ b/x264.c
@@ -328,11 +328,11 @@ static void print_csp_names( int longhelp )
     printf( "\n" );
     printf( "                              - valid csps for `lavf' demuxer:\n" );
     printf( INDENT );
-    int line_len = strlen( INDENT );
+    size_t line_len = strlen( INDENT );
     for( enum PixelFormat i = PIX_FMT_NONE+1; i < PIX_FMT_NB; i++ )
     {
         const char *pfname = av_pix_fmt_descriptors[i].name;
-        int name_len = strlen( pfname );
+        size_t name_len = strlen( pfname );
         if( line_len + name_len > (80 - strlen( ", " )) )
         {
             printf( "\n" INDENT );
diff --git a/x264cli.h b/x264cli.h
index 50a9be3..29e961c 100644
--- a/x264cli.h
+++ b/x264cli.h
@@ -34,7 +34,7 @@
 
 typedef void *hnd_t;
 
-static inline int64_t gcd( int64_t a, int64_t b )
+static inline uint64_t gcd( uint64_t a, uint64_t b )
 {
     while( 1 )
     {
@@ -46,7 +46,7 @@ static inline int64_t gcd( int64_t a, int64_t b )
     }
 }
 
-static inline int64_t lcm( int64_t a, int64_t b )
+static inline uint64_t lcm( uint64_t a, uint64_t b )
 {
     return ( a / gcd( a, b ) ) * b;
 }



More information about the x264-devel mailing list