mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 00:10:10 +00:00
Update.
* iconv/gconv_open.c (__gconv_open): Empty codeset name now means using the current locale's codeset. * iconv/iconv_open.c (iconv_open): Don't strip out everything for empty input string. * iconv/iconv_prog.c: Pass empty strings as default value for to- and from-charset. Don't determine locale's charset here. if libio is used [PR libc/2575].
This commit is contained in:
parent
c6baa867d3
commit
e0e86ccb1d
@ -1,11 +1,18 @@
|
|||||||
2001-11-28 Ulrich Drepper <drepper@redhat.com>
|
2001-11-28 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* iconv/gconv_open.c (__gconv_open): Empty codeset name now means using
|
||||||
|
the current locale's codeset.
|
||||||
|
* iconv/iconv_open.c (iconv_open): Don't strip out everything for
|
||||||
|
empty input string.
|
||||||
|
* iconv/iconv_prog.c: Pass empty strings as default value for to-
|
||||||
|
and from-charset. Don't determine locale's charset here.
|
||||||
|
|
||||||
* libio/genops.c (_IO_flush_all_lockp): New function. The same code
|
* libio/genops.c (_IO_flush_all_lockp): New function. The same code
|
||||||
as the old _IO_flush_all but lock only if parameter is nonzero.
|
as the old _IO_flush_all but lock only if parameter is nonzero.
|
||||||
(_IO_flush_all): Call _IO_flush_all_lockp with 1 as parameter.
|
(_IO_flush_all): Call _IO_flush_all_lockp with 1 as parameter.
|
||||||
* libio/libioP.h: Add prototype for _IO_flush_all_lockp.
|
* libio/libioP.h: Add prototype for _IO_flush_all_lockp.
|
||||||
* sysdeps/generic/abort.c (fflush): Define to _IO_flush_all_lockp(0)
|
* sysdeps/generic/abort.c (fflush): Define to _IO_flush_all_lockp(0)
|
||||||
if libio is used.
|
if libio is used [PR libc/2575].
|
||||||
|
|
||||||
2001-11-28 Jakub Jelinek <jakub@redhat.com>
|
2001-11-28 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include "../locale/localeinfo.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -149,6 +150,25 @@ __gconv_open (const char *toset, const char *fromset, __gconv_t *handle,
|
|||||||
fromset = memcpy (newfromset, fromset, ignore - fromset);
|
fromset = memcpy (newfromset, fromset, ignore - fromset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the string is empty define this to mean the charset of the
|
||||||
|
currently selected locale. */
|
||||||
|
if (strcmp (toset, "//") == 0)
|
||||||
|
{
|
||||||
|
const char *codeset = _NL_CURRENT (LC_CTYPE, CODESET);
|
||||||
|
size_t len = strlen (codeset);
|
||||||
|
char *dest;
|
||||||
|
toset = dest = (char *) alloca (len + 3);
|
||||||
|
memcpy (__mempcpy (dest, codeset, len), "//", 3);
|
||||||
|
}
|
||||||
|
if (strcmp (fromset, "//") == 0)
|
||||||
|
{
|
||||||
|
const char *codeset = _NL_CURRENT (LC_CTYPE, CODESET);
|
||||||
|
size_t len = strlen (codeset);
|
||||||
|
char *dest;
|
||||||
|
fromset = dest = (char *) alloca (len + 3);
|
||||||
|
memcpy (__mempcpy (dest, codeset, len), "//", 3);
|
||||||
|
}
|
||||||
|
|
||||||
res = __gconv_find_transform (toset, fromset, &steps, &nsteps, flags);
|
res = __gconv_find_transform (toset, fromset, &steps, &nsteps, flags);
|
||||||
if (res == __GCONV_OK)
|
if (res == __GCONV_OK)
|
||||||
{
|
{
|
||||||
|
@ -40,14 +40,15 @@ iconv_open (const char *tocode, const char *fromcode)
|
|||||||
/* Normalize the name. We remove all characters beside alpha-numeric,
|
/* Normalize the name. We remove all characters beside alpha-numeric,
|
||||||
'_', '-', '/', and '.'. */
|
'_', '-', '/', and '.'. */
|
||||||
tocode_len = strlen (tocode);
|
tocode_len = strlen (tocode);
|
||||||
tocode_conv = alloca (tocode_len + 3);
|
tocode_conv = (char *) alloca (tocode_len + 3);
|
||||||
strip (tocode_conv, tocode);
|
strip (tocode_conv, tocode);
|
||||||
tocode = tocode_conv[2] == '\0' ? upstr (tocode_conv, tocode) : tocode_conv;
|
tocode = (tocode_conv[2] == '\0' && tocode[0] != '\0'
|
||||||
|
? upstr (tocode_conv, tocode) : tocode_conv);
|
||||||
|
|
||||||
fromcode_len = strlen (fromcode);
|
fromcode_len = strlen (fromcode);
|
||||||
fromcode_conv = alloca (fromcode_len + 3);
|
fromcode_conv = (char *) alloca (fromcode_len + 3);
|
||||||
strip (fromcode_conv, fromcode);
|
strip (fromcode_conv, fromcode);
|
||||||
fromcode = (fromcode_conv[2] == '\0'
|
fromcode = (fromcode_conv[2] == '\0' && fromcode[0] != '\0'
|
||||||
? upstr (fromcode_conv, fromcode) : fromcode_conv);
|
? upstr (fromcode_conv, fromcode) : fromcode_conv);
|
||||||
|
|
||||||
res = __gconv_open (tocode, fromcode, &cd, 0);
|
res = __gconv_open (tocode, fromcode, &cd, 0);
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <error.h>
|
#include <error.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#include <langinfo.h>
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <search.h>
|
#include <search.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -92,9 +91,11 @@ static struct argp argp =
|
|||||||
options, parse_opt, args_doc, doc, NULL, more_help
|
options, parse_opt, args_doc, doc, NULL, more_help
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Code sets to convert from and to respectively. */
|
/* Code sets to convert from and to respectively. An empty string as the
|
||||||
static const char *from_code;
|
default causes the 'iconv_open' function to look up the charset of the
|
||||||
static const char *to_code;
|
currently selected locale and use it. */
|
||||||
|
static const char *from_code = "";
|
||||||
|
static const char *to_code = "";
|
||||||
|
|
||||||
/* File to write output to. If NULL write to stdout. */
|
/* File to write output to. If NULL write to stdout. */
|
||||||
static const char *output_file;
|
static const char *output_file;
|
||||||
@ -141,20 +142,6 @@ main (int argc, char *argv[])
|
|||||||
print_known_names ();
|
print_known_names ();
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
if (from_code == NULL)
|
|
||||||
{
|
|
||||||
/* The Unix standard says that in this case the charset of the current
|
|
||||||
locale is used. */
|
|
||||||
from_code = nl_langinfo (CODESET);
|
|
||||||
assert (from_code != NULL);
|
|
||||||
}
|
|
||||||
if (to_code == NULL)
|
|
||||||
{
|
|
||||||
/* The Unix standard says that in this case the charset of the current
|
|
||||||
locale is used. */
|
|
||||||
to_code = nl_langinfo (CODESET);
|
|
||||||
assert (to_code != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we have to ignore errors make sure we use the appropriate name for
|
/* If we have to ignore errors make sure we use the appropriate name for
|
||||||
the to-character-set. */
|
the to-character-set. */
|
||||||
|
Loading…
Reference in New Issue
Block a user