summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2013-09-24 12:22:00 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2013-09-24 12:22:00 +0000
commita834b02d43bca971ae91062f3b9c70759525b5d4 (patch)
tree4ce86f8823936b672052f1691c6c4cbdc9348742 /Build/source/texk/dvipdfm-x
parentb68e9d4dea7036d84321a93391c2f810766a41a0 (diff)
dvipdfm-x: Bug fix for (x)dvipdfm-res.test (tikz-bug)
git-svn-id: svn://tug.org/texlive/trunk@31739 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfm-x')
-rw-r--r--Build/source/texk/dvipdfm-x/ChangeLog13
-rw-r--r--Build/source/texk/dvipdfm-x/Makefile.am5
-rw-r--r--Build/source/texk/dvipdfm-x/Makefile.in11
-rw-r--r--Build/source/texk/dvipdfm-x/dpxcrypt.c8
-rw-r--r--Build/source/texk/dvipdfm-x/dpxcrypt.h8
-rwxr-xr-xBuild/source/texk/dvipdfm-x/dvipdfm-ann.test4
-rwxr-xr-xBuild/source/texk/dvipdfm-x/dvipdfm-bkm.test4
-rwxr-xr-xBuild/source/texk/dvipdfm-x/dvipdfm-res.test25
-rw-r--r--Build/source/texk/dvipdfm-x/pdfdoc.c13
-rw-r--r--Build/source/texk/dvipdfm-x/pdfdoc.h3
-rw-r--r--Build/source/texk/dvipdfm-x/pdfnames.c151
-rw-r--r--Build/source/texk/dvipdfm-x/pdfnames.h2
-rw-r--r--Build/source/texk/dvipdfm-x/pdfobj.c48
-rw-r--r--Build/source/texk/dvipdfm-x/spc_pdfm.c2
-rw-r--r--Build/source/texk/dvipdfm-x/specials.c24
-rw-r--r--Build/source/texk/dvipdfm-x/tests/annot.dvibin552 -> 680 bytes
-rw-r--r--Build/source/texk/dvipdfm-x/tests/annot.tex5
-rw-r--r--Build/source/texk/dvipdfm-x/tests/bookm.tex2
-rw-r--r--Build/source/texk/dvipdfm-x/tests/resrc.dvibin0 -> 1144 bytes
-rw-r--r--Build/source/texk/dvipdfm-x/tests/resrc.tex6
-rwxr-xr-xBuild/source/texk/dvipdfm-x/xdvipdfm-ann.test4
-rwxr-xr-xBuild/source/texk/dvipdfm-x/xdvipdfm-bkm.test4
-rwxr-xr-xBuild/source/texk/dvipdfm-x/xdvipdfm-res.test25
23 files changed, 161 insertions, 206 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog
index 96df73f722b..06a4e428123 100644
--- a/Build/source/texk/dvipdfm-x/ChangeLog
+++ b/Build/source/texk/dvipdfm-x/ChangeLog
@@ -1,3 +1,16 @@
+2013-09-24 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * pdfnames.[ch], pdfobj.c, specials.c: Fix (x)dvipdfm-res.test
+ (tikz-bug).
+
+ * tests/annot.{dvi,tex}: Test a broken link annotation.
+
+2013-09-20 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * dpxcrypt.h, dpxcrypt.c: Use uint32_t instead of unsigned long to
+ calculate MD5, because it leads to an error if compiled with clang
+ on 64bit OS X, reported by T. Yamamoto.
+
2013-09-12 Peter Breitenlohner <peb@mppmu.mpg.de>
* (x)dvipdfm-bkm.test: Additional tests with bookmarks.
diff --git a/Build/source/texk/dvipdfm-x/Makefile.am b/Build/source/texk/dvipdfm-x/Makefile.am
index 7bd1ce8f42c..1ef5bb8cdd9 100644
--- a/Build/source/texk/dvipdfm-x/Makefile.am
+++ b/Build/source/texk/dvipdfm-x/Makefile.am
@@ -269,10 +269,12 @@ DISTCLEANFILES = config.force
##
TESTS =
dvipdfmx_tests = dvipdfmx.test dvipdfm-ann.test dvipdfm-bb.test dvipdfm-bkm.test dvipdfm-psz.test
+dvipdfmx_tests += dvipdfm-res.test
if DVIPDFMX
TESTS += $(dvipdfmx_tests)
endif DVIPDFMX
xdvipdfmx_tests = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bb.test xdvipdfm-bkm.test xdvipdfm-psz.test
+xdvipdfmx_tests += xdvipdfm-res.test
if XDVIPDFMX
TESTS += $(xdvipdfmx_tests)
endif XDVIPDFMX
@@ -285,5 +287,6 @@ EXTRA_DIST += tests/image.png tests/imgpng.bb tests/imgpng.xbb tests/picpng.bb t
EXTRA_DIST += tests/image.dvi tests/image.tex
EXTRA_DIST += tests/cmr10.pfb tests/cmr10.tfm tests/annot.dvi tests/annot.tex
EXTRA_DIST += tests/bookm.dvi tests/bookm.tex tests/paper.dvi tests/paper.tex
-DISTCLEANFILES += img*.* pic*.* image*.pdf annot*.pdf bookm*.pdf paper*.pdf
+EXTRA_DIST += tests/resrc.dvi tests/resrc.tex
+DISTCLEANFILES += img*.* pic*.* image*.pdf annot*.pdf bookm*.pdf paper*.pdf resrc*.pdf
diff --git a/Build/source/texk/dvipdfm-x/Makefile.in b/Build/source/texk/dvipdfm-x/Makefile.in
index d932c3d116c..6f4df171086 100644
--- a/Build/source/texk/dvipdfm-x/Makefile.in
+++ b/Build/source/texk/dvipdfm-x/Makefile.in
@@ -817,10 +817,12 @@ dist_mapdata_DATA = data/cid-x.map
cmapdatadir = $(datarootdir)/texmf-dist/fonts/cmap/dvipdfmx
dist_cmapdata_DATA = data/EUC-UCS2
DISTCLEANFILES = config.force img*.* pic*.* image*.pdf annot*.pdf \
- bookm*.pdf paper*.pdf
+ bookm*.pdf paper*.pdf resrc*.pdf
TESTS = $(am__append_5) $(am__append_6)
-dvipdfmx_tests = dvipdfmx.test dvipdfm-ann.test dvipdfm-bb.test dvipdfm-bkm.test dvipdfm-psz.test
-xdvipdfmx_tests = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bb.test xdvipdfm-bkm.test xdvipdfm-psz.test
+dvipdfmx_tests = dvipdfmx.test dvipdfm-ann.test dvipdfm-bb.test \
+ dvipdfm-bkm.test dvipdfm-psz.test dvipdfm-res.test
+xdvipdfmx_tests = xdvipdfmx.test xdvipdfm-ann.test xdvipdfm-bb.test \
+ xdvipdfm-bkm.test xdvipdfm-psz.test xdvipdfm-res.test
EXTRA_DIST = $(dvipdfmx_tests) $(xdvipdfmx_tests) tests/dvipdfmx.cfg \
tests/psfonts.map tests/image.jpeg tests/imgjpeg.bb \
tests/imgjpeg.xbb tests/picjpeg.bb tests/picjpeg.xbb \
@@ -830,7 +832,8 @@ EXTRA_DIST = $(dvipdfmx_tests) $(xdvipdfmx_tests) tests/dvipdfmx.cfg \
tests/picpng.xbb tests/image.dvi tests/image.tex \
tests/cmr10.pfb tests/cmr10.tfm tests/annot.dvi \
tests/annot.tex tests/bookm.dvi tests/bookm.tex \
- tests/paper.dvi tests/paper.tex
+ tests/paper.dvi tests/paper.tex tests/resrc.dvi \
+ tests/resrc.tex
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
diff --git a/Build/source/texk/dvipdfm-x/dpxcrypt.c b/Build/source/texk/dvipdfm-x/dpxcrypt.c
index 235e9b9726b..379ebe5ead2 100644
--- a/Build/source/texk/dvipdfm-x/dpxcrypt.c
+++ b/Build/source/texk/dvipdfm-x/dpxcrypt.c
@@ -28,12 +28,6 @@
# include <sys/types.h>
#endif
#include <string.h>
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
#include "dpxcrypt.h"
@@ -289,7 +283,7 @@ void MD5_final (unsigned char *outbuf, MD5_CONTEXT *hd)
#define X(a) do { *p++ = hd->a; *p++ = hd->a >> 8; \
*p++ = hd->a >> 16; *p++ = hd->a >> 24; } while (0)
#else /* little endian */
-#define X(a) do { *(unsigned long *)p = (*hd).a ; p += 4; } while (0)
+#define X(a) do { *(uint32_t *)p = (*hd).a ; p += sizeof(uint32_t); } while (0)
#endif
X(A);
X(B);
diff --git a/Build/source/texk/dvipdfm-x/dpxcrypt.h b/Build/source/texk/dvipdfm-x/dpxcrypt.h
index d2613043cf8..4470bfd4095 100644
--- a/Build/source/texk/dvipdfm-x/dpxcrypt.h
+++ b/Build/source/texk/dvipdfm-x/dpxcrypt.h
@@ -24,10 +24,16 @@
#define _DPXCRYPT_H_
#include <stdio.h>
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
/* libgcrypt md5 */
typedef struct {
- unsigned long A,B,C,D; /* chaining variables */
+ uint32_t A,B,C,D; /* chaining variables */
unsigned long nblocks;
unsigned char buf[64];
int count;
diff --git a/Build/source/texk/dvipdfm-x/dvipdfm-ann.test b/Build/source/texk/dvipdfm-x/dvipdfm-ann.test
index 09b145d5a24..a59bab11732 100755
--- a/Build/source/texk/dvipdfm-x/dvipdfm-ann.test
+++ b/Build/source/texk/dvipdfm-x/dvipdfm-ann.test
@@ -13,8 +13,8 @@ export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
failed=
-echo "*** dvipdfmx -v -o annot1.pdf annot" && echo \
- && ./dvipdfmx -v -o annot1.pdf $srcdir/tests/annot \
+echo "*** dvipdfmx -v -z0 -o annot1.pdf annot" && echo \
+ && ./dvipdfmx -v -z0 -o annot1.pdf $srcdir/tests/annot \
&& echo && echo "dvipdfmx-ann tests OK" && echo \
|| failed="$failed dvipdfmx-ann"
diff --git a/Build/source/texk/dvipdfm-x/dvipdfm-bkm.test b/Build/source/texk/dvipdfm-x/dvipdfm-bkm.test
index 3ccdaba7fd2..563a29f0651 100755
--- a/Build/source/texk/dvipdfm-x/dvipdfm-bkm.test
+++ b/Build/source/texk/dvipdfm-x/dvipdfm-bkm.test
@@ -13,8 +13,8 @@ export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
failed=
-echo "*** dvipdfmx -v -o bookm1.pdf bookm" && echo \
- && ./dvipdfmx -v -o bookm1.pdf $srcdir/tests/bookm \
+echo "*** dvipdfmx -v -z0 -o bookm1.pdf bookm" && echo \
+ && ./dvipdfmx -v -z0 -o bookm1.pdf $srcdir/tests/bookm \
&& echo && echo "dvipdfmx-bkm tests OK" && echo \
|| failed="$failed dvipdfmx-bkm"
diff --git a/Build/source/texk/dvipdfm-x/dvipdfm-res.test b/Build/source/texk/dvipdfm-x/dvipdfm-res.test
new file mode 100755
index 00000000000..dfb622da211
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/dvipdfm-res.test
@@ -0,0 +1,25 @@
+#! /bin/sh
+
+# Copyright (C) 2013 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+TEXMFCNF=$srcdir/../kpathsea
+TFMFONTS="$srcdir/tests;$srcdir/data"
+T1FONTS="$srcdir/tests;$srcdir/data"
+TEXFONTMAPS="$srcdir/tests;$srcdir/data"
+DVIPDFMXINPUTS="$srcdir/tests;$srcdir/data"
+TEXPICTS=$srcdir/tests
+export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
+
+failed=
+
+echo "*** dvipdfmx -v -z0 -o resrc1.pdf resrc" && echo \
+ && ./dvipdfmx -v -z0 -o resrc1.pdf $srcdir/tests/resrc \
+ && echo && echo "dvipdfmx-res tests OK" && echo \
+ || failed="$failed dvipdfmx-res"
+
+test -z "$failed" && exit 0
+echo
+echo "failed tests:$failed"
+exit 1
+
diff --git a/Build/source/texk/dvipdfm-x/pdfdoc.c b/Build/source/texk/dvipdfm-x/pdfdoc.c
index 48b2ad0b4e7..6b69c1202dc 100644
--- a/Build/source/texk/dvipdfm-x/pdfdoc.c
+++ b/Build/source/texk/dvipdfm-x/pdfdoc.c
@@ -1648,7 +1648,7 @@ pdf_doc_close_names (pdf_doc *p)
void
pdf_doc_add_annot (unsigned page_no, const pdf_rect *rect,
- pdf_obj *annot_dict)
+ pdf_obj *annot_dict, int new_annot)
{
pdf_doc *p = &pdoc;
pdf_page *page;
@@ -1693,6 +1693,9 @@ pdf_doc_add_annot (unsigned page_no, const pdf_rect *rect,
pdf_add_array(page->annots, pdf_ref_obj(annot_dict));
+ if (new_annot)
+ pdf_doc_add_goto(annot_dict);
+
return;
}
@@ -2649,9 +2652,10 @@ pdf_doc_end_grabbing (pdf_obj *attrib)
static struct
{
int dirty;
+ int broken;
pdf_obj *annot_dict;
pdf_rect rect;
-} breaking_state = {0, NULL, {0.0, 0.0, 0.0, 0.0}};
+} breaking_state = {0, 0, NULL, {0.0, 0.0, 0.0, 0.0}};
static void
reset_box (void)
@@ -2665,6 +2669,7 @@ void
pdf_doc_begin_annot (pdf_obj *dict)
{
breaking_state.annot_dict = dict;
+ breaking_state.broken = 0;
reset_box();
}
@@ -2685,8 +2690,10 @@ pdf_doc_break_annot (void)
annot_dict = pdf_new_dict();
pdf_merge_dict(annot_dict, breaking_state.annot_dict);
pdf_doc_add_annot(pdf_doc_current_page_number(), &(breaking_state.rect),
- annot_dict);
+ annot_dict, !breaking_state.broken);
pdf_release_obj(annot_dict);
+
+ breaking_state.broken = 1;
}
reset_box();
}
diff --git a/Build/source/texk/dvipdfm-x/pdfdoc.h b/Build/source/texk/dvipdfm-x/pdfdoc.h
index 0b9b27553e9..5772758af93 100644
--- a/Build/source/texk/dvipdfm-x/pdfdoc.h
+++ b/Build/source/texk/dvipdfm-x/pdfdoc.h
@@ -115,7 +115,8 @@ extern void pdf_doc_end_grabbing (pdf_obj *attrib);
/* Annotation */
extern void pdf_doc_add_annot (unsigned page_no,
const pdf_rect *rect,
- pdf_obj *annot_dict);
+ pdf_obj *annot_dict,
+ int new_annot);
/* Annotation with auto- clip and line (or page) break */
extern void pdf_doc_begin_annot (pdf_obj *dict);
diff --git a/Build/source/texk/dvipdfm-x/pdfnames.c b/Build/source/texk/dvipdfm-x/pdfnames.c
index 323b7d38a75..c22446d86e8 100644
--- a/Build/source/texk/dvipdfm-x/pdfnames.c
+++ b/Build/source/texk/dvipdfm-x/pdfnames.c
@@ -47,8 +47,6 @@
struct obj_data
{
pdf_obj *object;
- pdf_obj *object_ref;
- int reserve; /* 1 if object is not actually defined. */
int closed; /* 1 if object is closed */
};
@@ -88,12 +86,6 @@ hval_free (void *hval)
pdf_release_obj(value->object);
value->object = NULL;
}
- if (value->object_ref) {
- pdf_release_obj(value->object_ref);
- value->object_ref = NULL;
- }
- value->reserve = 0;
- value->closed = 0;
RELEASE(value);
@@ -112,7 +104,7 @@ pdf_new_name_tree (void)
}
static void
-flush_objects (struct ht_table *ht_tab)
+check_objects_defined (struct ht_table *ht_tab)
{
struct ht_iter iter;
@@ -124,19 +116,12 @@ flush_objects (struct ht_table *ht_tab)
key = ht_iter_getkey(&iter, &keylen);
value = ht_iter_getval(&iter);
- if (value->reserve) {
- WARN("Unresolved object reference \"%s\" found!!!",
+ ASSERT(value->object);
+ if (PDF_OBJ_UNDEFINED(value->object)) {
+ pdf_names_add_object(ht_tab, key, keylen, pdf_new_null());
+ WARN("Object @%s used, but not defined. Replaced by null.",
printable_key(key, keylen));
}
- if (value->object) {
- pdf_release_obj(value->object);
- }
- if (value->object_ref) {
- pdf_release_obj(value->object_ref);
- }
- value->object = NULL;
- value->object_ref = NULL;
- value->reserve = 0;
} while (ht_iter_next(&iter) >= 0);
ht_clear_iter(&iter);
}
@@ -147,7 +132,7 @@ pdf_delete_name_tree (struct ht_table **names)
{
ASSERT(names && *names);
- flush_objects (*names);
+ check_objects_defined (*names);
ht_clear_table(*names);
RELEASE(*names);
@@ -171,85 +156,24 @@ pdf_names_add_object (struct ht_table *names,
if (!value) {
value = NEW(1, struct obj_data);
value->object = object;
- value->object_ref = NULL;
- value->reserve = 0;
value->closed = 0;
ht_append_table(names, key, keylen, value);
} else {
-#ifdef XETEX
- if (value->reserve) {
- /* null object is used for undefined objects */
- pdf_copy_object(value->object, object);
- pdf_release_obj(object); /* PLEASE FIX THIS!!! */
-#else
ASSERT(value->object);
if (PDF_OBJ_UNDEFINED(value->object)) {
pdf_transfer_label(object, value->object);
pdf_release_obj(value->object);
value->object = object;
-#endif
} else {
-#ifdef XETEX
- if (value->object || value->object_ref) {
- if (pdf_obj_get_verbose()) {
- WARN("Object reference with key \"%s\" is in use.", printable_key(key, keylen));
- }
- pdf_release_obj(object);
- return -1;
- } else {
- value->object = object;
- }
-#else
WARN("Object @%s already defined.", printable_key(key, keylen));
pdf_release_obj(object);
return -1;
-#endif
}
- value->reserve = 0;
}
return 0;
}
-#ifdef XETEX
-int
-pdf_names_add_reference (struct ht_table *names,
- const void *key, int keylen, pdf_obj *object_ref)
-{
- struct obj_data *value;
-
- ASSERT(names);
-
- if (!PDF_OBJ_INDIRECTTYPE(object_ref)) {
- WARN("Invalid type: @%s is not reference...",
- printable_key(key, keylen));
- return -1;
- }
-
- value = ht_lookup_table(names, key, keylen);
- if (!value) {
- value = NEW(1, struct obj_data);
- value->object = NULL;
- value->object_ref = object_ref;
- value->reserve = 0;
- ht_append_table(names, key, keylen, value);
- } else {
- if (value->object || value->object_ref) {
- WARN("Object reference \"%s\" is in use.",
- printable_key(key, keylen));
- WARN("Please close it before redefining.");
- return -1;
- } else {
- value->object = NULL;
- value->object_ref = object_ref;
- }
- value->reserve = 0;
- }
-
- return 0;
-}
-#endif
-
/*
* The following routine returns copies, not the original object.
*/
@@ -258,37 +182,15 @@ pdf_names_lookup_reference (struct ht_table *names,
const void *key, int keylen)
{
struct obj_data *value;
-#ifndef XETEX
pdf_obj *object;
-#endif
ASSERT(names);
value = ht_lookup_table(names, key, keylen);
-#ifdef XETEX
- if (!value) {
- /* Reserve object label */
- value = NEW(1, struct obj_data);
- value->object = pdf_new_null(); /* dummy */
- value->object_ref = NULL;
- value->reserve = 1;
- ht_append_table(names, key, keylen, value);
- }
-
- if (!value->object_ref) {
- if (value->object)
- value->object_ref = pdf_ref_obj(value->object);
- else {
- WARN("Object @%s not defined or already closed.",
- printable_key(key, keylen));
- }
- }
-
- return pdf_link_obj(value->object_ref);
-#else
if (value) {
object = value->object;
+ ASSERT(object);
} else {
/* A null object as dummy would create problems because as value
* of a dictionary entry, a null object is be equivalent to no entry
@@ -299,7 +201,6 @@ pdf_names_lookup_reference (struct ht_table *names,
}
return pdf_ref_obj(object);
-#endif
}
pdf_obj *
@@ -313,9 +214,7 @@ pdf_names_lookup_object (struct ht_table *names,
value = ht_lookup_table(names, key, keylen);
if (!value || PDF_OBJ_UNDEFINED(value->object))
return NULL;
- if (!value->object)
- ERROR("Object @%s not defined or already closed.",
- printable_key(key, keylen));
+ ASSERT(value->object);
return value->object;
}
@@ -329,22 +228,17 @@ pdf_names_close_object (struct ht_table *names,
ASSERT(names);
value = ht_lookup_table(names, key, keylen);
- if (!value) {
- WARN("Tried to release nonexistent reference: %s",
- printable_key(key, keylen));
- return -1;
- }
- if (PDF_OBJ_UNDEFINED(value->object) ) {
+ if (!value ||PDF_OBJ_UNDEFINED(value->object) ) {
WARN("Cannot close undefined object @%s.", printable_key(key, keylen));
return -1;
}
- if (!value->object || value->closed) {
+ ASSERT(value->object);
+
+ if (value->closed) {
WARN("Object @%s already closed.", printable_key(key, keylen));
return -1;
}
- pdf_release_obj(value->object);
- value->object = NULL;
value->closed = 1;
return 0;
@@ -489,36 +383,17 @@ flat_table (struct ht_table *ht_tab, long *num_entries,
}
value = ht_iter_getval(&iter);
-#ifdef XETEX
- if (value->reserve) {
- WARN("Named object \"%s\" not defined!!!",
-#else
ASSERT(value->object);
if (PDF_OBJ_UNDEFINED(value->object)) {
- WARN("Object @%s\" not defined!!!",
-#endif
+ WARN("Object @%s\" not defined. Replaced by null.",
printable_key(key, keylen));
- WARN("Replacing with null.");
objects[count].key = (char *) key;
objects[count].keylen = keylen;
objects[count].value = pdf_new_null();
- } else if (value->object_ref) {
- objects[count].key = (char *) key;
- objects[count].keylen = keylen;
- objects[count].value = pdf_link_obj(value->object_ref);
} else if (value->object) {
objects[count].key = (char *) key;
objects[count].keylen = keylen;
objects[count].value = pdf_link_obj(value->object);
-#ifdef XETEX
- } else {
- WARN("Named object \"%s\" not defined!!!",
- printable_key(key, keylen));
- WARN("Replacing with null.");
- objects[count].key = (char *) key;
- objects[count].keylen = keylen;
- objects[count].value = pdf_new_null();
-#endif
}
} while (ht_iter_next(&iter) >= 0);
ht_clear_iter(&iter);
diff --git a/Build/source/texk/dvipdfm-x/pdfnames.h b/Build/source/texk/dvipdfm-x/pdfnames.h
index 38ec277ef92..bcf3aec9d98 100644
--- a/Build/source/texk/dvipdfm-x/pdfnames.h
+++ b/Build/source/texk/dvipdfm-x/pdfnames.h
@@ -35,8 +35,6 @@ extern void pdf_delete_name_tree (struct ht_table **names);
extern int pdf_names_add_object (struct ht_table *names,
const void *key, int keylen, pdf_obj *object);
-extern int pdf_names_add_reference (struct ht_table *names,
- const void *key, int keylen, pdf_obj *object_ref);
extern pdf_obj *pdf_names_lookup_reference (struct ht_table *names,
const void *key, int keylen);
extern pdf_obj *pdf_names_lookup_object (struct ht_table *names,
diff --git a/Build/source/texk/dvipdfm-x/pdfobj.c b/Build/source/texk/dvipdfm-x/pdfobj.c
index cbad9b8014d..207a48d2a67 100644
--- a/Build/source/texk/dvipdfm-x/pdfobj.c
+++ b/Build/source/texk/dvipdfm-x/pdfobj.c
@@ -117,6 +117,7 @@ struct pdf_stream
struct pdf_indirect
{
pdf_file *pf;
+ pdf_obj *obj; /* used when PF == NULL */
unsigned long label;
unsigned short generation;
};
@@ -193,6 +194,7 @@ static void release_objstm (pdf_obj *objstm);
static void pdf_out_char (FILE *file, char c);
static void pdf_out (FILE *file, const void *buffer, long length);
+static pdf_obj *pdf_new_ref (pdf_obj *object);
static void release_indirect (pdf_indirect *data);
static void write_indirect (pdf_indirect *indirect, FILE *file);
@@ -603,7 +605,7 @@ pdf_new_obj(int type)
{
pdf_obj *result;
- if (type >= PDF_UNDEFINED || type < 0)
+ if (type > PDF_UNDEFINED || type < 0)
ERROR("Invalid object type: %d", type);
result = NEW(1, pdf_obj);
@@ -641,7 +643,6 @@ pdf_label_obj (pdf_obj *object)
}
}
-#ifndef XETEX
/*
* Transfer the label assigned to the object src to the object dst.
* The object dst must not yet have been labeled.
@@ -656,7 +657,6 @@ pdf_transfer_label (pdf_obj *dst, pdf_obj *src)
src->label = 0;
src->generation = 0;
}
-#endif
/*
* This doesn't really copy the object, but allows it to be used without
@@ -689,10 +689,7 @@ pdf_ref_obj (pdf_obj *object)
if (PDF_OBJ_INDIRECTTYPE(object)) {
return pdf_link_obj(object);
} else {
- if (object->label == 0) {
- pdf_label_obj(object);
- }
- return pdf_new_indirect(NULL, object->label, object->generation);
+ return pdf_new_ref(object);
}
}
@@ -713,7 +710,6 @@ write_indirect (pdf_indirect *indirect, FILE *file)
pdf_out(file, format_buffer, length);
}
-#ifndef XETEX
/* The undefined object is used as a placeholder in pdfnames.c
* for objects which are referenced before they are defined.
*/
@@ -727,7 +723,6 @@ pdf_new_undefined (void)
return result;
}
-#endif
pdf_obj *
pdf_new_null (void)
@@ -2242,6 +2237,7 @@ pdf_copy_object (pdf_obj *dst, pdf_obj *src)
dst->data = data = NEW(1, pdf_indirect);
data->pf = ((pdf_indirect *) (src->data))->pf;
+ data->obj = ((pdf_indirect *) (src->data))->obj;
data->label = ((pdf_indirect *) (src->data))->label;
data->generation = ((pdf_indirect *) (src->data))->generation;
}
@@ -2382,6 +2378,7 @@ pdf_new_indirect (pdf_file *pf, unsigned long obj_num, unsigned short obj_gen)
indirect = NEW(1, pdf_indirect);
indirect->pf = pf;
+ indirect->obj = NULL;
indirect->label = obj_num;
indirect->generation = obj_gen;
@@ -2616,9 +2613,23 @@ pdf_get_object (pdf_file *pf, unsigned long obj_num, unsigned short obj_gen)
}
#define OBJ_FILE(o) (((pdf_indirect *)((o)->data))->pf)
+#define OBJ_OBJ(o) (((pdf_indirect *)((o)->data))->obj)
#define OBJ_NUM(o) (((pdf_indirect *)((o)->data))->label)
#define OBJ_GEN(o) (((pdf_indirect *)((o)->data))->generation)
+static pdf_obj *
+pdf_new_ref (pdf_obj *object)
+{
+ pdf_obj *result;
+
+ if (object->label == 0) {
+ pdf_label_obj(object);
+ }
+ result = pdf_new_indirect(NULL, object->label, object->generation);
+ OBJ_OBJ(result) = object;
+ return result;
+}
+
/* pdf_deref_obj always returns a link instead of the original */
/* It never return the null object, but the NULL pointer instead */
pdf_obj *
@@ -2631,12 +2642,19 @@ pdf_deref_obj (pdf_obj *obj)
while (PDF_OBJ_INDIRECTTYPE(obj) && --count) {
pdf_file *pf = OBJ_FILE(obj);
- unsigned long obj_num = OBJ_NUM(obj);
- unsigned short obj_gen = OBJ_GEN(obj);
- if (!pf)
- ERROR("Tried to deref a non-file object");
- pdf_release_obj(obj);
- obj = pdf_get_object(pf, obj_num, obj_gen);
+ if (pf) {
+ unsigned long obj_num = OBJ_NUM(obj);
+ unsigned short obj_gen = OBJ_GEN(obj);
+ pdf_release_obj(obj);
+ obj = pdf_get_object(pf, obj_num, obj_gen);
+ } else {
+ pdf_obj *next_obj = OBJ_OBJ(obj);
+ if (!next_obj) {
+ ERROR("Undefined object reference");
+ }
+ pdf_release_obj(obj);
+ obj = pdf_link_obj(next_obj);
+ }
}
if (!count)
diff --git a/Build/source/texk/dvipdfm-x/spc_pdfm.c b/Build/source/texk/dvipdfm-x/spc_pdfm.c
index c27e6dc2808..560ab15117c 100644
--- a/Build/source/texk/dvipdfm-x/spc_pdfm.c
+++ b/Build/source/texk/dvipdfm-x/spc_pdfm.c
@@ -685,7 +685,7 @@ spc_handler_pdfm_annot (struct spc_env *spe, struct spc_arg *args)
if (ident)
spc_push_object(ident, pdf_link_obj(annot_dict));
/* Add this reference. */
- pdf_doc_add_annot(pdf_doc_current_page_number(), &rect, annot_dict);
+ pdf_doc_add_annot(pdf_doc_current_page_number(), &rect, annot_dict, 1);
if (ident) {
spc_flush_object(ident);
diff --git a/Build/source/texk/dvipdfm-x/specials.c b/Build/source/texk/dvipdfm-x/specials.c
index d65cbbb67f4..0c0f2fd5f67 100644
--- a/Build/source/texk/dvipdfm-x/specials.c
+++ b/Build/source/texk/dvipdfm-x/specials.c
@@ -291,29 +291,7 @@ spc_push_object (const char *key, pdf_obj *value)
if (!key || !value)
return;
-#ifdef XETEX
- if (PDF_OBJ_INDIRECTTYPE(value)) {
- pdf_names_add_reference(named_objects,
- key, strlen(key), value);
- } else
-#endif
- {
- int error = pdf_names_add_object(named_objects,
- key, strlen(key), value);
- if (!error) {
-#ifdef XETEX
- /* _FIXME_:
- * Objects created by pdf:obj must always
- * be written to output regardless of if
- * they are actually used in document.
- */
- pdf_obj *obj_ref = pdf_names_lookup_reference(named_objects,
- key, strlen(key));
- if (obj_ref)
- pdf_release_obj(obj_ref);
-#endif
- }
- }
+ pdf_names_add_object(named_objects, key, strlen(key), value);
}
void
diff --git a/Build/source/texk/dvipdfm-x/tests/annot.dvi b/Build/source/texk/dvipdfm-x/tests/annot.dvi
index 7ea86daa1f5..0cea9bacc12 100644
--- a/Build/source/texk/dvipdfm-x/tests/annot.dvi
+++ b/Build/source/texk/dvipdfm-x/tests/annot.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdfm-x/tests/annot.tex b/Build/source/texk/dvipdfm-x/tests/annot.tex
index c57f2ca5786..dd10e9fd223 100644
--- a/Build/source/texk/dvipdfm-x/tests/annot.tex
+++ b/Build/source/texk/dvipdfm-x/tests/annot.tex
@@ -1,9 +1,12 @@
%
\special{pdf:obj @tug <</S/URI /URI (http://www.tug.org)>>}
+Add some text and more text and still more text in order to get a link annotation
+extending
\special{pdf:bann <</Subtype/Link /A @tug>>}%
TUG on the web
-\special{pdf:eann}%
+\special{pdf:eann}
+over two lines.
\vskip 20 bp
diff --git a/Build/source/texk/dvipdfm-x/tests/bookm.tex b/Build/source/texk/dvipdfm-x/tests/bookm.tex
index 72745154473..d42e12a51f4 100644
--- a/Build/source/texk/dvipdfm-x/tests/bookm.tex
+++ b/Build/source/texk/dvipdfm-x/tests/bookm.tex
@@ -57,4 +57,4 @@
\noindent The second section
-\bye \ No newline at end of file
+\bye
diff --git a/Build/source/texk/dvipdfm-x/tests/resrc.dvi b/Build/source/texk/dvipdfm-x/tests/resrc.dvi
new file mode 100644
index 00000000000..8e16467e097
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/resrc.dvi
Binary files differ
diff --git a/Build/source/texk/dvipdfm-x/tests/resrc.tex b/Build/source/texk/dvipdfm-x/tests/resrc.tex
new file mode 100644
index 00000000000..5c95c930e51
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/tests/resrc.tex
@@ -0,0 +1,6 @@
+\documentclass[dvipdfmx]{article}
+\usepackage{tikz}
+\usetikzlibrary{patterns}
+\begin{document}
+\tikz \path[pattern=crosshatch] (0,0) -- (1,0) -- (0,1) -- cycle;
+\end{document}
diff --git a/Build/source/texk/dvipdfm-x/xdvipdfm-ann.test b/Build/source/texk/dvipdfm-x/xdvipdfm-ann.test
index 9a0ae4b8193..24d6e6c1025 100755
--- a/Build/source/texk/dvipdfm-x/xdvipdfm-ann.test
+++ b/Build/source/texk/dvipdfm-x/xdvipdfm-ann.test
@@ -13,8 +13,8 @@ export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
failed=
-echo "*** xdvipdfmx -v -o annot2.pdf annot" && echo \
- && ./xdvipdfmx -v -o annot2.pdf $srcdir/tests/annot \
+echo "*** xdvipdfmx -v -z0 -o annot2.pdf annot" && echo \
+ && ./xdvipdfmx -v -z0 -o annot2.pdf $srcdir/tests/annot \
&& echo && echo "xdvipdfmx-ann tests OK" && echo \
|| failed="$failed xdvipdfmx-ann"
diff --git a/Build/source/texk/dvipdfm-x/xdvipdfm-bkm.test b/Build/source/texk/dvipdfm-x/xdvipdfm-bkm.test
index 92e4460b2c1..dd8cb51edf4 100755
--- a/Build/source/texk/dvipdfm-x/xdvipdfm-bkm.test
+++ b/Build/source/texk/dvipdfm-x/xdvipdfm-bkm.test
@@ -13,8 +13,8 @@ export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
failed=
-echo "*** xdvipdfmx -v -o bookm2.pdf bookm" && echo \
- && ./xdvipdfmx -v -o bookm2.pdf $srcdir/tests/bookm \
+echo "*** xdvipdfmx -v -z0 -o bookm2.pdf bookm" && echo \
+ && ./xdvipdfmx -v -z0 -o bookm2.pdf $srcdir/tests/bookm \
&& echo && echo "xdvipdfmx-bkm tests OK" && echo \
|| failed="$failed xdvipdfmx-bkm"
diff --git a/Build/source/texk/dvipdfm-x/xdvipdfm-res.test b/Build/source/texk/dvipdfm-x/xdvipdfm-res.test
new file mode 100755
index 00000000000..ab3b87755cd
--- /dev/null
+++ b/Build/source/texk/dvipdfm-x/xdvipdfm-res.test
@@ -0,0 +1,25 @@
+#! /bin/sh
+
+# Copyright (C) 2013 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+TEXMFCNF=$srcdir/../kpathsea
+TFMFONTS="$srcdir/tests;$srcdir/data"
+T1FONTS="$srcdir/tests;$srcdir/data"
+TEXFONTMAPS="$srcdir/tests;$srcdir/data"
+DVIPDFMXINPUTS="$srcdir/tests;$srcdir/data"
+TEXPICTS=$srcdir/tests
+export TEXMFCNF TFMFONTS T1FONTS TEXFONTMAPS DVIPDFMXINPUTS TEXPICTS
+
+failed=
+
+echo "*** xdvipdfmx -v -z0 -o resrc2.pdf resrc" && echo \
+ && ./xdvipdfmx -v -z0 -o resrc2.pdf $srcdir/tests/resrc \
+ && echo && echo "xdvipdfmx-res tests OK" && echo \
+ || failed="$failed xdvipdfmx-res"
+
+test -z "$failed" && exit 0
+echo
+echo "failed tests:$failed"
+exit 1
+