aboutsummaryrefslogtreecommitdiff
path: root/wcsmbs
diff options
context:
space:
mode:
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 bac99e8547..1c6332ee8c 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 bf995ec713..78ff2a22dd 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 fbebc8de4c..78e327eeea 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 1993e2e702..a10eb85f1a 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 9f3c303e2a..b546c7a9d3 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 18537c2a24..f93d404eb1 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 fbcf0c7c5c..02575992d6 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 8cbcbe41c3..0fba46ad72 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];