]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Update for changed calling convention of xmem_cd_iconv.
authorBruno Haible <bruno@clisp.org>
Sun, 21 Jan 2007 21:19:34 +0000 (21:19 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:14:37 +0000 (12:14 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/recode-sr-latin.c

index 35cb877649b5b7a8d349a13c9074432e7ea0f931..2fca1a50f200c7ab3efc85c084b75b7c0f86bcb2 100644 (file)
@@ -3,6 +3,7 @@
        * msgl-iconv.c (convert_string, convert_msgstr, iconvable_string,
        iconvable_msgstr): Update for changed calling convention of
        xmem_cd_iconv.
+       * recode-sr-latin.c (process): Likewise.
 
 2007-01-07  Bruno Haible  <bruno@clisp.org>
 
index c2a69c091ff750b18ddcc2b4336570e02d7a909e..2f878abdba844034c57e7dee546456ca6ae296ea 100644 (file)
@@ -259,10 +259,10 @@ process (FILE *stream)
 #if HAVE_ICONV
   iconv_t conv_to_utf8 = (iconv_t)(-1);
   iconv_t conv_from_utf8 = (iconv_t)(-1);
-  char *utf8_line;
-  size_t utf8_line_len;
-  char *backconv_line;
-  size_t backconv_line_len;
+  char *last_utf8_line;
+  size_t last_utf8_line_len;
+  char *last_backconv_line;
+  size_t last_backconv_line_len;
 #endif
 
   init_linebuffer (&lb);
@@ -290,10 +290,10 @@ and iconv() does not support this conversion."),
 Cannot convert from \"%s\" to \"%s\". %s relies on iconv(), \
 and iconv() does not support this conversion."),
               "UTF-8", locale_code, basename (program_name));
-      utf8_line = NULL;
-      utf8_line_len = 0;
-      backconv_line = NULL;
-      backconv_line_len = 0;
+      last_utf8_line = NULL;
+      last_utf8_line_len = 0;
+      last_backconv_line = NULL;
+      last_backconv_line_len = 0;
 #else
       error (EXIT_FAILURE, 0, _("\
 Cannot convert from \"%s\" to \"%s\". %s relies on iconv(). \
@@ -326,11 +326,22 @@ This version was built without iconv()."),
       /* Convert it to UTF-8.  */
       if (need_code_conversion)
        {
+         char *utf8_line = last_utf8_line;
+         size_t utf8_line_len = last_utf8_line_len;
+
          if (xmem_cd_iconv (line, line_len, conv_to_utf8,
                             &utf8_line, &utf8_line_len) != 0)
            error (EXIT_FAILURE, errno,
                   _("input is not valid in \"%s\" encoding"),
                   locale_code);
+         if (utf8_line != last_utf8_line)
+           {
+             if (last_utf8_line != NULL)
+               free (last_utf8_line);
+             last_utf8_line = utf8_line;
+             last_utf8_line_len = utf8_line_len;
+           }
+
          line = utf8_line;
          line_len = utf8_line_len;
        }
@@ -343,11 +354,22 @@ This version was built without iconv()."),
       /* Convert it back to the original encoding.  */
       if (need_code_conversion)
        {
+         char *backconv_line = last_backconv_line;
+         size_t backconv_line_len = last_backconv_line_len;
+
          if (xmem_cd_iconv (filtered_line, filtered_line_len, conv_from_utf8,
                             &backconv_line, &backconv_line_len) != 0)
            error (EXIT_FAILURE, errno,
                   _("error while converting from \"%s\" encoding to \"%s\" encoding"),
                   "UTF-8", locale_code);
+         if (backconv_line != last_backconv_line)
+           {
+             if (last_backconv_line != NULL)
+               free (last_backconv_line);
+             last_backconv_line = backconv_line;
+             last_backconv_line_len = backconv_line_len;
+           }
+
          fwrite (backconv_line, 1, backconv_line_len, stdout);
        }
       else