mirror of git://sourceware.org/git/glibc.git
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>
|
1999-03-15 Mark Kettenis <kettenis@gnu.org>
|
||||||
|
|
||||||
* sysdeps/mach/hurd/Versions (ld.so) [GLIBC_2.0]: Add
|
* 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.
|
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
|
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
|
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'
|
`--enable-add-ons=crypt,linuxthreads'
|
||||||
|
|
||||||
`--with-binutils=DIRECTORY'
|
`--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
|
Perl is not required, but it is used if present to test the
|
||||||
installation. We may decide to use it elsewhere in the future.
|
installation. We may decide to use it elsewhere in the future.
|
||||||
|
|
||||||
|
|
||||||
If you change any of the `configure.in' files you will also need
|
If you change any of the `configure.in' files you will also need
|
||||||
|
|
||||||
* GNU `autoconf' 2.12 or higher
|
* 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,
|
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
|
but keep the old libraries around for old binaries to use. This is
|
||||||
complicated and difficult. Consult the Glibc2 HOWTO at
|
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
|
You cannot use `nscd' with 2.0 kernels, due to bugs in the
|
||||||
kernel-side thread support. `nscd' happens to hit these bugs
|
kernel-side thread support. `nscd' happens to hit these bugs
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
int
|
int
|
||||||
internal_function
|
internal_function
|
||||||
__gconv (gconv_t cd, const char **inbuf, const char *inbufend, char **outbuf,
|
__gconv (gconv_t cd, const unsigned char **inbuf, const unsigned char *inbufend,
|
||||||
char *outbufend, size_t *converted)
|
unsigned char **outbuf, unsigned char *outbufend, size_t *converted)
|
||||||
{
|
{
|
||||||
size_t last_step = cd->nsteps - 1;
|
size_t last_step = cd->nsteps - 1;
|
||||||
int result;
|
int result;
|
||||||
|
|
|
@ -106,8 +106,9 @@ extern int __gconv_close (gconv_t cd)
|
||||||
according to rules described by CD and place up to *OUTBYTESLEFT
|
according to rules described by CD and place up to *OUTBYTESLEFT
|
||||||
bytes in buffer starting at *OUTBUF. Return number of written
|
bytes in buffer starting at *OUTBUF. Return number of written
|
||||||
characters in *CONVERTED if this pointer is not null. */
|
characters in *CONVERTED if this pointer is not null. */
|
||||||
extern int __gconv (gconv_t __cd, const char **__inbuf, const char *inbufend,
|
extern int __gconv (gconv_t __cd, const unsigned char **__inbuf,
|
||||||
char **__outbuf, char *outbufend, size_t *converted)
|
const unsigned char *inbufend, unsigned char **__outbuf,
|
||||||
|
unsigned char *outbufend, size_t *converted)
|
||||||
internal_function;
|
internal_function;
|
||||||
|
|
||||||
/* Return in *HANDLE a pointer to an array with *NSTEPS elements describing
|
/* 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
|
#ifdef _LIBC
|
||||||
# define __BUILTIN_TRANS(Name) \
|
# define __BUILTIN_TRANS(Name) \
|
||||||
extern int Name (struct gconv_step *__step, struct gconv_step_data *__data, \
|
extern int Name (struct gconv_step *__step, struct gconv_step_data *__data, \
|
||||||
const char **__inbuf, const char *__inbufend, \
|
const unsigned char **__inbuf, \
|
||||||
size_t *__written, int __do_flush)
|
const unsigned char *__inbufend, size_t *__written, \
|
||||||
|
int __do_flush)
|
||||||
|
|
||||||
__BUILTIN_TRANS (__gconv_transform_ascii_internal);
|
__BUILTIN_TRANS (__gconv_transform_ascii_internal);
|
||||||
__BUILTIN_TRANS (__gconv_transform_internal_ascii);
|
__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)
|
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);
|
&converted);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *instart = *inbuf;
|
const char *instart = *inbuf;
|
||||||
|
|
||||||
result = __gconv (gcd, inbuf, *inbuf + *inbytesleft, outbuf,
|
result = __gconv (gcd, (unsigned char **) inbuf,
|
||||||
*outbuf + *outbytesleft, &converted);
|
(unsigned char *) (*inbuf + *inbytesleft),
|
||||||
|
(unsigned char **) outbuf,
|
||||||
|
(unsigned char *) (*outbuf + *outbytesleft),
|
||||||
|
&converted);
|
||||||
|
|
||||||
*inbytesleft -= *inbuf - instart;
|
*inbytesleft -= *inbuf - instart;
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,8 +196,8 @@ gconv_init (struct gconv_step *step)
|
||||||
|
|
||||||
int
|
int
|
||||||
FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||||
const char **inbuf, const char *inbufend, size_t *written,
|
const unsigned char **inbuf, const unsigned char *inbufend,
|
||||||
int do_flush)
|
size_t *written, int do_flush)
|
||||||
{
|
{
|
||||||
struct gconv_step *next_step = step + 1;
|
struct gconv_step *next_step = step + 1;
|
||||||
struct gconv_step_data *next_data = data + 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
|
else
|
||||||
{
|
{
|
||||||
/* We preserve the initial values of the pointer variables. */
|
/* We preserve the initial values of the pointer variables. */
|
||||||
const char *inptr = *inbuf;
|
const unsigned char *inptr = *inbuf;
|
||||||
char *outbuf = data->outbuf;
|
unsigned char *outbuf = data->outbuf;
|
||||||
char *outend = data->outbufend;
|
unsigned char *outend = data->outbufend;
|
||||||
char *outptr;
|
unsigned char *outstart;
|
||||||
|
|
||||||
/* This variable is used to count the number of characters we
|
/* This variable is used to count the number of characters we
|
||||||
actually converted. */
|
actually converted. */
|
||||||
|
@ -242,7 +242,7 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||||
/* Remember the start value for this round. */
|
/* Remember the start value for this round. */
|
||||||
inptr = *inbuf;
|
inptr = *inbuf;
|
||||||
/* The outbuf buffer is empty. */
|
/* The outbuf buffer is empty. */
|
||||||
outptr = outbuf;
|
outstart = outbuf;
|
||||||
|
|
||||||
#ifdef SAVE_RESET_STATE
|
#ifdef SAVE_RESET_STATE
|
||||||
SAVE_RESET_STATE (1);
|
SAVE_RESET_STATE (1);
|
||||||
|
@ -250,18 +250,12 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
||||||
|
|
||||||
if (FROM_DIRECTION)
|
if (FROM_DIRECTION)
|
||||||
/* Run the conversion loop. */
|
/* Run the conversion loop. */
|
||||||
status = FROM_LOOP ((const unsigned char **) inbuf,
|
status = FROM_LOOP (inbuf, inbufend, &outbuf, outend,
|
||||||
(const unsigned char *) inbufend,
|
|
||||||
(unsigned char **) &outbuf,
|
|
||||||
(unsigned char *) outend,
|
|
||||||
data->statep, step->data, &converted
|
data->statep, step->data, &converted
|
||||||
EXTRA_LOOP_ARGS);
|
EXTRA_LOOP_ARGS);
|
||||||
else
|
else
|
||||||
/* Run the conversion loop. */
|
/* Run the conversion loop. */
|
||||||
status = TO_LOOP ((const unsigned char **) inbuf,
|
status = TO_LOOP (inbuf, inbufend, &outbuf, outend,
|
||||||
(const unsigned char *) inbufend,
|
|
||||||
(unsigned char **) &outbuf,
|
|
||||||
(unsigned char *) outend,
|
|
||||||
data->statep, step->data, &converted
|
data->statep, step->data, &converted
|
||||||
EXTRA_LOOP_ARGS);
|
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. */
|
/* 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;
|
int result;
|
||||||
|
|
||||||
result = DL_CALL_FCT (fct, (next_step, next_data, &outerr,
|
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. */
|
/* Reload the pointers. */
|
||||||
*inbuf = inptr;
|
*inbuf = inptr;
|
||||||
outbuf = outptr;
|
outbuf = outstart;
|
||||||
|
|
||||||
/* Reset the state. */
|
/* Reset the state. */
|
||||||
# ifdef SAVE_RESET_STATE
|
# ifdef SAVE_RESET_STATE
|
||||||
|
|
|
@ -199,7 +199,7 @@ gconv_end (struct gconv_step *data)
|
||||||
data->statep->count = ASCII_set; \
|
data->statep->count = ASCII_set; \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
char *outbuf = data->outbuf; \
|
unsigned char *outbuf = data->outbuf; \
|
||||||
\
|
\
|
||||||
/* We are not in the initial state. To switch back we have \
|
/* We are not in the initial state. To switch back we have \
|
||||||
to emit the sequence `Esc ( B'. */ \
|
to emit the sequence `Esc ( B'. */ \
|
||||||
|
|
|
@ -31,8 +31,8 @@ __btowc (c)
|
||||||
{
|
{
|
||||||
wchar_t result;
|
wchar_t result;
|
||||||
struct gconv_step_data data;
|
struct gconv_step_data data;
|
||||||
char inbuf[1];
|
unsigned char inbuf[1];
|
||||||
const char *inptr = inbuf;
|
const unsigned char *inptr = inbuf;
|
||||||
size_t dummy;
|
size_t dummy;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ __btowc (c)
|
||||||
return WEOF;
|
return WEOF;
|
||||||
|
|
||||||
/* Tell where we want the result. */
|
/* Tell where we want the result. */
|
||||||
data.outbuf = (char *) &result;
|
data.outbuf = (unsigned char *) &result;
|
||||||
data.outbufend = data.outbuf + sizeof (wchar_t);
|
data.outbufend = data.outbuf + sizeof (wchar_t);
|
||||||
data.invocation_counter = 0;
|
data.invocation_counter = 0;
|
||||||
data.internal_use = 1;
|
data.internal_use = 1;
|
||||||
|
|
|
@ -39,7 +39,7 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
||||||
int status;
|
int status;
|
||||||
size_t result;
|
size_t result;
|
||||||
size_t dummy;
|
size_t dummy;
|
||||||
const char *inbuf;
|
const unsigned char *inbuf;
|
||||||
char *outbuf = (char *) (pwc ?: buf);
|
char *outbuf = (char *) (pwc ?: buf);
|
||||||
|
|
||||||
/* Tell where we want the result. */
|
/* 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 ();
|
update_conversion_ptrs ();
|
||||||
|
|
||||||
/* Do a normal conversion. */
|
/* Do a normal conversion. */
|
||||||
inbuf = s;
|
inbuf = (const unsigned char *) s;
|
||||||
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
||||||
&data, &inbuf, inbuf + n,
|
&data, &inbuf, inbuf + n,
|
||||||
&dummy, 0);
|
&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
|
if (status == GCONV_OK || status == GCONV_EMPTY_INPUT
|
||||||
|| status == GCONV_FULL_OUTPUT)
|
|| 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. */
|
/* The converted character is the NUL character. */
|
||||||
assert (__mbsinit (data.statep));
|
assert (__mbsinit (data.statep));
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = inbuf - s;
|
result = inbuf - (const unsigned char *) s;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
|
||||||
size_t len;
|
size_t len;
|
||||||
mbstate_t *ps;
|
mbstate_t *ps;
|
||||||
{
|
{
|
||||||
const char *srcend;
|
const unsigned char *srcend;
|
||||||
struct gconv_step_data data;
|
struct gconv_step_data data;
|
||||||
size_t result = 0;
|
size_t result = 0;
|
||||||
int status;
|
int status;
|
||||||
|
@ -66,7 +66,7 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
|
||||||
if (dst == NULL)
|
if (dst == NULL)
|
||||||
{
|
{
|
||||||
wchar_t buf[64]; /* Just an arbitrary size. */
|
wchar_t buf[64]; /* Just an arbitrary size. */
|
||||||
const char *inbuf = *src;
|
const unsigned char *inbuf = *src;
|
||||||
|
|
||||||
data.outbufend = data.outbuf + sizeof (buf);
|
data.outbufend = data.outbuf + sizeof (buf);
|
||||||
do
|
do
|
||||||
|
@ -89,12 +89,13 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
|
||||||
/* This code is based on the safe assumption that all internal
|
/* This code is based on the safe assumption that all internal
|
||||||
multi-byte encodings use the NUL byte only to mark the end
|
multi-byte encodings use the NUL byte only to mark the end
|
||||||
of the string. */
|
of the string. */
|
||||||
data.outbuf = (char *) dst;
|
data.outbuf = (unsigned char *) dst;
|
||||||
data.outbufend = data.outbuf + len * sizeof (wchar_t);
|
data.outbufend = data.outbuf + len * sizeof (wchar_t);
|
||||||
|
|
||||||
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
||||||
&data, src, srcend,
|
&data,
|
||||||
&result, 0);
|
(const unsigned char **) src,
|
||||||
|
srcend, &result, 0);
|
||||||
|
|
||||||
/* We have to determine whether the last character converted
|
/* We have to determine whether the last character converted
|
||||||
is the NUL character. */
|
is the NUL character. */
|
||||||
|
|
|
@ -58,8 +58,8 @@ __mbsrtowcs (dst, src, len, ps)
|
||||||
if (dst == NULL)
|
if (dst == NULL)
|
||||||
{
|
{
|
||||||
wchar_t buf[64]; /* Just an arbitrary size. */
|
wchar_t buf[64]; /* Just an arbitrary size. */
|
||||||
const char *srcend = *src + strlen (*src) + 1;
|
const unsigned char *inbuf = (const unsigned char *) *src;
|
||||||
const char *inbuf = *src;
|
const unsigned char *srcend = inbuf + strlen (inbuf) + 1;
|
||||||
|
|
||||||
data.outbufend = data.outbuf + sizeof (buf);
|
data.outbufend = data.outbuf + sizeof (buf);
|
||||||
do
|
do
|
||||||
|
@ -85,14 +85,19 @@ __mbsrtowcs (dst, src, len, ps)
|
||||||
/* This code is based on the safe assumption that all internal
|
/* This code is based on the safe assumption that all internal
|
||||||
multi-byte encodings use the NUL byte only to mark the end
|
multi-byte encodings use the NUL byte only to mark the end
|
||||||
of the string. */
|
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);
|
data.outbufend = data.outbuf + len * sizeof (wchar_t);
|
||||||
|
|
||||||
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
||||||
&data, src, srcend,
|
&data,
|
||||||
&result, 0);
|
(const unsigned char **) src,
|
||||||
|
srcend, &result, 0);
|
||||||
|
|
||||||
/* We have to determine whether the last character converted
|
/* We have to determine whether the last character converted
|
||||||
is the NUL character. */
|
is the NUL character. */
|
||||||
|
|
|
@ -75,7 +75,7 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Do a normal conversion. */
|
/* 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,
|
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
||||||
&data, &inbuf,
|
&data, &inbuf,
|
||||||
|
@ -94,7 +94,7 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
|
||||||
|
|
||||||
if (status == GCONV_OK || status == GCONV_EMPTY_INPUT
|
if (status == GCONV_OK || status == GCONV_EMPTY_INPUT
|
||||||
|| status == GCONV_FULL_OUTPUT)
|
|| status == GCONV_FULL_OUTPUT)
|
||||||
result = data.outbuf - s;
|
result = data.outbuf - (unsigned char *) s;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = (size_t) -1;
|
result = (size_t) -1;
|
||||||
|
|
|
@ -64,7 +64,7 @@ __wcsnrtombs (dst, src, nwc, len, ps)
|
||||||
/* We have to handle DST == NULL special. */
|
/* We have to handle DST == NULL special. */
|
||||||
if (dst == NULL)
|
if (dst == NULL)
|
||||||
{
|
{
|
||||||
char buf[256]; /* Just an arbitrary value. */
|
unsigned char buf[256]; /* Just an arbitrary value. */
|
||||||
const wchar_t *inbuf = *src;
|
const wchar_t *inbuf = *src;
|
||||||
size_t dummy;
|
size_t dummy;
|
||||||
|
|
||||||
|
@ -77,8 +77,8 @@ __wcsnrtombs (dst, src, nwc, len, ps)
|
||||||
|
|
||||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
||||||
&data,
|
&data,
|
||||||
(const char **) &inbuf,
|
(const unsigned char **) &inbuf,
|
||||||
(const char *) srcend,
|
(const unsigned char *) srcend,
|
||||||
&dummy, 0);
|
&dummy, 0);
|
||||||
|
|
||||||
/* Count the number of bytes. */
|
/* Count the number of bytes. */
|
||||||
|
@ -102,19 +102,20 @@ __wcsnrtombs (dst, src, nwc, len, ps)
|
||||||
data.outbufend = dst + len;
|
data.outbufend = dst + len;
|
||||||
|
|
||||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
||||||
&data, (const char **) src,
|
&data,
|
||||||
(const char *) srcend,
|
(const unsigned char **) src,
|
||||||
|
(const unsigned char *) srcend,
|
||||||
&dummy, 0);
|
&dummy, 0);
|
||||||
|
|
||||||
/* Count the number of bytes. */
|
/* Count the number of bytes. */
|
||||||
result = data.outbuf - dst;
|
result = data.outbuf - (unsigned char *) dst;
|
||||||
|
|
||||||
/* We have to determine whether the last character converted
|
/* We have to determine whether the last character converted
|
||||||
is the NUL character. */
|
is the NUL character. */
|
||||||
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
|
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
|
||||||
&& data.outbuf[-1] == '\0')
|
&& data.outbuf[-1] == '\0')
|
||||||
{
|
{
|
||||||
assert (data.outbuf != dst);
|
assert (data.outbuf != (unsigned char *) dst);
|
||||||
assert (__mbsinit (data.statep));
|
assert (__mbsinit (data.statep));
|
||||||
*src = NULL;
|
*src = NULL;
|
||||||
--result;
|
--result;
|
||||||
|
|
|
@ -56,7 +56,7 @@ __wcsrtombs (dst, src, len, ps)
|
||||||
/* We have to handle DST == NULL special. */
|
/* We have to handle DST == NULL special. */
|
||||||
if (dst == NULL)
|
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 *srcend = *src + __wcslen (*src) + 1;
|
||||||
const wchar_t *inbuf = *src;
|
const wchar_t *inbuf = *src;
|
||||||
size_t dummy;
|
size_t dummy;
|
||||||
|
@ -70,8 +70,8 @@ __wcsrtombs (dst, src, len, ps)
|
||||||
|
|
||||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
||||||
&data,
|
&data,
|
||||||
(const char **) &inbuf,
|
(const unsigned char **) &inbuf,
|
||||||
(const char *) srcend,
|
(const unsigned char *) srcend,
|
||||||
&dummy, 0);
|
&dummy, 0);
|
||||||
|
|
||||||
/* Count the number of bytes. */
|
/* Count the number of bytes. */
|
||||||
|
@ -99,12 +99,13 @@ __wcsrtombs (dst, src, len, ps)
|
||||||
data.outbufend = dst + len;
|
data.outbufend = dst + len;
|
||||||
|
|
||||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
||||||
&data, (const char **) src,
|
&data,
|
||||||
(const char *) srcend,
|
(const unsigned char **) src,
|
||||||
|
(const unsigned char *) srcend,
|
||||||
&dummy, 0);
|
&dummy, 0);
|
||||||
|
|
||||||
/* Count the number of bytes. */
|
/* Count the number of bytes. */
|
||||||
result = data.outbuf - dst;
|
result = data.outbuf - (unsigned char *) dst;
|
||||||
|
|
||||||
/* We have to determine whether the last character converted
|
/* We have to determine whether the last character converted
|
||||||
is the NUL character. */
|
is the NUL character. */
|
||||||
|
@ -112,7 +113,7 @@ __wcsrtombs (dst, src, len, ps)
|
||||||
|| status == GCONV_FULL_OUTPUT)
|
|| status == GCONV_FULL_OUTPUT)
|
||||||
&& data.outbuf[-1] == '\0')
|
&& data.outbuf[-1] == '\0')
|
||||||
{
|
{
|
||||||
assert (data.outbuf != dst);
|
assert (data.outbuf != (unsigned char *) dst);
|
||||||
assert (__mbsinit (data.statep));
|
assert (__mbsinit (data.statep));
|
||||||
*src = NULL;
|
*src = NULL;
|
||||||
--result;
|
--result;
|
||||||
|
|
|
@ -53,13 +53,13 @@ wctob (c)
|
||||||
inbuf[0] = c;
|
inbuf[0] = c;
|
||||||
|
|
||||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb, &data,
|
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb, &data,
|
||||||
(const char **) &inptr,
|
(const unsigned char **) &inptr,
|
||||||
(const char *) &inbuf[1],
|
(const unsigned char *) &inbuf[1],
|
||||||
&dummy, 0);
|
&dummy, 0);
|
||||||
/* The conversion failed or the output is too long. */
|
/* The conversion failed or the output is too long. */
|
||||||
if ((status != GCONV_OK && status != GCONV_FULL_OUTPUT
|
if ((status != GCONV_OK && status != GCONV_FULL_OUTPUT
|
||||||
&& status != GCONV_EMPTY_INPUT)
|
&& status != GCONV_EMPTY_INPUT)
|
||||||
|| data.outbuf != buf + 1)
|
|| data.outbuf != (unsigned char *) (buf + 1))
|
||||||
return EOF;
|
return EOF;
|
||||||
|
|
||||||
return buf[0];
|
return buf[0];
|
||||||
|
|
Loading…
Reference in New Issue