author | ecalot
<ecalot> 2006-02-19 15:37:37 UTC |
committer | ecalot
<ecalot> 2006-02-19 15:37:37 UTC |
parent | 0d9d75d48d3b2454a33615bedb931e3bfa5bec58 |
PR/src/include/disk.h | +1 | -1 |
PR/src/include/other.h | +1 | -0 |
PR/src/lib/formats/pal.c | +2 | -2 |
PR/src/lib/layers/disk.c | +1 | -1 |
PR/src/lib/object/object.c | +6 | -5 |
PR/src/lib/object/other/binary.c | +5 | -1 |
diff --git a/PR/src/include/disk.h b/PR/src/include/disk.h index 5e6ee44..3f1097c 100644 --- a/PR/src/include/disk.h +++ b/PR/src/include/disk.h @@ -60,7 +60,7 @@ typedef enum {eFile,eDirectory,eNotFound}whatIs; #define isDirSep(a,i) ((a[i]=='\\')||(a[i]=='/')) #define writeCloseOk(a,b,c) writeClose(a,0,b,c) -int writeData (const unsigned char* data, int ignoreChars, char* vFileext, int size, int optionflag,const char* backupExtension); +int writeData (const unsigned char* data, int ignoreChars, const char* vFileext, int size, int optionflag,const char* backupExtension); int writeOpen (const char* vFileext, FILE* *fp, int optionflag); int writeClose (FILE* fp,int dontSave,int optionflag,const char* backupExtension); int mLoadFileArray(const char* vFile,unsigned char** array); diff --git a/PR/src/include/other.h b/PR/src/include/other.h index 5384e9e..a719ef6 100644 --- a/PR/src/include/other.h +++ b/PR/src/include/other.h @@ -34,5 +34,6 @@ other.h: Princed Resources : #define _OTHER_H_ void* objBinaryCreate(unsigned char* data, int size, int *error); +int objBinaryWrite(void* o, const char* file, int optionflag, const char* backupExtension); #endif diff --git a/PR/src/lib/formats/pal.c b/PR/src/lib/formats/pal.c index 60e8515..a3e9c58 100644 --- a/PR/src/lib/formats/pal.c +++ b/PR/src/lib/formats/pal.c @@ -51,7 +51,7 @@ int writePal(const char* file, int colors, const tColor* colorArray, int optionf FILE* fd; /* open file */ - if (!writeOpen(file,&fd,optionflag)) return 0; /* false */ + if (!writeOpen(file,&fd,optionflag)) return PR_RESULT_ERR_FILE_NOT_WRITE_ACCESS; fprintf(fd,"JASC-PAL\r\n%04d\r\n%d\r\n",100,colors); for (i=0;i<colors;i++) { @@ -65,7 +65,7 @@ int writePal(const char* file, int colors, const tColor* colorArray, int optionf /* save JASC palette */ writeCloseOk(fd,optionflag,backupExtension); - return i; + return PR_RESULT_SUCCESS; } int mFormatImportPal(tPalette* p, int* bits, const char* vFile) { diff --git a/PR/src/lib/layers/disk.c b/PR/src/lib/layers/disk.c index a2c7791..f5c526c 100644 --- a/PR/src/lib/layers/disk.c +++ b/PR/src/lib/layers/disk.c @@ -367,7 +367,7 @@ int writeOpen(const char* vFileext, FILE* *fp, int optionflag) { } #endif -int writeData(const unsigned char* data, int ignoreChars, char* vFileext, int size, int optionflag,const char* backupExtension) { +int writeData(const unsigned char* data, int ignoreChars, const char* vFileext, int size, int optionflag,const char* backupExtension) { /* Creates vFileext and saves data in it. In case the directory doesn't exist it will be created. diff --git a/PR/src/lib/object/object.c b/PR/src/lib/object/object.c index 3758503..193c894 100644 --- a/PR/src/lib/object/object.c +++ b/PR/src/lib/object/object.c @@ -30,13 +30,14 @@ main.c: Princed Resources : Main item class implementation DO NOT remove this copyright notice */ +#include "common.h" #include "object.h" #include "reslist.h" -#include "common.h" -#include "other.h" #include "image.h" +#include "other.h" #include "palette.h" +#include "sound.h" tObject getObject(tResource* r, int* error) { tObject o; @@ -61,13 +62,13 @@ tObject getObject(tResource* r, int* error) { o.obj=objPalette_pop1_4bitsCreate(r->data,r->size,error); break; case eResTypePcspeaker: /* save pcs file */ - /*o.obj=objPcspeakerCreate(r->data,r->size,error); */ + o.obj=objPcspeakerCreate(r->data,r->size,error); break; case eResTypeMidi: /* save midi file */ - /*o.obj=objMidiCreate(r->data,r->size,error); */ + o.obj=objMidiCreate(r->data,r->size,error); break; case eResTypeWave: /* save wav file */ - /*o.obj=objWaveCreate(r->data,r->size,error); */ + o.obj=objWaveCreate(r->data,r->size,error); break; case eResTypeImage: /* save image */ o.obj=objImageCreate(r->data,r->size,r->palette,error); diff --git a/PR/src/lib/object/other/binary.c b/PR/src/lib/object/other/binary.c index 6aa22a4..fbe136b 100644 --- a/PR/src/lib/object/other/binary.c +++ b/PR/src/lib/object/other/binary.c @@ -37,6 +37,7 @@ #include "binary.h" /* tBinary */ #include "common.h" +#include "disk.h" /* we are skiping the format layer here */ #include <stdlib.h> /***************************************************************\ @@ -53,5 +54,8 @@ void* objBinaryCreate(unsigned char* data, int size, int *error) { /* use get li return (void*)r; } - +int objBinaryWrite(void* o, const char* file, int optionflag, const char* backupExtension) { + tBinary* b=o; + return writeData(b->data,1,file,b->size,optionflag,backupExtension)?PR_RESULT_SUCCESS:PR_RESULT_ERR_FILE_NOT_WRITE_ACCESS; +}