1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 19:50:24 +02:00

Remove byte-order mark check from 'scm_i_scan_for_encoding'.

* libguile/read.c (scm_i_scan_for_encoding): Remove byte-order mark
  check.
This commit is contained in:
Mark H Weaver 2013-04-05 17:33:03 -04:00
parent 9a334eb3ab
commit e1966d0e21

View file

@ -1986,7 +1986,6 @@ scm_i_scan_for_encoding (SCM port)
char header[SCM_ENCODING_SEARCH_SIZE+1]; char header[SCM_ENCODING_SEARCH_SIZE+1];
size_t bytes_read, encoding_length, i; size_t bytes_read, encoding_length, i;
char *encoding = NULL; char *encoding = NULL;
int utf8_bom = 0;
char *pos, *encoding_start; char *pos, *encoding_start;
int in_comment; int in_comment;
@ -2031,10 +2030,6 @@ scm_i_scan_for_encoding (SCM port)
scm_seek (port, scm_from_int (0), scm_from_int (SEEK_SET)); scm_seek (port, scm_from_int (0), scm_from_int (SEEK_SET));
} }
if (bytes_read > 3
&& header[0] == '\xef' && header[1] == '\xbb' && header[2] == '\xbf')
utf8_bom = 1;
/* search past "coding[:=]" */ /* search past "coding[:=]" */
pos = header; pos = header;
while (1) while (1)
@ -2103,11 +2098,6 @@ scm_i_scan_for_encoding (SCM port)
/* This wasn't in a comment */ /* This wasn't in a comment */
return NULL; return NULL;
if (utf8_bom && c_strcasecmp(encoding, "UTF-8"))
scm_misc_error (NULL,
"the port input declares the encoding ~s but is encoded as UTF-8",
scm_list_1 (scm_from_locale_string (encoding)));
return encoding; return encoding;
} }