RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Ralf S. Engelschall Root: /v/rpm/cvs Email: [EMAIL PROTECTED] Module: popt Date: 14-Jun-2007 09:21:46 Branch: HEAD Handle: 2007061408214500 Modified files: popt poptint.c Log: Fix iconv(3) usage. POPT assumed that iconv(3) is available all the time. This is not the case. It _might_ be available (and then indicated by the #define HAVE_ICONV from gettext) if NLS is enabled. But if NLS is disabled (--disable-nls) then the gettext NLS stuff not even _checks_ for an available iconv(3) and hence it cannot even be used with an explicit --with-libiconv-prefix, etc. Hence we POPT can use iconv(3) only for its UTF-8 fiddling if HAVE_ICONV is defined. Summary: Revision Changes Path 1.3 +8 -0 popt/poptint.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: popt/poptint.c ============================================================================ $ cvs diff -u -r1.2 -r1.3 poptint.c --- popt/poptint.c 25 May 2007 18:34:14 -0000 1.2 +++ popt/poptint.c 14 Jun 2007 07:21:45 -0000 1.3 @@ -5,7 +5,9 @@ #include <stdio.h> #include <stdarg.h> #include <errno.h> +#ifdef HAVE_ICONV #include <iconv.h> +#endif #ifdef HAVE_LANGINFO_H #include <langinfo.h> #endif @@ -18,6 +20,7 @@ (retval) = vfprintf ((stream), (format), (args)); \ va_end ((args)); +#ifdef HAVE_ICONV static char * strdup_locale_from_utf8 (char *buffer) { @@ -87,6 +90,7 @@ return dest_str; } +#endif static char * strdup_vprintf (const char *format, va_list ap) @@ -124,14 +128,18 @@ buffer = strdup_vprintf (format, args); va_end (args); +#ifdef HAVE_ICONV locale_str = strdup_locale_from_utf8 (buffer); if (locale_str) { retval = fprintf (stream, "%s", locale_str); free (locale_str); } else { fprintf (stderr, POPT_WARNING "%s\n", "Invalid UTF-8"); +#endif retval = fprintf (stream, "%s", buffer); +#ifdef HAVE_ICONV } +#endif free (buffer); return retval; @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org