git » fp-git.git » commit 58d8058

o Ported the source to other platforms

author ecalot
2003-10-22 16:53:37 UTC
committer ecalot
2003-10-22 16:53:37 UTC
parent 59f014ee68bf426d17d47d4d3264f4d354358ba0

o Ported the source to other platforms

PR/src/include/bitmap.h +1 -10
PR/src/include/bmp.h +1 -10
PR/src/include/common.h +3 -1
PR/src/include/compress.h +0 -8
PR/src/include/image.h +0 -8
PR/src/include/pal.h +0 -7
PR/src/include/png.h +1 -10
PR/src/include/pr.h +3 -1
PR/src/include/wav.h +1 -8
PR/src/lib/formats/Attic/bmp.c +11 -16
PR/src/lib/formats/Attic/mid.c +2 -0
PR/src/lib/formats/Attic/pal.c +7 -11
PR/src/lib/formats/Attic/wav.c +9 -19

diff --git a/PR/src/include/bitmap.h b/PR/src/include/bitmap.h
index 5310b89..4647154 100644
--- a/PR/src/include/bitmap.h
+++ b/PR/src/include/bitmap.h
@@ -1,16 +1,7 @@
 
 #ifndef _BMP_H_
 #define _BMP_H_
-/*
-#include <stdio.h>
-#if DIR_SEPARATOR=='/'
-#include "../pg.h"
-#include "../resources.h"
-#else
-#include "pg.h"
-#include "resources.h"
-#endif
-*/
+
 #include "resources.h"
 #include "compress.h"
 
diff --git a/PR/src/include/bmp.h b/PR/src/include/bmp.h
index 5310b89..4647154 100644
--- a/PR/src/include/bmp.h
+++ b/PR/src/include/bmp.h
@@ -1,16 +1,7 @@
 
 #ifndef _BMP_H_
 #define _BMP_H_
-/*
-#include <stdio.h>
-#if DIR_SEPARATOR=='/'
-#include "../pg.h"
-#include "../resources.h"
-#else
-#include "pg.h"
-#include "resources.h"
-#endif
-*/
+
 #include "resources.h"
 #include "compress.h"
 
diff --git a/PR/src/include/common.h b/PR/src/include/common.h
index 26c948a..fc61ccb 100644
--- a/PR/src/include/common.h
+++ b/PR/src/include/common.h
@@ -4,7 +4,9 @@
 //princed resource library
 
 //User configuration defines
-#define UNIX
+#ifndef WIN32
+ #define UNIX
+#endif
 //#define DLL
 #define PR_ABOUT "Princed resources (PR) V0.7\r\n(c) Copyright 2003 - Princed Development Team\r\nhttp://www.princed.com.ar\r\n\r\n"
 
diff --git a/PR/src/include/compress.h b/PR/src/include/compress.h
index d83c8f6..86bb540 100644
--- a/PR/src/include/compress.h
+++ b/PR/src/include/compress.h
@@ -45,13 +45,5 @@ private:
  tImage*        imageArray[256];
  int            imageArrayLength;
 
-*/
-/*
-#include <stdio.h>
-#include <stdlib.h>
-#include "pg.h"
-#include "formats/bmp.h"
-#include "formats/pal.h"
-#include "memory.h"
 */
 #endif
diff --git a/PR/src/include/image.h b/PR/src/include/image.h
index d83c8f6..86bb540 100644
--- a/PR/src/include/image.h
+++ b/PR/src/include/image.h
@@ -45,13 +45,5 @@ private:
  tImage*        imageArray[256];
  int            imageArrayLength;
 
-*/
-/*
-#include <stdio.h>
-#include <stdlib.h>
-#include "pg.h"
-#include "formats/bmp.h"
-#include "formats/pal.h"
-#include "memory.h"
 */
 #endif
diff --git a/PR/src/include/pal.h b/PR/src/include/pal.h
index fb74ae7..68b1316 100644
--- a/PR/src/include/pal.h
+++ b/PR/src/include/pal.h
@@ -5,13 +5,6 @@
 
 #ifndef _PAL_H_
 #define _PAL_H_
-/*
-#if DIR_SEPARATOR=='/'
-#include "../pg.h"
-#else
-#include "pg.h"
-#endif
-*/
 
 #include "compress.h"
 
