Browse Source

gzip file bugfix

master
Nasca Octavian PAUL 10 years ago
parent
commit
2848f71446
2 changed files with 9 additions and 7 deletions
  1. +7
    -7
      XMLwrapper.cpp
  2. +2
    -0
      readme.txt

+ 7
- 7
XMLwrapper.cpp View File

@@ -253,7 +253,8 @@ int XMLwrapper::loadXMLfile(const char *filename){

char *xmldata=doloadfile(filename);
if (xmldata==NULL) return(-1);//the file could not be loaded or uncompressed
printf("%s\n",xmldata);
root=tree=mxmlLoadString(NULL,xmldata,MXML_OPAQUE_CALLBACK);

delete []xmldata;
@@ -280,14 +281,13 @@ char *XMLwrapper::doloadfile(const char *filename){
gzFile gzfile=gzopen(filename,"rb");
if (gzfile!=NULL){//this is a gzip file
// first check it's size
int bufsize=1024;
char* tmpbuf=new char[bufsize];
filesize=0;
while(!gzeof(gzfile)) {
gzseek (gzfile,1024*1024,SEEK_CUR);
if (gztell(gzfile)>10000000) {
gzclose(gzfile);
goto notgzip;//the file is too big
};
filesize+=gzread(gzfile,tmpbuf,bufsize);
};
filesize=gztell(gzfile);
delete []tmpbuf;

//rewind the file and load the data
xmldata=new char[filesize+1];


+ 2
- 0
readme.txt View File

@@ -73,6 +73,8 @@ History:
- Shorten algorithm improvements
- Added an option to preserve the tonal part or noise part
- Ignored the commandline parameters starting with "-" (usefull for macosx)
20110303(2.2-0)
- gzip bugfix which prevents loading of the .psx files on Windows

Enjoy! :)
Paul


Loading…
Cancel
Save