View | Details | Raw Unified | Return to bug 9088
Collapse All | Expand All

(-)cdrtools-2.01/include/unls.h (+10 lines)
Lines 30-35 Link Here
30
#include <prototyp.h>
30
#include <prototyp.h>
31
#endif
31
#endif
32
32
33
#ifdef USE_ICONV
34
#include <iconv.h>
35
#endif
36
33
#ifdef	__cplusplus
37
#ifdef	__cplusplus
34
extern "C" {
38
extern "C" {
35
#endif
39
#endif
Lines 43-48 Link Here
43
	char *charset;
47
	char *charset;
44
	unsigned char **page_uni2charset;
48
	unsigned char **page_uni2charset;
45
	struct nls_unicode *charset2uni;
49
	struct nls_unicode *charset2uni;
50
#ifdef USE_ICONV
51
	iconv_t iconv_d;
52
#endif
46
53
47
	void (*inc_use_count) 	__PR((void));
54
	void (*inc_use_count) 	__PR((void));
48
	void (*dec_use_count) 	__PR((void));
55
	void (*dec_use_count) 	__PR((void));
Lines 58-63 Link Here
58
extern void 		unload_nls		__PR((struct nls_table *));
65
extern void 		unload_nls		__PR((struct nls_table *));
59
extern struct nls_table *load_nls_default	__PR((void));
66
extern struct nls_table *load_nls_default	__PR((void));
60
extern int		init_nls_file		__PR((char * name));
67
extern int		init_nls_file		__PR((char * name));
68
#ifdef USE_ICONV
69
extern int		init_nls_iconv		__PR((char * name));
70
#endif
61
71
62
#ifdef	__cplusplus
72
#ifdef	__cplusplus
63
}
73
}
(-)cdrtools-2.01/libunls/libunls.mk (+1 lines)
Lines 8-13 Link Here
8
INSDIR=		lib
8
INSDIR=		lib
9
TARGETLIB=	unls
9
TARGETLIB=	unls
10
#CPPOPTS +=	-Istdio
10
#CPPOPTS +=	-Istdio
11
CPPOPTS +=	-DUSE_ICONV
11
include		Targets
12
include		Targets
12
LIBS=		
13
LIBS=		
13
14
(-)cdrtools-2.01/libunls/nls.h (+3 lines)
Lines 111-115 Link Here
111
extern int init_nls_cp10079	__PR((void));
111
extern int init_nls_cp10079	__PR((void));
112
extern int init_nls_cp10081	__PR((void));
112
extern int init_nls_cp10081	__PR((void));
113
extern int init_nls_file	__PR((char * name));
113
extern int init_nls_file	__PR((char * name));
114
#ifdef USE_ICONV
115
extern int init_nls_iconv	__PR((char * name));
116
#endif
114
117
115
#endif	/* _NLS_H */
118
#endif	/* _NLS_H */
(-)cdrtools-2.01/libunls/nls_iconv.c (+96 lines)
Line 0 Link Here
1
/* @(#)nls_iconv.c	1.0 02/04/20 2002 J. Schilling  */
2
#ifndef lint
3
static	char sccsid[] =
4
	"@(#)nls_iconv.c	1.0 02/01/20 2002 J. Schilling";
5
#endif
6
/*
7
 * This program is free software; you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation; either version 2, or (at your option)
10
 * any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program; see the file COPYING.  If not, write to
19
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20
 */
21
/*
22
 *	Modifications to make the code portable Copyright (c) 2000 J. Schilling
23
 *
24
 * nls_iconv: create a pseudo-charset table to use iconv() provided by C
25
 * library or libiconv by Bruno Haible
26
 * The Unicode to charset table has only exact mappings.
27
 *
28
 *
29
 * Jungshik Shin (jshin@mailaps.org) 04-Feb-2002
30
 */
31
32
#ifdef USE_ICONV
33
#include <mconfig.h>
34
#include <stdio.h>
35
#include <stdxlib.h>
36
#include <strdefs.h>
37
#include "nls.h"
38
#include <iconv.h>
39
40
static void	inc_use_count	__PR((void));
41
static void	dec_use_count	__PR((void));
42
43
44
static void
45
inc_use_count()
46
{
47
	MOD_INC_USE_COUNT;
48
}
49
50
static void
51
dec_use_count()
52
{
53
	MOD_DEC_USE_COUNT;
54
}
55
56
int
57
init_nls_iconv(charset)
58
	char	*charset;
