diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-04-19 20:45:12 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-04-19 20:45:12 +0100 |
commit | 4b6a1a260468728f545f67771da0d624bf3a8aad (patch) | |
tree | b02e88bcee1c1a09475b0e9d33890b434d987e33 /fitz | |
parent | 158bbabcbfd38479b2077778ec6b8016204a2f14 (diff) | |
download | mupdf-4b6a1a260468728f545f67771da0d624bf3a8aad.tar.xz |
Change fz_document_open to assume PDF format by default.
Previously, we would only open files with the correct extension.
Until such time as we get file type detection by contents working
assume that any file that doesn't end in .xps or .cbz is a pdf
file.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/doc_document.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fitz/doc_document.c b/fitz/doc_document.c index 095a7fb5..15ad4b62 100644 --- a/fitz/doc_document.c +++ b/fitz/doc_document.c @@ -27,14 +27,22 @@ fz_document * fz_open_document(fz_context *ctx, char *filename) { char *ext = strrchr(filename, '.'); - if (ext && !fz_strcasecmp(ext, ".pdf")) - return (fz_document*) pdf_open_document(ctx, filename); if (ext && !fz_strcasecmp(ext, ".xps")) return (fz_document*) xps_open_document(ctx, filename); if (ext && !fz_strcasecmp(ext, ".cbz")) return (fz_document*) cbz_open_document(ctx, filename); +#if 0 + /* We used to only open pdf files if they ended in .pdf. For now, + * until we move to detecting filetypes by their content, we disable + * this code, and assume that any file that hasn't matched an + * extension already, is a PDF. */ + if (ext && !fz_strcasecmp(ext, ".pdf")) + return (fz_document*) pdf_open_document(ctx, filename); fz_throw(ctx, "unknown document type: '%s'", filename); return NULL; +#else + return (fz_document*) pdf_open_document(ctx, filename); +#endif } void |