summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-10-11 09:08:32 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-10-11 09:08:32 +0000
commit6c78d2b79d507e086cb5d04a769a96153e29357e (patch)
treeaec87a9b44a50d67b30e1aa7efd22fd7f633ae43 /Build/source/texk/web2c
parent1f3b2b3a8f46782d86ac9fa147f20540221d0a3c (diff)
WIN32: Slightly reformulate detection of Byte order marks
git-svn-id: svn://tug.org/texlive/trunk@24264 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r--Build/source/texk/web2c/lib/ChangeLog4
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c12
2 files changed, 12 insertions, 4 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog
index d9925dc6ff9..149b3660e15 100644
--- a/Build/source/texk/web2c/lib/ChangeLog
+++ b/Build/source/texk/web2c/lib/ChangeLog
@@ -1,3 +1,7 @@
+2011-10-11 Peter Breitenlohner <peb@mp.mpg.de>
+
+ * texmfmp.c [WIN32]: Slightly reformulate Byte order marks.
+
2011-10-07 Peter Breitenlohner <peb@mp.mpg.de>
* texmfmp.c: More changes to reduce diffs with W32TeX.
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
index 9f2f8807433..f3682cfbb6d 100644
--- a/Build/source/texk/web2c/lib/texmfmp.c
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -2086,7 +2086,7 @@ input_line (FILE *f)
if (f != Poptr && fileno (f) != fileno (stdin)) {
long position = ftell (f);
- if (position == 0L) {
+ if (position == 0L) { /* Detect and skip Byte order marks. */
int k1 = getc (f);
if (k1 == EOF || k1 == '\r' || k1 == '\n')
@@ -2096,11 +2096,15 @@ input_line (FILE *f)
if (k2 == EOF || k2 == '\r' || k2 == '\n')
fseek (f, -2L , SEEK_CUR);
- else if (!(k1 == 0xff && k2 == 0xfe) &&
- !(k1 == 0xfe && k2 == 0xff)) {
+ else if ((k1 == 0xff && k2 == 0xfe) || /* UTF-16(LE) */
+ (k1 == 0xfe && k2 == 0xff)) /* UTF-16(BE) */
+ ;
+ else {
int k3 = getc (f);
- if (!(k1 == 0xef && k2 == 0xbb && k3 == 0xbf))
+ if (k1 == 0xef && k2 == 0xbb && k3 == 0xbf) /* UTF-8 */
+ ;
+ else
fseek (f, -3L, SEEK_CUR);
}
}