59
{
60
	iconv_t iconv_d;  /* iconv conversion descriptor */
61
	struct nls_table *table;
62
63
	/* give up if no charset is given */
64
	if (charset == NULL)
65
		return -1;
66
67
	/* see if we already have a table with this name - built in tables
68
	   have precedence over iconv() - i.e. can't have the name of an
69
	   existing table. Also, we may have already registered this file
70
	   table */
71
	if (find_nls(charset) != NULL)
72
		return -1;
73
74
	if ((iconv_d = iconv_open("UCS-2BE", charset)) == (iconv_t) -1)
75
		return -1;
76
77
78
	/* set up the table */
79
	if ((table = (struct nls_table *)malloc(sizeof (struct nls_table)))
80
							== NULL) {
81
		return -1;
82
	}
83
84
	/* give the table the file name, so we can find it again if needed */
85
	table->charset = strdup(charset);
86
	table->iconv_d = iconv_d;
87
	table->page_uni2charset = NULL;
88
	table->charset2uni = NULL;
89
	table->inc_use_count = inc_use_count;
90
	table->dec_use_count = dec_use_count;
91
	table->next = NULL;
92
93
	/* register the table */
94
	return register_nls(table);
95
}
96
#endif
(-)cdrtools-2.01/libunls/Targets (-1 / +2 lines)
Lines 39-42 Link Here
39
	nls_cp10029.c \
39
	nls_cp10029.c \
40
	nls_cp10079.c \
40
	nls_cp10079.c \
41
	nls_cp10081.c \
41
	nls_cp10081.c \
42
	nls_file.c
42
	nls_file.c \
43
	nls_iconv.c
(-)cdrtools-2.01/mkisofs/joliet.c (-15 / +174 lines)
Lines 90-95 Link Here
90
#include <unls.h>	/* For UNICODE translation */
90
#include <unls.h>	/* For UNICODE translation */
91
#include <schily.h>
91
#include <schily.h>
92
92
93
#ifdef USE_ICONV
94
#include <iconv.h>
95
#include <errno.h>
96
#endif
97
93
static Uint	jpath_table_index;
98
static Uint	jpath_table_index;
94
static struct directory **jpathlist;
99
static struct directory **jpathlist;
95
static int	next_jpath_index = 1;
100
static int	next_jpath_index = 1;
Lines 103-115 Link Here
103
};
108
};
104
109
105
#ifdef	UDF
110
#ifdef	UDF
106
	void	convert_to_unicode	__PR((unsigned char *buffer,
111
#	ifdef USE_ICONV
112
	size_t
113
#	else
114
	void
115
#	endif
116
		convert_to_unicode	__PR((unsigned char *buffer,
107
		int size, char *source, struct nls_table *inls));
117
		int size, char *source, struct nls_table *inls));
108
	int	joliet_strlen		__PR((const char *string));
118
	int	joliet_strlen		__PR((const char *string, struct nls_table *inls));
109
#else
119
#else
110
static void	convert_to_unicode	__PR((unsigned char *buffer,
120
#	ifdef USE_ICONV
121
	static size_t
122
#	else
123
	static void
124
#endif
125
		convert_to_unicode	__PR((unsigned char *buffer,
111
		int size, char *source, struct nls_table *inls));
126
		int size, char *source, struct nls_table *inls));
112
static int	joliet_strlen		__PR((const char *string));
127
static int	joliet_strlen		__PR((const char *string, struct nls_table *inls));
113
#endif
128
#endif
114
static void	get_joliet_vol_desc	__PR((struct iso_primary_descriptor *jvol_desc));
129
static void	get_joliet_vol_desc	__PR((struct iso_primary_descriptor *jvol_desc));
115
static void	assign_joliet_directory_addresses __PR((struct directory *node));
130
static void	assign_joliet_directory_addresses __PR((struct directory *node));
Lines 161-166 Link Here
161
	if (inls == onls)
176
	if (inls == onls)
162
		return (c);
