author | ecalot
<ecalot> 2006-07-17 02:49:53 UTC |
committer | ecalot
<ecalot> 2006-07-17 02:49:53 UTC |
parent | fe866bdf98704d59238acdbe754f04852d4ae642 |
PR/src/console/filedir.c | +3 | -3 |
PR/src/include/common.h | +34 | -33 |
PR/src/lib/actions/classify.c | +2 | -2 |
PR/src/lib/actions/export.c | +3 | -3 |
PR/src/lib/actions/import.c | +3 | -3 |
PR/src/lib/compression/rle_decompress.c | +2 | -2 |
PR/src/lib/compression/rlev_decompress.c | +1 | -1 |
PR/src/lib/formats/bmp.c | +3 | -3 |
PR/src/lib/formats/mid.c | +1 | -1 |
PR/src/lib/formats/pal.c | +2 | -2 |
PR/src/lib/formats/plv.c | +4 | -4 |
PR/src/lib/formats/wav.c | +4 | -4 |
PR/src/lib/layers/dat.c | +16 | -16 |
PR/src/lib/layers/disk.c | +4 | -4 |
PR/src/lib/layers/idlist.c | +2 | -2 |
PR/src/lib/layers/resourcematch.c | +4 | -4 |
PR/src/lib/object/image/image16.c | +2 | -2 |
PR/src/lib/object/image/image2.c | +2 | -2 |
PR/src/lib/object/image/image256.c | +5 | -5 |
PR/src/lib/object/image/image_common.c | +7 | -7 |
PR/src/lib/object/other/binary.c | +1 | -1 |
PR/src/lib/object/palette/pop1_16c.c | +4 | -4 |
PR/src/lib/object/palette/pop2_256c.c | +2 | -2 |
PR/src/lib/object/sound/sound_common.c | +3 | -3 |
PR/src/lib/pr.c | +2 | -2 |
PR/src/lib/xml/parse.c | +26 | -26 |
PR/src/lib/xml/tree.c | +1 | -1 |
PR/src/lib/xml/unknown.c | +4 | -4 |
diff --git a/PR/src/console/filedir.c b/PR/src/console/filedir.c index c6d7913..6730c9c 100644 --- a/PR/src/console/filedir.c +++ b/PR/src/console/filedir.c @@ -232,10 +232,10 @@ int fd_GetFilesImport(tFileDir2* list1,tFileDir2* files,const char* resfile,int if (dirs>1) { while ((file=filedir_pop(&(files->filenames)))) free(file); /* empty list */ - return PR_RESULT_FD_IMPORT_FROM_MORE_THAN_ONE_DIR; + return PR_RESULT_F_FD_IMPORT_FROM_MORE_THAN_ONE_DIR; } if (!fils&&!dirs) - return PR_RESULT_FD_NO_FILES_SELECTED; /* no files selected */ + return PR_RESULT_F_FD_NO_FILES_SELECTED; /* no files selected */ if (parseError) { while ((file=filedir_pop(&(files->filenames)))) free(file); /* empty list */ @@ -322,7 +322,7 @@ int fileDirGetFiles(tFileDir2* list1,tFileDir2* files,int hasExportFlag,int notH free(filedir_pop(&(list1->options))); free(file); } - return PR_RESULT_FD_IMPORT_RECURSIVE; /* import with recursive flag is not allowed */ + return PR_RESULT_F_FD_IMPORT_RECURSIVE; /* import with recursive flag is not allowed */ } if (hasExportFlag) diff --git a/PR/src/include/common.h b/PR/src/include/common.h index 4dec51e..b1dcc31 100644 --- a/PR/src/include/common.h +++ b/PR/src/include/common.h @@ -204,41 +204,42 @@ PARSING_OPTRAW\ #define hasFlag(a) (optionflag&(a)) #define setFlag(a) optionflag|=(a) -#define PR_RESULT_CHECKSUM_ERROR -24 -#define PR_RESULT_COMPRESS_RESULT_FATAL -26 -#define PR_RESULT_COMPRESS_RESULT_WARNING -27 -#define PR_RESULT_ERR_BMP_BITRATE_DIFFERS -31 -#define PR_RESULT_ERR_COMMAND_LINE_SYNTAX -17 -#define PR_RESULT_ERR_EXTRACTION -18 -#define PR_RESULT_ERR_FILE_DAT_NOT_OPEN_NOTFOUND -2 -#define PR_RESULT_ERR_FILE_DAT_NOT_OPEN_WASDIR -3 -#define PR_RESULT_ERR_FILE_DAT_NOT_READ_ACCESS -4 -#define PR_RESULT_ERR_FILE_DAT_NOT_WRITE_ACCESS -5 -#define PR_RESULT_ERR_FILE_NOT_OPEN_NOTFOUND -6 -#define PR_RESULT_ERR_FILE_NOT_OPEN_WASDIR -7 -#define PR_RESULT_ERR_FILE_NOT_READ_ACCESS -8 -#define PR_RESULT_ERR_FILE_NOT_WRITE_ACCESS -9 -#define PR_RESULT_ERR_INVALID_DAT -10 -#define PR_RESULT_ERR_MEMORY -11 -#define PR_RESULT_ERR_WRONG_PRIMITIVE_CALL -19 -#define PR_RESULT_ERR_XML_ALREADY_OPEN -15 -#define PR_RESULT_ERR_XML_ATTR -12 -#define PR_RESULT_ERR_XML_FILE -13 -#define PR_RESULT_ERR_XML_NOT_OPEN -16 -#define PR_RESULT_ERR_XML_PARSING -14 -#define PR_RESULT_FD_IMPORT_FROM_MORE_THAN_ONE_DIR -20 -#define PR_RESULT_FD_IMPORT_RECURSIVE -21 -#define PR_RESULT_FD_NO_FILES_SELECTED -22 +#define PR_RESULT_F_BMP_BITRATE_DIFFERS -31 +#define PR_RESULT_F_COMMAND_LINE_SYNTAX -17 +#define PR_RESULT_F_EXTRACTION -18 +#define PR_RESULT_F_FILE_DAT_NOT_OPEN_NOTFOUND -2 +#define PR_RESULT_F_FILE_DAT_NOT_OPEN_WASDIR -3 +#define PR_RESULT_F_FILE_DAT_NOT_READ_ACCESS -4 +#define PR_RESULT_F_FILE_DAT_NOT_WRITE_ACCESS -5 +#define PR_RESULT_F_FILE_NOT_OPEN_NOTFOUND -6 +#define PR_RESULT_F_FILE_NOT_OPEN_WASDIR -7 +#define PR_RESULT_F_FILE_NOT_READ_ACCESS -8 +#define PR_RESULT_F_FILE_NOT_WRITE_ACCESS -9 +#define PR_RESULT_F_INVALID_DAT -10 +#define PR_RESULT_F_MEMORY -11 +#define PR_RESULT_F_WRONG_PRIMITIVE_CALL -19 +#define PR_RESULT_F_XML_ALREADY_OPEN -15 +#define PR_RESULT_F_XML_ATTR -12 +#define PR_RESULT_F_XML_FILE -13 +#define PR_RESULT_F_XML_NOT_OPEN -16 +#define PR_RESULT_F_XML_PARSING -14 +#define PR_RESULT_F_COMPRESS_RESULT_FATAL -26 +#define PR_RESULT_F_FD_IMPORT_FROM_MORE_THAN_ONE_DIR -20 +#define PR_RESULT_F_FD_IMPORT_RECURSIVE -21 +#define PR_RESULT_F_FD_NO_FILES_SELECTED -22 +#define PR_RESULT_F_INDEX_NOT_FOUND -23 +#define PR_RESULT_F_MID_WRONG_FILE_FORMAT -34 +#define PR_RESULT_F_PAL_UNSUPPORTED_SIZE -32 +#define PR_RESULT_F_PLV_WRONG_FILE_FORMAT -33 +#define PR_RESULT_F_POP1_PALETTE_EXPECTED -35; +#define PR_RESULT_F_WAV_UNSUPPORTED_BITRATE -28 +#define PR_RESULT_F_WAV_UNSUPPORTED_SAMPLERATE -29 +#define PR_RESULT_F_WAV_UNSUPPORTED_STEREO -30 +#define PR_RESULT_F_XML_AND_DAT_FORMAT_DO_NOT_MATCH -25 #define PR_RESULT_HELP_SHOWN -1 -#define PR_RESULT_INDEX_NOT_FOUND -23 -#define PR_RESULT_PAL_UNSUPPORTED -32 #define PR_RESULT_SUCCESS 0 -#define PR_RESULT_WAV_UNSUPPORTED_BITRATE -28 -#define PR_RESULT_WAV_UNSUPPORTED_SAMPLERATE -29 -#define PR_RESULT_WAV_UNSUPPORTED_STEREO -30 -#define PR_RESULT_PLV_WRONG_FILE_FORMAT -33 -#define PR_RESULT_MID_WRONG_FILE_FORMAT -34 -#define PR_RESULT_XML_AND_DAT_FORMAT_DO_NOT_MATCH -25 +#define PR_RESULT_W_CHECKSUM_ERROR -24 +#define PR_RESULT_W_COMPRESS_RESULT_WARNING -27 #endif diff --git a/PR/src/lib/actions/classify.c b/PR/src/lib/actions/classify.c index 9c02791..8fe9bd2 100644 --- a/PR/src/lib/actions/classify.c +++ b/PR/src/lib/actions/classify.c @@ -43,7 +43,7 @@ classify.c: Princed Resources : File classify routines | Get the type of a DAT file | \***************************************************************/ -#define READ_ERROR {mReadCloseDatFile();return PR_RESULT_ERR_INVALID_DAT;} +#define READ_ERROR {mReadCloseDatFile();return PR_RESULT_F_INVALID_DAT;} int prClassifyDat(const char* vFiledat) { int indexNumber; @@ -62,7 +62,7 @@ int prClassifyDat(const char* vFiledat) { for (indexNumber=0;(indexNumber<numberOfItems)&&(type==eResTypeOtherBinary);indexNumber++) { int ok; ok=mReadFileInDatFile(&res,indexNumber); - if (ok==PR_RESULT_INDEX_NOT_FOUND) READ_ERROR; /* Read error */ + if (ok==PR_RESULT_F_INDEX_NOT_FOUND) READ_ERROR; /* Read error */ /*if (ok==PR_RESULT_CHECKSUM_ERROR) fprintf(outputStream,"Warning: Checksum error\n"); Warning TODO: add an output for the checksum warning */ if (res.id.value==0xFFFF) continue; /* Tammo Jan Bug fix */ type=verifyHeader(res.content); diff --git a/PR/src/lib/actions/export.c b/PR/src/lib/actions/export.c index 311c39d..b45f044 100644 --- a/PR/src/lib/actions/export.c +++ b/PR/src/lib/actions/export.c @@ -90,8 +90,8 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti /* main loop */ for (indexNumber=0;ok&&(indexNumber<numberOfItems);indexNumber++) { int ok2=mReadFileInDatFile(&res,indexNumber); - if (ok2==PR_RESULT_INDEX_NOT_FOUND) return PR_RESULT_ERR_INVALID_DAT; /* Read error */ - if (ok2==PR_RESULT_CHECKSUM_ERROR) fprintf(outputStream,"Warning: Checksum error\n"); /* Warning */ + if (ok2==PR_RESULT_F_INDEX_NOT_FOUND) return PR_RESULT_F_INVALID_DAT; /* Read error */ + if (ok2==PR_RESULT_W_CHECKSUM_ERROR) fprintf(outputStream,"Warning: Checksum error\n"); /* Warning */ if (res.id.value==0xFFFF) continue; /* Tammo Jan Bug fix */ /* add to res more information from the resource list */ resourceListAddInfo(r,&res); @@ -183,6 +183,6 @@ showobj(pal); /*pl_free(&paletteBuffer);*/ /* Close unknownXML */ - return ok?count:PR_RESULT_ERR_EXTRACTION; + return ok?count:PR_RESULT_F_EXTRACTION; } diff --git a/PR/src/lib/actions/import.c b/PR/src/lib/actions/import.c index b4f65f6..6c1a63c 100644 --- a/PR/src/lib/actions/import.c +++ b/PR/src/lib/actions/import.c @@ -67,7 +67,7 @@ int import_full(const char* vFiledat, const char* vDirExt, tResourceList* r, int const tResource* res; tResource newRes; - if (mWriteBeginDatFile(vFiledat,optionflag)) return PR_RESULT_ERR_FILE_DAT_NOT_WRITE_ACCESS; /* File couldn't be open */ + if (mWriteBeginDatFile(vFiledat,optionflag)) return PR_RESULT_F_FILE_DAT_NOT_WRITE_ACCESS; /* File couldn't be open */ list_firstCursor(r); while ((res=list_getCursor(r))) { @@ -136,8 +136,8 @@ int import_partial(const char* vFiledat, const char* vDirExt, tResourceList* r, for (indexNumber=0;(indexNumber<numberOfItems);indexNumber++) { int readResult; readResult=mReadFileInDatFile(&res,indexNumber); - if (readResult==PR_RESULT_INDEX_NOT_FOUND) return PR_RESULT_ERR_INVALID_DAT; /* Read error */ - if (readResult==PR_RESULT_CHECKSUM_ERROR) fprintf(outputStream,"Warning: Ignoring checksum error\n"); /* Warning */ + if (readResult==PR_RESULT_F_INDEX_NOT_FOUND) return PR_RESULT_F_INVALID_DAT; /* Read error */ + if (readResult==PR_RESULT_W_CHECKSUM_ERROR) fprintf(outputStream,"Warning: Ignoring checksum error\n"); /* Warning */ if (res.id.value==0xFFFF) continue; /* Tammo Jan Bug fix */ diff --git a/PR/src/lib/compression/rle_decompress.c b/PR/src/lib/compression/rle_decompress.c index 1ce09f0..55ec1ff 100644 --- a/PR/src/lib/compression/rle_decompress.c +++ b/PR/src/lib/compression/rle_decompress.c @@ -43,7 +43,7 @@ int expandRle(tBinary input, unsigned char** output, int *outputSize) { int iCursor=0; /* reserve memory */ - if ((*output=malloc(40000))==NULL) return PR_RESULT_COMPRESS_RESULT_FATAL; + if ((*output=malloc(40000))==NULL) return PR_RESULT_F_COMPRESS_RESULT_FATAL; /* main loop */ while (iCursor<input.size) { @@ -60,5 +60,5 @@ int expandRle(tBinary input, unsigned char** output, int *outputSize) { } *outputSize=oCursor; - return (rep==1)?PR_RESULT_SUCCESS:PR_RESULT_COMPRESS_RESULT_WARNING; + return (rep==1)?PR_RESULT_SUCCESS:PR_RESULT_W_COMPRESS_RESULT_WARNING; } diff --git a/PR/src/lib/compression/rlev_decompress.c b/PR/src/lib/compression/rlev_decompress.c index fd67828..fef7863 100644 --- a/PR/src/lib/compression/rlev_decompress.c +++ b/PR/src/lib/compression/rlev_decompress.c @@ -60,5 +60,5 @@ int expandRleV(tBinary input, unsigned char* output, int *outputSize) { } *outputSize=oCursor; - return (rep==255)?PR_RESULT_SUCCESS:PR_RESULT_COMPRESS_RESULT_WARNING; + return (rep==255)?PR_RESULT_SUCCESS:PR_RESULT_W_COMPRESS_RESULT_WARNING; } diff --git a/PR/src/lib/formats/bmp.c b/PR/src/lib/formats/bmp.c index f790e46..a66d02b 100644 --- a/PR/src/lib/formats/bmp.c +++ b/PR/src/lib/formats/bmp.c @@ -61,7 +61,7 @@ int mWriteBmp(const char* file,const unsigned char* data, int w, int h, int bits FILE* bitmap; /* open file */ - if (!writeOpen(file,&bitmap,optionflag)) return PR_RESULT_ERR_FILE_NOT_WRITE_ACCESS; + if (!writeOpen(file,&bitmap,optionflag)) return PR_RESULT_F_FILE_NOT_WRITE_ACCESS; /* initialize variables */ /* width=img.width; @@ -127,7 +127,7 @@ int readBmp(const char* file, unsigned char** data, int *ph, int *pw, int *pbit unsigned short int width=0; bitmap=fopen(file,"rb"); - if (!bitmap) return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; + if (!bitmap) return PR_RESULT_F_FILE_NOT_READ_ACCESS; /* Read headers */ /* file header */ @@ -226,7 +226,7 @@ int readBmp(const char* file, unsigned char** data, int *ph, int *pw, int *pbit if (!ok) { free(*colorArray); free(*data); - return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; /* TODO: use a bad format code */ + return PR_RESULT_F_FILE_NOT_READ_ACCESS; /* TODO: use a bad format code */ } *pbits = bits; diff --git a/PR/src/lib/formats/mid.c b/PR/src/lib/formats/mid.c index 066f3df..cad2a08 100644 --- a/PR/src/lib/formats/mid.c +++ b/PR/src/lib/formats/mid.c @@ -41,7 +41,7 @@ mid.c: Princed Resources : MIDI files support int writeMid(const char* file, tBinary* snd, int optionflag, const char* backupExtension) { /* Mid files are saved as raw */ - return writeData(snd->data,0,file,snd->size,optionflag,backupExtension)?PR_RESULT_SUCCESS:PR_RESULT_ERR_FILE_NOT_WRITE_ACCESS; + return writeData(snd->data,0,file,snd->size,optionflag,backupExtension)?PR_RESULT_SUCCESS:PR_RESULT_F_FILE_NOT_WRITE_ACCESS; } #if 0 int mFormatImportMid(tResource *res) { diff --git a/PR/src/lib/formats/pal.c b/PR/src/lib/formats/pal.c index a5f1d69..52f3fdc 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 PR_RESULT_ERR_FILE_NOT_WRITE_ACCESS; + if (!writeOpen(file,&fd,optionflag)) return PR_RESULT_F_FILE_NOT_WRITE_ACCESS; fprintf(fd,"JASC-PAL\r\n0100\r\n%d\r\n",colors); for (i=0;i<colors;i++) { @@ -76,7 +76,7 @@ int readPal(const char* file,tColor* *colorArray,int *colors) { int b; fd=fopen(file,"rb"); - if (!fd) return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; + if (!fd) return PR_RESULT_F_FILE_NOT_READ_ACCESS; /* TODO: do the reading */ if (fscanf(fd,"JASC-PAL\n0100\n%d\n",colors)!=1) diff --git a/PR/src/lib/formats/plv.c b/PR/src/lib/formats/plv.c index 76c1847..ef330bf 100644 --- a/PR/src/lib/formats/plv.c +++ b/PR/src/lib/formats/plv.c @@ -167,7 +167,7 @@ int writePlv(const char* file, tBinary content, int popversion, const char* datf /* Close file and return */ ok=ok&&(!writeCloseOk(target,optionflag,backupExtension)); - return ok?PR_RESULT_SUCCESS:PR_RESULT_ERR_FILE_NOT_WRITE_ACCESS; + return ok?PR_RESULT_SUCCESS:PR_RESULT_F_FILE_NOT_WRITE_ACCESS; } extern FILE* outputStream; @@ -202,7 +202,7 @@ int readPlv(const char* file, tBinary* content, int *number, char** datfile, cha content->size=0; fd=fopen(file,"rb"); - if (!fd) return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; + if (!fd) return PR_RESULT_F_FILE_NOT_READ_ACCESS; /* Read headers */ ok=fread(magic,PLV_HEADER_MAGIC_SIZE,1,fd); @@ -220,7 +220,7 @@ int readPlv(const char* file, tBinary* content, int *number, char** datfile, cha /* Check data */ if (!ok) { fclose(fd); - return PR_RESULT_PLV_WRONG_FILE_FORMAT; + return PR_RESULT_F_PLV_WRONG_FILE_FORMAT; } /* Read data */ @@ -247,7 +247,7 @@ int readPlv(const char* file, tBinary* content, int *number, char** datfile, cha content->isCopy=1; content->data=NULL; content->size=0; - return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; /* TODO: use a bad format code */ + return PR_RESULT_F_FILE_NOT_READ_ACCESS; /* TODO: use a bad format code */ } diff --git a/PR/src/lib/formats/wav.c b/PR/src/lib/formats/wav.c index 673c064..ffaf903 100644 --- a/PR/src/lib/formats/wav.c +++ b/PR/src/lib/formats/wav.c @@ -59,7 +59,7 @@ int writeWav(const char* file, tBinary* snd, int optionflag, const char* backupE ok=ok&&fwrite(snd->data,snd->size,1,target); ok=ok&&(!writeCloseOk(target,optionflag,backupExtension)); - return ok?PR_RESULT_SUCCESS:PR_RESULT_ERR_FILE_NOT_WRITE_ACCESS; + return ok?PR_RESULT_SUCCESS:PR_RESULT_F_FILE_NOT_WRITE_ACCESS; } int readWav(const char* file, tBinary* snd, int *pchannels, long *psamplerate, long *pbps) { @@ -79,7 +79,7 @@ int readWav(const char* file, tBinary* snd, int *pchannels, long *psamplerate, l snd->isCopy=1; fd=fopen(file,"rb"); - if (!fd) return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; + if (!fd) return PR_RESULT_F_FILE_NOT_READ_ACCESS; /* Read headers */ ok=fread(magic,4,1,fd); @@ -117,7 +117,7 @@ int readWav(const char* file, tBinary* snd, int *pchannels, long *psamplerate, l fclose(fd); } else { fclose(fd); - return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; /* TODO: use a bad format code */ + return PR_RESULT_F_FILE_NOT_READ_ACCESS; /* TODO: use a bad format code */ } /* TODO: check eof */ @@ -137,7 +137,7 @@ int readWav(const char* file, tBinary* snd, int *pchannels, long *psamplerate, l if (!ok) { free(snd->data); - return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; /* TODO: use a bad format code */ + return PR_RESULT_F_FILE_NOT_READ_ACCESS; /* TODO: use a bad format code */ } *pchannels = NumChannels; diff --git a/PR/src/lib/layers/dat.c b/PR/src/lib/layers/dat.c index eee44ee..ada6f2f 100644 --- a/PR/src/lib/layers/dat.c +++ b/PR/src/lib/layers/dat.c @@ -444,21 +444,21 @@ int mReadBeginDatFile(unsigned short int *numberOfItems,const char* vFiledat){ readDatFile=mLoadFileArray(vFiledat); if (readDatFile.size<=0) { switch (readDatFile.size) { - case PR_RESULT_ERR_FILE_NOT_READ_ACCESS: - return PR_RESULT_ERR_FILE_DAT_NOT_READ_ACCESS; - case PR_RESULT_ERR_FILE_NOT_OPEN_WASDIR: - return PR_RESULT_ERR_FILE_DAT_NOT_OPEN_WASDIR; - case PR_RESULT_ERR_FILE_NOT_OPEN_NOTFOUND: - return PR_RESULT_ERR_FILE_DAT_NOT_OPEN_NOTFOUND; + case PR_RESULT_F_FILE_NOT_READ_ACCESS: + return PR_RESULT_F_FILE_DAT_NOT_READ_ACCESS; + case PR_RESULT_F_FILE_NOT_OPEN_WASDIR: + return PR_RESULT_F_FILE_DAT_NOT_OPEN_WASDIR; + case PR_RESULT_F_FILE_NOT_OPEN_NOTFOUND: + return PR_RESULT_F_FILE_DAT_NOT_OPEN_NOTFOUND; case PR_RESULT_SUCCESS: - return PR_RESULT_ERR_INVALID_DAT; + return PR_RESULT_F_INVALID_DAT; default: return readDatFile.size; } } if (readDatFile.size<=6) { free(readDatFile.data); - return PR_RESULT_ERR_INVALID_DAT; + return PR_RESULT_F_INVALID_DAT; } /* read header */ @@ -468,26 +468,26 @@ int mReadBeginDatFile(unsigned short int *numberOfItems,const char* vFiledat){ /* verify DAT format: the index offset belongs to the file and the file size is the index size plus the index offset */ if ((indexOffset>readDatFile.size)&&((indexOffset+indexSize)!=readDatFile.size)) { free(readDatFile.data); - return PR_RESULT_ERR_INVALID_DAT; /* this is not a valid prince DAT file */ + return PR_RESULT_F_INVALID_DAT; /* this is not a valid prince DAT file */ } /* create cursor */ readIndexCursor=dat_createCursor(readDatFile.data+indexOffset,indexSize,numberOfItems); /* pop version check */ - if (!dat_readCursorGetVersion(readIndexCursor)) return PR_RESULT_ERR_INVALID_DAT; + if (!dat_readCursorGetVersion(readIndexCursor)) return PR_RESULT_F_INVALID_DAT; return PR_RESULT_SUCCESS; } int mReadFileInDatFileId(tResource* res) { - if (!dat_cursorMoveId(&readIndexCursor,res->id)) return PR_RESULT_INDEX_NOT_FOUND; /* false means index not found */ - return dat_readRes(res,readIndexCursor)?PR_RESULT_SUCCESS:PR_RESULT_CHECKSUM_ERROR; /* depending on the checksum */ + if (!dat_cursorMoveId(&readIndexCursor,res->id)) return PR_RESULT_F_INDEX_NOT_FOUND; /* false means index not found */ + return dat_readRes(res,readIndexCursor)?PR_RESULT_SUCCESS:PR_RESULT_W_CHECKSUM_ERROR; /* depending on the checksum */ } int mReadFileInDatFile(tResource* res, int k) { - if (!dat_cursorMove(&readIndexCursor,k)) return PR_RESULT_INDEX_NOT_FOUND; /* false means out of range */ - return dat_readRes(res,readIndexCursor)?PR_RESULT_SUCCESS:PR_RESULT_CHECKSUM_ERROR; /* depending on the checksum */ + if (!dat_cursorMove(&readIndexCursor,k)) return PR_RESULT_F_INDEX_NOT_FOUND; /* false means out of range */ + return dat_readRes(res,readIndexCursor)?PR_RESULT_SUCCESS:PR_RESULT_W_CHECKSUM_ERROR; /* depending on the checksum */ } #endif @@ -507,7 +507,7 @@ int mWriteBeginDatFile(const char* vFile, int optionflag) { * * Return Values: * PR_RESULT_SUCCESS Ok - * PR_RESULT_ERR_FILE_DAT_NOT_WRITE_ACCESS File couldn't be open + * PR_RESULT_F_FILE_DAT_NOT_WRITE_ACCESS File couldn't be open * */ if (writeOpen(vFile,&writeDatFile,optionflag|backup_flag)) { @@ -518,7 +518,7 @@ int mWriteBeginDatFile(const char* vFile, int optionflag) { fwriteshort(&fill,writeDatFile); /* Fill the file with 6 starting null bytes */ return PR_RESULT_SUCCESS; } else { - return PR_RESULT_ERR_FILE_DAT_NOT_WRITE_ACCESS; + return PR_RESULT_F_FILE_DAT_NOT_WRITE_ACCESS; } } diff --git a/PR/src/lib/layers/disk.c b/PR/src/lib/layers/disk.c index eb06b5a..671a714 100644 --- a/PR/src/lib/layers/disk.c +++ b/PR/src/lib/layers/disk.c @@ -414,19 +414,19 @@ tBinary mLoadFileArray(const char* vFile) { /* check type */ f=isDir(file); if (f==eDirectory) { - ret.size=PR_RESULT_ERR_FILE_NOT_OPEN_WASDIR; + ret.size=PR_RESULT_F_FILE_NOT_OPEN_WASDIR; ret.data=NULL; return ret; } if (f==eNotFound) { - ret.size=PR_RESULT_ERR_FILE_NOT_OPEN_NOTFOUND; + ret.size=PR_RESULT_F_FILE_NOT_OPEN_NOTFOUND; ret.data=NULL; return ret; } /* Open the file */ if ((fp=fopen(file,"rb"))==NULL) { - ret.size=PR_RESULT_ERR_FILE_NOT_READ_ACCESS; + ret.size=PR_RESULT_F_FILE_NOT_READ_ACCESS; ret.data=NULL; return ret; } else { @@ -440,7 +440,7 @@ tBinary mLoadFileArray(const char* vFile) { } if ((ret.data=(unsigned char*)malloc(ret.size+1))==NULL) { fclose(fp); - ret.size=PR_RESULT_ERR_MEMORY; + ret.size=PR_RESULT_F_MEMORY; ret.data=NULL; return ret; /* this could happen in big files! */ } else { diff --git a/PR/src/lib/layers/idlist.c b/PR/src/lib/layers/idlist.c index e058983..d077956 100644 --- a/PR/src/lib/layers/idlist.c +++ b/PR/src/lib/layers/idlist.c @@ -99,7 +99,7 @@ int parseGivenPath(char* path) { int error=0; /* Check if the variable wasn't initialized before */ - if (itemMatchingList.count!=0) return PR_RESULT_ERR_WRONG_PRIMITIVE_CALL; + if (itemMatchingList.count!=0) return PR_RESULT_F_WRONG_PRIMITIVE_CALL; itemMatchingList.list=NULL; /* Validates the NULL path */ @@ -141,7 +141,7 @@ int parseGivenPath(char* path) { } if (error) { for (i=0;i<j-1;i++) freeRM(itemMatchingList.list+i); - return PR_RESULT_ERR_COMMAND_LINE_SYNTAX; + return PR_RESULT_F_COMMAND_LINE_SYNTAX; } return PR_RESULT_SUCCESS; } diff --git a/PR/src/lib/layers/resourcematch.c b/PR/src/lib/layers/resourcematch.c index 7e8f4bc..f1341a3 100644 --- a/PR/src/lib/layers/resourcematch.c +++ b/PR/src/lib/layers/resourcematch.c @@ -98,7 +98,7 @@ int initRM(const char* text, tResourceMatch *r) { result.flag|=nPat; } else { if (status==eVal) { - if (t!=text) return PR_RESULT_ERR_COMMAND_LINE_SYNTAX; /* one ! inside the val number */ + if (t!=text) return PR_RESULT_F_COMMAND_LINE_SYNTAX; /* one ! inside the val number */ result.flag|=nVal; } else { /* default action */ rm_emit(status,*t); @@ -120,7 +120,7 @@ int initRM(const char* text, tResourceMatch *r) { status=eInd; if (result.flag&dInd) { freeRM(&result); - return PR_RESULT_ERR_COMMAND_LINE_SYNTAX; /* ind flag has been set, duplicated index? */ + return PR_RESULT_F_COMMAND_LINE_SYNTAX; /* ind flag has been set, duplicated index? */ } result.flag|=dInd; } else rm_emit(status,*t); @@ -134,7 +134,7 @@ int initRM(const char* text, tResourceMatch *r) { status=eOrd; if (result.flag&dOrd) { freeRM(&result); - return PR_RESULT_ERR_COMMAND_LINE_SYNTAX; /* ord flag has been set, duplicated order? */ + return PR_RESULT_F_COMMAND_LINE_SYNTAX; /* ord flag has been set, duplicated order? */ } result.flag|=dOrd; } else rm_emit(status,*t); @@ -152,7 +152,7 @@ int initRM(const char* text, tResourceMatch *r) { *r=result; if ( ( !(result.flag&dVal) ) && ( result.flag&nVal ) ) - return PR_RESULT_ERR_COMMAND_LINE_SYNTAX; /* check for this particular case: @!: */ + return PR_RESULT_F_COMMAND_LINE_SYNTAX; /* check for this particular case: @!: */ return PR_RESULT_SUCCESS; /* Ok */ } diff --git a/PR/src/lib/object/image/image16.c b/PR/src/lib/object/image/image16.c index 8098bc2..4155694 100644 --- a/PR/src/lib/object/image/image16.c +++ b/PR/src/lib/object/image/image16.c @@ -115,7 +115,7 @@ void* objectImage16Create(tBinary cont, int *error) { /* use get like main.c */ /* Expand graphic and check results */ *error=mExpandGraphic(cont,image); - if (*error==PR_RESULT_COMPRESS_RESULT_FATAL) { + if (*error==PR_RESULT_F_COMPRESS_RESULT_FATAL) { free(image); return NULL; } @@ -160,7 +160,7 @@ void* objectImage16Read(const char* file,tObject palette, int *result) { image->pal=palette; bits=objectPaletteGetBitRate(image->pal); if (bits && bits!=image->bits) { /* bits=0 means all palettes allowed or ignore palette check */ - *result=PR_RESULT_ERR_BMP_BITRATE_DIFFERS; + *result=PR_RESULT_F_BMP_BITRATE_DIFFERS; free(image->pix); free(colorArray); free(image); diff --git a/PR/src/lib/object/image/image2.c b/PR/src/lib/object/image/image2.c index 4a8979d..f2cea74 100644 --- a/PR/src/lib/object/image/image2.c +++ b/PR/src/lib/object/image/image2.c @@ -117,7 +117,7 @@ void* objectImage2Create(tBinary cont, int *error) { /* use get like main.c */ /* Expand graphic and check results */ *error=mExpandGraphic(cont,image); - if (*error==PR_RESULT_COMPRESS_RESULT_FATAL) { + if (*error==PR_RESULT_F_COMPRESS_RESULT_FATAL) { free(image); return NULL; } @@ -154,7 +154,7 @@ void* objectImage2Read(const char* file,tObject palette, int *result) { bits=objectPaletteGetBitRate(image->pal); if (image->bits!=1) { - *result=PR_RESULT_ERR_BMP_BITRATE_DIFFERS; + *result=PR_RESULT_F_BMP_BITRATE_DIFFERS; free(image->pix); free(image); return NULL; diff --git a/PR/src/lib/object/image/image256.c b/PR/src/lib/object/image/image256.c index a167e6f..f52d0bb 100644 --- a/PR/src/lib/object/image/image256.c +++ b/PR/src/lib/object/image/image256.c @@ -77,7 +77,7 @@ int mExpandGraphic256(tBinary input, tImage *image) { image->height=array2short(input.data); image->width =array2short(input.data+2); - if (*(input.data+4)!=1) return PR_RESULT_COMPRESS_RESULT_FATAL; /* Verify format */ + if (*(input.data+4)!=1) return PR_RESULT_F_COMPRESS_RESULT_FATAL; /* Verify format */ /* if (*(input.data+5)!=0xb4) return PR_RESULT_COMPRESS_RESULT_FATAL; * Verify format */ image->type=(unsigned char)(*(input.data+5)); @@ -176,7 +176,7 @@ int pop2decompress(tBinary input, int verify, unsigned char** output,int* output lineI.data+=2; if (lineI.size>tempOutputSize) { /*printf(" error: lineI.size=%d tempOutputSize=%d\n",lineI.size,tempOutputSize);*/ - return PR_RESULT_COMPRESS_RESULT_WARNING; + return PR_RESULT_W_COMPRESS_RESULT_WARNING; } aux2=expandRleV(lineI,lineO,&lineSize); /*if (aux2) printf(" error: rle=%d linesize=%d of %d. size=%d r=%d.\n",aux2, lineSize,verify,tempOutputSize,tempOutputSize-lineI.size-2);*/ @@ -205,7 +205,7 @@ int pop2decompress(tBinary input, int verify, unsigned char** output,int* output lineI.data+=2; if (lineI.size>tempOutputSize) { /*printf(" error: lineI.size=%d tempOutputSize=%d\n",lineI.size,tempOutputSize);*/ - return PR_RESULT_COMPRESS_RESULT_WARNING; + return PR_RESULT_W_COMPRESS_RESULT_WARNING; } aux2=expandRleV(lineI,lineO,&lineSize); /*if (aux2) printf(" error: rle=%d linesize=%d of %d. size=%d r=%d.\n",aux2, lineSize,verify,tempOutputSize,tempOutputSize-lineI.size-2);*/ @@ -261,7 +261,7 @@ void* objectImage256Create(tBinary cont, int *error) { /* use get like main.c */ /* Expand graphic and check results */ *error=mExpandGraphic256(cont,image); - if (*error==PR_RESULT_COMPRESS_RESULT_FATAL) { + if (*error==PR_RESULT_F_COMPRESS_RESULT_FATAL) { free(image); return NULL; } @@ -333,7 +333,7 @@ void* objectImage256Read(const char* file,tObject palette, int *result) { image->pal=palette; bits=objectPaletteGetBitRate(image->pal); if (bits && bits!=image->bits) { /* bits=0 means all palettes allowed or ignore palette check */ - *result=PR_RESULT_ERR_BMP_BITRATE_DIFFERS; + *result=PR_RESULT_F_BMP_BITRATE_DIFFERS; free(image->pix); free(colorArray); free(image); diff --git a/PR/src/lib/object/image/image_common.c b/PR/src/lib/object/image/image_common.c index a8a28f7..ac0dbac 100644 --- a/PR/src/lib/object/image/image_common.c +++ b/PR/src/lib/object/image/image_common.c @@ -152,7 +152,7 @@ int mExpandGraphic(tBinary input, tImage *image) { image->width =array2short(input.data); input.data+=2; - if (*(input.data++)>1) return PR_RESULT_COMPRESS_RESULT_FATAL; /* Verify format */ + if (*(input.data++)>1) return PR_RESULT_F_COMPRESS_RESULT_FATAL; /* Verify format */ image->type=(unsigned char)(*(input.data++)); input.size-=6; switch (((image->type>>4)&7)+1) { @@ -166,17 +166,17 @@ int mExpandGraphic(tBinary input, tImage *image) { image->widthInBytes=(image->width+7)/8; break; default: - return PR_RESULT_COMPRESS_RESULT_FATAL; + return PR_RESULT_F_COMPRESS_RESULT_FATAL; } #define checkSize if (imageSizeInBytes!=(image->widthInBytes*image->height))\ - return PR_RESULT_COMPRESS_RESULT_FATAL -#define checkResult if (result==PR_RESULT_COMPRESS_RESULT_FATAL)\ - return PR_RESULT_COMPRESS_RESULT_FATAL + return PR_RESULT_F_COMPRESS_RESULT_FATAL +#define checkResult if (result==PR_RESULT_F_COMPRESS_RESULT_FATAL)\ + return PR_RESULT_F_COMPRESS_RESULT_FATAL switch (getAlgor(image->type)) { case COMPRESS_RAW: /* No Compression Algorithm */ - if ((image->pix=getMemory(input.size))==NULL) return PR_RESULT_COMPRESS_RESULT_FATAL; + if ((image->pix=getMemory(input.size))==NULL) return PR_RESULT_F_COMPRESS_RESULT_FATAL; memcpy(image->pix,input.data,input.size); imageSizeInBytes=image->widthInBytes*image->height; result=PR_RESULT_SUCCESS; @@ -202,7 +202,7 @@ int mExpandGraphic(tBinary input, tImage *image) { cmp_transposeImage(image,imageSizeInBytes); break; default: - result=PR_RESULT_COMPRESS_RESULT_FATAL; /* unknown algorithm */ + result=PR_RESULT_F_COMPRESS_RESULT_FATAL; /* unknown algorithm */ break; } return result; /* Ok */ diff --git a/PR/src/lib/object/other/binary.c b/PR/src/lib/object/other/binary.c index de74973..7c85d37 100644 --- a/PR/src/lib/object/other/binary.c +++ b/PR/src/lib/object/other/binary.c @@ -58,7 +58,7 @@ void* objectBinaryCreate(tBinary cont, int *error) { /* use get like main.c */ int objectBinaryWrite(void* o, const char* file, int optionflag, const char* backupExtension) { tBinary* b=o; - return writeData(b->data,0,file,b->size,optionflag,backupExtension)?PR_RESULT_SUCCESS:PR_RESULT_ERR_FILE_NOT_WRITE_ACCESS; + return writeData(b->data,0,file,b->size,optionflag,backupExtension)?PR_RESULT_SUCCESS:PR_RESULT_F_FILE_NOT_WRITE_ACCESS; } void* objectOtherBinaryRead(const char* file,int *result) { diff --git a/PR/src/lib/object/palette/pop1_16c.c b/PR/src/lib/object/palette/pop1_16c.c index 248bebf..67a2786 100644 --- a/PR/src/lib/object/palette/pop1_16c.c +++ b/PR/src/lib/object/palette/pop1_16c.c @@ -62,8 +62,8 @@ void* objectPalettePop1_16Create(tBinary cont, int *error) { int i; tPalettePop1_16c* pal; - if (cont.size!=100) { - *error=PR_RESULT_XML_AND_DAT_FORMAT_DO_NOT_MATCH; + if (cont.size!=100) { /* TODO: use autodetect */ + *error=PR_RESULT_F_POP1_PALETTE_EXPECTED; return NULL; } @@ -138,7 +138,7 @@ void* objectPalettePop1_16Read(const char* file,int *result) { char aux[260]; tBinary raw; - *result=PR_RESULT_ERR_FILE_NOT_OPEN_NOTFOUND; + *result=PR_RESULT_F_FILE_NOT_OPEN_NOTFOUND; /* Import extra palette information */ sprintf(aux,"%s.more",file); @@ -150,7 +150,7 @@ void* objectPalettePop1_16Read(const char* file,int *result) { *result=readPal(file,&colorArray,&colors); if (*result==PR_RESULT_SUCCESS && colors!=16) { - *result=PR_RESULT_PAL_UNSUPPORTED; + *result=PR_RESULT_F_PAL_UNSUPPORTED_SIZE; free(colorArray); return NULL; } diff --git a/PR/src/lib/object/palette/pop2_256c.c b/PR/src/lib/object/palette/pop2_256c.c index 139c701..e06043e 100644 --- a/PR/src/lib/object/palette/pop2_256c.c +++ b/PR/src/lib/object/palette/pop2_256c.c @@ -98,14 +98,14 @@ void* objPop2PaletteNColorsRead(const char* file,int *result) { r=(tGenericPalette*)malloc(sizeof(tGenericPalette)); *result=readPal(file,&r->colorArray,&r->size); - +/* if (*result==PR_RESULT_SUCCESS && !(r->size==256 || r->size==320)) { *result=PR_RESULT_PAL_UNSUPPORTED; free(r->colorArray); free(r); return NULL; } - +*/ return (void*)r; } diff --git a/PR/src/lib/object/sound/sound_common.c b/PR/src/lib/object/sound/sound_common.c index 35c10f5..cd4b7c1 100644 --- a/PR/src/lib/object/sound/sound_common.c +++ b/PR/src/lib/object/sound/sound_common.c @@ -82,9 +82,9 @@ void* objectSoundWaveRead(const char* file, int *result) { *result=readWav(file,o,&channels,&samplerate,&bps); if (*result==PR_RESULT_SUCCESS) { - if (bps!=8) *result=PR_RESULT_WAV_UNSUPPORTED_BITRATE; - if (samplerate!=11025) *result=PR_RESULT_WAV_UNSUPPORTED_SAMPLERATE; - if (channels!=1) *result=PR_RESULT_WAV_UNSUPPORTED_STEREO; + if (bps!=8) *result=PR_RESULT_F_WAV_UNSUPPORTED_BITRATE; + if (samplerate!=11025) *result=PR_RESULT_F_WAV_UNSUPPORTED_SAMPLERATE; + if (channels!=1) *result=PR_RESULT_F_WAV_UNSUPPORTED_STEREO; } if (*result!=PR_RESULT_SUCCESS) { diff --git a/PR/src/lib/pr.c b/PR/src/lib/pr.c index a86cb0d..705c664 100644 --- a/PR/src/lib/pr.c +++ b/PR/src/lib/pr.c @@ -133,7 +133,7 @@ int prExportDatOpt(const char* vDatFile, const char* vDirName, const char* vResF currentDatFile=strallocandcopy(vDatFile); - if (parseGivenPath(currentDatFile)) return PR_RESULT_ERR_COMMAND_LINE_SYNTAX; + if (parseGivenPath(currentDatFile)) return PR_RESULT_F_COMMAND_LINE_SYNTAX; if (vDatFileName==NULL) { /* if no special DAT file was specified, a path parsed will be used */ aux=getFileNameFromPath(currentDatFile); @@ -209,7 +209,7 @@ int prImportDatOpt(const char* vDatFile, const char* vDirName, const char* vResF currentDatFile=strallocandcopy(vDatFile); - if (parseGivenPath(currentDatFile)) return PR_RESULT_ERR_COMMAND_LINE_SYNTAX; + if (parseGivenPath(currentDatFile)) return PR_RESULT_F_COMMAND_LINE_SYNTAX; if (vDatFileName==NULL) { /* if no special DAT file was specified, a path parsed will be used */ aux=getFileNameFromPath(currentDatFile); diff --git a/PR/src/lib/xml/parse.c b/PR/src/lib/xml/parse.c index 8e09cac..530b9eb 100644 --- a/PR/src/lib/xml/parse.c +++ b/PR/src/lib/xml/parse.c @@ -74,7 +74,7 @@ const char* getExtDesc(int type) { if ((tag->attribute==NULL)&&(father->attribute!=NULL)) \ tag->attribute=strallocandcopy(father->attribute); -#define parse_Error return PR_RESULT_ERR_XML_PARSING +#define parse_Error return PR_RESULT_F_XML_PARSING tTag* getTagStructure() { /* initializes */ @@ -131,7 +131,7 @@ void freeTagStructure(tTag* t) { int parse_attribFill(char* attr,char* val, tTag* t) { /* - * PR_RESULT_ERR_XML_ATTR Attribute mismatch + * PR_RESULT_F_XML_ATTR Attribute mismatch * PR_RESULT_SUCCESS Ok */ @@ -160,7 +160,7 @@ int parse_attribFill(char* attr,char* val, tTag* t) { parse_FillAttr(t->flags,"flags"); parse_FillAttr(t->colors,"colors"); - return PR_RESULT_ERR_XML_ATTR; + return PR_RESULT_F_XML_ATTR; } /****************************************************************\ @@ -170,9 +170,9 @@ int parse_attribFill(char* attr,char* val, tTag* t) { /* Parse text functions */ int parse_parseNext(char** pString, tTag* tag) { /* - * PR_RESULT_ERR_XML_ATTR Attribute not recognized - * PR_RESULT_ERR_MEMORY No memory - * PR_RESULT_ERR_XML_PARSING Parse error + * PR_RESULT_F_XML_ATTR Attribute not recognized + * PR_RESULT_F_MEMORY No memory + * PR_RESULT_F_XML_PARSING Parse error * PR_RESULT_SUCCESS If continue * XML_TAG_CLOSE If tag end * XML_TAG_OPEN If end @@ -211,7 +211,7 @@ int parse_parseNext(char** pString, tTag* tag) { size=(long int)i-(long int)start; /* Note: casted to long for portability with 64 bits architectures */ attribute=(char*)malloc(1+size); - if (attribute==NULL) return PR_RESULT_ERR_MEMORY; + if (attribute==NULL) return PR_RESULT_F_MEMORY; memcpy(attribute,start,size); attribute[size]=0; @@ -251,7 +251,7 @@ int parse_parseNext(char** pString, tTag* tag) { value=(char*)malloc(k+1); if (value==NULL) { free(attribute); - return PR_RESULT_ERR_MEMORY; + return PR_RESULT_F_MEMORY; } memcpy(value,aux,k); value[k]=0; @@ -260,7 +260,7 @@ int parse_parseNext(char** pString, tTag* tag) { value=(char*)malloc(1); if (value==NULL) { free(attribute); - return PR_RESULT_ERR_MEMORY; + return PR_RESULT_F_MEMORY; } value[0]=0; } @@ -268,7 +268,7 @@ int parse_parseNext(char** pString, tTag* tag) { if (parse_attribFill(attribute,value,tag)) { free(attribute); free(value); - return PR_RESULT_ERR_XML_ATTR; + return PR_RESULT_F_XML_ATTR; } free(attribute); *pString=i; @@ -277,8 +277,8 @@ int parse_parseNext(char** pString, tTag* tag) { int getNextTag(char** pString, char** value) { /* - * PR_RESULT_ERR_MEMORY No memory - * PR_RESULT_ERR_XML_PARSING Parse error + * PR_RESULT_F_MEMORY No memory + * PR_RESULT_F_XML_PARSING Parse error * XML_WAS_TAG if next item is a tag (value allocated) * XML_WAS_CDATA if it was a text (value allocated) * XML_WAS_CLOSER if next item closes a tag (value allocated) @@ -321,7 +321,7 @@ int getNextTag(char** pString, char** value) { size=(int)((long int)i-(long int)start); /* Note: casted to long for portability with 64 bits architectures */ *value=(char*)malloc(size); - if (*value==NULL) return PR_RESULT_ERR_MEMORY; + if (*value==NULL) return PR_RESULT_F_MEMORY; memcpy(*value,start,size-1); (*value)[size-1]=0; *pString=i-(!result); @@ -333,7 +333,7 @@ int getNextTag(char** pString, char** value) { if (start==i) return XML_WASNT_TEXT; size=(int)((long int)i-(long int)start); /* Note: casted to long for portability with 64 bits architectures */ *value=(char*)malloc(1+size); - if (*value==NULL) return PR_RESULT_ERR_MEMORY; + if (*value==NULL) return PR_RESULT_F_MEMORY; memcpy(*value,start,size); (*value)[size]=0; *pString=i; @@ -343,9 +343,9 @@ int getNextTag(char** pString, char** value) { /* Parse Tree functions */ tTag* parse_makeTree(char** p,char* name, int* error,tTag* father) { /* *error - * PR_RESULT_ERR_XML_ATTR Attribute not recognized - * PR_RESULT_ERR_MEMORY No memory - * PR_RESULT_ERR_XML_PARSING Parse error + * PR_RESULT_F_XML_ATTR Attribute not recognized + * PR_RESULT_F_MEMORY No memory + * PR_RESULT_F_XML_PARSING Parse error * PR_RESULT_SUCCESS If the tag was parsed successfully */ @@ -386,7 +386,7 @@ tTag* parse_makeTree(char** p,char* name, int* error,tTag* father) { /* Create new variable */ str=(char*)malloc(strlen(father->path)+strlen(tag->path)+2); - if (str==NULL) {*error=PR_RESULT_ERR_MEMORY;return NULL;} + if (str==NULL) {*error=PR_RESULT_F_MEMORY;return NULL;} /* Set variable and destroy old variables */ sprintf(str,"%s/%s",father->path,tag->path); @@ -430,11 +430,11 @@ tTag* parse_makeTree(char** p,char* name, int* error,tTag* father) { break; case XML_WAS_CLOSER: /* "no errors" or "a wrong tag is closed" */ - *error=(equalsIgnoreCase(value,tag->tag))?0:PR_RESULT_ERR_XML_PARSING; + *error=(equalsIgnoreCase(value,tag->tag))?0:PR_RESULT_F_XML_PARSING; free(value); return tag; case XML_WAS_EOD: - *error=PR_RESULT_ERR_XML_PARSING; /* this tag wasn't closed */ + *error=PR_RESULT_F_XML_PARSING; /* this tag wasn't closed */ return tag; break; } @@ -468,10 +468,10 @@ void showTag(int n,tTag* t) { tTag* xmlParseFile(const char* vFile,int* error) { /* error may take the following values: - * PR_RESULT_ERR_XML_PARSING Parse error - * PR_RESULT_ERR_MEMORY No memory - * PR_RESULT_ERR_XML_ATTR Attribute not recognized - * PR_RESULT_ERR_XML_FILE File not found + * PR_RESULT_F_XML_PARSING Parse error + * PR_RESULT_F_MEMORY No memory + * PR_RESULT_F_XML_ATTR Attribute not recognized + * PR_RESULT_F_XML_FILE File not found * PR_RESULT_SUCCESS No errors */ @@ -486,7 +486,7 @@ tTag* xmlParseFile(const char* vFile,int* error) { bin=mLoadFileArray(vFile); if (bin.size<=0) { - *error=PR_RESULT_ERR_XML_FILE; /* File not open */ + *error=PR_RESULT_F_XML_FILE; /* File not open */ return NULL; } /* bug fix moved to loadArray */ bin.data[bin.size-1]=0; /* The last character must be an end of line (the > is forbidden) */ @@ -523,7 +523,7 @@ tTag* xmlParseFile(const char* vFile,int* error) { } else { freeTagStructure(tag); free(father); - *error=PR_RESULT_ERR_XML_PARSING; + *error=PR_RESULT_F_XML_PARSING; return NULL; } } diff --git a/PR/src/lib/xml/tree.c b/PR/src/lib/xml/tree.c index 3b11d0c..f7a7080 100644 --- a/PR/src/lib/xml/tree.c +++ b/PR/src/lib/xml/tree.c @@ -493,7 +493,7 @@ void treeXmlGenerate(int n,const tTag* t,FILE* outputStream) { int xmlGenerateFile(const char* vFile,const tTag* t) { FILE* fd; - if (!(fd=fopen(vFile,"wb"))) return PR_RESULT_ERR_XML_NOT_OPEN; + if (!(fd=fopen(vFile,"wb"))) return PR_RESULT_F_XML_NOT_OPEN; treeXmlGenerate(0,t,fd); return PR_RESULT_SUCCESS; } diff --git a/PR/src/lib/xml/unknown.c b/PR/src/lib/xml/unknown.c index 7a59c43..4921ac2 100644 --- a/PR/src/lib/xml/unknown.c +++ b/PR/src/lib/xml/unknown.c @@ -81,7 +81,7 @@ tUnknownFile unknownFile; \***************************************************************/ int unknownLogStart (const char* file,int optionflag, const char* backupExtension) { - if (unknownFile.fd) return PR_RESULT_ERR_XML_ALREADY_OPEN; /* File already open */ + if (unknownFile.fd) return PR_RESULT_F_XML_ALREADY_OPEN; /* File already open */ /* Use default filename if file is NULL */ if (!file) file=RES_XML_UNKNOWN_XML; @@ -110,7 +110,7 @@ int unknownLogStart (const char* file,int optionflag, const char* backupExtensio } /* Open the file */ - if (!writeOpen(file,&unknownFile.fd,optionflag)) return PR_RESULT_ERR_XML_FILE; /* file not open */ + if (!writeOpen(file,&unknownFile.fd,optionflag)) return PR_RESULT_F_XML_FILE; /* file not open */ return PR_RESULT_SUCCESS; /* Ok */ } @@ -119,7 +119,7 @@ int unknownLogStop () { int i; tTag* t; - if (!unknownFile.fd) return PR_RESULT_ERR_XML_NOT_OPEN; /* File not open */ + if (!unknownFile.fd) return PR_RESULT_F_XML_NOT_OPEN; /* File not open */ /* common factor tree reducing function */ if (unknownFile.tree) xmlOptimizeCommonFactor(unknownFile.tree->child); @@ -158,7 +158,7 @@ int unknownLogStop () { } int unknownLogAppend(const char* vFiledat,tResourceId id,const char* ext,tResourceType type,const char* vDirExt,tResourceId pal,const char* vFiledatWithPath,int optionflag,int count, unsigned long int flags,const char* filename) { - if (!unknownFile.fd) return PR_RESULT_ERR_XML_NOT_OPEN; /* File not open, logging is off, just a warning */ + if (!unknownFile.fd) return PR_RESULT_F_XML_NOT_OPEN; /* File not open, logging is off, just a warning */ if (!unknownFile.currentDat) { /* this is the beginning of the file */ treeStatusFolder(vFiledatWithPath,vFiledat,pal.value,translateInt2Ext(strToLower(pal.index)),&unknownFile.status);