git » fp-git.git » commit a84a6db

done even more TODOs

author ecalot
2006-06-26 00:19:59 UTC
committer ecalot
2006-06-26 00:19:59 UTC
parent 4a5daf3b7588409295201587d44c24fb8ae74d3a

done even more TODOs

PR/src/lib/layers/autodetect.c +1 -10
PR/src/lib/layers/disk.c +5 -8
PR/src/lib/object/image/image256.c +1 -1
PR/src/lib/object/palette/pop2_256c.c +6 -6
PR/src/ports/winfiles/pr.dev +1 -1

diff --git a/PR/src/lib/layers/autodetect.c b/PR/src/lib/layers/autodetect.c
index c5c29c4..bef896e 100644
--- a/PR/src/lib/layers/autodetect.c
+++ b/PR/src/lib/layers/autodetect.c
@@ -89,15 +89,6 @@ int verifyPaletteHeaderPop2(tBinary c) {
 	);
 }
 
-int verifyPaletteHeaderPop2_256(tBinary c) {
-/*	tBinary c2;
-	c2.size=c.size-1;
-	c2.data=c.data+1;*/
-	return 0&&(
-		((c.size==(256*3+1)||c.size==(320*3))&&isA64kPalette(c)) /* TODO: the +1 is for debug purposes, it must be eliminated */
-	);
-}
-
 int verifySpeakerHeader(tBinary c) {
 	/* format: (checksum)+(0x00)+(even number)+3 bytes per note */
 	return
@@ -116,7 +107,7 @@ int verifyMidiHeader(tBinary c) {
 	/* format: (checksum)+(0x02)+"MThd"... */
 	return
 		(c.size>6) &&
-		(c.data[0]==0x02) &&
+		(c.data[0]==0x02) && /* magicMidi */
 		(c.data[1]=='M') &&
 		(c.data[2]=='T') &&
 		(c.data[3]=='h') &&
diff --git a/PR/src/lib/layers/disk.c b/PR/src/lib/layers/disk.c
index 5fe23d1..eb06b5a 100644
--- a/PR/src/lib/layers/disk.c
+++ b/PR/src/lib/layers/disk.c
@@ -407,7 +407,6 @@ tBinary mLoadFileArray(const char* vFile) {
 
 	/* declare variables */
 	FILE *fp;
-	int  aux; /* TODO: replace by ret.size */
 	const char* file=repairFolders(vFile);
 	whatIs f;
 	tBinary ret;
@@ -433,14 +432,13 @@ tBinary mLoadFileArray(const char* vFile) {
 	} else {
 		/* get file size */
 		fseek(fp,0,SEEK_END);
-		aux=ftell(fp);
-		if (!aux) {
+		ret.size=ftell(fp);
+		if (!ret.size) {
 			fclose(fp);
-			ret.size=0;
 			ret.data=NULL;
 			return ret;
 		}
-		if ((ret.data=(unsigned char*)malloc(aux+1))==NULL) {
+		if ((ret.data=(unsigned char*)malloc(ret.size+1))==NULL) {
 			fclose(fp);
 			ret.size=PR_RESULT_ERR_MEMORY;
 			ret.data=NULL;
@@ -448,10 +446,9 @@ tBinary mLoadFileArray(const char* vFile) {
 		} else {
 			/* if the file was successfully open */
 			fseek(fp,0,SEEK_SET);
-			aux=fread (ret.data,1,aux,fp);
-			ret.data[aux]=0;
+			ret.size=fread (ret.data,1,ret.size,fp);
+			ret.data[ret.size]=0;
 			fclose(fp);
-			ret.size=aux;
 			return ret;
 		}
 	}
diff --git a/PR/src/lib/object/image/image256.c b/PR/src/lib/object/image/image256.c
index 95b9325..641cf42 100644
--- a/PR/src/lib/object/image/image256.c
+++ b/PR/src/lib/object/image/image256.c
@@ -85,7 +85,7 @@ int mExpandGraphic256(tBinary input, tImage *image) {
 	imageSizeInBytes=image->widthInBytes*image->height;
 
 	/* special format has a special function */
-	return pop2decompress(binaryCrop(input,6,0),image->width,&(image->pix),&imageSizeInBytes); /* TODO: use tBinary */
+	return pop2decompress(binaryCrop(input,6,0),image->width,&(image->pix),&imageSizeInBytes);
 }
 
 /* Compress an image into binary data */
diff --git a/PR/src/lib/object/palette/pop2_256c.c b/PR/src/lib/object/palette/pop2_256c.c
index dd4fc29..139c701 100644
--- a/PR/src/lib/object/palette/pop2_256c.c
+++ b/PR/src/lib/object/palette/pop2_256c.c
@@ -63,13 +63,13 @@ void* objectPalettePop2_NColorsCreate(tBinary cont, int *error) {
 	}
 
 	r=(tGenericPalette*)malloc(sizeof(tGenericPalette));
-	r->colorArray=(tColor*)malloc(sizeof(tColor)*((cont.size+2)/3));
-	for (i=0,j=0;i<cont.size;i+=3,j++) {
-		r->colorArray[j].r=to8bits_B(cont.data[i+0]); /* TODO: use increase per line i++ */
-		r->colorArray[j].g=to8bits_B(cont.data[i+1]);
-		r->colorArray[j].b=to8bits_B(cont.data[i+2]);
+	r->colorArray=(tColor*)malloc(sizeof(tColor)*(cont.size/3));
+	for (i=0,j=0;i<(cont.size-2);j++) {
+		r->colorArray[j].r=to8bits_B(cont.data[i++]);
+		r->colorArray[j].g=to8bits_B(cont.data[i++]);
+		r->colorArray[j].b=to8bits_B(cont.data[i++]);
 	}
-	/*if (j!=256 && j!=320) return NULL; *TODO: add free */
+
 	r->size=j;
 printf("created a palette with %d colors. cs=%ld\n",j,cont.size);
 
diff --git a/PR/src/ports/winfiles/pr.dev b/PR/src/ports/winfiles/pr.dev
index 5831a63..c090ec7 100644
--- a/PR/src/ports/winfiles/pr.dev
+++ b/PR/src/ports/winfiles/pr.dev
@@ -933,7 +933,7 @@ BuildCmd=
 Major=1
 Minor=3
 Release=0
-Build=84
+Build=87
 LanguageID=2057
 CharsetID=1252
 CompanyName=Princed development team