[MPlayer-dev-eng] [PATCH] trivial signed/unsigned comparisons fix - spudec.c

Pierre Lombard p_l at gmx.fr
Fri May 5 10:42:45 CEST 2006


Hi,

The attached patch fix some 'always false' tests by somewhat more
sensible, I guess.

unsigned int a => a<0 is always false

-- 
Pierre Lombard
GPG: 0x1AF0803C
-------------- next part --------------
Index: spudec.c
===================================================================
RCS file: /cvsroot/mplayer/main/spudec.c,v
retrieving revision 1.46
diff -u -r1.46 spudec.c
--- spudec.c	19 Jun 2005 13:50:50 -0000	1.46
+++ spudec.c	5 May 2006 08:38:24 -0000
@@ -656,7 +656,7 @@
     case 1:
       if (sub_pos < 50) {
         bbox[2] = dys*sub_pos/100 - spu->height * scaley / 0x200;
-        if (bbox[2] < 0) bbox[2] = 0;
+        if ((int) bbox[2] < 0) bbox[2] = 0;
         bbox[3] = bbox[2] + spu->height;
       } else {
         bbox[3] = dys*sub_pos/100 + spu->height * scaley / 0x200;
@@ -666,7 +666,7 @@
       break;
     case 2:
       bbox[2] = dys*sub_pos/100 - spu->height * scaley / 0x100;
-      if (bbox[2] < 0) bbox[2] = 0;
+      if ((int)bbox[2] < 0) bbox[2] = 0;
       bbox[3] = bbox[2] + spu->height;
       break;
     default: /* -1 */
@@ -1074,7 +1074,7 @@
 	case 1:
           spu->scaled_start_row = dys*sub_pos/100 - spu->scaled_height/2;
           if (sub_pos < 50) {
-	    if (spu->scaled_start_row < 0) spu->scaled_start_row = 0;
+	    if ((int) spu->scaled_start_row < 0) spu->scaled_start_row = 0;
 	  } else {
 	    if (spu->scaled_start_row + spu->scaled_height > dys)
 	      spu->scaled_start_row = dys - spu->scaled_height;
@@ -1082,7 +1082,7 @@
 	  break;
         case 2:
           spu->scaled_start_row = dys*sub_pos/100 - spu->scaled_height;
-	  if (spu->scaled_start_row < 0) spu->scaled_start_row = 0;
+	  if ((int) spu->scaled_start_row < 0) spu->scaled_start_row = 0;
 	  break;
 	}
 	draw_alpha(spu->scaled_start_col, spu->scaled_start_row, spu->scaled_width, spu->scaled_height,


More information about the MPlayer-dev-eng mailing list