1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

fix file copy for empty input

This commit is contained in:
Lu Wang 2013-01-28 21:56:22 +08:00
parent f3b6c2c889
commit 272fb57755

View File

@ -414,6 +414,7 @@ void HTMLRenderer::post_process()
if(!fin) if(!fin)
throw "Cannot open read the pages"; throw "Cannot open read the pages";
output << fin.rdbuf(); output << fin.rdbuf();
output.clear(); // output will set fail big if fin is empty
} }
else if (line == "$pages") else if (line == "$pages")
{ {
@ -421,6 +422,7 @@ void HTMLRenderer::post_process()
if(!fin) if(!fin)
throw "Cannot open read the pages"; throw "Cannot open read the pages";
output << fin.rdbuf(); output << fin.rdbuf();
output.clear(); // output will set fail big if fin is empty
} }
else else
{ {
@ -458,8 +460,9 @@ void HTMLRenderer::embed_file(ostream & out, const string & path, const string &
if(!fin) if(!fin)
throw string("Cannot open file ") + path + " for embedding"; throw string("Cannot open file ") + path + " for embedding";
out << iter->second.first << endl out << iter->second.first << endl
<< fin.rdbuf() << fin.rdbuf();
<< iter->second.second << endl; out.clear(); // out will set fail big if fin is empty
out << iter->second.second << endl;
} }
else else
{ {
@ -477,6 +480,7 @@ void HTMLRenderer::embed_file(ostream & out, const string & path, const string &
if(!out) if(!out)
throw string("Cannot open file ") + path + " for embedding"; throw string("Cannot open file ") + path + " for embedding";
out << fin.rdbuf(); out << fin.rdbuf();
out.clear(); // out will set fail big if fin is empty
} }
} }
} }