diff --git a/PR/src/include/png.h b/PR/src/include/png.h
index 5310b89..4647154 100644
--- a/PR/src/include/png.h
+++ b/PR/src/include/png.h
@@ -1,16 +1,7 @@
 
 #ifndef _BMP_H_
 #define _BMP_H_
-/*
-#include <stdio.h>
-#if DIR_SEPARATOR=='/'
-#include "../pg.h"
-#include "../resources.h"
-#else
-#include "pg.h"
-#include "resources.h"
-#endif
-*/
+
 #include "resources.h"
 #include "compress.h"
 
diff --git a/PR/src/include/pr.h b/PR/src/include/pr.h
index 26c948a..fc61ccb 100644
--- a/PR/src/include/pr.h
+++ b/PR/src/include/pr.h
@@ -4,7 +4,9 @@
 //princed resource library
 
 //User configuration defines
-#define UNIX
+#ifndef WIN32
+ #define UNIX
+#endif
 //#define DLL
 #define PR_ABOUT "Princed resources (PR) V0.7\r\n(c) Copyright 2003 - Princed Development Team\r\nhttp://www.princed.com.ar\r\n\r\n"
 
diff --git a/PR/src/include/wav.h b/PR/src/include/wav.h
index c072ba1..670aca9 100644
--- a/PR/src/include/wav.h
+++ b/PR/src/include/wav.h
@@ -1,14 +1,7 @@
 
 #ifndef _WAV_H_
 #define _WAV_H_
-/*
-#include <stdio.h>
-#if DIR_SEPARATOR=='/'
-#include "../resources.h"
-#else
-#include "resources.h"
-#endif
-*/
+
 #include "resources.h"
 #include <stdio.h>
 
diff --git a/PR/src/lib/formats/Attic/bmp.c b/PR/src/lib/formats/Attic/bmp.c
index d3b1b84..685e347 100644
--- a/PR/src/lib/formats/Attic/bmp.c
+++ b/PR/src/lib/formats/Attic/bmp.c
@@ -1,10 +1,3 @@
-/*
-#if DIR_SEPARATOR=='/'
-#include "bmp.h"
-#else
-#include "formats/bmp.h"
-#endif
-*/
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -20,6 +13,7 @@ printf("ya expandi\n");
 		mWriteBitMap(image,vFileext);
 printf("Escribi el bitmap\n");
 		free(image.pix);
