| author | ecalot
<ecalot> 2004-06-27 14:53:46 UTC |
| committer | ecalot
<ecalot> 2004-06-27 14:53:46 UTC |
| parent | a2c0af6fd49b90e782757ee68bff732b6a988bf2 |
| PR/doc/changelog.txt | +2 | -1 |
| PR/src/Makefile | +3 | -3 |
| PR/src/addons/vb/pr.bas | +225 | -79 |
| PR/src/addons/vb/samples/pr.dll | +0 | -0 |
| PR/src/include/common.h | +1 | -1 |
| PR/src/include/en.lang.pr.h | +2 | -2 |
| PR/src/include/pr.h | +1 | -1 |
| PR/src/include/xml.h | +0 | -31 |
| PR/src/lib/actions/export.c | +4 | -4 |
| PR/src/lib/compression/rle_compress.c | +6 | -6 |
| PR/src/lib/compression/rle_decompress.c | +6 | -6 |
| PR/src/lib/compression/rlev_decompress.c | +6 | -6 |
| PR/src/lib/formats/bmp.c | +4 | -4 |
| PR/src/lib/layers/dat.c | +4 | -6 |
| PR/src/lib/layers/disk.c | +5 | -6 |
| PR/src/lib/layers/memory.c | +116 | -116 |
| PR/src/lib/object/image/image16.c | +6 | -6 |
| PR/src/lib/object/image/image2.c | +6 | -6 |
| PR/src/lib/object/image/image256.c | +6 | -6 |
| PR/src/lib/object/image/image_common.c | +6 | -6 |
| PR/src/lib/xml/parse.c | +6 | -3 |
| PR/src/ports/winfiles/pr.exe | +0 | -0 |
diff --git a/PR/doc/changelog.txt b/PR/doc/changelog.txt index 348d10e..f9708a6 100644 --- a/PR/doc/changelog.txt +++ b/PR/doc/changelog.txt @@ -134,7 +134,8 @@ Versions: x Checksum verification x Set, if applicable, POP2 in the parent folder of the unknown.xml file - + - Fixed some memory leaks in xml parser + 2) ToDo List & Future Plans: * PR v1.1: diff --git a/PR/src/Makefile b/PR/src/Makefile index 82d77c5..8a804d4 100644 --- a/PR/src/Makefile +++ b/PR/src/Makefile @@ -18,7 +18,7 @@ endif #Compiler options INCLUDE = -Iinclude/ DEFINES = -DOS=\"$(OS)\" $(LINUX) -OPTIONS = $(INCLUDE) $(DEFINES) +OPTIONS = $(INCLUDE) $(DEFINES) -g -pedantic OBJFILES = compile.o compress.o extract.o resources.o tasks.o disk.o\ xmlparse.o xmlsearch.o dat.o bmp.o mid.o pal.o wav.o plv.o\ @@ -34,7 +34,7 @@ EXEFILE = bin/pr bin/pr: $(OBJFILES) $(SRC1) bin/resources.xml $(INFO) Linking files... $(MAKEDIR) bin - $(CC) -o bin/pr $(OBJFILES) $(SRC1) -s -O2 + $(CC) $(OPTIONS) -o bin/pr $(OBJFILES) $(SRC1) -O2 $(INFO) Program successfully compiled $(INFO) $(INFO) Please read readme.txt for syntax information @@ -53,7 +53,7 @@ all: $(EXEFILE) lib: clean $(OBJFILES) $(SRC3) $(MAKEDIR) bin $(INFO) Making dynamic library... - $(CC) -o bin/pr.so $(OBJFILES) $(SRC3) -O2 -Llibc -shared -dynamic + $(CC) $(OPTIONS) -o bin/pr.so $(OBJFILES) $(SRC3) -Llibc -shared -dynamic $(INFO) Library successfully compiled $(INFO) $(INFO) Please read readme.coders.txt and pr.h for interfaces diff --git a/PR/src/addons/vb/pr.bas b/PR/src/addons/vb/pr.bas index 9e8e2cb..d078ec7 100644 --- a/PR/src/addons/vb/pr.bas +++ b/PR/src/addons/vb/pr.bas @@ -1,79 +1,225 @@ -Attribute VB_Name = "Module1" -'pr.dll V2.0 declaration for Visual Basic -'PR is a Princed Development Team work -'check for the latest version at http://www.princed.com.ar - -'Enumerations - -'Resource type -enum prResourceType - prResMemoryError=-2 - prResFileNotFoundError=-1 - - prResInvalidDatFile=00 - - prResLevelFile=01 - prResGraphicExtFile=02 - prResWaveFile=03 - prResMidiFile=04 - prResValidUnknownFile=05 - prResGraphicFile=06 - -end - -'Export -enum prExportResult - prExpMemoryError=-2 - prExpAccessDenied=-1 - prExpOk=0 -end - -enum prExportOpt 'To use more than one option separate them with "+". - prExpExtract=1 'If this option is not given, the files won't be extracted - prExpUpdate=2 'This will update the resource file - prExpUseRaw=4 'This will extract to raw files - prExpDontSave=8 'Running the function using this option will perform all - ' commands but without saving the changes in resource file - ' (update option will be ignored) -end - -'Import -enum prImportResult - prImpAccessDenied=-1 - prImpOk=0 - 'Note: If the file was parcially compiled a positive number of files missing will be returned -end - -enum prImportOpt - prImpUseRaw=0 - prImpReadDataType=1 -end - -'This function will extract vDatFile into vDirName adding the extracted files in vResFilename -Public Declare Function prExportDat Lib "pr.dll" Alias "_prExportDat" (ByVal vDatFile As String, ByVal vDirName As String, ByVal vResFilename As String) As Integer -'This function will import the files located in vDirName into vDatFile acording to the information read in vResFilename -Public Declare Function prImportDat Lib "pr.dll" Alias "_prImportDat" (ByVal vDatFile As String, ByVal vDirName As String, ByVal vResFilename As String) As Integer -'This function will clear vResFilename information table but It will keep the file header and foot -Public Declare Function prClearRes Lib "pr.dll" Alias "_prClearRes" (ByVal vResFilename As String) As Integer -'This function will verify if the vDatFile exists, id it is a valid POP1 DAT file, and what kind of DAT file it is -Public Declare Function prVerifyDatType Lib "pr.dll" Alias "_prVerifyDatType" (ByVal vDatFile As String) As integer - -' verifyDatType return values may be: -' -2 PR internal Memory error (only if RAM is too low) -' -1 File not found -' -' 00 Not a valid POP1 DAT file -' -' 01 Levels file -' 02 Graphic file with an image in the first valid entry (not common) -' 03 Waves/Digital sound file -' 04 Midis file -' 05 Valid DAT file with Undefined content (example ibmsnd for the moment) -' 06 Graphic file with a palette in the first valid entry (common) - -' extended functions - -Public Declare Function prVerifyDatTypeRes Lib "pr.dll" Alias "_prVerifyDatType" (ByVal vDatFile As String) As prResourceType -Public Declare Function prClearResBool Lib "pr.dll" Alias "_prClearRes" (ByVal vResFilename As String) As Boolean -Public Declare Function prExportDatOpt Lib "pr.dll" Alias "_prExportDatOpt" (ByVal vDatFile As String, ByVal vDirName As String, ByVal vResFilename As String, ByVal vExportOpt as prExportOpt) As prExportResult -Public Declare Function prImportDatOpt Lib "pr.dll" Alias "_prImportDatOpt" (ByVal vDatFile As String, ByVal vDirName As String, ByVal vResFilename As String, ByVal vImportOpt as prImportOpt) As prImportResult +Attribute VB_Name = "pr" +' Princed V3 - Prince of Persia Level Editor for PC Version +' Copyright (C) 2003 Princed Development Team +' +' This program is free software; you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation; either version 2 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License +' along with this program; if not, write to the Free Software +' Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +' +' The authors of this program may be contacted at http://forum.princed.com.ar + + +' +'pr.bas: Princed Resources : pr.dll declaration for Visual Basic +'\xaf\xaf\xaf\xaf\xaf\xaf +' Copyright 2003, 2004 Princed Development Team +' Created: 24 Apr 2003 +' +' Author: Enrique Calot <ecalot.cod@princed.com.ar> +' Version: 1.00 (2003-Apr-24) for PR v0.6 +' Version: 2.00 (2004-Mar-03) for PR v1.0 +' Version: 2.01 (2004-Mar-23) for PR v1.0 +' +' Note: +' DO NOT remove this copyright notice +' +' Check for the latest version at http://www.princed.com.ar + + +'Enumerations + +'Resource type +Enum prResourceType + prResMemoryError = -2 + prResFileNotFoundError = -1 + prResInvalidDatFile = 0 + prResLevelFile = 1 + prResGraphicExtFile = 2 + prResWaveFile = 3 + prResMidiFile = 4 + prResValidUnknownFile = 5 + prResGraphicFile = 6 + prResPCSpeaker = 7 + prResPop2Dat = 11 +End Enum + +Enum prFlags + prFlagImport = 1 + prFlagClassify = 2 + prFlagExport = 4 + prFlagBackup = 8 + prFlagForce = 16 + prFlagCgi = 32 + prFlagHelp = 64 + prFlagRaw = 128 + prFlagRecursive = 256 + prFlagVerbose = 512 + prFlagVersion = 1024 + prFlagUnknown = 2048 +End Enum + + +'Export +Enum prExportResult + prExpXmlFileNotFound = -7 + prExpXmlAttributeNotRecognized = -6 + prExpMemoryErrorInParsinng = -5 + prExpXmlParseError = -4 + prExpInvalidDatFile = -3 + prExpMemoryError = -2 + prExpAccessDenied = -1 + prExpOk = 0 +End Enum + +'Import +Enum prImportResult + prImpXmlFileNotFound = -6 + prImpXmlAttributeNotRecognized = -5 + prImpNoMemory = -4 + prImpXmlParseError = -3 + prImpInvalidInPartial = -2 + prImpAccessDenied = -1 + prImpOk = 0 + 'Note: If the file was parcially compiled a positive number of files missing will be returned +End Enum + +'This function will extract vDatFile into vDirName adding the extracted files in vResFilename +Public Declare Function prExportDat Lib "pr.dll" Alias "_prExportDat" ( _ + ByVal vDatFile As String, _ + ByVal vDirName As String, _ + ByVal vResFilename As String) As Integer + +'This function will import the files located in vDirName into vDatFile acording to the information read in vResFilename +Public Declare Function prImportDat Lib "pr.dll" Alias "_prImportDat" (ByVal vDatFile As String, ByVal vDirName As String, ByVal vResFilename As String) As Integer +'This function will verify if the vDatFile exists, id it is a valid POP1 DAT file, and what kind of DAT file it is +Public Declare Function prVerifyDatType Lib "pr.dll" Alias "_prVerifyDatType" (ByVal vDatFile As String) As Integer + +' verifyDatType return values may be: +' -2 PR internal Memory error (only if RAM is too low) +' -1 File not found +' +' 00 Not a valid POP1 DAT file +' +' 01 Levels file +' 02 Graphic file with an image in the first valid entry (not common) +' 03 Waves/Digital sound file +' 04 Midis file +' 05 Valid DAT file with Undefined content (example ibmsnd for the moment) +' 06 Graphic file with a palette in the first valid entry (common) +' 07 Internal PC Speaker dat file +' 11 Pop2 dat file + +' extended functions + +Public Declare Function prVerifyDatTypeRes Lib "pr.dll" Alias "_prVerifyDatType" (ByVal vDatFile As String) As prResourceType + +Public Declare Function prExportDatOpt Lib "pr.dll" Alias "_prExportDatOpt" ( _ + ByVal vDatFile As String, _ + ByVal vDirName As String, _ + ByVal vResFilename As String, _ + ByVal vExportOpt As prFlags, _ + ByVal vDatFileName As String, _ + ByVal datAuthor As String, _ + ByVal backupExtension As String) As prExportResult + +'Arguments: +' char* vDatFile - full Path to the dat file; +' if file use it, if directory, perform it for +' All Files +' char* vDirName - full Path to the extracting folder +' (doesn't need to exist) +' char* vResFile - full Path to the resources XML file +' NULL is the default file resources.xml +' char opt - program options, see below +' char * vDatFileName - name of the file to be extracted +' NULL means predict it from vDatFile +' const char* datAuthor - Author's name when extracting PLV's, +' NULL is default +' const char* backupExtension +' - If backup_flag is set, the string to attach +' to the backup files +'Options: +' unknown_flag - generate the unknown file without performing +' any extraction +' raw_flag - uses raw format +' verbose_flag - explain what is being done +' recursive_flag - searches for all dat files (only if vDatFile +' is not a dat file and vDatFileName is NULL) +' force_flag - default option, you cannot disable it, +' so please make a backup of your files +' backup_flag - backup your files +' Return values: +' 0 Ok +' -1 Error accessing the file DAT +' -2 Memory error in extraction +' -3 Invalid DAT file +' -4 XML Parse error +' -5 Memory error in parsing +' -6 XML Attribute not recognized +' -7 XML File not found + +Public Declare Function prImportDatOpt Lib "pr.dll" Alias "_prImportDatOpt" ( _ + ByVal vDatFile As String, _ + ByVal vDirName As String, _ + ByVal vResFilename As String, _ + ByVal vImportOpt As prFlags, _ + ByVal vDatFileName As String, _ + ByVal backupExtension As String) As prImportResult + +' Arguments: +' char* vDatFile - full Path to the dat file; +' if file use it, if directory, perform it for +' all files +' char* vDirName - full Path to the extracting folder +' (doesn't need to exist) +' char* vResFile - full Path to the resources XML file +' (resources.xml by default) +' char opt - program options, see below +' char * vDatFileName - name of the file to be extracted +' NULL means predict it from vDatFile +' const char* backupExtension +' - If backup_flag is set, the string to attach +' to the backup files +' +' Options: +' raw_flag - uses raw format +' verbose_flag - explain what is being done +' recursive_flag - searches for all dat files (only if vDatFile +' is not a dat file and vDatFileName is NULL) +' force_flag - If not set and the file exists it will prompt +' for action +' backup_flag - backup your files +' +' Return values: +' -1 DAT File couldn't be open for writing +' -2 XML Parse error +' -3 No memory +' -4 XML Attribute not recognized +' -5 XML File not found +' 00 File successfully imported +' positive number: number of missing files + +'type tResource as record +'type tResources as tResource(2000) + +'Public Declare Function parseFile Lib "pr.dll" Alias "_parseFile" (ByVal vFile as string, byval datFile as string, byref resources as tResources) as integer +Public Declare Function parseStructure Lib "pr.dll" Alias "_parseStructure" (ByVal vFile As String) As Integer + +Public Declare Function resourceTreeGetChild Lib "pr.dll" Alias "_resourceTreeGetChild" (ByVal whereAmI As Integer) As Integer +Public Declare Function resourceTreeGetNext Lib "pr.dll" Alias "_resourceTreeGetNext" (ByVal whereAmI As Integer) As Integer +Public Declare Function resourceTreeGetRoot Lib "pr.dll" Alias "_resourceTreeGetRoot" () As Integer +Public Declare Function resourceTreeGetInfo Lib "pr.dll" Alias "_resourceTreeGetInfo" (ByVal whereAmI As Integer, ByRef tag As Integer, ByRef desc As String, ByRef path As String, ByRef file As String, ByRef itemtype As String, ByRef name As String, ByRef palette As String, ByRef restype As String, ByRef value As String, ByRef version As String, ByRef number As String) As Integer + +Public Declare Sub prSetOutput Lib "pr.dll" Alias "_prSetOutput" (ByVal stream As Any) +Public Declare Sub freeParsedStructure Lib "pr.dll" Alias "_freeParsedStructure" () + diff --git a/PR/src/addons/vb/samples/pr.dll b/PR/src/addons/vb/samples/pr.dll index eb545ad..4e3ec15 100644 Binary files a/PR/src/addons/vb/samples/pr.dll and b/PR/src/addons/vb/samples/pr.dll differ diff --git a/PR/src/include/common.h b/PR/src/include/common.h index 942aa3c..387da8f 100644 --- a/PR/src/include/common.h +++ b/PR/src/include/common.h @@ -67,7 +67,7 @@ void prSetOutput(FILE* output); #endif /* Debug options */ -#define DEB_FLAG +/* #define DEB_FLAG */ /* #define MEM_CHECK */ #ifdef MEM_CHECK diff --git a/PR/src/include/en.lang.pr.h b/PR/src/include/en.lang.pr.h index a616a0e..e0c6906 100644 --- a/PR/src/include/en.lang.pr.h +++ b/PR/src/include/en.lang.pr.h @@ -155,6 +155,6 @@ pr.h: Princed Resources : English language strings #define PR_TXT_GFX_DEV "Graphic format development" #define PR_TXT_MID "MID Sound format development" #define PR_TXT_XML "Resources.xml edition" -#define PR_TXT_TRANSLATION "Translation" -#define PR_TXT_ABOUT_TRANSLATOR "<transwi text='Please add your name here for the credits, use different lines to add more names.'>\n" +#define PR_TXT_TRANSLATION "" +#define PR_TXT_ABOUT_TRANSLATOR "" diff --git a/PR/src/include/pr.h b/PR/src/include/pr.h index 942aa3c..387da8f 100644 --- a/PR/src/include/pr.h +++ b/PR/src/include/pr.h @@ -67,7 +67,7 @@ void prSetOutput(FILE* output); #endif /* Debug options */ -#define DEB_FLAG +/* #define DEB_FLAG */ /* #define MEM_CHECK */ #ifdef MEM_CHECK diff --git a/PR/src/include/xml.h b/PR/src/include/xml.h deleted file mode 100644 index 37d7434..0000000 --- a/PR/src/include/xml.h +++ /dev/null @@ -1,31 +0,0 @@ - -#ifndef _XML_H_ -#define _XML_H_ - -int equalsIgnoreCase(const char s1[],const char s2[]); - -typedef struct tTag { - struct tTag* child; - struct tTag* next; - char* tag; - char* desc; - char* external; - char* file; - char* itemtype; - char* name; - char* palette; - char* type; - char* value; - char* version; - char* number; -}tTag; - -//Constants -#define MAX_VALUE_SIZE 1000 -#define MAX_SIZE_OF_FILE 30000 - -//tTag* getTagStructure(); //initializes -void freeTagStructure(tTag* structure); -//int parseNext(char** pString, tTag* tag); -tTag* parseXmlFile(const char* vFile,int* error); -#endif diff --git a/PR/src/lib/actions/export.c b/PR/src/lib/actions/export.c index 6e9b1e5..c288ad6 100644 --- a/PR/src/lib/actions/export.c +++ b/PR/src/lib/actions/export.c @@ -93,7 +93,7 @@ fld("b"); for (indexNumber=0;ok&&(indexNumber<numberOfItems);indexNumber++) { id=mReadFileInDatFile(indexNumber,&data,&size); fld("c"); -printf("*K) id=%d size=%d %d:%d:%d:%d:%d:%d\n",id,size,data[0],data[1],data[2],data[3],data[4],data[5]); +/* printf("*K) id=%d size=%d %d:%d:%d:%d:%d:%d\n",id,size,data[0],data[1],data[2],data[3],data[4],data[5]); */ if (id<0) return -3; /* Read error */ if (id==0xFFFF) continue; /* Tammo Jan Bug fix */ @@ -103,7 +103,7 @@ fld("d"); /* set resource information on this index entry */ if (mReadInitResource(r+id,data,size)) return -2; fld("e"); -printf("z->%d\n",r[id]->type); +/* printf("z->%d\n",r[id]->type); */ if ((r[id]->type==RES_TYPE_PALETTE)||isInThePartialList(r[id]->path,id)) { /* If the resource was specified or is a palette, do the tasks */ if (!(hasFlag(unknown_flag))) { /* If unknown flag is set do nothing but generate the unknown.xml file */ if (hasFlag(raw_flag)) r[id]->type=0; /* If "extract as raw" is set, type is 0 */ @@ -133,9 +133,9 @@ fld("f"); break; case RES_TYPE_PCSPEAKER: /* save pcs file */ case RES_TYPE_MIDI: /* save midi file */ -printf("a->%d\n",ok); +/* printf("a->%d\n",ok); */ ok=ok&&mFormatExportMid(data,vFileext,size,optionflag,backupExtension); -printf("b->%d\n",ok); +/* printf("b->%d\n",ok); */ break; case RES_TYPE_WAVE: /* save wav file */ ok=ok&&mFormatExportWav(data,vFileext,size,optionflag,backupExtension); diff --git a/PR/src/lib/compression/rle_compress.c b/PR/src/lib/compression/rle_compress.c index 44eebf0..c5bc9cf 100644 --- a/PR/src/lib/compression/rle_compress.c +++ b/PR/src/lib/compression/rle_compress.c @@ -213,21 +213,21 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) int imageSizeInBytes; int result; -printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); +/* printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); */ data++; - image->height=array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->height=array2short(data); data+=2; - image->width =array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->width =array2short(data); data+=2; -printf("K) %d;%d\n",image->width,image->height); +/* printf("K) %d;%d\n",image->width,image->height); */ fld("XX"); if (*(data++)) return COMPRESS_RESULT_FATAL; /* Verify format */ fld("YY"); image->type=(unsigned char)(*(data++)); dataSizeInBytes-=7; -printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ if (image->type&0xB0) { image->widthInBytes=(image->width+1)/2; } else { @@ -261,7 +261,7 @@ printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->wi result=COMPRESS_RESULT_FATAL; break; } -printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ return result; /* Ok */ } diff --git a/PR/src/lib/compression/rle_decompress.c b/PR/src/lib/compression/rle_decompress.c index 44eebf0..c5bc9cf 100644 --- a/PR/src/lib/compression/rle_decompress.c +++ b/PR/src/lib/compression/rle_decompress.c @@ -213,21 +213,21 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) int imageSizeInBytes; int result; -printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); +/* printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); */ data++; - image->height=array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->height=array2short(data); data+=2; - image->width =array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->width =array2short(data); data+=2; -printf("K) %d;%d\n",image->width,image->height); +/* printf("K) %d;%d\n",image->width,image->height); */ fld("XX"); if (*(data++)) return COMPRESS_RESULT_FATAL; /* Verify format */ fld("YY"); image->type=(unsigned char)(*(data++)); dataSizeInBytes-=7; -printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ if (image->type&0xB0) { image->widthInBytes=(image->width+1)/2; } else { @@ -261,7 +261,7 @@ printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->wi result=COMPRESS_RESULT_FATAL; break; } -printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ return result; /* Ok */ } diff --git a/PR/src/lib/compression/rlev_decompress.c b/PR/src/lib/compression/rlev_decompress.c index 44eebf0..c5bc9cf 100644 --- a/PR/src/lib/compression/rlev_decompress.c +++ b/PR/src/lib/compression/rlev_decompress.c @@ -213,21 +213,21 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) int imageSizeInBytes; int result; -printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); +/* printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); */ data++; - image->height=array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->height=array2short(data); data+=2; - image->width =array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->width =array2short(data); data+=2; -printf("K) %d;%d\n",image->width,image->height); +/* printf("K) %d;%d\n",image->width,image->height); */ fld("XX"); if (*(data++)) return COMPRESS_RESULT_FATAL; /* Verify format */ fld("YY"); image->type=(unsigned char)(*(data++)); dataSizeInBytes-=7; -printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ if (image->type&0xB0) { image->widthInBytes=(image->width+1)/2; } else { @@ -261,7 +261,7 @@ printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->wi result=COMPRESS_RESULT_FATAL; break; } -printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ return result; /* Ok */ } diff --git a/PR/src/lib/formats/bmp.c b/PR/src/lib/formats/bmp.c index c328adf..e6e3155 100644 --- a/PR/src/lib/formats/bmp.c +++ b/PR/src/lib/formats/bmp.c @@ -56,7 +56,7 @@ fld("ZA1"); /* Expand graphic and check results */ result=mExpandGraphic(data,&image,size); -printf("0) %d+%d*%d,%d\n",image.pix,image.height,image.widthInBytes,image.widthInBytes); +/* printf("0) %d+%d*%d,%d\n",image.pix,image.height,image.widthInBytes,image.widthInBytes); */ if ((result==COMPRESS_RESULT_WARNING)&&hasFlag(verbose_flag)) fprintf(outputStream,PR_TEXT_EXPORT_BMP_WARN); if (result==COMPRESS_RESULT_FATAL) return 0; @@ -111,7 +111,7 @@ fld("alpha"); /* open file */ if (!writeOpen(vFile,&bitmap,optionflag)) return 0; fld("beta"); -printf("a) %d+%d*%d,%d\n",img.pix,img.height,img.widthInBytes,img.widthInBytes); +/* printf("a) %d+%d*%d,%d\n",img.pix,img.height,img.widthInBytes,img.widthInBytes); */ /* initialize variables */ width=img.width; @@ -123,7 +123,7 @@ printf("a) %d+%d*%d,%d\n",img.pix,img.height,img.widthInBytes,img.widthInBytes); r=(g=(b=(unsigned char*)&extra)+1)+1; lineSerialization=(-img.widthInBytes)&3; filesize=offset+(img.widthInBytes+lineSerialization)*height; -printf("b) %d+%d*%d,%d\n",img.pix,img.height,img.widthInBytes,img.widthInBytes); +/* printf("b) %d+%d*%d,%d\n",img.pix,img.height,img.widthInBytes,img.widthInBytes); */ fld("gamma"); /* Write header */ @@ -162,7 +162,7 @@ fld("epsilon"); /* Write data */ while (img.height--) { fld("e1"); -printf("c) %d+%d*%d,%d\n",img.pix,img.height,img.widthInBytes,img.widthInBytes); +/* printf("c) %d+%d*%d,%d\n",img.pix,img.height,img.widthInBytes,img.widthInBytes); */ fwrite(img.pix+img.height*img.widthInBytes,img.widthInBytes,1,bitmap); fld("e2"); fwrite(&zero,lineSerialization,1,bitmap); diff --git a/PR/src/lib/layers/dat.c b/PR/src/lib/layers/dat.c index f73034c..612b3e7 100644 --- a/PR/src/lib/layers/dat.c +++ b/PR/src/lib/layers/dat.c @@ -35,9 +35,7 @@ dat.c: Princed Resources : DAT library #include <string.h> #include "pr.h" -//#include "resources.h" #include "disk.h" -//#include "memory.h" #include "dat.h" /***************************************************************\ @@ -108,11 +106,11 @@ int mReadFileInDatFile(int k,unsigned char* *data,unsigned long int *size) { unsigned short int id; /* for each archived file the index is read */ - id= array2short(indexPointer+ofk+k*recordSize);//(indexPointer[ofk+k*recordSize])+(indexPointer[ofk+k*recordSize+1]<<8); - printf("a ver: %d %d\n",id,(indexPointer[ofk+k*recordSize])+(indexPointer[ofk+k*recordSize+1]<<8)); + id= array2short(indexPointer+ofk+k*recordSize);/*(indexPointer[ofk+k*recordSize])+(indexPointer[ofk+k*recordSize+1]<<8);*/ +/* printf("a ver: %d %d\n",id,(indexPointer[ofk+k*recordSize])+(indexPointer[ofk+k*recordSize+1]<<8)); */ - offset=array2long(indexPointer+ofk+k*recordSize+2);//indexPointer[ofk+k*recordSize+2])+(indexPointer[ofk+k*recordSize+3]<<8)+(indexPointer[ofk+k*recordSize+4]<<16)+(indexPointer[ofk+k*recordSize+5]<<24); - *size= array2short(indexPointer+ofk+k*recordSize+6);//indexPointer[ofk+k*recordSize+6])+(indexPointer[ofk+k*recordSize+7]<<8)+1; + offset=array2long(indexPointer+ofk+k*recordSize+2);/*indexPointer[ofk+k*recordSize+2])+(indexPointer[ofk+k*recordSize+3]<<8)+(indexPointer[ofk+k*recordSize+4]<<16)+(indexPointer[ofk+k*recordSize+5]<<24);*/ + *size= array2short(indexPointer+ofk+k*recordSize+6);/*indexPointer[ofk+k*recordSize+6])+(indexPointer[ofk+k*recordSize+7]<<8)+1;*/ if ((!pop1)&&(!(indexPointer[ofk+k*recordSize+8]==0x40)&&(!indexPointer[ofk+k*recordSize+9])&&(!indexPointer[ofk+k*recordSize+10]))) return -1; if (offset+indexSize>readDatFileSize) return -1; *data=readDatFile+offset; diff --git a/PR/src/lib/layers/disk.c b/PR/src/lib/layers/disk.c index 218cb4d..5a216f2 100644 --- a/PR/src/lib/layers/disk.c +++ b/PR/src/lib/layers/disk.c @@ -240,7 +240,7 @@ int writeOpen(const char* vFileext, FILE* *fp, int optionflag) { whatIs fileType; static int all=0; int result; -fld("g1"); + #ifdef UNIX #ifndef IGNORE_TERM_CHANGE /* This will eliminate the enter after the input */ @@ -321,15 +321,15 @@ int writeData(const unsigned char* data, int ignoreChars, char* vFileext, int si /* Verify parameters */ size-=ignoreChars; if (size<0) return 0; - //if (size==0) return 1; /* Wrote 0 bytes */ + /*if (size==0) return 1; * Wrote 0 bytes */ /* Save file */ ok=writeOpen(vFileext,&target,optionflag); -printf("x->%d\n",ok); +/* printf("x->%d\n",ok); */ ok=ok&&((!size)||fwrite(data+ignoreChars,size,1,target)); -printf("x->%d\n",ok); +/* printf("x->%d\n",ok); */ ok=ok&&(!writeCloseOk(target,optionflag,backupExtension)); -printf("x->%d\n",ok); +/* printf("x->%d\n",ok); */ return ok; } @@ -345,7 +345,6 @@ int mLoadFileArray(const char* vFile,unsigned char** array) { int aux; /* Open the file */ - fp=fopen(repairFolders(vFile),"rb"); if ((fp=fopen(repairFolders(vFile),"rb"))==NULL) { return 0; } else { diff --git a/PR/src/lib/layers/memory.c b/PR/src/lib/layers/memory.c index a613cca..821e510 100644 --- a/PR/src/lib/layers/memory.c +++ b/PR/src/lib/layers/memory.c @@ -33,7 +33,7 @@ memory.c: Princed Resources : Memory handling #include "memory.h" #include <string.h> - + #ifndef MEM_CHECK char* strallocandcopy(const char* text) { int size; @@ -44,118 +44,118 @@ char* strallocandcopy(const char* text) { if (aux) memcpy(aux,text,size); return aux; } - - -#else -#include <stdlib.h> -#include <stdio.h> - -typedef struct memm { - struct memm* next; - void* pointer; - char file[30]; - int line; - int size; -}memm; - - -static memm* list=NULL; -static int memcounter=0; -static long int memsize=0; -static long int memsizef=0; - -void* mymalloc(int size,char* fileName,int line) { - memm* nodo; - void* p; - p=malloc(size); - nodo=malloc(sizeof(memm)); - nodo->next=list; - list=nodo; - strcpy(nodo->file,fileName); - nodo->line=line; - nodo->size=size; - nodo->pointer=p; - //if (!(memcounter%100)) - //fprintf(stderr,"Memory allocation: %d bytes at %p in %d@%s (%d/%d)\n",size,p,line,fileName,memsize,memcounter); - memcounter++; - memsize+=size; - memsizef+=size; - return p; -} - -void myfree(void* a,char* fileName,int line) { - memm* currentNode; - memm* priorNode=NULL; - memcounter--; - //if ((!(memcounter%100))||((memcounter<100)&&(memcounter>-100))) - //fprintf(stderr,"Liberando memoria? -> %p (%d/%d)\n",a,memsize,memcounter); - - - free(a); - - if (list==NULL) { - fprintf(stderr,"Error!!!! se pidio liberar %p pero no estaba alocado (lista vacia)\n",a); - return; /* Empty list */ - } - currentNode=list; - while ((currentNode->pointer!=a)&&(currentNode->next!=NULL)) { - priorNode=currentNode; - currentNode=currentNode->next; - } - if (currentNode->pointer!=a) { - fprintf(stderr,"Error!!!! se pidio liberar %p pero no estaba alocado %d@%s\n",a,line,fileName); - return; /* Not found */ - } - - memsizef-=currentNode->size; - - //fprintf(stderr,"Liberada: %d bytes at %p alloc: %d@%s | free %d@%s (%d/%d)\n",currentNode->size,currentNode->pointer,currentNode->line,currentNode->file,line,fileName,memsize,memcounter); - - /* free node and set prior pointer to the next */ - if (priorNode==NULL) { - list=currentNode->next; - } else { - priorNode->next=currentNode->next; - } - free(currentNode); - -} - -void showInfo(void* a) { - memm* currentNode; - memm* priorNode=NULL; - - if (list==NULL) { - fprintf(stderr,"lista vacia\n"); - return; /* Empty list */ - } - currentNode=list; - while ((currentNode->pointer!=a)&&(currentNode->next!=NULL)) { - priorNode=currentNode; - currentNode=currentNode->next; - } - if (currentNode->pointer!=a) { - fprintf(stderr,"Puntero no alocado\n"); - return; /* Not found */ - } - - fprintf(stderr,"showInfo: %d bytes at %p alloc: %d@%s Mem tot: %d\n",currentNode->size,currentNode->pointer,currentNode->line,currentNode->file,memcounter); - -} - -void showStats() { - fprintf(stderr,"Total de memoria manejada: %d. Allocaciones: %d. Memoria no liberada: %d\n",memsize,memcounter,memsizef); - - memm* currentNode; - if (list==NULL) { - fprintf(stderr,"Todo COOL!!!!!\n"); - return; /* Empty list */ - } - currentNode=list; - do { - fprintf(stderr,"en %s@%d alocaste %d en %p y no los liberaste\n",currentNode->file,currentNode->line,currentNode->size,currentNode->pointer); - currentNode=currentNode->next; - } while (currentNode->next!=NULL); - -} -#endif + + +#else +#include <stdlib.h> +#include <stdio.h> + +typedef struct memm { + struct memm* next; + void* pointer; + char file[30]; + int line; + int size; +}memm; + + +static memm* list=NULL; +static int memcounter=0; +static long int memsize=0; +static long int memsizef=0; + +void* mymalloc(int size,char* fileName,int line) { + memm* nodo; + void* p; + p=malloc(size); + nodo=malloc(sizeof(memm)); + nodo->next=list; + list=nodo; + strcpy(nodo->file,fileName); + nodo->line=line; + nodo->size=size; + nodo->pointer=p; + /*if (!(memcounter%100)) + //fprintf(stderr,"Memory allocation: %d bytes at %p in %d@%s (%d/%d)\n",size,p,line,fileName,memsize,memcounter); */ + memcounter++; + memsize+=size; + memsizef+=size; + return p; +} + +void myfree(void* a,char* fileName,int line) { + memm* currentNode; + memm* priorNode=NULL; + memcounter--; + /*if ((!(memcounter%100))||((memcounter<100)&&(memcounter>-100))) + //fprintf(stderr,"Liberando memoria? -> %p (%d/%d)\n",a,memsize,memcounter);*/ + + + free(a); + + if (list==NULL) { + fprintf(stderr,"Error!!!! se pidio liberar %p pero no estaba alocado (lista vacia)\n",a); + return; /* Empty list */ + } + currentNode=list; + while ((currentNode->pointer!=a)&&(currentNode->next!=NULL)) { + priorNode=currentNode; + currentNode=currentNode->next; + } + if (currentNode->pointer!=a) { + fprintf(stderr,"Error!!!! se pidio liberar %p pero no estaba alocado %d@%s\n",a,line,fileName); + return; /* Not found */ + } + + memsizef-=currentNode->size; + + /*fprintf(stderr,"Liberada: %d bytes at %p alloc: %d@%s | free %d@%s (%d/%d)\n",currentNode->size,currentNode->pointer,currentNode->line,currentNode->file,line,fileName,memsize,memcounter);*/ + + /* free node and set prior pointer to the next */ + if (priorNode==NULL) { + list=currentNode->next; + } else { + priorNode->next=currentNode->next; + } + free(currentNode); + +} + +void showInfo(void* a) { + memm* currentNode; + memm* priorNode=NULL; + + if (list==NULL) { + fprintf(stderr,"lista vacia\n"); + return; /* Empty list */ + } + currentNode=list; + while ((currentNode->pointer!=a)&&(currentNode->next!=NULL)) { + priorNode=currentNode; + currentNode=currentNode->next; + } + if (currentNode->pointer!=a) { + fprintf(stderr,"Puntero no alocado\n"); + return; /* Not found */ + } + + fprintf(stderr,"showInfo: %d bytes at %p alloc: %d@%s Mem tot: %d\n",currentNode->size,currentNode->pointer,currentNode->line,currentNode->file,memcounter); + +} + +void showStats() { + fprintf(stderr,"Total de memoria manejada: %d. Allocaciones: %d. Memoria no liberada: %d\n",memsize,memcounter,memsizef); + + memm* currentNode; + if (list==NULL) { + fprintf(stderr,"Todo COOL!!!!!\n"); + return; /* Empty list */ + } + currentNode=list; + do { + fprintf(stderr,"en %s@%d alocaste %d en %p y no los liberaste\n",currentNode->file,currentNode->line,currentNode->size,currentNode->pointer); + currentNode=currentNode->next; + } while (currentNode->next!=NULL); + +} +#endif diff --git a/PR/src/lib/object/image/image16.c b/PR/src/lib/object/image/image16.c index 44eebf0..c5bc9cf 100644 --- a/PR/src/lib/object/image/image16.c +++ b/PR/src/lib/object/image/image16.c @@ -213,21 +213,21 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) int imageSizeInBytes; int result; -printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); +/* printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); */ data++; - image->height=array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->height=array2short(data); data+=2; - image->width =array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->width =array2short(data); data+=2; -printf("K) %d;%d\n",image->width,image->height); +/* printf("K) %d;%d\n",image->width,image->height); */ fld("XX"); if (*(data++)) return COMPRESS_RESULT_FATAL; /* Verify format */ fld("YY"); image->type=(unsigned char)(*(data++)); dataSizeInBytes-=7; -printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ if (image->type&0xB0) { image->widthInBytes=(image->width+1)/2; } else { @@ -261,7 +261,7 @@ printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->wi result=COMPRESS_RESULT_FATAL; break; } -printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ return result; /* Ok */ } diff --git a/PR/src/lib/object/image/image2.c b/PR/src/lib/object/image/image2.c index 44eebf0..c5bc9cf 100644 --- a/PR/src/lib/object/image/image2.c +++ b/PR/src/lib/object/image/image2.c @@ -213,21 +213,21 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) int imageSizeInBytes; int result; -printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); +/* printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); */ data++; - image->height=array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->height=array2short(data); data+=2; - image->width =array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->width =array2short(data); data+=2; -printf("K) %d;%d\n",image->width,image->height); +/* printf("K) %d;%d\n",image->width,image->height); */ fld("XX"); if (*(data++)) return COMPRESS_RESULT_FATAL; /* Verify format */ fld("YY"); image->type=(unsigned char)(*(data++)); dataSizeInBytes-=7; -printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ if (image->type&0xB0) { image->widthInBytes=(image->width+1)/2; } else { @@ -261,7 +261,7 @@ printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->wi result=COMPRESS_RESULT_FATAL; break; } -printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ return result; /* Ok */ } diff --git a/PR/src/lib/object/image/image256.c b/PR/src/lib/object/image/image256.c index 44eebf0..c5bc9cf 100644 --- a/PR/src/lib/object/image/image256.c +++ b/PR/src/lib/object/image/image256.c @@ -213,21 +213,21 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) int imageSizeInBytes; int result; -printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); +/* printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); */ data++; - image->height=array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->height=array2short(data); data+=2; - image->width =array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->width =array2short(data); data+=2; -printf("K) %d;%d\n",image->width,image->height); +/* printf("K) %d;%d\n",image->width,image->height); */ fld("XX"); if (*(data++)) return COMPRESS_RESULT_FATAL; /* Verify format */ fld("YY"); image->type=(unsigned char)(*(data++)); dataSizeInBytes-=7; -printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ if (image->type&0xB0) { image->widthInBytes=(image->width+1)/2; } else { @@ -261,7 +261,7 @@ printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->wi result=COMPRESS_RESULT_FATAL; break; } -printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ return result; /* Ok */ } diff --git a/PR/src/lib/object/image/image_common.c b/PR/src/lib/object/image/image_common.c index 44eebf0..c5bc9cf 100644 --- a/PR/src/lib/object/image/image_common.c +++ b/PR/src/lib/object/image/image_common.c @@ -213,21 +213,21 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) int imageSizeInBytes; int result; -printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); +/* printf("+K) %d:%d:%d:%d:%d:%d\n",data[0],data[1],data[2],data[3],data[4],data[5]); */ data++; - image->height=array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->height=array2short(data); data+=2; - image->width =array2short(data);//((unsigned char)data[0])+((unsigned char)data[1]<<8);data+=2; + image->width =array2short(data); data+=2; -printf("K) %d;%d\n",image->width,image->height); +/* printf("K) %d;%d\n",image->width,image->height); */ fld("XX"); if (*(data++)) return COMPRESS_RESULT_FATAL; /* Verify format */ fld("YY"); image->type=(unsigned char)(*(data++)); dataSizeInBytes-=7; -printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ if (image->type&0xB0) { image->widthInBytes=(image->width+1)/2; } else { @@ -261,7 +261,7 @@ printf("K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->wi result=COMPRESS_RESULT_FATAL; break; } -printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); +/* printf("-K) %d+%d*%d,%d\n",image->pix,image->height,image->widthInBytes,image->widthInBytes); */ return result; /* Ok */ } diff --git a/PR/src/lib/xml/parse.c b/PR/src/lib/xml/parse.c index f64c207..a9a4f03 100644 --- a/PR/src/lib/xml/parse.c +++ b/PR/src/lib/xml/parse.c @@ -377,9 +377,8 @@ tTag* makeTree(char** p,char* name, int* error,tTag* father) { /* Set variable and destroy old variables */ sprintf(str,"%s/%s",father->path,tag->path); free(tag->path); - if ((*(father->path))==0) free(father->path); + if ((*(father->path))==0) {free(father->path);father->path=NULL;} tag->path=str; - memcpy(tag->path,str,x); } } /* END specific xml tag inheritance */ @@ -460,11 +459,13 @@ tTag* parseXmlFile(const char* vFile,int* error) { char* value=NULL; tTag* tag; tTag* father; + int size; - if (!mLoadFileArray(vFile,(unsigned char**)(&l))) { + if (!(size=mLoadFileArray(vFile,(unsigned char**)(&l)))) { *error=-4; /* File not open */ return NULL; } + l[size-1]=0; /* The last character must be an end of line (the > is forbiden) */ p=l; *error=getNextTag(&p, &value); @@ -482,7 +483,9 @@ tTag* parseXmlFile(const char* vFile,int* error) { free(father); return NULL; } + *error=getNextTag(&p, &value); + free(l); if (*error<0) { freeTagStructure(tag); diff --git a/PR/src/ports/winfiles/pr.exe b/PR/src/ports/winfiles/pr.exe index c081677..9735736 100755 Binary files a/PR/src/ports/winfiles/pr.exe and b/PR/src/ports/winfiles/pr.exe differ