git » fp-git.git » commit 6239c2f

cleaned the source. Commented some debug comments.

author ecalot
2006-06-06 00:29:02 UTC
committer ecalot
2006-06-06 00:29:02 UTC
parent 6513e8c695125210a1a2a531516a877653776138

cleaned the source. Commented some debug comments.

PR/src/include/compress.h +1 -1
PR/src/lib/compression/rlev_decompress.c +13 -43
PR/src/lib/object/image/image256.c +12 -14
PR/src/xml/resources.xml +1 -1

diff --git a/PR/src/include/compress.h b/PR/src/include/compress.h
index 2fc407b..b01127c 100644
--- a/PR/src/include/compress.h
+++ b/PR/src/include/compress.h
@@ -73,6 +73,6 @@ int expandLzg(const unsigned char* input, int inputSize,
 int expandRle(const unsigned char* input, int inputSize,
                unsigned char** output, int *outputSize);
 int expandRleC(const unsigned char* input, int inputSize,
-               unsigned char* output, int *outputSize,int verif);
+               unsigned char* output, int *outputSize);
 
 #endif
diff --git a/PR/src/lib/compression/rlev_decompress.c b/PR/src/lib/compression/rlev_decompress.c
index 6749a4c..47bc592 100644
--- a/PR/src/lib/compression/rlev_decompress.c
+++ b/PR/src/lib/compression/rlev_decompress.c
@@ -39,60 +39,30 @@ rlec_uncompress.c: Princed Resources : Image Compression Library :
 
 /* Expands RLE algorithm */
 int expandRleC(const unsigned char* input, int inputSize,
-               unsigned char* output, int *outputSize,int verif) {
+               unsigned char* output, int *outputSize) {
 	register unsigned char rep=0;
 	int oCursor=0;
 	int iCursor=0;
 	int done=0;
-	/*int aux=0;*/
-	/*int lineSize;*/
-
-	/* reserve memory */
-/*	if ((*output=(unsigned char*)malloc(40000))==NULL) return COMPRESS_RESULT_FATAL;*/
 
 	/* main loop */
 	while (iCursor<inputSize) {
 		rep=(input[iCursor++]);
-/*printf("o=%d i=%d\n",oCursor,iCursor);*/
-/*		if (1||(done)||(oCursor%verif)) {*/
-			done=0;
-			if (rep&0x80) { /* repeat */
-				/*rep&=~0x80;*/
-				rep-=0x80;
-				rep++;
-				while (rep--) (output)[oCursor++]=input[iCursor];
-				iCursor++;
-			} else { /* jump */
-				rep++;
-				while ((rep--)&&(iCursor<inputSize)) {
-					(output)[oCursor++]=input[iCursor++];
-				}
-			}
-/*		} else {
-			if (aux)
-				if (lineSize!=(iCursor-aux))
-					printf("Error, line size is wrong: lineSize=%d got=%d\n",lineSize,(iCursor-aux));
-
-			lineSize=rep+256*input[iCursor]+1;
+		done=0;
+		if (rep&0x80) { /* repeat */
+			rep&=(~0x80);
+			rep++;
+			while (rep--) (output)[oCursor++]=input[iCursor];
 			iCursor++;
-			done=1;
-			aux=iCursor;
-*			if (oCursor==28800) {
-				int g;
-				printf("error time: (ls=%d)",lineSize);
-				for (g=-20;g<100;g++)
-					printf(" %02x",input[iCursor+g]);
-				printf("\n");
-				iCursor-=4;
-			}*/
-	/*	}*/
-
-
-
+		} else { /* jump */
+			rep++;
+			while ((rep--)&&(iCursor<inputSize)) {
+				(output)[oCursor++]=input[iCursor++];
+			}
+		}
 	}
-/*printf("done=%d i=%d but=%d\n",done,iCursor,inputSize);*/
+	
 	*outputSize=oCursor;
-/*	printf("rep=%d\n",rep);*/
 	return (rep==255)?COMPRESS_RESULT_SUCCESS:COMPRESS_RESULT_WARNING;
 }
 
