git » fp-git.git » commit 9aa72a9

added return comments

author ecalot
2006-01-07 20:45:48 UTC
committer ecalot
2006-01-07 20:45:48 UTC
parent e0954d272e7e7a46f765c84bf4f3c7fc17c6a9a6

added return comments

PR/src/lib/formats/bmp.c +8 -8
PR/src/lib/formats/mid.c +1 -1
PR/src/lib/formats/pal.c +4 -4
PR/src/lib/formats/plv.c +5 -5
PR/src/lib/formats/wav.c +2 -2

diff --git a/PR/src/lib/formats/bmp.c b/PR/src/lib/formats/bmp.c
index 82a19d8..e71f0ce 100644
--- a/PR/src/lib/formats/bmp.c
+++ b/PR/src/lib/formats/bmp.c
@@ -57,26 +57,26 @@ int mFormatExportBmp(const unsigned char* data, const char *vFileext,unsigned lo
 	result=mExpandGraphic(data,&image,size);
 	if ((result==COMPRESS_RESULT_WARNING)&&hasFlag(verbose_flag))
 		fprintf(outputStream,PR_TEXT_EXPORT_BMP_WARN);
-	if (result==COMPRESS_RESULT_FATAL) return 0;
+	if (result==COMPRESS_RESULT_FATAL) return 0; /* false */
 
 	/* Write bitmap */
 	mWriteBitMap(image,vFileext,optionflag,backupExtension);
 
 	/* free bitmap */
 	free(image.pix);
-	return 1;
+	return 1; /* true */
 }
 
 int mFormatImportBmp(tResource *res) {
 	tImage img;
 
-	if (!mReadBitMap(&img,res->data,res->size)) return 0;
+	if (!mReadBitMap(&img,res->data,res->size)) return 0; /* false */
 	free(res->data);
 	mCompressGraphic(&(res->data),&img,(int*)&(res->size));
 	mWriteFileInDatFile(res);
 	free(img.pix);
 
-	return 1;
+	return 1; /* true */
 }
 
 int mWriteBitMap(tImage img,const char* vFile,int optionflag,const char* backupExtension) {
@@ -98,7 +98,7 @@ int mWriteBitMap(tImage img,const char* vFile,int optionflag,const char* backupE
 	FILE* bitmap;
 
 	/* open file */
-	if (!writeOpen(vFile,&bitmap,optionflag)) return 0;
+	if (!writeOpen(vFile,&bitmap,optionflag)) return 0; /* false */
 
 	/* initialize variables */
 	width=img.width;
@@ -151,7 +151,7 @@ int mWriteBitMap(tImage img,const char* vFile,int optionflag,const char* backupE
 	}
 
 	writeCloseOk(bitmap,optionflag,backupExtension);
-	return 1;
+	return 1; /* true */
 }
 
 int mReadBitMap(tImage* image,unsigned char* data, int size) {
@@ -196,7 +196,7 @@ int mReadBitMap(tImage* image,unsigned char* data, int size) {
 	/* if validations==wrong */
 	if (!ok) {
 		freeAllocation(image->pix);
-		return 0; /* this is not a valid bmp file format or memory too low */
+		return 0; /* false: this is not a valid bmp file format or memory too low */
 	}
 
 	/* Serialize bitmap-->raw array */
@@ -207,5 +207,5 @@ int mReadBitMap(tImage* image,unsigned char* data, int size) {
 			image->widthInBytes
 		);
 
-	return 1;
+	return 1; /* true */
 }
diff --git a/PR/src/lib/formats/mid.c b/PR/src/lib/formats/mid.c
index 45558e3..a0fc41f 100644
--- a/PR/src/lib/formats/mid.c
+++ b/PR/src/lib/formats/mid.c
@@ -54,5 +54,5 @@ int mFormatImportMid(tResource *res) {
 	free(res->data);
 	res->data=file;
 	mWriteFileInDatFile(res);
-	return 1;
+	return 1; /* true */
 }
diff --git a/PR/src/lib/formats/pal.c b/PR/src/lib/formats/pal.c
index 61c6a8b..05d965a 100644
--- a/PR/src/lib/formats/pal.c
+++ b/PR/src/lib/formats/pal.c
@@ -97,11 +97,11 @@ int mFormatImportPal(tResource *res,const char* vFile) {
 	int sample1;
 
 	/* check size */
-	if ((res->size)<130) return 0;
+	if ((res->size)<130) return 0; /* false */
 
 	/* verify jasc pal header */
 	while (palh[i]==(res->data)[i++]);
-	if (i!=sizeof(palh)) return 0; /* palette differs with headers */
+	if (i!=sizeof(palh)) return 0; /* false: palette differs with headers */
 
 	/* Read sample */
 	sprintf(aux,"%s.more",vFile);
@@ -125,7 +125,7 @@ int mFormatImportPal(tResource *res,const char* vFile) {
 	/* set current values */
 	data2=strtok((char*)(res->data)+sizeof(palh)-1,enter);
 	while (k--) {
-		if (!sscanf(data2,"%d %d %d",&r,&g,&b)) return 0;
+		if (!sscanf(data2,"%d %d %d",&r,&g,&b)) return 0; /* false */
 		/* Those lines mean a loss of data (palette colors are saved in the nearest multiple of 4) */
 		*(pal2++)=(unsigned char)((r+2)>>2);
 		*(pal2++)=(unsigned char)((g+2)>>2);
@@ -139,6 +139,6 @@ int mFormatImportPal(tResource *res,const char* vFile) {
 	res->data=pal;
 	mWriteFileInDatFile(res);
 
-	return 1;
+	return 1; /* true */
 }
 
diff --git a/PR/src/lib/formats/plv.c b/PR/src/lib/formats/plv.c
index 7f8e91c..0a6dadb 100644
--- a/PR/src/lib/formats/plv.c
+++ b/PR/src/lib/formats/plv.c
@@ -172,8 +172,8 @@ int mFormatImportPlv(tResource *res) {
 	unsigned long int oldSize=res->size;
 
 	/* integrity check 1 */
-	if (oldSize<=PLV_HEADER_A_SIZE+1+PLV_HEADER_B_SIZE) return 0;
-	if (memcmp(res->data,PLV_HEADER_A,PLV_HEADER_A_SIZE)) return 0;
+	if (oldSize<=PLV_HEADER_A_SIZE+1+PLV_HEADER_B_SIZE) return 0; /* false */
+	if (memcmp(res->data,PLV_HEADER_A,PLV_HEADER_A_SIZE)) return 0; /* false */
 
 	/* jump to size */
 	pos=res->data+PLV_HEADER_A_SIZE+1+PLV_HEADER_B_SIZE;
@@ -182,7 +182,7 @@ int mFormatImportPlv(tResource *res) {
 	res->size=array2long(pos);pos+=4;
 
 	/* integrity check 2 */
-	if (oldSize<=PLV_HEADER_A_SIZE+1+PLV_HEADER_B_SIZE+res->size) return 0;
+	if (oldSize<=PLV_HEADER_A_SIZE+1+PLV_HEADER_B_SIZE+res->size) return 0; /* false */
 
 	/* validate checksum */
 	if (!checkSum(pos,res->size))
@@ -193,6 +193,6 @@ int mFormatImportPlv(tResource *res) {
 	res->data=pos;
 	mWriteFileInDatFileIgnoreChecksum(res);
 	res->data=posAux;
-	
-	return 1;
+
+	return 1; /* true */
 }
diff --git a/PR/src/lib/formats/wav.c b/PR/src/lib/formats/wav.c
index 4deddc1..fc37373 100644
--- a/PR/src/lib/formats/wav.c
+++ b/PR/src/lib/formats/wav.c
@@ -66,13 +66,13 @@ int mFormatImportWav(tResource *res) {
 	int i=sizeof(wav);
 	unsigned char* posAux=res->data;
 
-	if (res->size<=i) return 0;
+	if (res->size<=i) return 0; /* false */
 	res->size-=(--i);
 	while ((i==4||i==5||i==6||i==7||i==40||i==41||i==42||i==43||((res->data)[i]==wav[i]))&&(i--));
 	(res->data)[sizeof(wav)-1]=1; /* First character must be a 0x01 (wav type in dat) */
 	res->data+=sizeof(wav)-1;
 	if (i==-1) mWriteFileInDatFile(res);
 	res->data=posAux;
-	return 1;
+	return 1; /* true */
 }