+printf("libere imagen\n");
 		return 1;
 	} else {
 		return 0;
@@ -40,7 +34,8 @@ char mFormatCompileBmp(unsigned char* data, FILE* fp, tResource *res) {
 	printf("llega ssss3\n");
 	mAddFileToDatFile(fp,aux,size);
 	printf("llega ssss4\n");
-	(*res).size=size; //TODO: delete this bug (added to debug ;) ironic, don't you think
+	(*res).size=size; //this was a bug (added to debug ;) ironic, don't you think?
+	/* Note: after the debugging we realized this line was missing so this is not a bug anymore*/
 	return 1;
 }
 
@@ -104,16 +99,16 @@ char mWriteBitMap(tImage img,char* vFile) {
 
 	//TODO: avoid using header array andwrite everithing in one run
 
-	header[2]=filesize;
-	header[3]=filesize>>8;
-	header[4]=filesize>>16;
-	header[5]=filesize>>24;
+	header[2]=(unsigned char)(filesize);
+	header[3]=(unsigned char)(filesize>>8);
+	header[4]=(unsigned char)(filesize>>16);
+	header[5]=(unsigned char)(filesize>>24);
 
-	header[18]=width;
-	header[19]=width>>8;
+	header[18]=(unsigned char)(width);
+	header[19]=(unsigned char)(width>>8);
 
-	header[22]=height;
-	header[23]=height>>8;
+	header[22]=(unsigned char)(height);
+	header[23]=(unsigned char)(height>>8);
 
 //BEGIN of format writing
 	//Write ColorTable
diff --git a/PR/src/lib/formats/Attic/mid.c b/PR/src/lib/formats/Attic/mid.c
index 3f703e7..37ca3e1 100644
--- a/PR/src/lib/formats/Attic/mid.c
+++ b/PR/src/lib/formats/Attic/mid.c
@@ -1,3 +1,5 @@
+#include "mid.h"
+#include "extract.h"
 
 char mFormatExtractMid(unsigned char* data, char *vFileext,unsigned long int size) {
 	//Ignore checksum & sound type
diff --git a/PR/src/lib/formats/Attic/pal.c b/PR/src/lib/formats/Attic/pal.c
index 4d8313a..487bd3f 100644
--- a/PR/src/lib/formats/Attic/pal.c
+++ b/PR/src/lib/formats/Attic/pal.c
@@ -1,10 +1,3 @@
-/*
-#if DIR_SEPARATOR=='/'
-#include "pal.h"
-#else
-#include "formats/pal.h"
-#endif
-*/
 
 #include <string.h>
 #include <stdlib.h>
@@ -27,17 +20,20 @@ char mFormatExtractPal(unsigned char** data, char *vFileext,unsigned long int si
 }
 
 char mImportPalette(unsigned char** data, unsigned short *size) {
-	//check size
-	if (*size<130) return 0;
 
 	//declare variables
 	unsigned char palh[]=PAL_HEADER;
 	unsigned char pals[]=PAL_SAMPLE;
-	unsigned char* pal=getMemory(100);
+	unsigned char* pal;
 	unsigned short int parsed;
 	int i=0;
 	int k=0;
 
+	//check size
+	if (*size<130) return 0;
+
+	pal=getMemory(100);
+
 	//set palette with sample
 	memcpy(pal,pals,100);
 
@@ -66,10 +62,10 @@ char mImportPalette(unsigned char** data, unsigned short *size) {
 void mExportPalette(unsigned char** data, unsigned long int *size) {
 	unsigned char* pal=getMemory(240);
 	unsigned char* aux=getMemory(240);
+	unsigned char i;
 
 	sprintf(pal,PAL_HEADER);
 
-	unsigned char i;
 	for (i=0;i<16;i++) {
 		sprintf(aux,pal);
 		sprintf(pal,"%s%d %d %d\r\n",aux,(*data)[(i*3)+5]<<2,(*data)[(i*3)+6]<<2,(*data)[(i*3)+7]<<2);
diff --git a/PR/src/lib/formats/Attic/wav.c b/PR/src/lib/formats/Attic/wav.c
index 4c75e29..bd99954 100644
--- a/PR/src/lib/formats/Attic/wav.c
+++ b/PR/src/lib/formats/Attic/wav.c
@@ -1,13 +1,3 @@
-/*
-#if DIR_SEPARATOR=='/'
-#include "wav.h"
-#include "../compile.h"
-#else
-#include "formats/wav.h"
-#include "compile.h"
-#endif
-*/
-
 #include "wav.h"
 #include "compile.h"
 
@@ -20,15 +10,15 @@ char mFormatExtractWav(unsigned char* data, char *vFileext,unsigned long int siz
 
 						size-=2;
 						ok=((target=fopen(vFileext,"wb"))!=NULL);
-						wav[4]=(size+36)&0xFF;
-						wav[5]=((size+36)>>8)&0xFF;
-						wav[6]=((size+36)>>16)&0xFF;
-						wav[7]=((size+36)>>24)&0xFF;
-
-						wav[40]=(size)&0xFF;
-						wav[41]=((size)>>8)&0xFF;
-						wav[42]=((size)>>16)&0xFF;
-						wav[43]=((size)>>24)&0xFF;
+						wav[4]=(unsigned char)((size+36)&0xFF);
+						wav[5]=(unsigned char)(((size+36)>>8)&0xFF);
+						wav[6]=(unsigned char)(((size+36)>>16)&0xFF);
+						wav[7]=(unsigned char)(((size+36)>>24)&0xFF);
+
+						wav[40]=(unsigned char)((size)&0xFF);
+						wav[41]=(unsigned char)(((size)>>8)&0xFF);
+						wav[42]=(unsigned char)(((size)>>16)&0xFF);
+						wav[43]=(unsigned char)(((size)>>24)&0xFF);
 						ok=ok&&fwrite(wav,sizeof(wav),1,target);
 						ok=ok&&fwrite(data+2,size-2,1,target);
 						ok=ok&&(!fclose(target));