diff options
author | Karl Berry <karl@freefriends.org> | 2009-05-19 00:42:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-05-19 00:42:35 +0000 |
commit | 136f54b7dc95964f3db31da84ba3f1961967babe (patch) | |
tree | 2050345bf4d6396bce5b756842aea46626c7d53b /Build/source/texk/dvipdfmx/src/pdfparse.c | |
parent | 53241b23b422addce6dd1145dfa1d334a940c45d (diff) |
update to http://project.ktug.or.kr/dvipdfmx/snapshot/latest/dvipdfmx-20090506.tar.gz
git-svn-id: svn://tug.org/texlive/trunk@13221 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfmx/src/pdfparse.c')
-rw-r--r-- | Build/source/texk/dvipdfmx/src/pdfparse.c | 84 |
1 files changed, 25 insertions, 59 deletions
diff --git a/Build/source/texk/dvipdfmx/src/pdfparse.c b/Build/source/texk/dvipdfmx/src/pdfparse.c index 111114ec362..7709e7fced7 100644 --- a/Build/source/texk/dvipdfmx/src/pdfparse.c +++ b/Build/source/texk/dvipdfmx/src/pdfparse.c @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/pdfparse.c,v 1.43 2008/06/07 09:54:38 chofchof Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/pdfparse.c,v 1.44 2009/04/29 11:20:21 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -503,10 +503,18 @@ parse_pdf_literal_string (char **pp, char *endptr) p++; - /* - * Accroding to the PDF spec., an end-of-line marker, not preceded - * by a backslash, must be converted to single \n. - */ + /* The carriage return (CR, 0x0d) and line feed (LF, 0x0a) characters, + * also called newline characters, are treated as end-of-line (EOL) + * markers. The combination of a carriage return followed immediately + * by a line feed is treated as one EOL marker. + * [PDF Reference, 6th ed., version 1.7, p. 50] */ + + /* If an end-of-line marker appears within a literal string + * without a preceding backslash, the result is equivalent to + * \n (regardless of whether the end-of-line marker was + * a carriage return, a line feed, or both). + * [PDF Reference, 6th ed., version 1.7, p. 55] */ + while (p < endptr) { ch = p[0]; @@ -666,7 +674,7 @@ parse_pdf_tainted_dict (char **pp, char *endptr) } #else /* PDF_PARSE_STRICT */ pdf_obj * -parse_pdf_tainted_dict (char **pp, char *endptr, int level) +parse_pdf_tainted_dict (char **pp, char *endptr) { return parse_pdf_dict(pp, endptr, NULL); } @@ -788,26 +796,19 @@ parse_pdf_stream (char **pp, char *endptr, pdf_obj *dict, pdf_file *pf) } p += 6; - /* Carrige return alone is not allowed after keyword "stream". - * See, PDF Reference, 4th ed., version 1.5, p. 36. - */ + /* The keyword stream that follows the stream dictionary + * should be followed by an end-of-line marker consisting of + * either a carriage return (0x0D;\r) and a line feed (0x0A;\n) + * or just a line feed, and not by a carriage return alone. + * [PDF Reference, 6th ed., version 1.7, pp. 60-61] */ + + /* Notice that TeX translates an end-of-line marker to a single space. */ if (p < endptr && p[0] == '\n') { p++; } else if (p + 1 < endptr && (p[0] == '\r' && p[1] == '\n')) { p += 2; } -#ifndef PDF_PARSE_STRICT - else { - /* TeX translate end-of-line marker to a single space. */ - if (parser_state.tainted) { - if (p < endptr && p[0] == ' ') { - p++; - } - } - } - /* The end-of-line marker not mandatory? */ -#endif /* !PDF_PARSE_STRICT */ /* Stream length */ { @@ -824,31 +825,6 @@ parse_pdf_stream (char **pp, char *endptr, pdf_obj *dict, pdf_file *pf) } pdf_release_obj(tmp2); } -#ifndef PDF_PARSE_STRICT - else if (p + 9 <= endptr) - { - /* - * This was added to allow TeX users to write PDF stream object - * directly in their TeX source. This violates PDF spec. - */ - char *q; - - stream_length = -1; - for (q = endptr - 1; q >= p + 8; q--) { - if (q[0] != 'm') - continue; - else { - if (!memcmp(q - 8, "endstrea", 8)) { - /* The end-of-line marker is not skipped here. There are - * no way to decide if it is a part of the stream or not. - */ - stream_length = ((long) (q - p)) - 8; - break; - } - } - } - } -#endif /* !PDF_PARSE_STRICT */ else { return NULL; } @@ -882,24 +858,14 @@ parse_pdf_stream (char **pp, char *endptr, pdf_obj *dict, pdf_file *pf) /* Check "endsteam" */ { - /* - * It is an error if the stream contained too much data except there - * may be an extra end-of-line marker before the keyword "endstream". - */ -#ifdef PDF_PARSE_STRICT + /* It is recommended that there be an end-of-line marker + * after the data and before endstream; this marker is not included + * in the stream length. + * [PDF Reference, 6th ed., version 1.7, pp. 61] */ if (p < endptr && p[0] == '\r') p++; if (p < endptr && p[0] == '\n') p++; -#else /* !PDF_PARSE_STRICT */ - /* - * This may skip data starting with '%' and terminated by a - * '\r' or '\n' or '\r\n'. The PDF syntax rule should not be - * applied to the content of the stream data. - * TeX may have converted end-of-line to single white space. - */ - skip_white(&p, endptr); -#endif /* !PDF_PARSE_STRICT */ if (p + 9 > endptr || memcmp(p, "endstream", 9)) { |