diff --git a/PR/src/lib/object/image/image256.c b/PR/src/lib/object/image/image256.c
index eb5df43..6ca26d8 100644
--- a/PR/src/lib/object/image/image256.c
+++ b/PR/src/lib/object/image/image256.c
@@ -207,8 +207,6 @@ int pop2decompress(const unsigned char* input, int inputSize, int verify, unsign
 	int            tempOutputSize;
 	int            osCheck;
 
-	printf("\n\nNew image!\n");
-
 	*output=malloc(40000);
 	lineO=*output;
 	*outputSize=0;
@@ -220,33 +218,33 @@ int pop2decompress(const unsigned char* input, int inputSize, int verify, unsign
 	tempOutputSize=osCheck+6;
 
 	remaining=expandLzg(input,inputSize-2,&tempOutput,&tempOutputSize);
-	printf("Call:\n return=%d function input size=%d\n internal output size=%d result output size=%d\n",
-	remaining,inputSize,osCheck,tempOutputSize);
-	if ((osCheck+6)!=tempOutputSize)
-		printf(" Special case: more is coming\n");
+	/*printf("Call:\n return=%d function input size=%d\n internal output size=%d result output size=%d\n",
+		remaining,inputSize,osCheck,tempOutputSize);*/
+	/*if ((osCheck+6)!=tempOutputSize)
+		printf(" Special case: more is coming\n");*/
 
 	/* Second layer expand each rle line */
 	lineI=tempOutput;
-	printf("RLE loop layer:\n");
+	/*printf("RLE loop layer:\n");*/
 	do {
 		aux=array2short(lineI);
 		lineI+=2;
 		if (aux>tempOutputSize) {
-			printf(" error: aux=%d tempOutputSize=%d\n",aux,tempOutputSize);
+			/*printf(" error: aux=%d tempOutputSize=%d\n",aux,tempOutputSize);*/
 			return COMPRESS_RESULT_WARNING;
 		}
-		aux2= expandRleC(lineI,aux,lineO,&lineSize,1000);
-		if (aux2) printf(" error: rle=%d linesize=%d of %d. size=%d r=%d.\n",aux2, lineSize,verify,tempOutputSize,tempOutputSize-aux-2);
+		aux2= expandRleC(lineI,aux,lineO,&lineSize);
+		/*if (aux2) printf(" error: rle=%d linesize=%d of %d. size=%d r=%d.\n",aux2, lineSize,verify,tempOutputSize,tempOutputSize-aux-2);*/
 		lineO+=lineSize;
 		*outputSize+=lineSize;
 		tempOutputSize-=aux;
 		tempOutputSize-=2;
 		lineI+=aux;
 	} while (lineSize==verify && tempOutputSize>0);
-	printf(" return: linesize=%d verify=%d tempOutputSize=%d\n", lineSize, verify, tempOutputSize);
+	/*printf(" return: linesize=%d verify=%d tempOutputSize=%d\n", lineSize, verify, tempOutputSize);*/
 	if (remaining) {
 		const unsigned char* start=input+(inputSize-0)-remaining;
-		printf("Remaining tailing data: size=%d first=%02x %02x\n", remaining,start[0],start[1]);
+		/*printf("Remaining tailing data: size=%d first=%02x %02x\n", remaining,start[0],start[1]);*/
 		tempOutputSize=0;
 		remaining=expandLzg(start,remaining,&tempOutput,&tempOutputSize);
 		
@@ -256,10 +254,10 @@ int pop2decompress(const unsigned char* input, int inputSize, int verify, unsign
 			aux=array2short(lineI);
 			lineI+=2;
 			if (aux>tempOutputSize) {
-				printf(" error: aux=%d tempOutputSize=%d\n",aux,tempOutputSize);
+				/*printf(" error: aux=%d tempOutputSize=%d\n",aux,tempOutputSize);*/
 				return COMPRESS_RESULT_WARNING;
 			}
-			aux2= expandRleC(lineI,aux,lineO,&lineSize,1000);
+			aux2= expandRleC(lineI,aux,lineO,&lineSize);
 			if (aux2) printf(" error: rle=%d linesize=%d of %d. size=%d r=%d.\n",aux2, lineSize,verify,tempOutputSize,tempOutputSize-aux-2);
 			lineO+=lineSize;
 			*outputSize+=lineSize;
diff --git a/PR/src/xml/resources.xml b/PR/src/xml/resources.xml
index ec44892..2a67055 100644
--- a/PR/src/xml/resources.xml
+++ b/PR/src/xml/resources.xml
@@ -807,7 +807,7 @@ resources.xml: Princed Resources : Resource tree
  </folder>
 
 
- <folder index="pop1" name="binary" file="ikid.dat" path="kid" palette="400" type="image">
+ <folder index="pop1" name="binary" file="kid.dat" path="kid" palette="400" type="image">
   <item value="400" path="kid.pal" type="palette-pop1-4bits">Resource number 400</item>
   <folder path="running">
    <item value="401" path="frame01.bmp">Image frame01 (401)</item>