mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
Use 'strcasecmp' to compare encoding names.
Reported by Ludovic Courtès <ludo@gnu.org>. * libguile/ports.c (scm_new_port_table_entry, scm_i_set_default_port_encoding, scm_i_set_port_encoding_x): libguile/read.c (scm_i_scan_for_encoding): Use 'strcasecmp' to compare encoding names.
This commit is contained in:
parent
72e2b5923a
commit
7290de89fb
2 changed files with 6 additions and 6 deletions
|
@ -633,7 +633,7 @@ scm_new_port_table_entry (scm_t_bits tag)
|
|||
encoding = scm_i_default_port_encoding ();
|
||||
entry->ilseq_handler = scm_i_default_port_conversion_handler ();
|
||||
entry->encoding = encoding ? scm_gc_strdup (encoding, "port") : NULL;
|
||||
if (encoding && strcmp (encoding, "UTF-8") == 0)
|
||||
if (encoding && strcasecmp (encoding, "UTF-8") == 0)
|
||||
pti->encoding_mode = SCM_PORT_ENCODING_MODE_UTF8;
|
||||
else
|
||||
pti->encoding_mode = SCM_PORT_ENCODING_MODE_ICONV;
|
||||
|
@ -2235,9 +2235,9 @@ scm_i_set_default_port_encoding (const char *encoding)
|
|||
SCM_EOL);
|
||||
|
||||
if (encoding == NULL
|
||||
|| !strcmp (encoding, "ASCII")
|
||||
|| !strcmp (encoding, "ANSI_X3.4-1968")
|
||||
|| !strcmp (encoding, "ISO-8859-1"))
|
||||
|| !strcasecmp (encoding, "ASCII")
|
||||
|| !strcasecmp (encoding, "ANSI_X3.4-1968")
|
||||
|| !strcasecmp (encoding, "ISO-8859-1"))
|
||||
scm_fluid_set_x (SCM_VARIABLE_REF (default_port_encoding_var), SCM_BOOL_F);
|
||||
else
|
||||
scm_fluid_set_x (SCM_VARIABLE_REF (default_port_encoding_var),
|
||||
|
@ -2383,7 +2383,7 @@ scm_i_set_port_encoding_x (SCM port, const char *encoding)
|
|||
/* If ENCODING is UTF-8, then no conversion descriptor is opened
|
||||
because we do I/O ourselves. This saves 100+ KiB for each
|
||||
descriptor. */
|
||||
if (strcmp (encoding, "UTF-8") == 0)
|
||||
if (strcasecmp (encoding, "UTF-8") == 0)
|
||||
{
|
||||
pt->encoding = "UTF-8";
|
||||
pti->encoding_mode = SCM_PORT_ENCODING_MODE_UTF8;
|
||||
|
|
|
@ -2102,7 +2102,7 @@ scm_i_scan_for_encoding (SCM port)
|
|||
/* This wasn't in a comment */
|
||||
return NULL;
|
||||
|
||||
if (utf8_bom && strcmp(encoding, "UTF-8"))
|
||||
if (utf8_bom && 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)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue