From a634f3f7e760e37850348436d819b55d6a91a830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Thu, 28 Oct 2010 18:05:42 +0100 Subject: [PATCH] fix scanning of UTF-32 files. --- C/iopreds.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/C/iopreds.c b/C/iopreds.c index 61e884450..3737d7aaf 100644 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -1967,7 +1967,7 @@ get_wchar(int sno) wch = 0; } how_many--; - wch += ((unsigned char) (ch & 0xff)) << (how_many*8); + wch += ((unsigned char) (ch & 0xff)) << ((3-how_many)*8); if (how_many == 0) return wch; break; @@ -1977,7 +1977,7 @@ get_wchar(int sno) wch = 0; } how_many--; - wch += ((unsigned char) (ch & 0xff)) << ((3-how_many)*8); + wch += ((unsigned char) (ch & 0xff)) << (how_many*8); if (how_many == 0) return wch; break; @@ -2803,6 +2803,7 @@ p_open (void) (needs_bom || (st->status & Seekable_Stream_f))) { if (!check_bom(sno, st)) return FALSE; + /* if (st->encoding == ENC_ISO_UTF32_BE) { Yap_Error(DOMAIN_ERROR_STREAM_ENCODING, ARG1, "UTF-32 (BE) stream encoding unsupported"); return FALSE; @@ -2810,6 +2811,7 @@ p_open (void) Yap_Error(DOMAIN_ERROR_STREAM_ENCODING, ARG1, "UTF-32 (LE) stream encoding unsupported"); return FALSE; } + */ } st->status &= ~(Free_Stream_f); return (Yap_unify (ARG3, t));