+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
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'
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
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
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;
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
#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);
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;
}
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;
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. */
/* 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);
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);
}
/* 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,
/* Reload the pointers. */
*inbuf = inptr;
- outbuf = outptr;
+ outbuf = outstart;
/* Reset the state. */
# ifdef SAVE_RESET_STATE
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'. */ \
{
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;
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;
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. */
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);
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
{
size_t len;
mbstate_t *ps;
{
- const char *srcend;
+ const unsigned char *srcend;
struct gconv_step_data data;
size_t result = 0;
int status;
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
/* 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. */
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
/* 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. */
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,
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;
/* 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;
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. */
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;
/* 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;
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. */
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. */
|| 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;
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];