From 1b54746a7a7087af138fe21c002cd967fdaf6597 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Sat, 4 Jul 2015 11:28:05 +0000 Subject: e-(u)pTeX: Add \pdfmdfivesum as in pdfTeX (from Hironori Kitagawa) git-svn-id: svn://tug.org/texlive/trunk@37756 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/pdftexdir/utils.c | 84 ++----------------------------- 1 file changed, 5 insertions(+), 79 deletions(-) (limited to 'Build/source/texk/web2c/pdftexdir/utils.c') diff --git a/Build/source/texk/web2c/pdftexdir/utils.c b/Build/source/texk/web2c/pdftexdir/utils.c index 31fbae2237a..43b9ba4b73f 100644 --- a/Build/source/texk/web2c/pdftexdir/utils.c +++ b/Build/source/texk/web2c/pdftexdir/utils.c @@ -1,5 +1,5 @@ /* -Copyright 1996-2014 Han The Thanh, +Copyright 1996-2015 Han The Thanh, This file is part of pdfTeX. @@ -29,15 +29,15 @@ with this program. If not, see . #include #include /* for DBL_EPSILON */ #include "md5.h" -#include "zlib.h" +#include #include "ptexlib.h" -#include "png.h" +#include #ifdef POPPLER_VERSION -#include "poppler-config.h" +#include #define xpdfVersion POPPLER_VERSION #define xpdfString "poppler" #else -#include "xpdf/config.h" /* just to get the xpdf version */ +#include /* just to get the xpdf version */ #define xpdfString "xpdf" #endif @@ -670,26 +670,6 @@ void unescapehex(poolpointer in) } } - -/* Converts any string given in in in an allowed PDF string which is - * hexadecimal encoded; - * sizeof(out) should be at least lin*2+1. - */ -static void convertStringToHexString(const char *in, char *out, int lin) -{ - int i, j, k; - char buf[3]; - j = 0; - for (i = 0; i < lin; i++) { - k = snprintf(buf, sizeof(buf), - "%02X", (unsigned int) (unsigned char) in[i]); - check_nprintf(k, sizeof(buf)); - out[j++] = buf[0]; - out[j++] = buf[1]; - } - out[j] = '\0'; -} - /* Compute the ID string as per PDF1.4 9.3:
File identifers are defined by the optional ID entry in a PDF file's @@ -841,60 +821,6 @@ void printmoddate(void) pdf_printf("/ModDate (%s)\n", start_time_str); } -#define DIGEST_SIZE 16 -#define FILE_BUF_SIZE 1024 - -void getmd5sum(strnumber s, boolean file) -{ - md5_state_t state; - md5_byte_t digest[DIGEST_SIZE]; - char outbuf[2 * DIGEST_SIZE + 1]; - int len = 2 * DIGEST_SIZE; - - if (file) { - char file_buf[FILE_BUF_SIZE]; - int read = 0; - FILE *f; - - char *file_name = kpse_find_tex(makecfilename(s)); - if (file_name == NULL) { - return; /* empty string */ - } - /* in case of error the empty string is returned, - no need for xfopen that aborts on error. - */ - f = fopen(file_name, FOPEN_RBIN_MODE); - if (f == NULL) { - xfree(file_name); - return; - } - recorder_record_input(file_name); - md5_init(&state); - while ((read = fread(&file_buf, sizeof(char), FILE_BUF_SIZE, f)) > 0) { - md5_append(&state, (const md5_byte_t *) file_buf, read); - } - md5_finish(&state, digest); - fclose(f); - - xfree(file_name); - } else { - /* s contains the data */ - md5_init(&state); - md5_append(&state, - (const md5_byte_t *) &strpool[strstart[s]], - strstart[s + 1] - strstart[s]); - md5_finish(&state, digest); - } - - if (poolptr + len >= poolsize) { - /* error by str_toks that calls str_room(1) */ - return; - } - convertStringToHexString((char *) digest, outbuf, DIGEST_SIZE); - memcpy(&strpool[poolptr], outbuf, len); - poolptr += len; -} - #define DEFAULT_SUB_MATCH_COUNT 10 static int sub_match_count = DEFAULT_SUB_MATCH_COUNT; static regmatch_t *pmatch = NULL; -- cgit v1.2.3