[Scummvm-cvs-logs] CVS: scummvm/scumm/smush codec44.cpp,1.4,1.5 codec44.h,1.3,1.4

Pawel Kolodziejski aquadran at users.sourceforge.net
Sun Jan 19 03:01:05 CET 2003


Update of /cvsroot/scummvm/scummvm/scumm/smush
In directory sc8-pr-cvs1:/tmp/cvs-serv17819/scumm/smush

Modified Files:
	codec44.cpp codec44.h 
Log Message:
some cleanup

Index: codec44.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/codec44.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- codec44.cpp	18 Jan 2003 21:51:00 -0000	1.4
+++ codec44.cpp	19 Jan 2003 11:00:17 -0000	1.5
@@ -25,16 +25,14 @@
 #include "blitter.h"
 
 bool Codec44Decoder::decode(Blitter & dst, Chunk & src) {
-	int32 size_line;
-	int32 num;
+	int32 size_line, num;
 	int32 length = src.getSize() - 14;
 	int32 width = getRect().width();
 	int32 height = getRect().height();
 	byte * src2 = (byte*)malloc(length);
 	byte * org_src2 = src2;
 	src.read(src2, length);
-	byte * dst2 = (byte*)malloc(2000);
-	byte * org_dst2 = dst2;
+	byte * dst2 = _buffer;
 	byte val;
 
 	do {
@@ -49,25 +47,23 @@
 			dst2 += num;
 			length -= 2;
 			size_line -= 2;
-			if (size_line == 0)
-				break;
-
-			num = READ_LE_UINT16(src2) + 1;
-			src2 += 2;
-			memcpy(dst2, src2, num);
-			dst2 += num;
-			src2 += num;
-			length -= num + 2;
-			size_line -= num + 2;
+			if (size_line != 0) {
+				num = READ_LE_UINT16(src2) + 1;
+				src2 += 2;
+				memcpy(dst2, src2, num);
+				dst2 += num;
+				src2 += num;
+				length -= num + 2;
+				size_line -= num + 2;
+			}
 		}
 		dst2--;
 
 	} while (length > 1);
 
-	dst.blit(org_dst2, width * height);
+	dst.blit(_buffer, width * height);
 
 	free(org_src2);
-	free(org_dst2);
 
 	return true;
 }

Index: codec44.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/codec44.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- codec44.h	24 Aug 2002 23:21:55 -0000	1.3
+++ codec44.h	19 Jan 2003 11:00:21 -0000	1.4
@@ -22,24 +22,11 @@
 #ifndef CODEC44_H
 #define CODEC44_H
 
-#include "config.h"
-
-#ifdef DEBUG
-# ifndef NO_DEBUG_CODEC44
-#  define DEBUG_CODEC44
-# endif
-#else
-# ifdef DEBUG_CODEC44
-#  error DEBUG_CODEC44 defined without DEBUG
-# endif
-#endif
-
 #include "decoder.h"
 
-/*!	@brief ::decoder for codec 21 and 44.
-
-*/
 class Codec44Decoder : public Decoder {
+	byte _buffer[1000];
+
 public:
 	bool decode(Blitter & dst, Chunk & src);
 };





More information about the Scummvm-git-logs mailing list