177
		return (c);
163
178
179
#ifdef USE_ICONV
180
	if(inls->charset2uni == NULL || onls->page_uni2charset == NULL) {
181
		/*
182
		 * This shouldn't be reached
183
		 */
184
		static BOOL iconv_warned = FALSE;
185
		if(!iconv_warned) {
186
			error("Warning: Iconv conversion not supported in conv_charset.\n");
187
			iconv_warned = TRUE;
188
		}
189
		return (c);
190
	}
191
#endif
192
164
	/* get high and low UNICODE bytes */
193
	/* get high and low UNICODE bytes */
165
	uh = inls->charset2uni[c].uni2;
194
	uh = inls->charset2uni[c].uni2;
166
	ul = inls->charset2uni[c].uni1;
195
	ul = inls->charset2uni[c].uni1;
Lines 186-195 Link Here
186
 *
215
 *
187
 * Notes:
216
 * Notes:
188
 */
217
 */
189
#ifdef	UDF
218
#ifdef USE_ICONV
190
void
219
#	if	UDF
220
size_t
221
#	else
222
static size_t
223
#	endif
191
#else
224
#else
225
#	if	UDF
226
void
227
#	else
192
static void
228
static void
229
#	endif
193
#endif
230
#endif
194
convert_to_unicode(buffer, size, source, inls)
231
convert_to_unicode(buffer, size, source, inls)
195
	unsigned char	*buffer;
232
	unsigned char	*buffer;
Lines 216-221 Link Here
216
		tmpbuf = (Uchar *) source;
253
		tmpbuf = (Uchar *) source;
217
	}
254
	}
218
255
256
#ifdef USE_ICONV
257
	if (inls->iconv_d && inls->charset2uni==NULL &&
258
			inls->page_uni2charset==NULL) {
259
		char *inptr = tmpbuf;
260
		char *outptr = buffer;
261
		size_t inleft = strlen(tmpbuf);
262
		size_t inlen = inleft;
263
		size_t outleft = size;
264
265
		iconv(inls->iconv_d, NULL, NULL, NULL, NULL);
266
		if(iconv(inls->iconv_d, &inptr, &inleft, &outptr, &outleft) ==
267
				(size_t)-1 && errno == EILSEQ) {
268
			fprintf(stderr, "Incorrectly encoded string (%s) "
269
				"encountered.\nPossibly creating an invalid "
270
				"Joliet extension. Aborting.\n", source);
271
			exit(1);
272
		}
273
274
	  	for (i = 0; (i + 1) < size - outleft; i += 2) {	/* Size may be odd!!!*/
275
			if (buffer[i]=='\0') {
276
				switch (buffer[i+1]) {   /* Invalid characters for Joliet */
277
					case '*':
278
					case '/':
279
					case ':':
280
					case ';':
281
					case '?':
282
					case '\\':
283
						buffer[i+1]='_';
284
					default:
285
						if (buffer[i+1] == 0x7f ||
286
							    buffer[i+1] < 0x20)
287
							buffer[i+1]='_';
288
				}
289
			}
290
		}
291
		if (size & 1) {	/* beautification */
292
	  		buffer[size - 1] = 0;
293
		}
294
		if (source == NULL) {
295
			free(tmpbuf);
296
		}
297
		return (inlen - inleft);
298
	}
299
#endif
300
219
	/*
301
	/*
220
	 * Now start copying characters.  If the size was specified to be 0,
302
	 * Now start copying characters.  If the size was specified to be 0,
221
	 * then assume the input was 0 terminated.
303
	 * then assume the input was 0 terminated.
Lines 271-276 Link Here
271
	if (source == NULL) {
353
	if (source == NULL) {
272
		free(tmpbuf);
354
		free(tmpbuf);
273
	}
355
	}
356
#ifdef USE_ICONV
357
	return j;
358
#endif
274
}
359
}
275
360
276
/*
361
/*
Lines 287-298 Link Here
287
#else
372
#else
288
static int
373
static int
289
#endif
374
#endif
290
joliet_strlen(string)
375
joliet_strlen(string, inls)
291
	const char	*string;
376
	const char	*string;
377
	struct nls_table *inls;
292
{
378
{
293
	int		rtn;
379
	int		rtn;
294
380
381
#ifdef USE_ICONV
382
	if (inls->iconv_d && inls->charset2uni==NULL &&
383
			inls->page_uni2charset==NULL) {
384
		/*
385
		 * we const-cast since we're sure iconv won't change
386
		 * the string itself
387
		 */
