aboutsummaryrefslogtreecommitdiff
path: root/wcsmbs/wcsnrtombs.c
diff options
context:
space:
mode:
Diffstat (limited to 'wcsmbs/wcsnrtombs.c')
-rw-r--r--wcsmbs/wcsnrtombs.c71
1 files changed, 36 insertions, 35 deletions
diff --git a/wcsmbs/wcsnrtombs.c b/wcsmbs/wcsnrtombs.c
index f93d404..fb86992 100644
--- a/wcsmbs/wcsnrtombs.c
+++ b/wcsmbs/wcsnrtombs.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
+ Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -43,16 +43,17 @@ __wcsnrtombs (dst, src, nwc, len, ps)
size_t len;
mbstate_t *ps;
{
- struct gconv_step_data data;
+ struct __gconv_step_data data;
const wchar_t *srcend;
int status;
size_t result;
+ struct __gconv_step *tomb;
/* Tell where we want the result. */
- data.invocation_counter = 0;
- data.internal_use = 1;
- data.is_last = 1;
- data.statep = ps ?: &state;
+ data.__invocation_counter = 0;
+ data.__internal_use = 1;
+ data.__is_last = 1;
+ data.__statep = ps ?: &state;
if (nwc == 0)
return 0;
@@ -61,6 +62,9 @@ __wcsnrtombs (dst, src, nwc, len, ps)
/* Make sure we use the correct function. */
update_conversion_ptrs ();
+ /* Get the structure with the function pointers. */
+ tomb = __wcsmbs_gconv_fcts.tomb;
+
/* We have to handle DST == NULL special. */
if (dst == NULL)
{
@@ -69,25 +73,23 @@ __wcsnrtombs (dst, src, nwc, len, ps)
size_t dummy;
result = 0;
- data.outbufend = buf + sizeof (buf);
+ data.__outbufend = buf + sizeof (buf);
do
{
- data.outbuf = buf;
+ data.__outbuf = buf;
- status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
- &data,
- (const unsigned char **) &inbuf,
- (const unsigned char *) srcend,
- &dummy, 0);
+ status = (*tomb->__fct) (__wcsmbs_gconv_fcts.tomb, &data,
+ (const unsigned char **) &inbuf,
+ (const unsigned char *) srcend, &dummy, 0);
/* Count the number of bytes. */
- result += data.outbuf - buf;
+ result += data.__outbuf - buf;
}
- while (status == GCONV_FULL_OUTPUT);
+ while (status == __GCONV_FULL_OUTPUT);
- if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
- && data.outbuf[-1] == '\0')
+ if ((status == __GCONV_OK || status == __GCONV_EMPTY_INPUT)
+ && data.__outbuf[-1] == '\0')
/* Don't count the NUL character in. */
--result;
}
@@ -98,25 +100,23 @@ __wcsnrtombs (dst, src, nwc, len, ps)
of the string. */
size_t dummy;
- data.outbuf = dst;
- data.outbufend = dst + len;
+ data.__outbuf = dst;
+ data.__outbufend = dst + len;
- status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
- &data,
- (const unsigned char **) src,
- (const unsigned char *) srcend,
- &dummy, 0);
+ status = (*tomb->__fct) (__wcsmbs_gconv_fcts.tomb, &data,
+ (const unsigned char **) src,
+ (const unsigned char *) srcend, &dummy, 0);
/* Count the number of bytes. */
- result = data.outbuf - (unsigned char *) 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')
+ if ((status == __GCONV_OK || status == __GCONV_EMPTY_INPUT)
+ && data.__outbuf[-1] == '\0')
{
- assert (data.outbuf != (unsigned char *) dst);
- assert (__mbsinit (data.statep));
+ assert (data.__outbuf != (unsigned char *) dst);
+ assert (__mbsinit (data.__statep));
*src = NULL;
--result;
}
@@ -124,12 +124,13 @@ __wcsnrtombs (dst, src, nwc, len, ps)
/* There must not be any problems with the conversion but illegal input
characters. */
- assert (status == GCONV_OK || status == GCONV_EMPTY_INPUT
- || status == GCONV_ILLEGAL_INPUT
- || status == GCONV_INCOMPLETE_INPUT || status == GCONV_FULL_OUTPUT);
+ assert (status == __GCONV_OK || status == __GCONV_EMPTY_INPUT
+ || status == __GCONV_ILLEGAL_INPUT
+ || status == __GCONV_INCOMPLETE_INPUT
+ || status == __GCONV_FULL_OUTPUT);
- if (status != GCONV_OK && status != GCONV_FULL_OUTPUT
- && status != GCONV_EMPTY_INPUT)
+ if (status != __GCONV_OK && status != __GCONV_FULL_OUTPUT
+ && status != __GCONV_EMPTY_INPUT)
{
result = (size_t) -1;
__set_errno (EILSEQ);