mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
Update.
1999-03-15 Ulrich Drepper <drepper@cygnus.com> * iconv/gconv.h (gconv_fct): Change parameter from `char' to `unsigned char'. (gconv_step_data): Likewise. * iconv/gconv_int.h (__gconv): Likewise. (__BUILINT_TRANS): Likewise. * iconv/gconv.c (__gconv): Likewise. * iconv/iconv.c (iconv): Add casts for call of __gconv. * iconv/skeleton.c: Change local parameters and variable from `char' to `unsigned char'. Remove casts from calls into modules. * iconvdata/iso-2022-jp.c (gconv): Change local variable outbuf from `char' to `unsigned char'. * wcsmbs/btowc.c: Change pointers from `char *' to `unsigned char *'. * wcsmbs/mbrtowc.c: Likewise. * wcsmbs/mbsnrtowcs.c: Likewise. * wcsmbs/mbsrtowcs.c: Likewise. * wcsmbs/wcrtomb.c: Likewise. * wcsmbs/wcsnrtombs.c: Likewise. * wcsmbs/wcsrtombs.c: Likewise. * wcsmbs/wctob.c: Likewise.
This commit is contained in:
parent
1d0b8e4b8f
commit
b117f744e1
22
ChangeLog
22
ChangeLog
@ -1,3 +1,25 @@
|
||||
1999-03-15 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* iconv/gconv.h (gconv_fct): Change parameter from `char' to
|
||||
`unsigned char'.
|
||||
(gconv_step_data): Likewise.
|
||||
* iconv/gconv_int.h (__gconv): Likewise.
|
||||
(__BUILINT_TRANS): Likewise.
|
||||
* iconv/gconv.c (__gconv): Likewise.
|
||||
* iconv/iconv.c (iconv): Add casts for call of __gconv.
|
||||
* iconv/skeleton.c: Change local parameters and variable from `char' to
|
||||
`unsigned char'. Remove casts from calls into modules.
|
||||
* iconvdata/iso-2022-jp.c (gconv): Change local variable outbuf from
|
||||
`char' to `unsigned char'.
|
||||
* wcsmbs/btowc.c: Change pointers from `char *' to `unsigned char *'.
|
||||
* wcsmbs/mbrtowc.c: Likewise.
|
||||
* wcsmbs/mbsnrtowcs.c: Likewise.
|
||||
* wcsmbs/mbsrtowcs.c: Likewise.
|
||||
* wcsmbs/wcrtomb.c: Likewise.
|
||||
* wcsmbs/wcsnrtombs.c: Likewise.
|
||||
* wcsmbs/wcsrtombs.c: Likewise.
|
||||
* wcsmbs/wctob.c: Likewise.
|
||||
|
||||
1999-03-15 Mark Kettenis <kettenis@gnu.org>
|
||||
|
||||
* sysdeps/mach/hurd/Versions (ld.so) [GLIBC_2.0]: Add
|
||||
|
5
INSTALL
5
INSTALL
@ -82,7 +82,7 @@ will be used, and CFLAGS sets optimization options for the compiler.
|
||||
given with no list, it enables all the add-on packages it finds.
|
||||
If you do not wish to use some add-on package that you have
|
||||
present in your source tree, give this option a list of the
|
||||
add-ons that you *do* want used, like this:
|
||||
add-ons that you _do_ want used, like this:
|
||||
`--enable-add-ons=crypt,linuxthreads'
|
||||
|
||||
`--with-binutils=DIRECTORY'
|
||||
@ -299,6 +299,7 @@ build the GNU C library:
|
||||
Perl is not required, but it is used if present to test the
|
||||
installation. We may decide to use it elsewhere in the future.
|
||||
|
||||
|
||||
If you change any of the `configure.in' files you will also need
|
||||
|
||||
* GNU `autoconf' 2.12 or higher
|
||||
@ -401,7 +402,7 @@ installed there.
|
||||
library on your system against the new library for the sake of new code,
|
||||
but keep the old libraries around for old binaries to use. This is
|
||||
complicated and difficult. Consult the Glibc2 HOWTO at
|
||||
`http://www.imaxx.net/~thrytis/glibc' for details.
|
||||
<http://www.imaxx.net/~thrytis/glibc> for details.
|
||||
|
||||
You cannot use `nscd' with 2.0 kernels, due to bugs in the
|
||||
kernel-side thread support. `nscd' happens to hit these bugs
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
int
|
||||
internal_function
|
||||
__gconv (gconv_t cd, const char **inbuf, const char *inbufend, char **outbuf,
|
||||
char *outbufend, size_t *converted)
|
||||
__gconv (gconv_t cd, const unsigned char **inbuf, const unsigned char *inbufend,
|
||||
unsigned char **outbuf, unsigned char *outbufend, size_t *converted)
|
||||
{
|
||||
size_t last_step = cd->nsteps - 1;
|
||||
int result;
|
||||
|
@ -106,8 +106,9 @@ extern int __gconv_close (gconv_t cd)
|
||||
according to rules described by CD and place up to *OUTBYTESLEFT
|
||||
bytes in buffer starting at *OUTBUF. Return number of written
|
||||
characters in *CONVERTED if this pointer is not null. */
|
||||
extern int __gconv (gconv_t __cd, const char **__inbuf, const char *inbufend,
|
||||
char **__outbuf, char *outbufend, size_t *converted)
|
||||
extern int __gconv (gconv_t __cd, const unsigned char **__inbuf,
|
||||
const unsigned char *inbufend, unsigned char **__outbuf,
|
||||
unsigned char *outbufend, size_t *converted)
|
||||
internal_function;
|
||||
|
||||
/* Return in *HANDLE a pointer to an array with *NSTEPS elements describing
|
||||
@ -154,8 +155,9 @@ extern void __gconv_get_builtin_trans (const char *__name,
|
||||
#ifdef _LIBC
|
||||
# define __BUILTIN_TRANS(Name) \
|
||||
extern int Name (struct gconv_step *__step, struct gconv_step_data *__data, \
|
||||
const char **__inbuf, const char *__inbufend, \
|
||||
size_t *__written, int __do_flush)
|
||||
const unsigned char **__inbuf, \
|
||||
const unsigned char *__inbufend, size_t *__written, \
|
||||
int __do_flush)
|
||||
|
||||
__BUILTIN_TRANS (__gconv_transform_ascii_internal);
|
||||
__BUILTIN_TRANS (__gconv_transform_internal_ascii);
|
||||
|
@ -38,15 +38,19 @@ iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf,
|
||||
|
||||
if (inbuf == NULL || *inbuf == NULL)
|
||||
{
|
||||
result = __gconv (gcd, NULL, NULL, outbuf, outstart + *outbytesleft,
|
||||
result = __gconv (gcd, NULL, NULL, (unsigned char **) outbuf,
|
||||
(unsigned char *) (outstart + *outbytesleft),
|
||||
&converted);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *instart = *inbuf;
|
||||
|
||||
result = __gconv (gcd, inbuf, *inbuf + *inbytesleft, outbuf,
|
||||
*outbuf + *outbytesleft, &converted);
|
||||
result = __gconv (gcd, (unsigned char **) inbuf,
|
||||
(unsigned char *) (*inbuf + *inbytesleft),
|
||||
(unsigned char **) outbuf,
|
||||
(unsigned char *) (*outbuf + *outbytesleft),
|
||||
&converted);
|
||||
|
||||
*inbytesleft -= *inbuf - instart;
|
||||
}
|
||||
|
@ -196,8 +196,8 @@ gconv_init (struct gconv_step *step)
|
||||
|
||||
int
|
||||
FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
const char **inbuf, const char *inbufend, size_t *written,
|
||||
int do_flush)
|
||||
const unsigned char **inbuf, const unsigned char *inbufend,
|
||||
size_t *written, int do_flush)
|
||||
{
|
||||
struct gconv_step *next_step = step + 1;
|
||||
struct gconv_step_data *next_data = data + 1;
|
||||
@ -224,10 +224,10 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
else
|
||||
{
|
||||
/* We preserve the initial values of the pointer variables. */
|
||||
const char *inptr = *inbuf;
|
||||
char *outbuf = data->outbuf;
|
||||
char *outend = data->outbufend;
|
||||
char *outptr;
|
||||
const unsigned char *inptr = *inbuf;
|
||||
unsigned char *outbuf = data->outbuf;
|
||||
unsigned char *outend = data->outbufend;
|
||||
unsigned char *outstart;
|
||||
|
||||
/* This variable is used to count the number of characters we
|
||||
actually converted. */
|
||||
@ -242,7 +242,7 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
/* Remember the start value for this round. */
|
||||
inptr = *inbuf;
|
||||
/* The outbuf buffer is empty. */
|
||||
outptr = outbuf;
|
||||
outstart = outbuf;
|
||||
|
||||
#ifdef SAVE_RESET_STATE
|
||||
SAVE_RESET_STATE (1);
|
||||
@ -250,18 +250,12 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
|
||||
if (FROM_DIRECTION)
|
||||
/* Run the conversion loop. */
|
||||
status = FROM_LOOP ((const unsigned char **) inbuf,
|
||||
(const unsigned char *) inbufend,
|
||||
(unsigned char **) &outbuf,
|
||||
(unsigned char *) outend,
|
||||
status = FROM_LOOP (inbuf, inbufend, &outbuf, outend,
|
||||
data->statep, step->data, &converted
|
||||
EXTRA_LOOP_ARGS);
|
||||
else
|
||||
/* Run the conversion loop. */
|
||||
status = TO_LOOP ((const unsigned char **) inbuf,
|
||||
(const unsigned char *) inbufend,
|
||||
(unsigned char **) &outbuf,
|
||||
(unsigned char *) outend,
|
||||
status = TO_LOOP (inbuf, inbufend, &outbuf, outend,
|
||||
data->statep, step->data, &converted
|
||||
EXTRA_LOOP_ARGS);
|
||||
|
||||
@ -279,9 +273,9 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
}
|
||||
|
||||
/* Write out all output which was produced. */
|
||||
if (outbuf > outptr)
|
||||
if (outbuf > outstart)
|
||||
{
|
||||
const char *outerr = data->outbuf;
|
||||
const unsigned char *outerr = data->outbuf;
|
||||
int result;
|
||||
|
||||
result = DL_CALL_FCT (fct, (next_step, next_data, &outerr,
|
||||
@ -300,7 +294,7 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||
|
||||
/* Reload the pointers. */
|
||||
*inbuf = inptr;
|
||||
outbuf = outptr;
|
||||
outbuf = outstart;
|
||||
|
||||
/* Reset the state. */
|
||||
# ifdef SAVE_RESET_STATE
|
||||
|
@ -199,7 +199,7 @@ gconv_end (struct gconv_step *data)
|
||||
data->statep->count = ASCII_set; \
|
||||
else \
|
||||
{ \
|
||||
char *outbuf = data->outbuf; \
|
||||
unsigned char *outbuf = data->outbuf; \
|
||||
\
|
||||
/* We are not in the initial state. To switch back we have \
|
||||
to emit the sequence `Esc ( B'. */ \
|
||||
|
@ -31,8 +31,8 @@ __btowc (c)
|
||||
{
|
||||
wchar_t result;
|
||||
struct gconv_step_data data;
|
||||
char inbuf[1];
|
||||
const char *inptr = inbuf;
|
||||
unsigned char inbuf[1];
|
||||
const unsigned char *inptr = inbuf;
|
||||
size_t dummy;
|
||||
int status;
|
||||
|
||||
@ -42,7 +42,7 @@ __btowc (c)
|
||||
return WEOF;
|
||||
|
||||
/* Tell where we want the result. */
|
||||
data.outbuf = (char *) &result;
|
||||
data.outbuf = (unsigned char *) &result;
|
||||
data.outbufend = data.outbuf + sizeof (wchar_t);
|
||||
data.invocation_counter = 0;
|
||||
data.internal_use = 1;
|
||||
|
@ -39,7 +39,7 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
||||
int status;
|
||||
size_t result;
|
||||
size_t dummy;
|
||||
const char *inbuf;
|
||||
const unsigned char *inbuf;
|
||||
char *outbuf = (char *) (pwc ?: buf);
|
||||
|
||||
/* Tell where we want the result. */
|
||||
@ -63,7 +63,7 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
||||
update_conversion_ptrs ();
|
||||
|
||||
/* Do a normal conversion. */
|
||||
inbuf = s;
|
||||
inbuf = (const unsigned char *) s;
|
||||
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
||||
&data, &inbuf, inbuf + n,
|
||||
&dummy, 0);
|
||||
@ -80,14 +80,15 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
||||
if (status == GCONV_OK || status == GCONV_EMPTY_INPUT
|
||||
|| status == GCONV_FULL_OUTPUT)
|
||||
{
|
||||
if (data.outbuf != outbuf && *(wchar_t *)outbuf == L'\0')
|
||||
if (data.outbuf != (unsigned char *) outbuf
|
||||
&& *(wchar_t *) outbuf == L'\0')
|
||||
{
|
||||
/* The converted character is the NUL character. */
|
||||
assert (__mbsinit (data.statep));
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
result = inbuf - s;
|
||||
result = inbuf - (const unsigned char *) s;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
|
||||
size_t len;
|
||||
mbstate_t *ps;
|
||||
{
|
||||
const char *srcend;
|
||||
const unsigned char *srcend;
|
||||
struct gconv_step_data data;
|
||||
size_t result = 0;
|
||||
int status;
|
||||
@ -66,7 +66,7 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
|
||||
if (dst == NULL)
|
||||
{
|
||||
wchar_t buf[64]; /* Just an arbitrary size. */
|
||||
const char *inbuf = *src;
|
||||
const unsigned char *inbuf = *src;
|
||||
|
||||
data.outbufend = data.outbuf + sizeof (buf);
|
||||
do
|
||||
@ -89,12 +89,13 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
|
||||
/* This code is based on the safe assumption that all internal
|
||||
multi-byte encodings use the NUL byte only to mark the end
|
||||
of the string. */
|
||||
data.outbuf = (char *) dst;
|
||||
data.outbuf = (unsigned char *) dst;
|
||||
data.outbufend = data.outbuf + len * sizeof (wchar_t);
|
||||
|
||||
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
||||
&data, src, srcend,
|
||||
&result, 0);
|
||||
&data,
|
||||
(const unsigned char **) src,
|
||||
srcend, &result, 0);
|
||||
|
||||
/* We have to determine whether the last character converted
|
||||
is the NUL character. */
|
||||
|
@ -58,8 +58,8 @@ __mbsrtowcs (dst, src, len, ps)
|
||||
if (dst == NULL)
|
||||
{
|
||||
wchar_t buf[64]; /* Just an arbitrary size. */
|
||||
const char *srcend = *src + strlen (*src) + 1;
|
||||
const char *inbuf = *src;
|
||||
const unsigned char *inbuf = (const unsigned char *) *src;
|
||||
const unsigned char *srcend = inbuf + strlen (inbuf) + 1;
|
||||
|
||||
data.outbufend = data.outbuf + sizeof (buf);
|
||||
do
|
||||
@ -85,14 +85,19 @@ __mbsrtowcs (dst, src, len, ps)
|
||||
/* This code is based on the safe assumption that all internal
|
||||
multi-byte encodings use the NUL byte only to mark the end
|
||||
of the string. */
|
||||
const char *srcend = *src + __strnlen (*src, len * MB_CUR_MAX) + 1;
|
||||
const unsigned char *srcend;
|
||||
|
||||
data.outbuf = (char *) dst;
|
||||
srcend = (const unsigned char *) (*src
|
||||
+ __strnlen (*src, len * MB_CUR_MAX)
|
||||
+ 1);
|
||||
|
||||
data.outbuf = (unsigned char *) dst;
|
||||
data.outbufend = data.outbuf + len * sizeof (wchar_t);
|
||||
|
||||
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
||||
&data, src, srcend,
|
||||
&result, 0);
|
||||
&data,
|
||||
(const unsigned char **) src,
|
||||
srcend, &result, 0);
|
||||
|
||||
/* We have to determine whether the last character converted
|
||||
is the NUL character. */
|
||||
|
@ -75,7 +75,7 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
|
||||
else
|
||||
{
|
||||
/* Do a normal conversion. */
|
||||
const char *inbuf = (const char *) &wc;
|
||||
const unsigned char *inbuf = (const unsigned char *) &wc;
|
||||
|
||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
||||
&data, &inbuf,
|
||||
@ -94,7 +94,7 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
|
||||
|
||||
if (status == GCONV_OK || status == GCONV_EMPTY_INPUT
|
||||
|| status == GCONV_FULL_OUTPUT)
|
||||
result = data.outbuf - s;
|
||||
result = data.outbuf - (unsigned char *) s;
|
||||
else
|
||||
{
|
||||
result = (size_t) -1;
|
||||
|
@ -64,7 +64,7 @@ __wcsnrtombs (dst, src, nwc, len, ps)
|
||||
/* We have to handle DST == NULL special. */
|
||||
if (dst == NULL)
|
||||
{
|
||||
char buf[256]; /* Just an arbitrary value. */
|
||||
unsigned char buf[256]; /* Just an arbitrary value. */
|
||||
const wchar_t *inbuf = *src;
|
||||
size_t dummy;
|
||||
|
||||
@ -77,8 +77,8 @@ __wcsnrtombs (dst, src, nwc, len, ps)
|
||||
|
||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
||||
&data,
|
||||
(const char **) &inbuf,
|
||||
(const char *) srcend,
|
||||
(const unsigned char **) &inbuf,
|
||||
(const unsigned char *) srcend,
|
||||
&dummy, 0);
|
||||
|
||||
/* Count the number of bytes. */
|
||||
@ -102,19 +102,20 @@ __wcsnrtombs (dst, src, nwc, len, ps)
|
||||
data.outbufend = dst + len;
|
||||
|
||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
||||
&data, (const char **) src,
|
||||
(const char *) srcend,
|
||||
&data,
|
||||
(const unsigned char **) src,
|
||||
(const unsigned char *) srcend,
|
||||
&dummy, 0);
|
||||
|
||||
/* Count the number of bytes. */
|
||||
result = data.outbuf - dst;
|
||||
result = data.outbuf - (unsigned char *) dst;
|
||||
|
||||
/* We have to determine whether the last character converted
|
||||
is the NUL character. */
|
||||
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
|
||||
&& data.outbuf[-1] == '\0')
|
||||
{
|
||||
assert (data.outbuf != dst);
|
||||
assert (data.outbuf != (unsigned char *) dst);
|
||||
assert (__mbsinit (data.statep));
|
||||
*src = NULL;
|
||||
--result;
|
||||
|
@ -56,7 +56,7 @@ __wcsrtombs (dst, src, len, ps)
|
||||
/* We have to handle DST == NULL special. */
|
||||
if (dst == NULL)
|
||||
{
|
||||
char buf[256]; /* Just an arbitrary value. */
|
||||
unsigned char buf[256]; /* Just an arbitrary value. */
|
||||
const wchar_t *srcend = *src + __wcslen (*src) + 1;
|
||||
const wchar_t *inbuf = *src;
|
||||
size_t dummy;
|
||||
@ -70,8 +70,8 @@ __wcsrtombs (dst, src, len, ps)
|
||||
|
||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
||||
&data,
|
||||
(const char **) &inbuf,
|
||||
(const char *) srcend,
|
||||
(const unsigned char **) &inbuf,
|
||||
(const unsigned char *) srcend,
|
||||
&dummy, 0);
|
||||
|
||||
/* Count the number of bytes. */
|
||||
@ -99,12 +99,13 @@ __wcsrtombs (dst, src, len, ps)
|
||||
data.outbufend = dst + len;
|
||||
|
||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
||||
&data, (const char **) src,
|
||||
(const char *) srcend,
|
||||
&data,
|
||||
(const unsigned char **) src,
|
||||
(const unsigned char *) srcend,
|
||||
&dummy, 0);
|
||||
|
||||
/* Count the number of bytes. */
|
||||
result = data.outbuf - dst;
|
||||
result = data.outbuf - (unsigned char *) dst;
|
||||
|
||||
/* We have to determine whether the last character converted
|
||||
is the NUL character. */
|
||||
@ -112,7 +113,7 @@ __wcsrtombs (dst, src, len, ps)
|
||||
|| status == GCONV_FULL_OUTPUT)
|
||||
&& data.outbuf[-1] == '\0')
|
||||
{
|
||||
assert (data.outbuf != dst);
|
||||
assert (data.outbuf != (unsigned char *) dst);
|
||||
assert (__mbsinit (data.statep));
|
||||
*src = NULL;
|
||||
--result;
|
||||
|
@ -53,13 +53,13 @@ wctob (c)
|
||||
inbuf[0] = c;
|
||||
|
||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb, &data,
|
||||
(const char **) &inptr,
|
||||
(const char *) &inbuf[1],
|
||||
(const unsigned char **) &inptr,
|
||||
(const unsigned char *) &inbuf[1],
|
||||
&dummy, 0);
|
||||
/* The conversion failed or the output is too long. */
|
||||
if ((status != GCONV_OK && status != GCONV_FULL_OUTPUT
|
||||
&& status != GCONV_EMPTY_INPUT)
|
||||
|| data.outbuf != buf + 1)
|
||||
|| data.outbuf != (unsigned char *) (buf + 1))
|
||||
return EOF;
|
||||
|
||||
return buf[0];
|
||||
|
Loading…
Reference in New Issue
Block a user