From 90d9e209c5d3445ebc542591f03ee4d42f9b8ff4 Mon Sep 17 00:00:00 2001 From: jmcneill Date: Mon, 30 Dec 2002 19:19:18 +0000 Subject: Make dia fallback to UTF-8 if it doesn't understand our charset instead of segfaulting -- from Jarkko Torppa. Closes pkg/19008. Now that dia works again, remove the BROKEN tag from the Makefile. --- graphics/dia/Makefile | 4 +--- graphics/dia/patches/patch-ba | 45 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 7 deletions(-) (limited to 'graphics') diff --git a/graphics/dia/Makefile b/graphics/dia/Makefile index 9bb0a06d1a0..235cb4c98dd 100644 --- a/graphics/dia/Makefile +++ b/graphics/dia/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.11 2002/12/01 13:49:38 salo Exp $ +# $NetBSD: Makefile,v 1.12 2002/12/30 19:19:18 jmcneill Exp $ DISTNAME= dia-0.90 # PKGREVISION= 1 @@ -21,8 +21,6 @@ LIBTOOL_OVERRIDE= ${WRKSRC}/libtool GNU_CONFIGURE= YES CONFIGURE_ARGS+= --enable-gnome -BROKEN= segfaults on start-up - .include "../../graphics/gdk-pixbuf/buildlink2.mk" .include "../../x11/gnome-libs/buildlink2.mk" .include "../../textproc/libxml/buildlink2.mk" diff --git a/graphics/dia/patches/patch-ba b/graphics/dia/patches/patch-ba index 1733e12cb6b..ef4eb97928a 100644 --- a/graphics/dia/patches/patch-ba +++ b/graphics/dia/patches/patch-ba @@ -1,8 +1,17 @@ -$NetBSD: patch-ba,v 1.1 2002/09/07 17:40:51 mjl Exp $ +$NetBSD: patch-ba,v 1.2 2002/12/30 19:19:18 jmcneill Exp $ ---- lib/charconv.c.orig Fri May 17 01:06:50 2002 -+++ lib/charconv.c Sun Sep 1 02:54:46 2002 -@@ -98,7 +98,8 @@ +--- charconv.c.orig Thu May 16 20:06:50 2002 ++++ charconv.c Mon Dec 30 15:13:23 2002 +@@ -69,6 +69,8 @@ + { + static char *this_charset = NULL; + static int local_is_utf8 = 0; ++ unicode_iconv_t t1 = (unicode_iconv_t)(-1); ++ unicode_iconv_t t2 = (unicode_iconv_t)(-1); + + if (this_charset) { + *charset = this_charset; +@@ -98,7 +100,8 @@ if ((*charset == NULL) || (0==strcmp(*charset,"US-ASCII")) || @@ -12,3 +21,31 @@ $NetBSD: patch-ba,v 1.1 2002/09/07 17:40:51 mjl Exp $ /* we got basic stupid ASCII here. We use its sane superset instead. Especially since libxml2 doesn't like the pedantic name of ASCII. */ +@@ -108,8 +111,25 @@ + } + + this_charset = *charset; +- local_is_utf8 = (*charset) && (0==strcmp(*charset,"UTF-8")); +- ++ if (*charset) { ++ if (strcmp(*charset, "UTF-8") != 0) { ++ if ((t1 = unicode_iconv_open(*charset, "UTF-8")) == (unicode_iconv_t)(-1) ++ || (t2 = unicode_iconv_open("UTF-8", *charset)) == ++ (unicode_iconv_t)(-1)) { ++ g_warning("unicode_iconv_open() does not understand your charset %s\n", ++ "Using UTF-8 as local. Set LC_CTYPE or CHARSET.", ++ *charset); ++ local_is_utf8 = 1; ++ *charset = "UTF-8"; ++ } ++ } else ++ local_is_utf8 = 1; ++ } ++ if (t1 != (unicode_iconv_t)(-1)) ++ unicode_iconv_close(t1); ++ if (t2 != (unicode_iconv_t)(-1)) ++ unicode_iconv_close(t2); ++ + return local_is_utf8; + } + -- cgit v1.2.3