|
a/src/internfile/internfile.cpp |
|
b/src/internfile/internfile.cpp |
|
... |
|
... |
185 |
// uncompressed file type.
|
185 |
// uncompressed file type.
|
186 |
//
|
186 |
//
|
187 |
// Empty handler on return says that we're in error, this will be
|
187 |
// Empty handler on return says that we're in error, this will be
|
188 |
// processed by the first call to internfile().
|
188 |
// processed by the first call to internfile().
|
189 |
// Split into "constructor calls init()" to allow use from other constructor
|
189 |
// Split into "constructor calls init()" to allow use from other constructor
|
190 |
FileInterner::FileInterner(const string &f, const struct stat *stp,
|
190 |
FileInterner::FileInterner(const string &fn, const struct stat *stp,
|
191 |
RclConfig *cnf,
|
191 |
RclConfig *cnf,
|
192 |
TempDir& td, int flags, const string *imime)
|
192 |
TempDir& td, int flags, const string *imime)
|
193 |
: m_tdir(td), m_ok(false), m_missingdatap(0)
|
193 |
: m_tdir(td), m_ok(false), m_missingdatap(0)
|
194 |
{
|
194 |
{
|
|
|
195 |
LOGDEB0(("FileInterner::FileInterner(fn=%s)\n", fn.c_str()));
|
|
|
196 |
if (fn.empty()) {
|
|
|
197 |
LOGERR(("FileInterner::FileInterner: empty file name!\n"));
|
|
|
198 |
return;
|
|
|
199 |
}
|
195 |
initcommon(cnf, flags);
|
200 |
initcommon(cnf, flags);
|
196 |
init(f, stp, cnf, flags, imime);
|
201 |
init(fn, stp, cnf, flags, imime);
|
197 |
}
|
202 |
}
|
198 |
|
203 |
|
199 |
void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
|
204 |
void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
|
200 |
int flags, const string *imime)
|
205 |
int flags, const string *imime)
|
201 |
{
|
206 |
{
|
|
|
207 |
if (f.empty()) {
|
|
|
208 |
LOGERR(("FileInterner::init: empty file name!\n"));
|
|
|
209 |
return;
|
|
|
210 |
}
|
202 |
m_fn = f;
|
211 |
m_fn = f;
|
203 |
|
212 |
|
204 |
// Compute udi for the input file. This is used by filters which
|
213 |
// Compute udi for the input file. This is used by filters which
|
205 |
// manage some kind of cache. Indexing by udi makes things easier
|
214 |
// manage some kind of cache. Indexing by udi makes things easier
|
206 |
// because they sometimes get a temp as actual input.
|
215 |
// because they sometimes get a temp as actual input.
|
|
... |
|
... |
224 |
LOGERR(("FileInterner:: told to use null imime\n"));
|
233 |
LOGERR(("FileInterner:: told to use null imime\n"));
|
225 |
return;
|
234 |
return;
|
226 |
}
|
235 |
}
|
227 |
l_mime = *imime;
|
236 |
l_mime = *imime;
|
228 |
} else {
|
237 |
} else {
|
229 |
LOGDEB(("FileInterner:: [%s] mime [%s] preview %d\n",
|
238 |
LOGDEB(("FileInterner::init fn [%s] mime [%s] preview %d\n",
|
230 |
f.c_str(), imime?imime->c_str() : "(null)", m_forPreview));
|
239 |
f.c_str(), imime?imime->c_str() : "(null)", m_forPreview));
|
231 |
|
240 |
|
232 |
// Run mime type identification in any case (see comment above).
|
241 |
// Run mime type identification in any case (see comment above).
|
233 |
l_mime = mimetype(m_fn, stp, m_cfg, usfci);
|
242 |
l_mime = mimetype(m_fn, stp, m_cfg, usfci);
|
234 |
|
243 |
|
|
... |
|
... |
318 |
// Setup from memory data (ie: out of the web cache). imime needs to be set.
|
327 |
// Setup from memory data (ie: out of the web cache). imime needs to be set.
|
319 |
FileInterner::FileInterner(const string &data, RclConfig *cnf,
|
328 |
FileInterner::FileInterner(const string &data, RclConfig *cnf,
|
320 |
TempDir& td, int flags, const string& imime)
|
329 |
TempDir& td, int flags, const string& imime)
|
321 |
: m_tdir(td), m_ok(false), m_missingdatap(0)
|
330 |
: m_tdir(td), m_ok(false), m_missingdatap(0)
|
322 |
{
|
331 |
{
|
|
|
332 |
LOGDEB0(("FileInterner::FileInterner(data)\n"));
|
323 |
initcommon(cnf, flags);
|
333 |
initcommon(cnf, flags);
|
324 |
init(data, cnf, flags, imime);
|
334 |
init(data, cnf, flags, imime);
|
325 |
}
|
335 |
}
|
326 |
|
336 |
|
327 |
void FileInterner::init(const string &data, RclConfig *cnf,
|
337 |
void FileInterner::init(const string &data, RclConfig *cnf,
|
|
... |
|
... |
382 |
|
392 |
|
383 |
FileInterner::FileInterner(const Rcl::Doc& idoc, RclConfig *cnf,
|
393 |
FileInterner::FileInterner(const Rcl::Doc& idoc, RclConfig *cnf,
|
384 |
TempDir& td, int flags)
|
394 |
TempDir& td, int flags)
|
385 |
: m_tdir(td), m_ok(false), m_missingdatap(0)
|
395 |
: m_tdir(td), m_ok(false), m_missingdatap(0)
|
386 |
{
|
396 |
{
|
387 |
LOGDEB(("FileInterner::FileInterner(idoc)\n"));
|
397 |
LOGDEB0(("FileInterner::FileInterner(idoc)\n"));
|
388 |
initcommon(cnf, flags);
|
398 |
initcommon(cnf, flags);
|
389 |
|
399 |
|
390 |
DocFetcher *fetcher = docFetcherMake(idoc);
|
400 |
DocFetcher *fetcher = docFetcherMake(idoc);
|
391 |
if (fetcher == 0) {
|
401 |
if (fetcher == 0) {
|
392 |
LOGERR(("FileInterner:: no backend\n"));
|
402 |
LOGERR(("FileInterner:: no backend\n"));
|