]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(iconv): Allow omitting output buffer if no input buffer is given to
authorUlrich Drepper <drepper@redhat.com>
Tue, 21 Dec 1999 07:17:16 +0000 (07:17 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 21 Dec 1999 07:17:16 +0000 (07:17 +0000)
place conversion descriptor in initial state.

iconv/iconv.c

index a6c84367a7401dd868de3a22b31fc009c110ea98..a44525324992c196bae26ce89454cad7b3119bcc 100644 (file)
@@ -38,9 +38,12 @@ iconv (iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf,
 
   if (inbuf == NULL || *inbuf == NULL)
     {
-      result = __gconv (gcd, NULL, NULL, (unsigned char **) outbuf,
-                       (unsigned char *) (outstart + *outbytesleft),
-                       &converted);
+      if (outbuf == NULL || *outbuf == NULL)
+       result = __gconv (gcd, NULL, NULL, NULL, NULL, &converted);
+      else
+       result = __gconv (gcd, NULL, NULL, (unsigned char **) outbuf,
+                         (unsigned char *) (outstart + *outbytesleft),
+                         &converted);
     }
   else
     {