Lines 1000-1005
Link Here
|
1000 |
|
1000 |
|
1001 |
void getCharDataFromXML(void *data,const char *s,int len) |
1001 |
void getCharDataFromXML(void *data,const char *s,int len) |
1002 |
{ |
1002 |
{ |
|
|
1003 |
//cerr << "called getCharDataFromXML with len: " << len << endl; |
1003 |
int copylen=len; |
1004 |
int copylen=len; |
1004 |
|
1005 |
|
1005 |
if(FREA->error) return; |
1006 |
if(FREA->error) return; |
Lines 1017-1022
Link Here
|
1017 |
memcpy((FREA->dataBuffer)+buffpos,s,sizeof(char) * copylen ); |
1018 |
memcpy((FREA->dataBuffer)+buffpos,s,sizeof(char) * copylen ); |
1018 |
buffpos += copylen; |
1019 |
buffpos += copylen; |
1019 |
FREA->dataBuffer[buffpos] = '\0'; |
1020 |
FREA->dataBuffer[buffpos] = '\0'; |
|
|
1021 |
// cerr << "returning from getCharDataFromXML." << endl; |
1020 |
} |
1022 |
} |
1021 |
|
1023 |
|
1022 |
|
1024 |
|
Lines 1066-1079
Link Here
|
1066 |
return 1; |
1068 |
return 1; |
1067 |
} |
1069 |
} |
1068 |
|
1070 |
|
1069 |
done = gzeof(f); |
1071 |
// Olivier.Dormond@gmail.com |
|
|
1072 |
// This is apparently buggy most probably because it can be set when the eof |
1073 |
// of the gzipped file is seen but the decompressed content is bigger than |
1074 |
// the read buffer. In such a case, the very last chunk of data is never read |
1075 |
// and the XML_Parse call will fail because it will miss the closing tag. |
1076 |
// done = gzeof(f); |
1077 |
// So simply check we didn't get any more data to read as calling XML_Parse |
1078 |
// with an empty buffer is safe. |
1079 |
done = len == 0; |
1070 |
|
1080 |
|
|
|
1081 |
//cerr << "Calling XML_Parse with " << len << "bytes and done=" << done << endl; |
1071 |
if (! XML_Parse(p, Buff, len, done)) |
1082 |
if (! XML_Parse(p, Buff, len, done)) |
1072 |
{ |
1083 |
{ |
1073 |
errormsg = QString("Parse error at line %1:\n%2\n") |
1084 |
errormsg = QString("Parse error at line %1:\n%2\n") |
1074 |
.arg(XML_GetCurrentLineNumber(p)) |
1085 |
.arg(XML_GetCurrentLineNumber(p)) |
1075 |
.arg(XML_ErrorString(XML_GetErrorCode(p))); |
1086 |
.arg(XML_ErrorString(XML_GetErrorCode(p))); |
1076 |
|
1087 |
|
|
|
1088 |
// cerr << "Buffer content at time of error:" << endl; |
1089 |
// cerr << Buff << endl; |
1090 |
// cerr << "End buffer content." << endl; |
1077 |
delete [] Buff; |
1091 |
delete [] Buff; |
1078 |
delete [] dataBuffer; |
1092 |
delete [] dataBuffer; |
1079 |
return 1; |
1093 |
return 1; |