388
		char *string_ptr = (char *)string;
389
		size_t string_len = strlen(string);
390
391
		/*
392
		 * iconv has no way of finding out the required size
393
		 * in the target
394
		 */
395
396
		char *tmp, *tmp_ptr;
397
		/* we assume that the maximum length is 2 * jlen */
398
		size_t tmp_len = (size_t)jlen * 2 + 1;
399
		tmp = e_malloc(tmp_len);
400
		tmp_ptr = tmp;
401
402
		iconv(inls->iconv_d, NULL, NULL, NULL, NULL);
403
		iconv(inls->iconv_d, &string_ptr, &string_len, &tmp_ptr,
404
			&tmp_len);
405
406
		/*
407
		 * iconv advanced the tmp pointer with as many chars
408
		 * as it has written to it, so we add up the delta
409
		 */
410
		rtn = (tmp_ptr - tmp);
411
412
		free(tmp);
413
	} else {
414
		rtn = strlen(string) << 1;
415
	}
416
#else
295
	rtn = strlen(string) << 1;
417
	rtn = strlen(string) << 1;
418
#endif
296
419
297
	/*
420
	/*
298
	 * We do clamp the maximum length of a Joliet string to be the
421
	 * We do clamp the maximum length of a Joliet string to be the
Lines 480-495 Link Here
480
	/* compare the Unicode names */
603
	/* compare the Unicode names */
481
604
482
	while (*rpnt && *lpnt) {
605
	while (*rpnt && *lpnt) {
606
#ifdef USE_ICONV
607
		size_t ri, li;
608
609
		ri = convert_to_unicode(rtmp, 2, rpnt, rinls);
610
		li = convert_to_unicode(ltmp, 2, lpnt, linls);
611
		rpnt += ri;
612
		lpnt += li;
613
		if(!ri && !li)
614
			return (0);
615
		else if(ri && !li)
616
			return (1);
617
		else if(!ri && li)
618
			return (-1);
619
#else
483
		convert_to_unicode(rtmp, 2, rpnt, rinls);
620
		convert_to_unicode(rtmp, 2, rpnt, rinls);
484
		convert_to_unicode(ltmp, 2, lpnt, linls);
621
		convert_to_unicode(ltmp, 2, lpnt, linls);
622
#endif
485
623
486
		if (a_to_u_2_byte(rtmp) < a_to_u_2_byte(ltmp))
624
		if (a_to_u_2_byte(rtmp) < a_to_u_2_byte(ltmp))
487
			return (-1);
625
			return (-1);
488
		if (a_to_u_2_byte(rtmp) > a_to_u_2_byte(ltmp))
626
		if (a_to_u_2_byte(rtmp) > a_to_u_2_byte(ltmp))
489
			return (1);
627
			return (1);
490
628
629
#ifndef USE_ICONV
491
		rpnt++;
630
		rpnt++;
492
		lpnt++;
631
		lpnt++;
632
#endif
493
	}
633
	}
494
634
495
	if (*rpnt)
635
	if (*rpnt)
Lines 574-583 Link Here
574
		}
714
		}
575
#ifdef APPLE_HYB
715
#ifdef APPLE_HYB
576
		if (USE_MAC_NAME(de))
716
		if (USE_MAC_NAME(de))
577
			namelen = joliet_strlen(de->hfs_ent->name);
717
			namelen = joliet_strlen(de->hfs_ent->name, hfs_inls);
578
		else
718
		else
579
#endif	/* APPLE_HYB */
719
#endif	/* APPLE_HYB */
580
			namelen = joliet_strlen(de->name);
720
			namelen = joliet_strlen(de->name, in_nls);
