about summary refs log tree commit diff
path: root/iconv/gconv_simple.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-04 07:25:25 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-04 07:25:25 +0000
commit0d9f67937f0c9329c35c2c0d15848ab8316dc520 (patch)
treeee2b01470306f95f731e268aab1c0712f9e9d50c /iconv/gconv_simple.c
parente62c19f12cfc377ac9ce7c037713ead5dc6b57d9 (diff)
downloadglibc-0d9f67937f0c9329c35c2c0d15848ab8316dc520.tar.gz
glibc-0d9f67937f0c9329c35c2c0d15848ab8316dc520.tar.xz
glibc-0d9f67937f0c9329c35c2c0d15848ab8316dc520.zip
Update.
1998-04-03 23:17  Ulrich Drepper  <drepper@cygnus.com>

	* iconv/gconv.c: Rewrite of the low-level of gconv.
	* iconv/gconv.h: Likewise.
	* iconv/gconv_builtin.h: Likewise.
	* iconv/gconv_close.c: Likewise.
	* iconv/gconv_db.: Likewise.
	* iconv/gconv_dl.c: Likewise.
	* iconv/gconv_int.h: Likewise.
	* iconv/gconv_open.c: Likewise.
	* iconv/gconv_simple.c: Likewise.
	* iconvdata/8bit-gap.c: Adapt for rewrite.
	* iconvdata/8bit-generic.c: Likewise.
	* iconvdata/euckr.c: Likewise.
	* iconvdata/iso646.c: Likewise.
	* iconvdata/iso6937.c: Likewise.
	* iconvdata/iso8859-1.c: Likewise.
	* iconvdata/johab.c: Likewise.
	* iconvdata/sjis.c: Likewise.
	* iconvdata/t61.c: Likewise.
	* iconvdata/uhc.c: Likewise.
Diffstat (limited to 'iconv/gconv_simple.c')
-rw-r--r--iconv/gconv_simple.c42
1 files changed, 11 insertions, 31 deletions
diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c
index 280ecf57b5..7fbdfbacf3 100644
--- a/iconv/gconv_simple.c
+++ b/iconv/gconv_simple.c
@@ -59,26 +59,6 @@ __gconv_transform_dummy (struct gconv_step *step, struct gconv_step_data *data,
 
 
 int
-__gconv_transform_init_rstate (struct gconv_step *step,
-			       struct gconv_step_data *data)
-{
-  /* We have to provide the transformation function an correctly initialized
-     object of type `mbstate_t'.  This must be dynamically allocated.  */
-  data->data = calloc (1, sizeof (mbstate_t));
-
-  return data->data == NULL ? GCONV_NOMEM : GCONV_OK;
-}
-
-
-void
-__gconv_transform_end_rstate (struct gconv_step_data *data)
-{
-  if (data->data != NULL)
-    free (data->data);
-}
-
-
-int
 __gconv_transform_ucs4_utf8 (struct gconv_step *step,
 			     struct gconv_step_data *data, const char *inbuf,
 			     size_t *inlen, size_t *written, int do_flush)
@@ -95,7 +75,7 @@ __gconv_transform_ucs4_utf8 (struct gconv_step *step,
   if (do_flush)
     {
       /* Clear the state.  */
-      memset (data->data, '\0', sizeof (mbstate_t));
+      memset (data->statep, '\0', sizeof (mbstate_t));
       do_write = 0;
 
       /* Call the steps down the chain if there are any.  */
@@ -127,7 +107,7 @@ __gconv_transform_ucs4_utf8 (struct gconv_step *step,
 				   (const wchar_t **) &newinbuf,
 				   *inlen / sizeof (wchar_t),
 				   data->outbufsize - data->outbufavail,
-				   (mbstate_t *) data->data);
+				   data->statep);
 
 	  /* Remember how much we converted.  */
 	  do_write += newinbuf - inbuf;
@@ -200,7 +180,7 @@ __gconv_transform_utf8_ucs4 (struct gconv_step *step,
   if (do_flush)
     {
       /* Clear the state.  */
-      memset (data->data, '\0', sizeof (mbstate_t));
+      memset (data->statep, '\0', sizeof (mbstate_t));
       do_write = 0;
 
       /* Call the steps down the chain if there are any.  */
@@ -229,7 +209,7 @@ __gconv_transform_utf8_ucs4 (struct gconv_step *step,
 				   &newinbuf, *inlen,
 				   ((data->outbufsize
 				     - data->outbufavail) / sizeof (wchar_t)),
-				   (mbstate_t *) data->data);
+				   data->statep);
 
 	  /* Remember how much we converted.  */
 	  do_write += actually;
@@ -244,7 +224,7 @@ __gconv_transform_utf8_ucs4 (struct gconv_step *step,
 	      break;
 	    }
 
-	  if (*inlen == 0 && !mbsinit ((mbstate_t *) data->data))
+	  if (*inlen == 0 && !mbsinit (data->statep))
 	    {
 	      /* We have an incomplete character at the end.  */
 	      result = GCONV_INCOMPLETE_INPUT;
@@ -309,7 +289,7 @@ __gconv_transform_ucs2_ucs4 (struct gconv_step *step,
   if (do_flush)
     {
       /* Clear the state.  */
-      memset (data->data, '\0', sizeof (mbstate_t));
+      memset (data->statep, '\0', sizeof (mbstate_t));
       do_write = 0;
 
       /* Call the steps down the chain if there are any.  */
@@ -347,7 +327,7 @@ __gconv_transform_ucs2_ucs4 (struct gconv_step *step,
 	  if (*inlen != 1)
 	    {
 	      /* We have an incomplete input character.  */
-	      mbstate_t *state = (mbstate_t *) data->data;
+	      mbstate_t *state = data->statep;
 	      state->count = 1;
 	      state->value = *(uint8_t *) newinbuf;
 	      --*inlen;
@@ -363,7 +343,7 @@ __gconv_transform_ucs2_ucs4 (struct gconv_step *step,
 	      break;
 	    }
 
-	  if (*inlen == 0 && !mbsinit ((mbstate_t *) data->data))
+	  if (*inlen == 0 && !mbsinit (data->statep))
 	    {
 	      /* We have an incomplete character at the end.  */
 	      result = GCONV_INCOMPLETE_INPUT;
@@ -428,7 +408,7 @@ __gconv_transform_ucs4_ucs2 (struct gconv_step *step,
   if (do_flush)
     {
       /* Clear the state.  */
-      memset (data->data, '\0', sizeof (mbstate_t));
+      memset (data->statep, '\0', sizeof (mbstate_t));
       do_write = 0;
 
       /* Call the steps down the chain if there are any.  */
@@ -474,7 +454,7 @@ __gconv_transform_ucs4_ucs2 (struct gconv_step *step,
 	  if (*inlen < 4)
 	    {
 	      /* We have an incomplete input character.  */
-	      mbstate_t *state = (mbstate_t *) data->data;
+	      mbstate_t *state = data->statep;
 	      state->count = *inlen;
 	      state->value = 0;
 	      while (*inlen > 0)
@@ -495,7 +475,7 @@ __gconv_transform_ucs4_ucs2 (struct gconv_step *step,
 	      break;
 	    }
 
-	  if (*inlen == 0 && !mbsinit ((mbstate_t *) data->data))
+	  if (*inlen == 0 && !mbsinit (data->statep))
 	    {
 	      /* We have an incomplete character at the end.  */
 	      result = GCONV_INCOMPLETE_INPUT;