internfile: keep around temp file for possible caller use
This commit is contained in:
parent
4287eb008a
commit
631121e24e
@ -734,6 +734,13 @@ int FileInterner::addHandler()
|
|||||||
if (!(setres = newflt->set_document_file(filename))) {
|
if (!(setres = newflt->set_document_file(filename))) {
|
||||||
m_tmpflgs[m_handlers.size()] = false;
|
m_tmpflgs[m_handlers.size()] = false;
|
||||||
m_tempfiles.pop_back();
|
m_tempfiles.pop_back();
|
||||||
|
} else {
|
||||||
|
// Hack here, but really helps perfs: if we happen to
|
||||||
|
// create a temp file for, ie, an image attachment,
|
||||||
|
// keep it around for preview reuse
|
||||||
|
if (!mimetype.compare(0, 6, "image/")) {
|
||||||
|
m_imgtmp = m_tempfiles.back();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -765,6 +772,10 @@ void FileInterner::processNextDocError(Rcl::Doc &doc, string& ipath)
|
|||||||
FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath)
|
FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath)
|
||||||
{
|
{
|
||||||
LOGDEB(("FileInterner::internfile. ipath [%s]\n", ipath.c_str()));
|
LOGDEB(("FileInterner::internfile. ipath [%s]\n", ipath.c_str()));
|
||||||
|
|
||||||
|
// Get rid of possible image tempfile from older call
|
||||||
|
m_imgtmp.release();
|
||||||
|
|
||||||
if (m_handlers.size() < 1) {
|
if (m_handlers.size() < 1) {
|
||||||
// Just means the constructor failed
|
// Just means the constructor failed
|
||||||
LOGDEB(("FileInterner::internfile: no handler: constructor failed\n"));
|
LOGDEB(("FileInterner::internfile: no handler: constructor failed\n"));
|
||||||
|
|||||||
@ -159,6 +159,10 @@ class FileInterner {
|
|||||||
*/
|
*/
|
||||||
const string& get_html() {return m_html;}
|
const string& get_html() {return m_html;}
|
||||||
|
|
||||||
|
/** If we happen to be processing an image file and need a temp file,
|
||||||
|
we keep it around to save work for our caller, which can get it here */
|
||||||
|
TempFile get_imgtmp() {return m_imgtmp;}
|
||||||
|
|
||||||
/** Extract internal document into temporary file.
|
/** Extract internal document into temporary file.
|
||||||
* This is used mainly for starting an external viewer for a
|
* This is used mainly for starting an external viewer for a
|
||||||
* subdocument (ie: mail attachment).
|
* subdocument (ie: mail attachment).
|
||||||
@ -198,6 +202,7 @@ class FileInterner {
|
|||||||
string m_mimetype; // Mime type for [uncompressed] file
|
string m_mimetype; // Mime type for [uncompressed] file
|
||||||
bool m_forPreview;
|
bool m_forPreview;
|
||||||
string m_html; // Possibly set-aside html text for preview
|
string m_html; // Possibly set-aside html text for preview
|
||||||
|
TempFile m_imgtmp; // Possible reference to an image temp file
|
||||||
string m_targetMType;
|
string m_targetMType;
|
||||||
string m_reachedMType; // target or text/plain
|
string m_reachedMType; // target or text/plain
|
||||||
// m_tdir and m_tfile are used only for decompressing input file if needed
|
// m_tdir and m_tfile are used only for decompressing input file if needed
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user