581
721
582
		if (dpnt == root) {
722
		if (dpnt == root) {
583
			jpath_table_l[jpath_table_index] = 1;
723
			jpath_table_l[jpath_table_index] = 1;
Lines 742-751 Link Here
742
#ifdef APPLE_HYB
882
#ifdef APPLE_HYB
743
		/* Use the HFS name if it exists */
883
		/* Use the HFS name if it exists */
744
		if (USE_MAC_NAME(s_entry1))
884
		if (USE_MAC_NAME(s_entry1))
745
			cvt_len = joliet_strlen(s_entry1->hfs_ent->name);
885
			cvt_len = joliet_strlen(s_entry1->hfs_ent->name, hfs_inls);
746
		else
886
		else
747
#endif	/* APPLE_HYB */
887
#endif	/* APPLE_HYB */
748
			cvt_len = joliet_strlen(s_entry1->name);
888
			cvt_len = joliet_strlen(s_entry1->name, in_nls);
749
889
750
		/*
890
		/*
751
		 * Fix the record length
891
		 * Fix the record length
Lines 891-902 Link Here
891
				if (USE_MAC_NAME(s_entry))
1031
				if (USE_MAC_NAME(s_entry))
892
					/* Use the HFS name if it exists */
1032
					/* Use the HFS name if it exists */
893
					jpath_table_size +=
1033
					jpath_table_size +=
894
						joliet_strlen(s_entry->hfs_ent->name) +
1034
						joliet_strlen(s_entry->hfs_ent->name, hfs_inls) +
895
						offsetof(struct iso_path_table, name[0]);
1035
						offsetof(struct iso_path_table, name[0]);
896
				else
1036
				else
897
#endif	/* APPLE_HYB */
1037
#endif	/* APPLE_HYB */
898
					jpath_table_size +=
1038
					jpath_table_size +=
899
						joliet_strlen(s_entry->name) +
1039
						joliet_strlen(s_entry->name, in_nls) +
900
						offsetof(struct iso_path_table, name[0]);
1040
						offsetof(struct iso_path_table, name[0]);
901
				if (jpath_table_size & 1) {
1041
				if (jpath_table_size & 1) {
902
					jpath_table_size++;
1042
					jpath_table_size++;
Lines 918-930 Link Here
918
				/* Use the HFS name if it exists */
1058
				/* Use the HFS name if it exists */
919
				s_entry->jreclen =
1059
				s_entry->jreclen =
920
				offsetof(struct iso_directory_record, name[0])
1060
				offsetof(struct iso_directory_record, name[0])
921
					+ joliet_strlen(s_entry->hfs_ent->name)
1061
					+ joliet_strlen(s_entry->hfs_ent->name, hfs_inls)
922
					+ 1;
1062
					+ 1;
923
			else
1063
			else
924
#endif	/* APPLE_HYB */
1064
#endif	/* APPLE_HYB */
925
				s_entry->jreclen =
1065
				s_entry->jreclen =
926
				offsetof(struct iso_directory_record, name[0])
1066
				offsetof(struct iso_directory_record, name[0])
927
					+ joliet_strlen(s_entry->name)
1067
					+ joliet_strlen(s_entry->name, in_nls)
928
					+ 1;
1068
					+ 1;
929
		} else {
1069
		} else {
930
			/*
1070
			/*
Lines 1072-1077 Link Here
1072
#endif
1212
#endif
1073
1213
1074
	while (*rpnt && *lpnt) {
1214
	while (*rpnt && *lpnt) {
1215
#ifdef USE_ICONV
1216
		size_t ri, li;
1217
#endif
1075
		if (*rpnt == ';' && *lpnt != ';')
1218
		if (*rpnt == ';' && *lpnt != ';')
1076
			return (-1);
1219
			return (-1);
1077
		if (*rpnt != ';' && *lpnt == ';')
1220
		if (*rpnt != ';' && *lpnt == ';')
Lines 1092-1107 Link Here
1092
			return (1);
1235
			return (1);
1093
#endif
1236
#endif
1094
1237
1238
#ifdef USE_ICONV
1239
1240
		ri = convert_to_unicode(rtmp, 2, rpnt, rinls);
1241
		li = convert_to_unicode(ltmp, 2, lpnt, linls);
1242
		rpnt += ri;
1243
		lpnt += li;
1244
		if(!ri && !li)
1245
			return (0);
1246
		else if(ri && !li)
1247
			return (1);
1248
		else if(!ri && li)
1249
			return (-1);
1250
#else
1095
		convert_to_unicode(rtmp, 2, rpnt, rinls);
1251
		convert_to_unicode(rtmp, 2, rpnt, rinls);
1096
		convert_to_unicode(ltmp, 2, lpnt, linls);
1252
		convert_to_unicode(ltmp, 2, lpnt, linls);
1253
#endif
1097
1254
1098
		if (a_to_u_2_byte(rtmp) < a_to_u_2_byte(ltmp))
1255
		if (a_to_u_2_byte(rtmp) < a_to_u_2_byte(ltmp))
1099
			return (-1);
1256
			return (-1);
1100
		if (a_to_u_2_byte(rtmp) > a_to_u_2_byte(ltmp))
1257
		if (a_to_u_2_byte(rtmp) > a_to_u_2_byte(ltmp))
1101
			return (1);
1258
			return (1);
1102
1259
1260
#ifndef USE_ICONV
1103
		rpnt++;
1261
		rpnt++;
1104
		lpnt++;
1262
		lpnt++;
1263
#endif
1105
	}
1264
	}
1106
	if (*rpnt)
1265
	if (*rpnt)
1107
		return (1);
1266
		return (1);
(-)cdrtools-2.01/mkisofs/Makefile (+1 lines)
Lines 32-37 Link Here
32
CPPOPTS +=	-DUDF
32
CPPOPTS +=	-DUDF
33
CPPOPTS +=	-DDVD_VIDEO
33
CPPOPTS +=	-DDVD_VIDEO
34
CPPOPTS +=	-DSORTING
34
CPPOPTS +=	-DSORTING
35
CPPOPTS +=	-DUSE_ICONV
35
CPPOPTS +=	-I../libhfs_iso/
36
CPPOPTS +=	-I../libhfs_iso/
36
CPPOPTS	+=	-DHAVE_CONFIG_H -DUSE_LIBSCHILY -DUSE_SCG \
37
CPPOPTS	+=	-DHAVE_CONFIG_H -DUSE_LIBSCHILY -DUSE_SCG \
37
		'-DAPPID_DEFAULT="MKISOFS ISO 9660/HFS FILESYSTEM BUILDER & CDRECORD CD-R/DVD CREATOR (C) 1993 E.YOUNGDALE (C) 1997 J.PEARSON/J.SCHILLING"' \
38
		'-DAPPID_DEFAULT="MKISOFS ISO 9660/HFS FILESYSTEM BUILDER & CDRECORD CD-R/DVD CREATOR (C) 1993 E.YOUNGDALE (C) 1997 J.PEARSON/J.SCHILLING"' \
(-)cdrtools-2.01/mkisofs/mkisofs.c (+46 lines)
Lines 59-64 Link Here
59
#endif
59
#endif
60
#endif	/* no_more_needed */
60
#endif	/* no_more_needed */
61
61
62
#ifdef USE_ICONV
63
#include <locale.h>
64
#include <langinfo.h>
65
#endif
66
62
struct directory *root = NULL;
67
struct directory *root = NULL;
63
int		path_ind;
68
int		path_ind;
64
69
Lines 223-228 Link Here
223
int	do_sort = 0;		/* sort file data */
228
int	do_sort = 0;		/* sort file data */
224
#endif /* SORTING */
229
#endif /* SORTING */
225
230
231
#ifdef USE_ICONV
232
int	iconv_possible;
233
#endif
234
226
struct nls_table *in_nls = NULL;  /* input UNICODE conversion table */
235
struct nls_table *in_nls = NULL;  /* input UNICODE conversion table */
227
struct nls_table *out_nls = NULL; /* output UNICODE conversion table */
236
struct nls_table *out_nls = NULL; /* output UNICODE conversion table */
228
#ifdef APPLE_HYB
237
#ifdef APPLE_HYB
Lines 2235-2240 Link Here
2235
	init_nls_file(hfs_ocharset);
2244
	init_nls_file(hfs_ocharset);
2236
#endif /* APPLE_HYB */
2245
#endif /* APPLE_HYB */
2237
2246
2247
#ifdef USE_ICONV
2248
	iconv_possible = !(iso9660_level >= 4 || ((ocharset &&
2249
		strcmp(ocharset, icharset ? icharset : "")) &&
2250
		use_RockRidge) || apple_ext || apple_hyb);
2251
2252
	setlocale(LC_CTYPE, "");
2253
	
2254
  	if (icharset == NULL && iconv_possible) {
2255
		char *charset = nl_langinfo(CODESET);
2256
		/* set to detected value but only if it is not pure US-ASCII */
2257
		if(strcmp(charset, "ANSI_X3.4-1968") != 0)
2258
			icharset = charset;
2259
2260
		if(icharset && verbose > 0)
2261
			fprintf(stderr, "INFO:\t"
2262
			"%s character encoding detected by locale settings."
2263
			"\n\tAssuming %s encoded filenames on source "
2264
			"filesystem,\n"
2265
			"\tuse -input-charset to override.\n",
2266
			icharset, icharset);
2267
	}
2268
2269
	if(iconv_possible) {
2270
		/*
2271
		 * don't care if initialization fails
2272
		 */
2273
		init_nls_iconv(icharset);
2274
		init_nls_iconv(ocharset);
2275
	}
2276
#endif
2277
2238
	if (icharset == NULL) {
2278
	if (icharset == NULL) {
2239
#if	(defined(__CYGWIN32__) || defined(__CYGWIN__)) && !defined(IS_CYGWIN_1)
2279
#if	(defined(__CYGWIN32__) || defined(__CYGWIN__)) && !defined(IS_CYGWIN_1)
2240
		in_nls = load_nls("cp437");
2280
		in_nls = load_nls("cp437");
Lines 2262-2267 Link Here
2262
	if (in_nls == NULL || out_nls == NULL) { /* Unknown charset specified */
2302
	if (in_nls == NULL || out_nls == NULL) { /* Unknown charset specified */
2263
		fprintf(stderr, "Unknown charset\nKnown charsets are:\n");
2303
		fprintf(stderr, "Unknown charset\nKnown charsets are:\n");
2264
		list_nls();	/* List all known charset names */
2304
		list_nls();	/* List all known charset names */
2305
#ifdef USE_ICONV
2306
		if(!iconv_possible)
2307
			fprintf(stderr, "Iconv charsets cannot be used with "
2308
				"Apple extension, HFS, ISO9660 version 2 or\n"
2309
				"Rock Ridge.\n");
2310
#endif
2265
		exit(1);
2311
		exit(1);
2266
	}
2312
	}
2267
2313
(-)cdrtools-2.01/mkisofs/mkisofs.h (-1 / +6 lines)
Lines 501-509 Link Here
501
501
502
/* joliet.c */
502
/* joliet.c */
503
#ifdef	UDF
503
#ifdef	UDF
504
#	ifdef USE_ICONV
505
extern	size_t	convert_to_unicode	__PR((unsigned char *buffer,
506
			int size, char *source, struct nls_table *inls));
507
#	else
504
extern	void	convert_to_unicode	__PR((unsigned char *buffer,
508
extern	void	convert_to_unicode	__PR((unsigned char *buffer,
505
			int size, char *source, struct nls_table *inls));
509
			int size, char *source, struct nls_table *inls));
506
extern	int	joliet_strlen		__PR((const char *string));
510
#	endif
511
extern	int	joliet_strlen		__PR((const char *string, struct nls_table *inls));
507
#endif
512
#endif
508
extern unsigned char conv_charset __PR((unsigned char, struct nls_table *,
513
extern unsigned char conv_charset __PR((unsigned char, struct nls_table *,
509
				struct nls_table *));
514
				struct nls_table *));
(-)cdrtools-2.01/mkisofs/udf.c (-1 / +1 lines)
Lines 442-448 Link Here
442
	int i;
442
	int i;
443
	int expanded_length;
443
	int expanded_length;
444
444
445
	expanded_length = joliet_strlen(src);
445
	expanded_length = joliet_strlen(src, in_nls);
446
	if (expanded_length > 1024)
446
	if (expanded_length > 1024)
447
		expanded_length = 1024;
447
		expanded_length = 1024;
448
	if (expanded_length > (dst_size-1)*2)
448
	if (expanded_length > (dst_size-1)*2)

Return to bug 9088