[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.118,1.119 base-costume.h,1.18,1.19 costume.cpp,1.128,1.129

Max Horn fingolfin at users.sourceforge.net
Sun Apr 4 15:57:01 CEST 2004


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2837

Modified Files:
	akos.cpp base-costume.h costume.cpp 
Log Message:
Fix signedness issue (lead to incorred address computations on 64 bit machines)

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- akos.cpp	4 Apr 2004 19:41:02 -0000	1.118
+++ akos.cpp	4 Apr 2004 22:43:54 -0000	1.119
@@ -347,7 +347,8 @@
 	const byte *mask, *src;
 	byte *dst;
 	byte len, maskbit;
-	uint y, color, height, pcolor;
+	int y;
+	uint color, height, pcolor;
 	const byte *scaleytab;
 	bool masked;
 	bool skip_column = false;
@@ -376,7 +377,7 @@
 		do {
 			if (*scaleytab++ < _scaleY) {
 				if (_actorHitMode) {
-					if (color && (int16) y == _actorHitY && v1.x == _actorHitX) {
+					if (color && y == _actorHitY && v1.x == _actorHitX) {
 						_actorHitResult = true;
 						return;
 					}
@@ -413,7 +414,7 @@
 
 				if (v1.scaletable[v1.scaleXindex] < _scaleX) {
 					v1.x += v1.scaleXstep;
-					if (v1.x < 0 || v1.x >= (int)_outwidth)
+					if (v1.x < 0 || v1.x >= _outwidth)
 						return;
 					maskbit = revBitMask[v1.x & 7];
 					v1.destptr += v1.scaleXstep;
@@ -613,7 +614,7 @@
 
 			j = startScaleIndexX;
 			for (i = 0, skip = 0; i < _width; i++) {
-				if (rect.left >= (int)_outwidth) {
+				if (rect.left >= _outwidth) {
 					startScaleIndexX = j;
 					skip++;
 				}
@@ -678,10 +679,10 @@
 	} else
 		_vm->markRectAsDirty(kMainVirtScreen, rect, _actorID);
 
-	if (rect.top >= (int)_outheight || rect.bottom <= 0)
+	if (rect.top >= _outheight || rect.bottom <= 0)
 		return 0;
 
-	if (rect.left >= (int)_outwidth || rect.right <= 0)
+	if (rect.left >= _outwidth || rect.right <= 0)
 		return 0;
 
 	v1.replen = 0;
@@ -724,10 +725,10 @@
 	if (v1.skip_width <= 0 || _height <= 0)
 		return 0;
 
-	if ((uint) rect.top > _outheight)
+	if (rect.top > _outheight)
 		rect.top = 0;
 
-	if ((uint) rect.bottom > _outheight)
+	if (rect.bottom > _outheight)
 		rect.bottom = _outheight;
 
 	if (_draw_top > rect.top)

Index: base-costume.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/base-costume.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- base-costume.h	12 Jan 2004 14:09:39 -0000	1.18
+++ base-costume.h	4 Apr 2004 22:43:54 -0000	1.19
@@ -69,7 +69,7 @@
 
 	// Destination
 	byte *_outptr;
-	uint _outwidth, _outheight;
+	int _outwidth, _outheight;
 	int32 _numStrips;
 
 	// Source pointer

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -d -r1.128 -r1.129
--- costume.cpp	4 Apr 2004 19:41:02 -0000	1.128
+++ costume.cpp	4 Apr 2004 22:43:54 -0000	1.129
@@ -148,7 +148,7 @@
 			rect.right = rect.left = v1.x;
 			_scaleIndexX = startScaleIndexX;
 			for (i = 0; i < _width; i++) {
-				if (rect.left >= (int)_outwidth) {
+				if (rect.left >= _outwidth) {
 					skip++;
 					startScaleIndexX = _scaleIndexX;
 				}
@@ -205,10 +205,10 @@
 	else
 		_vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 1, rect.top, rect.bottom, _actorID);
 
-	if (rect.top >= (int)_outheight || rect.bottom <= 0)
+	if (rect.top >= _outheight || rect.bottom <= 0)
 		return 0;
 
-	if (rect.left >= (int)_outwidth || rect.right <= 0)
+	if (rect.left >= _outwidth || rect.right <= 0)
 		return 0;
 
 	v1.replen = 0;
@@ -254,10 +254,10 @@
 	if (rect.left < 0)
 		rect.left = 0;
 
-	if ((uint) rect.top > _outheight)
+	if (rect.top > _outheight)
 		rect.top = 0;
 
-	if ((uint) rect.bottom > _outheight)
+	if (rect.bottom > _outheight)
 		rect.bottom = _outheight;
 
 	if (_draw_top > rect.top)
@@ -352,7 +352,8 @@
 	const byte *mask, *src;
 	byte *dst;
 	byte len;
-	uint y, height;
+	int y;
+	uint height;
 	byte color, pcolor;
 	bool rep;
 
@@ -409,7 +410,7 @@
 				height = _height;
 				y = v1.y;
 				v1.x += 8 * v1.scaleXstep;
-				if (v1.x < 0 || v1.x >= (int)_outwidth)
+				if (v1.x < 0 || v1.x >= _outwidth)
 					return;
 				mask = v1.mask_ptr;
 				v1.destptr += 8 * v1.scaleXstep;
@@ -426,7 +427,8 @@
 	const byte *mask, *src;
 	byte *dst;
 	byte len, maskbit;
-	uint y, color, height, pcolor;
+	int y;
+	uint color, height, pcolor;
 	const byte *scaleytab;
 	bool masked;
 
@@ -482,7 +484,7 @@
 
 				if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
 					v1.x += v1.scaleXstep;
-					if (v1.x < 0 || v1.x >= (int)_outwidth)
+					if (v1.x < 0 || v1.x >= _outwidth)
 						return;
 					maskbit = revBitMask[v1.x & 7];
 					v1.destptr += v1.scaleXstep;
@@ -501,7 +503,7 @@
 	byte *dst;
 	byte maskbit, len, height, width;
 	int color;
-	uint y;
+	int y;
 	bool masked;
 	int oldXpos, oldScaleIndexX;
 
@@ -525,7 +527,7 @@
 			if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) {
 				masked = (y >= _outheight) || v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
 				
-				if (color && v1.x >= 0 && v1.x < (int)_outwidth && !masked) {
+				if (color && v1.x >= 0 && v1.x < _outwidth && !masked) {
 					*dst = _palette[color];
 				}
 





More information about the Scummvm-git-logs mailing list