aboutsummaryrefslogtreecommitdiff
path: root/wcsmbs
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-03-15 20:41:16 +0000
committerUlrich Drepper <drepper@redhat.com>1999-03-15 20:41:16 +0000
commitb117f744e10e769a5d219cf0b69cc10f81738650 (patch)
tree35f76b5a32b99735df14db028185e85df3834c33 /wcsmbs
parent1d0b8e4b8f9c636cfaec78be5ebf819d3d8c2284 (diff)
downloadglibc-b117f744e10e769a5d219cf0b69cc10f81738650.zip
glibc-b117f744e10e769a5d219cf0b69cc10f81738650.tar.gz
glibc-b117f744e10e769a5d219cf0b69cc10f81738650.tar.bz2
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.
Diffstat (limited to 'wcsmbs')
-rw-r--r--wcsmbs/btowc.c6
-rw-r--r--wcsmbs/mbrtowc.c9
-rw-r--r--wcsmbs/mbsnrtowcs.c11
-rw-r--r--wcsmbs/mbsrtowcs.c17
-rw-r--r--wcsmbs/wcrtomb.c4
-rw-r--r--wcsmbs/wcsnrtombs.c15
-rw-r--r--wcsmbs/wcsrtombs.c15
-rw-r--r--wcsmbs/wctob.c6
8 files changed, 46 insertions, 37 deletions
diff --git a/wcsmbs/btowc.c b/wcsmbs/btowc.c
index bac99e8..1c6332e 100644
--- a/wcsmbs/btowc.c
+++ b/wcsmbs/btowc.c
@@ -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;
diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c
index bf995ec..78ff2a2 100644
--- a/wcsmbs/mbrtowc.c
+++ b/wcsmbs/mbrtowc.c
@@ -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
{
diff --git a/wcsmbs/mbsnrtowcs.c b/wcsmbs/mbsnrtowcs.c
index fbebc8d..78e327e 100644
--- a/wcsmbs/mbsnrtowcs.c
+++ b/wcsmbs/mbsnrtowcs.c
@@ -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. */
diff --git a/wcsmbs/mbsrtowcs.c b/wcsmbs/mbsrtowcs.c
index 1993e2e..a10eb85 100644
--- a/wcsmbs/mbsrtowcs.c
+++ b/wcsmbs/mbsrtowcs.c
@@ -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. */
diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c
index 9f3c303..b546c7a 100644
--- a/wcsmbs/wcrtomb.c
+++ b/wcsmbs/wcrtomb.c
@@ -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;
diff --git a/wcsmbs/wcsnrtombs.c b/wcsmbs/wcsnrtombs.c
index 18537c2..f93d404 100644
--- a/wcsmbs/wcsnrtombs.c
+++ b/wcsmbs/wcsnrtombs.c
@@ -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;
diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c
index fbcf0c7..0257599 100644
--- a/wcsmbs/wcsrtombs.c
+++ b/wcsmbs/wcsrtombs.c
@@ -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;
diff --git a/wcsmbs/wctob.c b/wcsmbs/wctob.c
index 8cbcbe4..0fba46a 100644
--- a/wcsmbs/wctob.c
+++ b/wcsmbs/wctob.c
@@ -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];