diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2013-04-30 13:21:50 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2013-04-30 13:21:50 +0000 |
commit | ef447158f844e9d9c2fb4e328cce5225e1f08fb9 (patch) | |
tree | 078ee5a14f27c241adecc0563617080fb5a6d562 /Build/source/texk/xdvipdfmx/src | |
parent | d9138f40c346b88147148d28cf7e479013a51246 (diff) |
Add a compatible mode with the old behavior per Karl, where image cache is ignored (default).
git-svn-id: svn://tug.org/texlive/trunk@30184 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/xdvipdfmx/src')
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/dpxfile.c | 10 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/dvipdfmx.c | 6 | ||||
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/pdfximage.c | 17 |
3 files changed, 20 insertions, 13 deletions
diff --git a/Build/source/texk/xdvipdfmx/src/dpxfile.c b/Build/source/texk/xdvipdfmx/src/dpxfile.c index 80998652a11..b904bea8055 100644 --- a/Build/source/texk/xdvipdfmx/src/dpxfile.c +++ b/Build/source/texk/xdvipdfmx/src/dpxfile.c @@ -61,7 +61,7 @@ #endif static int verbose = 0; -int keep_cache = false; +int keep_cache = 0; void dpx_file_set_verbose (void) @@ -899,7 +899,11 @@ dpx_delete_old_cache (int life) struct dirent *de; time_t limit = time(NULL) - life * 60 * 60; - if (life >= 0) keep_cache = true; + if (life == -2) { + keep_cache = -1; + return; + } + if (life >= 0) keep_cache = 1; if ((dp = opendir(dir)) != NULL) { while((de = readdir(dp)) != NULL) { if (dpx_clear_cache_filter(de)) { @@ -922,7 +926,7 @@ dpx_delete_temp_file (char *tmp, int force) { if (!tmp) return; - if (force || !keep_cache) remove (tmp); + if (force || keep_cache != 1) remove (tmp); RELEASE(tmp); return; diff --git a/Build/source/texk/xdvipdfmx/src/dvipdfmx.c b/Build/source/texk/xdvipdfmx/src/dvipdfmx.c index ac82c2cdf56..ac97ed11198 100644 --- a/Build/source/texk/xdvipdfmx/src/dvipdfmx.c +++ b/Build/source/texk/xdvipdfmx/src/dvipdfmx.c @@ -91,7 +91,8 @@ static int pdfdecimaldigits = 2; /* Image cache life in hours */ /* 0 means erase all old images and leave new images */ /* -1 means erase all old images and also erase new images */ -static int image_cache_life = -1; +/* -2 means ignore image cache (default) */ +static int image_cache_life = -2; /* Encryption */ static int do_encryption = 0; @@ -190,9 +191,10 @@ usage (int exit_code) fprintf (stdout, "\t\tAnd negative values replace old values.\n"); fprintf (stdout, "-D template\tPS->PDF conversion command line template [none]\n"); fprintf (stdout, "-E \t\tAlways try to embed fonts, regardless of licensing flags.\n"); - fprintf (stdout, "-I number\tImage cache life in hours [-1]\n"); + fprintf (stdout, "-I number\tImage cache life in hours [-2]\n"); fprintf (stdout, " \t 0: erase all old images and leave new images\n"); fprintf (stdout, " \t-1: erase all old images and also erase new images\n"); + fprintf (stdout, " \t-2: ignore image cache\n"); fprintf (stdout, "-K number\tEncryption key length [40]\n"); fprintf (stdout, "-O number\tSet maximum depth of open bookmark items [0]\n"); fprintf (stdout, "-P number\tSet permission flags for PDF encryption [0x003C]\n"); diff --git a/Build/source/texk/xdvipdfmx/src/pdfximage.c b/Build/source/texk/xdvipdfmx/src/pdfximage.c index 6ac7b87f481..f16829f18ba 100644 --- a/Build/source/texk/xdvipdfmx/src/pdfximage.c +++ b/Build/source/texk/xdvipdfmx/src/pdfximage.c @@ -191,7 +191,7 @@ pdf_close_images (void) * We also use this to convert a PS file only once if multiple * pages are imported from that file. */ - if (_opts.verbose > 1 && !keep_cache) + if (_opts.verbose > 1 && keep_cache != 1) MESG("pdf_image>> deleting temporary file \"%s\"\n", I->filename); dpx_delete_temp_file(I->filename, false); /* temporary filename freed here */ I->filename = NULL; @@ -855,12 +855,6 @@ ps_include_page (pdf_ximage *ximage, const char *filename) return -1; } - if (_opts.verbose > 1) { - MESG("\n"); - MESG("pdf_image>> Converting file \"%s\" --> \"%s\" via:\n", filename, temp); - MESG("pdf_image>> %s\n", distiller_template); - MESG("pdf_image>> ..."); - } #ifdef MIKTEX { char *p; @@ -872,12 +866,19 @@ ps_include_page (pdf_ximage *ximage, const char *filename) } } #endif - if (stat(temp, &stat_t)==0 && stat(filename, &stat_o)==0 + if (keep_cache != -1 && stat(temp, &stat_t)==0 && stat(filename, &stat_o)==0 && stat_t.st_mtime > stat_o.st_mtime) { /* cache exist */ /*printf("\nLast file modification: %s", ctime(&stat_o.st_mtime)); printf("Last file modification: %s", ctime(&stat_t.st_mtime));*/ + ; } else { + if (_opts.verbose > 1) { + MESG("\n"); + MESG("pdf_image>> Converting file \"%s\" --> \"%s\" via:\n", filename, temp); + MESG("pdf_image>> %s\n", distiller_template); + MESG("pdf_image>> ..."); + } error = dpx_file_apply_filter(distiller_template, filename, temp, (unsigned char) pdf_get_version()); if (error) { |