From 73447a07f1f4c93539418cc14fbfbbe6ede62728 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 12 Aug 2015 11:06:16 +0000 Subject: texk/dvipdfm-x: Moved check_for_mp() and declared as static git-svn-id: svn://tug.org/texlive/trunk@38104 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipdfm-x/ChangeLog | 5 +++++ Build/source/texk/dvipdfm-x/mpost.c | 25 +------------------------ Build/source/texk/dvipdfm-x/mpost.h | 4 +--- Build/source/texk/dvipdfm-x/pdfximage.c | 28 +++++++++++++++++++++++++--- 4 files changed, 32 insertions(+), 30 deletions(-) (limited to 'Build/source/texk/dvipdfm-x') diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index e4516a1bdad..88d9d6159ab 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,8 @@ +2015-08-12 Peter Breitenlohner + + * mpost.[ch]: Extern check_for_mp() moved from here ... + * pdfximage.c: ... to here as static. + 2015-08-05 Akira Kakuto * dvi.c: Introduce a new static function static int is_notdef_notzero() diff --git a/Build/source/texk/dvipdfm-x/mpost.c b/Build/source/texk/dvipdfm-x/mpost.c index 36476929021..047d4767650 100644 --- a/Build/source/texk/dvipdfm-x/mpost.c +++ b/Build/source/texk/dvipdfm-x/mpost.c @@ -1,6 +1,6 @@ /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - Copyright (C) 2007-2014 by Jin-Hwan Cho and Shunsaku Hirata, + Copyright (C) 2007-2015 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. Copyright (C) 1998, 1999 by Mark A. Wicks @@ -1658,26 +1658,3 @@ mps_do_page (FILE *image_file) */ return (error ? -1 : 0); } - -int -check_for_mp (FILE *image_file) -{ - int try_count = 10; - - rewind (image_file); - mfgets(work_buffer, WORK_BUFFER_SIZE, image_file); - if (strncmp(work_buffer, "%!PS", 4)) - return 0; - - while (try_count > 0) { - mfgets(work_buffer, WORK_BUFFER_SIZE, image_file); - if (!strncmp(work_buffer, "%%Creator:", 10)) { - if (strlen(work_buffer+10) >= 8 && - strstr(work_buffer+10, "MetaPost")) - break; - } - try_count--; - } - - return ((try_count > 0) ? 1 : 0); -} diff --git a/Build/source/texk/dvipdfm-x/mpost.h b/Build/source/texk/dvipdfm-x/mpost.h index abb6c3b8c24..a2980a4b314 100644 --- a/Build/source/texk/dvipdfm-x/mpost.h +++ b/Build/source/texk/dvipdfm-x/mpost.h @@ -1,6 +1,6 @@ /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - Copyright (C) 2002-2014 by Jin-Hwan Cho and Shunsaku Hirata, + Copyright (C) 2002-2015 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. Copyright (C) 1998, 1999 by Mark A. Wicks @@ -27,8 +27,6 @@ #include "pdfximage.h" #include "pdfdev.h" -extern int check_for_mp (FILE *fp); - extern int mps_scan_bbox (const char **pp, const char *endptr, pdf_rect *bbox); /* returns xobj_id */ diff --git a/Build/source/texk/dvipdfm-x/pdfximage.c b/Build/source/texk/dvipdfm-x/pdfximage.c index 8765e3a4f10..5e6aa96344c 100644 --- a/Build/source/texk/dvipdfm-x/pdfximage.c +++ b/Build/source/texk/dvipdfm-x/pdfximage.c @@ -1,6 +1,6 @@ /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - Copyright (C) 2007-2014 by Jin-Hwan Cho and Shunsaku Hirata, + Copyright (C) 2007-2015 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. Copyright (C) 1998, 1999 by Mark A. Wicks @@ -45,8 +45,8 @@ #include "pdfximage.h" -/* From psimage.h */ -static int check_for_ps (FILE *fp); +static int check_for_ps (FILE *image_file); +static int check_for_mp (FILE *image_file); static int ps_include_page (pdf_ximage *ximage, const char *file_name); @@ -979,3 +979,25 @@ static int check_for_ps (FILE *image_file) return 1; return 0; } + +static int check_for_mp (FILE *image_file) +{ + int try_count = 10; + + rewind (image_file); + mfgets(work_buffer, WORK_BUFFER_SIZE, image_file); + if (strncmp(work_buffer, "%!PS", 4)) + return 0; + + while (try_count > 0) { + mfgets(work_buffer, WORK_BUFFER_SIZE, image_file); + if (!strncmp(work_buffer, "%%Creator:", 10)) { + if (strlen(work_buffer+10) >= 8 && + strstr(work_buffer+10, "MetaPost")) + break; + } + try_count--; + } + + return ((try_count > 0) ? 1 : 0); +} -- cgit v1.2.3