diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-11-18 04:06:33 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-11-18 04:06:33 +0000 |
commit | 51feadcf52a1dd3da63a4b747d89a4bd5850a629 (patch) | |
tree | e16175fd23cdf90fb6e159d786dc19c72a36ed6d /Build/source/texk/web2c/lib | |
parent | 0b86d346f67771d77b72a59288ccbb83677d1698 (diff) |
Complete getfiledump() for XeTeX.
git-svn-id: svn://tug.org/texlive/trunk@49186 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/lib')
-rw-r--r-- | Build/source/texk/web2c/lib/ChangeLog | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/texmfmp.c | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index 8dfce2f7c41..36c380d7b46 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -2,7 +2,7 @@ * texmfmp.c: Make necessary changes for XeTeX in getcreationdate(), getfilemoddate(), getfilesize(), - and getfiledump(). getfiledump() is still incomplete. + and getfiledump(). 2018-11-17 Joseph Wright <joseph.wright@morningstar2.co.uk> diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index a1971a3b2bc..c404020bd0b 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -3254,7 +3254,10 @@ void getfiledump(integer s, int offset, int length) poolpointer data_ptr; poolpointer data_end; char *file_name; - +#if defined(XeTeX) + char *readbuffer, strbuf[3]; + int j, k; +#endif if (length == 0) { /* empty result string */ return; @@ -3287,6 +3290,18 @@ void getfiledump(integer s, int offset, int length) xfree(file_name); return; } +#if defined(XeTeX) + readbuffer = (char *)xmalloc (length + 1); + read = fread(readbuffer, sizeof(char), length, f); + fclose(f); + for (j = 0; j < read; j++) { + i = snprintf (strbuf, 3, "%.2X", (unsigned int)readbuffer[j]); + check_nprintf(i, 3); + for (k = 0; k < i; k++) + strpool[poolptr++] = (uint16_t)strbuf[k]; + } + xfree (readbuffer); +#else /* there is enough space in the string pool, the read data are put in the upper half of the result, thus the conversion to hex can be done without overwriting @@ -3303,6 +3318,7 @@ void getfiledump(integer s, int offset, int length) check_nprintf(i, 3); poolptr += i; } +#endif /* XeTeX */ xfree(file_name); } |