summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Weiler <pylon@gentoo.org>2006-10-28 08:59:35 +0000
committerLars Weiler <pylon@gentoo.org>2006-10-28 08:59:35 +0000
commit88c2549484f31cc4ddd14ffcff687bd6318cba7e (patch)
treed717b4908a22a9de017c5126d5d49609b08819e5 /app-cdr
parentx86 stable wrt bug #151031 (diff)
downloadhistorical-88c2549484f31cc4ddd14ffcff687bd6318cba7e.tar.gz
historical-88c2549484f31cc4ddd14ffcff687bd6318cba7e.tar.bz2
historical-88c2549484f31cc4ddd14ffcff687bd6318cba7e.zip
Added proper unicode-handling for mkisofs. Thanks to Kim Seongcheol in bug
#129759 who created the patch. Package-Manager: portage-2.1.2_rc1
Diffstat (limited to 'app-cdr')
-rw-r--r--app-cdr/cdrtools/ChangeLog7
-rw-r--r--app-cdr/cdrtools/Manifest38
-rw-r--r--app-cdr/cdrtools/cdrtools-2.01.01_alpha10.ebuild4
-rw-r--r--app-cdr/cdrtools/cdrtools-2.01.01_alpha11.ebuild4
-rw-r--r--app-cdr/cdrtools/files/mkisofs-iconv-11.patch602
5 files changed, 630 insertions, 25 deletions
diff --git a/app-cdr/cdrtools/ChangeLog b/app-cdr/cdrtools/ChangeLog
index d3a4ef4f8cd0..a6c5376dcc72 100644
--- a/app-cdr/cdrtools/ChangeLog
+++ b/app-cdr/cdrtools/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for app-cdr/cdrtools
# Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-cdr/cdrtools/ChangeLog,v 1.155 2006/09/05 16:47:34 metalgod Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-cdr/cdrtools/ChangeLog,v 1.156 2006/10/28 08:59:35 pylon Exp $
+
+ 28 Oct 2006; Lars Weiler <pylon@gentoo.org> +files/mkisofs-iconv-11.patch,
+ cdrtools-2.01.01_alpha10.ebuild, cdrtools-2.01.01_alpha11.ebuild:
+ Added proper unicode-handling for mkisofs. Thanks to Kim Seongcheol in bug
+ #129759 who created the patch.
05 Sep 2006; Luis Medinas <metalgod@gentoo.org> ChangeLog:
Add a blocker for app-cdr/cdrkit.
diff --git a/app-cdr/cdrtools/Manifest b/app-cdr/cdrtools/Manifest
index fd62f88b0b13..1656abaaf290 100644
--- a/app-cdr/cdrtools/Manifest
+++ b/app-cdr/cdrtools/Manifest
@@ -1,6 +1,3 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
AUX cdrtools-2.01-scsi-remote.patch 938 RMD160 146ba7ddd5a0d987ea554bcf7e50aea5bf0690ff SHA1 0388616bf453e46fa3186c93cc17f881508aa562 SHA256 93719cbcbf594be14e0aa993b49157fc6be2885e94f4a92947ea73bd58ed2a62
MD5 3b1ffea11e1653b7b16c2c89597d1c5a files/cdrtools-2.01-scsi-remote.patch 938
RMD160 146ba7ddd5a0d987ea554bcf7e50aea5bf0690ff files/cdrtools-2.01-scsi-remote.patch 938
@@ -25,6 +22,10 @@ AUX mkisofs-iconv-10.patch 16986 RMD160 3a8ae83e0c5e4e04e0b55c4cd1089ea603a4b169
MD5 1a596f5cae257e97c559716336b30e5b files/mkisofs-iconv-10.patch 16986
RMD160 3a8ae83e0c5e4e04e0b55c4cd1089ea603a4b169 files/mkisofs-iconv-10.patch 16986
SHA256 608868e8d5e7d0d4fd7469a7a1f7271e63590fb645fdbdf3d6251678aad41745 files/mkisofs-iconv-10.patch 16986
+AUX mkisofs-iconv-11.patch 16791 RMD160 a5f3cb9e8b03b2cda14cffe900f9a9371ec2def9 SHA1 e9348689ee7aaca850dff619656753fe05cdd28a SHA256 d1ddcbc3bf2f9bcb4949eb0bca871a104748daf8e4325f3776aa66bf0b2055f9
+MD5 75ba41189dc89a96075673a6679bbcf6 files/mkisofs-iconv-11.patch 16791
+RMD160 a5f3cb9e8b03b2cda14cffe900f9a9371ec2def9 files/mkisofs-iconv-11.patch 16791
+SHA256 d1ddcbc3bf2f9bcb4949eb0bca871a104748daf8e4325f3776aa66bf0b2055f9 files/mkisofs-iconv-11.patch 16791
DIST cdrtools-2.01-encrypt-1.0rc1.diff.gz 25384 RMD160 68fbcf1e9c1f03efa1474cce03e2ba4d1865ded8 SHA1 7e70f44d3c07f5e75632fb9805182aff65021afd SHA256 1dd80e793538bd51effffc44a278c2efca56a7b318de204231e5afbb5d11b63e
DIST cdrtools-2.01.01a07.tar.bz2 1441566 RMD160 db9862bbcc452657127f9cef1526d43dc5d50c99 SHA1 ee66f18f8ca5fa3b40f99570f81925032af4dcba SHA256 cdc502320924c55ad884590844bb9b88bf60357fae8954bb7985777df552f8f5
DIST cdrtools-2.01.01a08.tar.bz2 1442015 RMD160 23defddf01f8fa26dff800cd2b21a1f535d348dc SHA1 04195d8821be97850fdab21f05258f41add6eec5 SHA256 c80f43c14b4c09950d9314d789ccb4cb996837118ca04f9ca2631ed135472772
@@ -47,18 +48,18 @@ EBUILD cdrtools-2.01.01_alpha08.ebuild 3544 RMD160 12ccf6009a0f18cd9e6fe35def52d
MD5 fc6b33a80f12c522f436cd8b93af1bba cdrtools-2.01.01_alpha08.ebuild 3544
RMD160 12ccf6009a0f18cd9e6fe35def52d47153ed42f3 cdrtools-2.01.01_alpha08.ebuild 3544
SHA256 9d9aeadd86a92b91ba5db63267eab7469889ab4c800da8d2c1547d5cb229abe7 cdrtools-2.01.01_alpha08.ebuild 3544
-EBUILD cdrtools-2.01.01_alpha10.ebuild 3546 RMD160 39f1379c9c528d570650d9a2dddf063cfaceaa6e SHA1 d793174f3232ad0138d5cf9fd7ffa338772f4444 SHA256 9f69fea01599cd243e31e51b6899b49391d1ffa7e41f26c40ef16919db8c729e
-MD5 c43b100a1488678bdd3850be39fabca7 cdrtools-2.01.01_alpha10.ebuild 3546
-RMD160 39f1379c9c528d570650d9a2dddf063cfaceaa6e cdrtools-2.01.01_alpha10.ebuild 3546
-SHA256 9f69fea01599cd243e31e51b6899b49391d1ffa7e41f26c40ef16919db8c729e cdrtools-2.01.01_alpha10.ebuild 3546
-EBUILD cdrtools-2.01.01_alpha11.ebuild 3556 RMD160 75b9b6ec885f64dd92b4cd15b5a722651b2ce76e SHA1 56f945ca66c1815a08f127551cb4d660a64b92b2 SHA256 edeb52aad262603eb99d72f399ee70ba17c1f5712cbba71774ea0c6ac40d4de7
-MD5 5c1ae6bb71709170c78565877779390e cdrtools-2.01.01_alpha11.ebuild 3556
-RMD160 75b9b6ec885f64dd92b4cd15b5a722651b2ce76e cdrtools-2.01.01_alpha11.ebuild 3556
-SHA256 edeb52aad262603eb99d72f399ee70ba17c1f5712cbba71774ea0c6ac40d4de7 cdrtools-2.01.01_alpha11.ebuild 3556
-MISC ChangeLog 23061 RMD160 679dc1b01db241280b3d2128d528af5540fb7f2d SHA1 42352f497cb5a1e3532d91b30a8e73c9ff3c44ec SHA256 f85b4aaff87005f305102061ddb651639c2cebf916edb13510cfb9b3962aff7c
-MD5 42e828dc958830fc5cc3ffaace55c378 ChangeLog 23061
-RMD160 679dc1b01db241280b3d2128d528af5540fb7f2d ChangeLog 23061
-SHA256 f85b4aaff87005f305102061ddb651639c2cebf916edb13510cfb9b3962aff7c ChangeLog 23061
+EBUILD cdrtools-2.01.01_alpha10.ebuild 3604 RMD160 47fbca03092d966d9328831e0f1487df061c63fd SHA1 b16f47f247fface80cf3fc5931e7ebad60bc2973 SHA256 69a509e7cb7728747b5f052d1b5b1d49fbc775a5811d082db33dbef42c334c92
+MD5 48bf6260ecd6f27a76c691a5f38e71e7 cdrtools-2.01.01_alpha10.ebuild 3604
+RMD160 47fbca03092d966d9328831e0f1487df061c63fd cdrtools-2.01.01_alpha10.ebuild 3604
+SHA256 69a509e7cb7728747b5f052d1b5b1d49fbc775a5811d082db33dbef42c334c92 cdrtools-2.01.01_alpha10.ebuild 3604
+EBUILD cdrtools-2.01.01_alpha11.ebuild 3614 RMD160 97e850a4cf4192bccbebe1633a81141457ac7bd3 SHA1 f695daa045d39cee7e486884b84f994692c01d69 SHA256 06d51e1b7b08b9835d0e1d917b3703f57d33eb4b4976463d97cc8bd50a229d78
+MD5 4a9378846b8da560c4c46bd6e590c51a cdrtools-2.01.01_alpha11.ebuild 3614
+RMD160 97e850a4cf4192bccbebe1633a81141457ac7bd3 cdrtools-2.01.01_alpha11.ebuild 3614
+SHA256 06d51e1b7b08b9835d0e1d917b3703f57d33eb4b4976463d97cc8bd50a229d78 cdrtools-2.01.01_alpha11.ebuild 3614
+MISC ChangeLog 23314 RMD160 30736138b08a4b3cf023cf2085142721147cc753 SHA1 738e538e94f3760497e186824cfbdf55958cff6a SHA256 b3996806982600d748129cc7b25582c6522e774f7b40b3cffda3a613a49e84c4
+MD5 7a5c6647c935e455a663a97ef907622a ChangeLog 23314
+RMD160 30736138b08a4b3cf023cf2085142721147cc753 ChangeLog 23314
+SHA256 b3996806982600d748129cc7b25582c6522e774f7b40b3cffda3a613a49e84c4 ChangeLog 23314
MISC metadata.xml 254 RMD160 f274a70fa23d8064efddcce296e0aed3344bd86b SHA1 ab52ea446603ae6242dae41e0c90fcf7ae8f09cf SHA256 21400abf2dad3e5b7b0d2f7f9586c33cba6336b42a97e1f2b3e7e8b9db0daae5
MD5 015ab4293805faaa417d5ac5304750c4 metadata.xml 254
RMD160 f274a70fa23d8064efddcce296e0aed3344bd86b metadata.xml 254
@@ -81,10 +82,3 @@ SHA256 a243fe27f88f8832341653590b731738babc6c7ff6114e3c5f4a29f162dfd0c4 files/di
MD5 74108109d57ff6f24d4ea1f958738c88 files/digest-cdrtools-2.01.01_alpha11 265
RMD160 88f6b0f515511bffd75ab5d3e47dc1ccbb12d158 files/digest-cdrtools-2.01.01_alpha11 265
SHA256 71b73d81cd2f6de231be15e22f30cb5abe34e049bea542aa49befdba35d98aa2 files/digest-cdrtools-2.01.01_alpha11 265
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.5 (GNU/Linux)
-
-iD8DBQFE/aoxwUpWvClEHQoRAgasAJ97HkpKLvCGRgQgI0lKjHQe6OAGqgCfbdRA
-7koxCNlyAQgVrCLOdSpx+6E=
-=Iern
------END PGP SIGNATURE-----
diff --git a/app-cdr/cdrtools/cdrtools-2.01.01_alpha10.ebuild b/app-cdr/cdrtools/cdrtools-2.01.01_alpha10.ebuild
index fcc4e25628b9..6f91c29a9bd8 100644
--- a/app-cdr/cdrtools/cdrtools-2.01.01_alpha10.ebuild
+++ b/app-cdr/cdrtools/cdrtools-2.01.01_alpha10.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-cdr/cdrtools/cdrtools-2.01.01_alpha10.ebuild,v 1.11 2006/09/05 16:45:43 metalgod Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-cdr/cdrtools/cdrtools-2.01.01_alpha10.ebuild,v 1.12 2006/10/28 08:59:35 pylon Exp $
inherit eutils gnuconfig toolchain-funcs flag-o-matic
@@ -32,6 +32,8 @@ src_unpack() {
epatch "${FILESDIR}"/${PN}-2.01.01a01-scanbus.patch
epatch "${FILESDIR}"/${PN}-2.01.01a03-rezero.patch
+ use unicode && epatch "${FILESDIR}"/mkisofs-iconv-11.patch
+
# ppc-macos support
cd "${S}"/DEFAULTS
use ppc-macos && MYARCH="mac-os10" || MYARCH="linux"
diff --git a/app-cdr/cdrtools/cdrtools-2.01.01_alpha11.ebuild b/app-cdr/cdrtools/cdrtools-2.01.01_alpha11.ebuild
index 2ba1afb6961f..8d47ed098327 100644
--- a/app-cdr/cdrtools/cdrtools-2.01.01_alpha11.ebuild
+++ b/app-cdr/cdrtools/cdrtools-2.01.01_alpha11.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-cdr/cdrtools/cdrtools-2.01.01_alpha11.ebuild,v 1.2 2006/09/05 16:45:43 metalgod Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-cdr/cdrtools/cdrtools-2.01.01_alpha11.ebuild,v 1.3 2006/10/28 08:59:35 pylon Exp $
inherit eutils gnuconfig toolchain-funcs flag-o-matic
@@ -32,6 +32,8 @@ src_unpack() {
epatch "${FILESDIR}"/${PN}-2.01.01a01-scanbus.patch
epatch "${FILESDIR}"/${PN}-2.01.01a03-rezero.patch
+ use unicode && epatch "${FILESDIR}"/mkisofs-iconv-11.patch
+
# ppc-macos support
cd "${S}"/DEFAULTS
use ppc-macos && MYARCH="mac-os10" || MYARCH="linux"
diff --git a/app-cdr/cdrtools/files/mkisofs-iconv-11.patch b/app-cdr/cdrtools/files/mkisofs-iconv-11.patch
new file mode 100644
index 000000000000..bef3f7d849fe
--- /dev/null
+++ b/app-cdr/cdrtools/files/mkisofs-iconv-11.patch
@@ -0,0 +1,602 @@
+diff -uNr cdrtools-2.01.01.orig/include/unls.h cdrtools-2.01.01/include/unls.h
+--- cdrtools-2.01.01.orig/include/unls.h 2005-04-21 19:12:27.000000000 +0900
++++ cdrtools-2.01.01/include/unls.h 2006-07-22 10:36:29.655598750 +0900
+@@ -26,6 +26,10 @@
+ #include <prototyp.h>
+ #endif
+
++#ifdef USE_ICONV
++#include <iconv.h>
++#endif
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+@@ -40,6 +44,9 @@
+ unsigned char **unls_uni2cs; /* Unicode -> Charset */
+ struct unls_unicode *unls_cs2uni; /* Charset -> Unicode */
+ struct unls_table *unls_next; /* Next table */
++#ifdef USE_ICONV
++ iconv_t iconv_d;
++#endif
+ };
+
+ extern int init_unls __PR((void));
+@@ -51,6 +58,9 @@
+ extern void unload_unls __PR((struct unls_table *));
+ extern struct unls_table *load_unls_default __PR((void));
+ extern int init_unls_file __PR((char * name));
++#ifdef USE_ICONV
++extern int init_unls_iconv __PR((char * name));
++#endif
+
+ #ifdef __cplusplus
+ }
+diff -uNr cdrtools-2.01.01.orig/libunls/Targets cdrtools-2.01.01/libunls/Targets
+--- cdrtools-2.01.01.orig/libunls/Targets 2002-12-03 09:34:27.000000000 +0900
++++ cdrtools-2.01.01/libunls/Targets 2006-07-22 10:36:29.655598750 +0900
+@@ -39,4 +39,5 @@
+ nls_cp10029.c \
+ nls_cp10079.c \
+ nls_cp10081.c \
+- nls_file.c
++ nls_file.c \
++ nls_iconv.c
+diff -uNr cdrtools-2.01.01.orig/libunls/libunls.mk cdrtools-2.01.01/libunls/libunls.mk
+--- cdrtools-2.01.01.orig/libunls/libunls.mk 2000-03-25 21:51:56.000000000 +0900
++++ cdrtools-2.01.01/libunls/libunls.mk 2006-07-22 10:36:29.655598750 +0900
+@@ -8,6 +8,7 @@
+ INSDIR= lib
+ TARGETLIB= unls
+ #CPPOPTS += -Istdio
++CPPOPTS += -DUSE_ICONV
+ include Targets
+ LIBS=
+
+diff -uNr cdrtools-2.01.01.orig/libunls/nls.h cdrtools-2.01.01/libunls/nls.h
+--- cdrtools-2.01.01.orig/libunls/nls.h 2005-05-02 05:55:50.000000000 +0900
++++ cdrtools-2.01.01/libunls/nls.h 2006-07-22 10:36:29.655598750 +0900
+@@ -110,5 +110,8 @@
+ extern int init_unls_cp10079 __PR((void));
+ extern int init_unls_cp10081 __PR((void));
+ extern int init_unls_file __PR((char * name));
++#ifdef USE_ICONV
++extern int init_unls_iconv __PR((char * name));
++#endif
+
+ #endif /* _NLS_H */
+diff -uNr cdrtools-2.01.01.orig/libunls/nls_iconv.c cdrtools-2.01.01/libunls/nls_iconv.c
+--- cdrtools-2.01.01.orig/libunls/nls_iconv.c 1970-01-01 09:00:00.000000000 +0900
++++ cdrtools-2.01.01/libunls/nls_iconv.c 2006-07-22 10:36:29.655598750 +0900
+@@ -0,0 +1,79 @@
++/* @(#)nls_iconv.c 1.0 02/04/20 2002 J. Schilling */
++#ifndef lint
++static char sccsid[] =
++ "@(#)nls_iconv.c 1.0 02/01/20 2002 J. Schilling";
++#endif
++/*
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2, or (at your option)
++ * any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; see the file COPYING. If not, write to
++ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++/*
++ * Modifications to make the code portable Copyright (c) 2000 J. Schilling
++ *
++ * nls_iconv: create a pseudo-charset table to use iconv() provided by C
++ * library or libiconv by Bruno Haible
++ * The Unicode to charset table has only exact mappings.
++ *
++ *
++ * Jungshik Shin (jshin@mailaps.org) 04-Feb-2002
++ */
++
++#ifdef USE_ICONV
++#include <mconfig.h>
++#include <stdio.h>
++#include <stdxlib.h>
++#include <strdefs.h>
++#include "nls.h"
++#include <iconv.h>
++
++
++int
++init_unls_iconv(charset)
++ char *charset;
++{
++ iconv_t iconv_d; /* iconv conversion descriptor */
++ struct unls_table *table;
++
++ /* give up if no charset is given */
++ if (charset == NULL)
++ return -1;
++
++ /* see if we already have a table with this name - built in tables
++ have precedence over iconv() - i.e. can't have the name of an
++ existing table. Also, we may have already registered this file
++ table */
++ if (find_unls(charset) != NULL)
++ return -1;
++
++ if ((iconv_d = iconv_open("UCS-2BE", charset)) == (iconv_t) -1)
++ return -1;
++
++
++ /* set up the table */
++ if ((table = (struct unls_table *)malloc(sizeof (struct unls_table)))
++ == NULL) {
++ return -1;
++ }
++
++ /* give the table the file name, so we can find it again if needed */
++ table->unls_name = strdup(charset);
++ table->iconv_d = iconv_d;
++ table->unls_uni2cs = NULL;
++ table->unls_cs2uni = NULL;
++ table->unls_next = NULL;
++
++ /* register the table */
++ return register_unls(table);
++}
++#endif
+diff -uNr cdrtools-2.01.01.orig/mkisofs/Makefile cdrtools-2.01.01/mkisofs/Makefile
+--- cdrtools-2.01.01.orig/mkisofs/Makefile 2004-02-23 00:13:43.000000000 +0900
++++ cdrtools-2.01.01/mkisofs/Makefile 2006-07-22 10:36:29.903614250 +0900
+@@ -31,6 +31,7 @@
+ CPPOPTS += -DUDF
+ CPPOPTS += -DDVD_VIDEO
+ CPPOPTS += -DSORTING
++CPPOPTS += -DUSE_ICONV
+ CPPOPTS += -I../libhfs_iso/
+ CPPOPTS += -DHAVE_CONFIG_H -DUSE_LIBSCHILY -DUSE_SCG \
+ '-DAPPID_DEFAULT="MKISOFS ISO 9660/HFS FILESYSTEM BUILDER & CDRECORD CD-R/DVD CREATOR (C) 1993 E.YOUNGDALE (C) 1997 J.PEARSON/J.SCHILLING"' \
+diff -uNr cdrtools-2.01.01.orig/mkisofs/joliet.c cdrtools-2.01.01/mkisofs/joliet.c
+--- cdrtools-2.01.01.orig/mkisofs/joliet.c 2005-05-02 03:38:14.000000000 +0900
++++ cdrtools-2.01.01/mkisofs/joliet.c 2006-07-22 10:36:29.903614250 +0900
+@@ -90,6 +90,11 @@
+ #include <unls.h> /* For UNICODE translation */
+ #include <schily.h>
+
++#ifdef USE_ICONV
++#include <iconv.h>
++#include <errno.h>
++#endif
++
+ static Uint jpath_table_index;
+ static struct directory **jpathlist;
+ static int next_jpath_index = 1;
+@@ -103,13 +108,23 @@
+ };
+
+ #ifdef UDF
+- void convert_to_unicode __PR((unsigned char *buffer,
++# ifdef USE_ICONV
++ size_t
++# else
++ void
++# endif
++ convert_to_unicode __PR((unsigned char *buffer,
+ int size, char *source, struct unls_table *inls));
+- int joliet_strlen __PR((const char *string));
++ int joliet_strlen __PR((const char *string, struct unls_table *inls));
+ #else
+-static void convert_to_unicode __PR((unsigned char *buffer,
++# ifdef USE_ICONV
++ static size_t
++# else
++ static void
++#endif
++ convert_to_unicode __PR((unsigned char *buffer,
+ int size, char *source, struct unls_table *inls));
+-static int joliet_strlen __PR((const char *string));
++static int joliet_strlen __PR((const char *string, struct unls_table *inls));
+ #endif
+ static void get_joliet_vol_desc __PR((struct iso_primary_descriptor *jvol_desc));
+ static void assign_joliet_directory_addresses __PR((struct directory *node));
+@@ -161,6 +176,20 @@
+ if (inls == onls)
+ return (c);
+
++#ifdef USE_ICONV
++ if(inls->unls_cs2uni == NULL || onls->unls_uni2cs == NULL) {
++ /*
++ * This shouldn't be reached
++ */
++ static BOOL iconv_warned = FALSE;
++ if(!iconv_warned) {
++ error("Warning: Iconv conversion not supported in conv_charset.\n");
++ iconv_warned = TRUE;
++ }
++ return (c);
++ }
++#endif
++
+ /* get high and low UNICODE bytes */
+ uh = inls->unls_cs2uni[c].unls_high;
+ ul = inls->unls_cs2uni[c].unls_low;
+@@ -186,10 +215,18 @@
+ *
+ * Notes:
+ */
+-#ifdef UDF
+-void
++#ifdef USE_ICONV
++# if UDF
++size_t
++# else
++static size_t
++# endif
+ #else
++# if UDF
++void
++# else
+ static void
++# endif
+ #endif
+ convert_to_unicode(buffer, size, source, inls)
+ unsigned char *buffer;
+@@ -216,6 +253,51 @@
+ tmpbuf = (Uchar *) source;
+ }
+
++#ifdef USE_ICONV
++ if (inls->iconv_d && inls->unls_cs2uni==NULL &&
++ inls->unls_uni2cs==NULL) {
++ char *inptr = tmpbuf;
++ char *outptr = buffer;
++ size_t inleft = strlen(tmpbuf);
++ size_t inlen = inleft;
++ size_t outleft = size;
++
++ iconv(inls->iconv_d, NULL, NULL, NULL, NULL);
++ if(iconv(inls->iconv_d, &inptr, &inleft, &outptr, &outleft) ==
++ (size_t)-1 && errno == EILSEQ) {
++ fprintf(stderr, "Incorrectly encoded string (%s) "
++ "encountered.\nPossibly creating an invalid "
++ "Joliet extension. Aborting.\n", source);
++ exit(1);
++ }
++
++ for (i = 0; (i + 1) < size - outleft; i += 2) { /* Size may be odd!!!*/
++ if (buffer[i]=='\0') {
++ switch (buffer[i+1]) { /* Invalid characters for Joliet */
++ case '*':
++ case '/':
++ case ':':
++ case ';':
++ case '?':
++ case '\\':
++ buffer[i+1]='_';
++ default:
++ if (buffer[i+1] == 0x7f ||
++ buffer[i+1] < 0x20)
++ buffer[i+1]='_';
++ }
++ }
++ }
++ if (size & 1) { /* beautification */
++ buffer[size - 1] = 0;
++ }
++ if (source == NULL) {
++ free(tmpbuf);
++ }
++ return (inlen - inleft);
++ }
++#endif
++
+ /*
+ * Now start copying characters. If the size was specified to be 0,
+ * then assume the input was 0 terminated.
+@@ -271,6 +353,9 @@
+ if (source == NULL) {
+ free(tmpbuf);
+ }
++#ifdef USE_ICONV
++ return j;
++#endif
+ }
+
+ /*
+@@ -287,12 +372,50 @@
+ #else
+ static int
+ #endif
+-joliet_strlen(string)
++joliet_strlen(string, inls)
+ const char *string;
++ struct unls_table *inls;
+ {
+ int rtn;
+
++#ifdef USE_ICONV
++ if (inls->iconv_d && inls->unls_cs2uni==NULL &&
++ inls->unls_uni2cs==NULL) {
++ /*
++ * we const-cast since we're sure iconv won't change
++ * the string itself
++ */
++ char *string_ptr = (char *)string;
++ size_t string_len = strlen(string);
++
++ /*
++ * iconv has no way of finding out the required size
++ * in the target
++ */
++
++ char *tmp, *tmp_ptr;
++ /* we assume that the maximum length is 2 * jlen */
++ size_t tmp_len = (size_t)jlen * 2 + 1;
++ tmp = e_malloc(tmp_len);
++ tmp_ptr = tmp;
++
++ iconv(inls->iconv_d, NULL, NULL, NULL, NULL);
++ iconv(inls->iconv_d, &string_ptr, &string_len, &tmp_ptr,
++ &tmp_len);
++
++ /*
++ * iconv advanced the tmp pointer with as many chars
++ * as it has written to it, so we add up the delta
++ */
++ rtn = (tmp_ptr - tmp);
++
++ free(tmp);
++ } else {
++ rtn = strlen(string) << 1;
++ }
++#else
+ rtn = strlen(string) << 1;
++#endif
+
+ /*
+ * We do clamp the maximum length of a Joliet string to be the
+@@ -480,16 +603,33 @@
+ /* compare the Unicode names */
+
+ while (*rpnt && *lpnt) {
++#ifdef USE_ICONV
++ size_t ri, li;
++
++ ri = convert_to_unicode(rtmp, 2, rpnt, rinls);
++ li = convert_to_unicode(ltmp, 2, lpnt, linls);
++ rpnt += ri;
++ lpnt += li;
++ if(!ri && !li)
++ return (0);
++ else if(ri && !li)
++ return (1);
++ else if(!ri && li)
++ return (-1);
++#else
+ convert_to_unicode(rtmp, 2, rpnt, rinls);
+ convert_to_unicode(ltmp, 2, lpnt, linls);
++#endif
+
+ if (a_to_u_2_byte(rtmp) < a_to_u_2_byte(ltmp))
+ return (-1);
+ if (a_to_u_2_byte(rtmp) > a_to_u_2_byte(ltmp))
+ return (1);
+
++#ifndef USE_ICONV
+ rpnt++;
+ lpnt++;
++#endif
+ }
+
+ if (*rpnt)
+@@ -574,10 +714,10 @@
+ }
+ #ifdef APPLE_HYB
+ if (USE_MAC_NAME(de))
+- namelen = joliet_strlen(de->hfs_ent->name);
++ namelen = joliet_strlen(de->hfs_ent->name, hfs_inls);
+ else
+ #endif /* APPLE_HYB */
+- namelen = joliet_strlen(de->name);
++ namelen = joliet_strlen(de->name, in_nls);
+
+ if (dpnt == root) {
+ jpath_table_l[jpath_table_index] = 1;
+@@ -742,10 +882,10 @@
+ #ifdef APPLE_HYB
+ /* Use the HFS name if it exists */
+ if (USE_MAC_NAME(s_entry1))
+- cvt_len = joliet_strlen(s_entry1->hfs_ent->name);
++ cvt_len = joliet_strlen(s_entry1->hfs_ent->name, hfs_inls);
+ else
+ #endif /* APPLE_HYB */
+- cvt_len = joliet_strlen(s_entry1->name);
++ cvt_len = joliet_strlen(s_entry1->name, in_nls);
+
+ /*
+ * Fix the record length
+@@ -891,12 +1031,12 @@
+ if (USE_MAC_NAME(s_entry))
+ /* Use the HFS name if it exists */
+ jpath_table_size +=
+- joliet_strlen(s_entry->hfs_ent->name) +
++ joliet_strlen(s_entry->hfs_ent->name, hfs_inls) +
+ offsetof(struct iso_path_table, name[0]);
+ else
+ #endif /* APPLE_HYB */
+ jpath_table_size +=
+- joliet_strlen(s_entry->name) +
++ joliet_strlen(s_entry->name, in_nls) +
+ offsetof(struct iso_path_table, name[0]);
+ if (jpath_table_size & 1) {
+ jpath_table_size++;
+@@ -918,13 +1058,13 @@
+ /* Use the HFS name if it exists */
+ s_entry->jreclen =
+ offsetof(struct iso_directory_record, name[0])
+- + joliet_strlen(s_entry->hfs_ent->name)
++ + joliet_strlen(s_entry->hfs_ent->name, hfs_inls)
+ + 1;
+ else
+ #endif /* APPLE_HYB */
+ s_entry->jreclen =
+ offsetof(struct iso_directory_record, name[0])
+- + joliet_strlen(s_entry->name)
++ + joliet_strlen(s_entry->name, in_nls)
+ + 1;
+ } else {
+ /*
+@@ -1072,6 +1212,9 @@
+ #endif
+
+ while (*rpnt && *lpnt) {
++#ifdef USE_ICONV
++ size_t ri, li;
++#endif
+ if (*rpnt == ';' && *lpnt != ';')
+ return (-1);
+ if (*rpnt != ';' && *lpnt == ';')
+@@ -1092,16 +1235,32 @@
+ return (1);
+ #endif
+
++#ifdef USE_ICONV
++
++ ri = convert_to_unicode(rtmp, 2, rpnt, rinls);
++ li = convert_to_unicode(ltmp, 2, lpnt, linls);
++ rpnt += ri;
++ lpnt += li;
++ if(!ri && !li)
++ return (0);
++ else if(ri && !li)
++ return (1);
++ else if(!ri && li)
++ return (-1);
++#else
+ convert_to_unicode(rtmp, 2, rpnt, rinls);
+ convert_to_unicode(ltmp, 2, lpnt, linls);
++#endif
+
+ if (a_to_u_2_byte(rtmp) < a_to_u_2_byte(ltmp))
+ return (-1);
+ if (a_to_u_2_byte(rtmp) > a_to_u_2_byte(ltmp))
+ return (1);
+
++#ifndef USE_ICONV
+ rpnt++;
+ lpnt++;
++#endif
+ }
+ if (*rpnt)
+ return (1);
+diff -uNr cdrtools-2.01.01.orig/mkisofs/mkisofs.c cdrtools-2.01.01/mkisofs/mkisofs.c
+--- cdrtools-2.01.01.orig/mkisofs/mkisofs.c 2006-01-30 19:37:30.000000000 +0900
++++ cdrtools-2.01.01/mkisofs/mkisofs.c 2006-07-22 10:36:29.907614500 +0900
+@@ -59,6 +59,11 @@
+ #endif
+ #endif /* no_more_needed */
+
++#ifdef USE_ICONV
++#include <locale.h>
++#include <langinfo.h>
++#endif
++
+ struct directory *root = NULL;
+ int path_ind;
+
+@@ -223,6 +228,10 @@
+ int do_sort = 0; /* sort file data */
+ #endif /* SORTING */
+
++#ifdef USE_ICONV
++int iconv_possible;
++#endif
++
+ struct unls_table *in_nls = NULL; /* input UNICODE conversion table */
+ struct unls_table *out_nls = NULL; /* output UNICODE conversion table */
+ #ifdef APPLE_HYB
+@@ -2339,6 +2348,37 @@
+ init_unls_file(hfs_ocharset);
+ #endif /* APPLE_HYB */
+
++#ifdef USE_ICONV
++ iconv_possible = !(iso9660_level >= 4 || ((ocharset &&
++ strcmp(ocharset, icharset ? icharset : "")) &&
++ use_RockRidge) || apple_ext || apple_hyb);
++
++ setlocale(LC_CTYPE, "");
++
++ if (icharset == NULL && iconv_possible) {
++ char *charset = nl_langinfo(CODESET);
++ /* set to detected value but only if it is not pure US-ASCII */
++ if(strcmp(charset, "ANSI_X3.4-1968") != 0)
++ icharset = charset;
++
++ if(icharset && verbose > 0)
++ fprintf(stderr, "INFO:\t"
++ "%s character encoding detected by locale settings."
++ "\n\tAssuming %s encoded filenames on source "
++ "filesystem,\n"
++ "\tuse -input-charset to override.\n",
++ icharset, icharset);
++ }
++
++ if(iconv_possible) {
++ /*
++ * don't care if initialization fails
++ */
++ init_unls_iconv(icharset);
++ init_unls_iconv(ocharset);
++ }
++#endif
++
+ if (icharset == NULL) {
+ #if (defined(__CYGWIN32__) || defined(__CYGWIN__) || defined(__DJGPP__)) && !defined(IS_CYGWIN_1)
+ in_nls = load_unls("cp437");
+@@ -2366,6 +2406,12 @@
+ if (in_nls == NULL || out_nls == NULL) { /* Unknown charset specified */
+ fprintf(stderr, "Unknown charset\nKnown charsets are:\n");
+ list_unls(); /* List all known charset names */
++#ifdef USE_ICONV
++ if(!iconv_possible)
++ fprintf(stderr, "Iconv charsets cannot be used with "
++ "Apple extension, HFS, ISO9660 version 2 or\n"
++ "Rock Ridge.\n");
++#endif
+ exit(1);
+ }
+
+diff -uNr cdrtools-2.01.01.orig/mkisofs/mkisofs.h cdrtools-2.01.01/mkisofs/mkisofs.h
+--- cdrtools-2.01.01.orig/mkisofs/mkisofs.h 2005-05-02 03:38:14.000000000 +0900
++++ cdrtools-2.01.01/mkisofs/mkisofs.h 2006-07-22 10:36:29.907614500 +0900
+@@ -503,9 +503,14 @@
+
+ /* joliet.c */
+ #ifdef UDF
++# ifdef USE_ICONV
++extern size_t convert_to_unicode __PR((unsigned char *buffer,
++ int size, char *source, struct unls_table *inls));
++# else
+ extern void convert_to_unicode __PR((unsigned char *buffer,
+ int size, char *source, struct unls_table *inls));
+-extern int joliet_strlen __PR((const char *string));
++# endif
++extern int joliet_strlen __PR((const char *string, struct unls_table *inls));
+ #endif
+ extern unsigned char conv_charset __PR((unsigned char, struct unls_table *,
+ struct unls_table *));
+diff -uNr cdrtools-2.01.01.orig/mkisofs/udf.c cdrtools-2.01.01/mkisofs/udf.c
+--- cdrtools-2.01.01.orig/mkisofs/udf.c 2004-04-15 20:15:08.000000000 +0900
++++ cdrtools-2.01.01/mkisofs/udf.c 2006-07-22 10:36:29.907614500 +0900
+@@ -441,7 +441,7 @@
+ int i;
+ int expanded_length;
+
+- expanded_length = joliet_strlen(src);
++ expanded_length = joliet_strlen(src, in_nls);
+ if (expanded_length > 1024)
+ expanded_length = 1024;
+ if (expanded_length > (dst_size-1)*2)