about summary refs log tree commit diff
path: root/iconv/gconv_trans.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-02-06 04:20:37 +0000
committerUlrich Drepper <drepper@redhat.com>2001-02-06 04:20:37 +0000
commit403cb8a19cb457b7f830520a06b0da5a2b846812 (patch)
tree1e1991305bb711f5d31bc4fc50e417a30d71c3c2 /iconv/gconv_trans.c
parent5a35dfca75ee7f2e3b650f2d80a3f1b4802e21e1 (diff)
downloadglibc-403cb8a19cb457b7f830520a06b0da5a2b846812.tar.gz
glibc-403cb8a19cb457b7f830520a06b0da5a2b846812.tar.xz
glibc-403cb8a19cb457b7f830520a06b0da5a2b846812.zip
Update.
	* localedata/Makefile (tests): Add bug-iconv-trans.
	Define bug-iconv-trans-ENV.
	* localedata/bug-iconv-trans.c: New file.

2001-02-04  Bruno Haible  <haible@clisp.cons.org>

	* iconv/gconv_trans.c (__gconv_transliterate): Use a temporary output
	pointer, to avoid accumulating output from incomplete (unsuccessful)
	transliteration attempts.

2001-02-05  Ulrich Drepper  <drepper@redhat.com>
Diffstat (limited to 'iconv/gconv_trans.c')
-rw-r--r--iconv/gconv_trans.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/iconv/gconv_trans.c b/iconv/gconv_trans.c
index 3d02b461d6..b1ca6b46a2 100644
--- a/iconv/gconv_trans.c
+++ b/iconv/gconv_trans.c
@@ -111,17 +111,18 @@ __gconv_transliterate (struct __gconv_step *step,
 	      uint_fast32_t len = 0;
 	      int res;
 	      const unsigned char *toinptr;
+	      unsigned char *outptr;
 
 	      while (to_tbl[idx2 + len] != L'\0')
 		++len;
 
 	      /* Try this input text.  */
 	      toinptr = (const unsigned char *) &to_tbl[idx2];
+	      outptr = *outbufstart;
 	      res = DL_CALL_FCT (step->__fct,
 				 (step, step_data, &toinptr,
 				  (const unsigned char *) &to_tbl[idx2 + len],
-				  (unsigned char **) outbufstart,
-				  NULL, 0, 0));
+				  &outptr, NULL, 0, 0));
 	      if (res != __GCONV_ILLEGAL_INPUT)
 		{
 		  /* If the conversion succeeds we have to increment the
@@ -132,6 +133,7 @@ __gconv_transliterate (struct __gconv_step *step,
 		      ++*irreversible;
 		      res = __GCONV_OK;
 		    }
+		  *outbufstart = outptr;
 
 		  return res;
 		}
@@ -193,6 +195,7 @@ __gconv_transliterate (struct __gconv_step *step,
       const unsigned char *toinptr = (const unsigned char *) default_missing;
       uint32_t len = _NL_CURRENT_WORD (LC_CTYPE,
 				       _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN);
+      unsigned char *outptr;
       int res;
 
       /* Test whether there is enough input.  */
@@ -200,11 +203,11 @@ __gconv_transliterate (struct __gconv_step *step,
 	return (winbuf == winbufend
 		? __GCONV_EMPTY_INPUT : __GCONV_INCOMPLETE_INPUT);
 
+      outptr = *outbufstart;
       res = DL_CALL_FCT (step->__fct,
 			 (step, step_data, &toinptr,
 			  (const unsigned char *) (default_missing + len),
-			  (unsigned char **) outbufstart,
-			  NULL, 0, 0));
+			  &outptr, NULL, 0, 0));
 
       if (res != __GCONV_ILLEGAL_INPUT)
 	{
@@ -217,6 +220,7 @@ __gconv_transliterate (struct __gconv_step *step,
 	      *inbufp += 4;
 	      res = __GCONV_OK;
 	    }
+	  *outbufstart = outptr;
 
 	  return res;
 	}