Fixed compiling problems
This commit is contained in:
parent
6e9845fd93
commit
bed6c21a24
|
@ -492,14 +492,20 @@ std::string WrapLibxml::dumpXPathObject ( xmlXPathObjectPtr obj )
|
||||||
FILE *fp = tmpfile();
|
FILE *fp = tmpfile();
|
||||||
xmlXPathDebugDumpObject ( fp, obj, 0/*depth*/ );
|
xmlXPathDebugDumpObject ( fp, obj, 0/*depth*/ );
|
||||||
|
|
||||||
fpos_t size = ftell ( fp );
|
|
||||||
std::string str;
|
std::string str;
|
||||||
str.resize ( size );
|
long size = ftell ( fp );
|
||||||
fseek ( fp, 0, SEEK_SET );
|
if ( size == -1 )
|
||||||
fread ( ( char * ) str.c_str(), 1, str.capacity(), fp );
|
return str;
|
||||||
|
|
||||||
|
str.resize ( size + 1 );
|
||||||
|
if ( str.capacity() != ( size_t ) size + 1 )
|
||||||
|
return str;
|
||||||
|
rewind ( fp );
|
||||||
|
size_t read = fread ( ( char * ) str.c_str(), 1, str.capacity(), fp );
|
||||||
|
str[size] = '\0';
|
||||||
fclose ( fp );
|
fclose ( fp );
|
||||||
|
|
||||||
return str;
|
return read == str.capacity() ? str : sstream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
return sstream.str();
|
return sstream.str();
|
||||||
|
|
Loading…
Reference in New Issue