summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2010-06-10 17:09:33 +0000
committerTaco Hoekwater <taco@elvenkind.com>2010-06-10 17:09:33 +0000
commitb07c45ce0346104798d9922961bd425b16e642db (patch)
treecf850489a4e2b461b45e8a90ce0e243b421a7429 /Build
parentce64726315bd1a7a64b2894079b6c6aa2f9d379f (diff)
fix endianness of format files
git-svn-id: svn://tug.org/texlive/trunk@18874 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/luatexdir/ChangeLog5
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex.c12
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texfileio.w10
3 files changed, 20 insertions, 7 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog
index 473f5a8ddb7..28e97649f9b 100644
--- a/Build/source/texk/web2c/luatexdir/ChangeLog
+++ b/Build/source/texk/web2c/luatexdir/ChangeLog
@@ -1,4 +1,9 @@
2010-06-10 Taco Hoekwater <taco@luatex.org>
+ * luatex.c (swap_items): debugged.
+ * tex/texfileio.w (do_zdump): reswap the swapped items to avoid
+ crashes when called as |dump_things|.
+
+2010-06-10 Taco Hoekwater <taco@luatex.org>
* luafilesystem/src/lfs.c(get_dir): do not assume Gnu C compiler.
2010-06-10 Peter Breitenlohner <peb@mppmu.mpg.de>
diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c
index 268c8dfddc7..c66de3c5d1c 100644
--- a/Build/source/texk/web2c/luatexdir/luatex.c
+++ b/Build/source/texk/web2c/luatexdir/luatex.c
@@ -15,7 +15,7 @@
#include "luatex_svnversion.h"
static const char _svn_version[] =
- "$Id: luatex.c 3714 2010-06-04 12:33:50Z taco $ "
+ "$Id: luatex.c 3719 2010-06-10 16:58:16Z taco $ "
"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/luatex.c $";
#define TeX
@@ -986,7 +986,7 @@ calledit(packedASCIIcode * filename,
/* This macro is always invoked as a statement. It assumes a variable
`temp'. */
-# define SWAP(x, y) temp = (x); (x) = (y); (y) = temp
+# define SWAP(x, y) do { temp = x; x = y; y = temp; } while (0)
/* Make the NITEMS items pointed at by P, each of size SIZE, be the
@@ -995,9 +995,10 @@ calledit(packedASCIIcode * filename,
void swap_items(char *pp, int nitems, int size)
{
char temp;
- char *q = xmalloc(nitems*size);
+ unsigned total = nitems*size;
+ char *q = xmalloc(total);
char *p = q;
- memcpy(p,pp,nitems*size);
+ memcpy(p,pp,total);
/* Since `size' does not change, we can write a while loop for each
case, and avoid testing `size' for each time. */
switch (size) {
@@ -1061,7 +1062,8 @@ void swap_items(char *pp, int nitems, int size)
default:
FATAL1("Can't swap a %d-byte item for (un)dumping", size);
}
- xfree(q);
+ memcpy(pp,q,total);
+ xfree(q);
}
#endif /* not WORDS_BIGENDIAN and not NO_DUMP_SHARE */
diff --git a/Build/source/texk/web2c/luatexdir/tex/texfileio.w b/Build/source/texk/web2c/luatexdir/tex/texfileio.w
index f19f7873339..73ca7146192 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texfileio.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texfileio.w
@@ -23,7 +23,7 @@
#include <kpathsea/absolute.h>
static const char _svn_version[] =
- "$Id: texfileio.w 3612 2010-04-13 09:29:42Z taco $"
+ "$Id: texfileio.w 3719 2010-06-10 16:58:16Z taco $"
"$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/tex/texfileio.w $";
@ @c
@@ -913,7 +913,10 @@ is needed.
@c
static gzFile gz_fmtfile = NULL;
-@ @c
+@ That second swap is to make sure following calls don't get
+confused in the case of |dump_things|.
+
+@c
void do_zdump(char *p, int item_size, int nitems, FILE * out_file)
{
int err;
@@ -929,6 +932,9 @@ void do_zdump(char *p, int item_size, int nitems, FILE * out_file)
item_size, gzerror(gz_fmtfile, &err));
uexit(1);
}
+#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
+ swap_items(p, nitems, item_size);
+#endif
}
@ @c