Re: [PATCH] ISO9660 I18N Joliet label support
- From: leon breedt <bitserf gmail com>
- To: gnome-vfs-list gnome org
- Subject: Re: [PATCH] ISO9660 I18N Joliet label support
- Date: Wed, 12 Jan 2005 12:41:28 +1300
On Tue, 11 Jan 2005 11:08:56 +0100, Alexander Larsson <alexl redhat com> wrote:
> Looks good to me (although i don't know squat about joliet), applied.
Hi Alex,
Following some further discussion, the Gentoo guys found usability
issue with the way the label is selected in HAL (the same method is
used in the previous patch).
If the ISO and Joliet volume labels have the same leading 16
characters, the ISO label should be used, as the Joliet label is
limited to 16 characters due to being UTF-16 encoded, while the ISO
label is up to 32 characters ASCII. If a strncmp of the first 16
characters (after the UTF16 => UTF-8 conversion) succeeds, it means
that the Joliet label contains a truncated version of the ISO label.
The attached patch also removes an incorrect NUL byte check on the
UTF-16 label.
Incorrect since UTF-16 can contain embedded NULs, and we should rely
on g_convert to determine whether its valid or not.
I've attached a tested patch that should resolve these two issues.
Regards
Leon
Index: libgnomevfs/gnome-vfs-cdrom.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-cdrom.c,v
retrieving revision 1.8
diff -u -r1.8 gnome-vfs-cdrom.c
--- libgnomevfs/gnome-vfs-cdrom.c 11 Jan 2005 10:08:24 -0000 1.8
+++ libgnomevfs/gnome-vfs-cdrom.c 11 Jan 2005 23:26:33 -0000
@@ -210,6 +210,7 @@
#define ISO_ROOT_START (ISO_SECTOR_SIZE * (offset + 16))
#define ISO_VD_MAX 84
+ joliet_label = NULL;
for (i = 0, vd_alt_offset = ISO_ROOT_START + ISO_SECTOR_SIZE;
i < ISO_VD_MAX;
i++, vd_alt_offset += ISO_SECTOR_SIZE)
@@ -220,22 +221,25 @@
break;
if (iso_buffer.type[0] != ISO_VD_SUPPLEMENTARY)
continue;
- if (iso_buffer.volume_id[0] == 0)
- continue;
joliet_label = g_convert (iso_buffer.volume_id, 32, "UTF-8",
"UTF-16BE", NULL, NULL, NULL);
if (!joliet_label)
continue;
- return joliet_label;
+ break;
}
lseek (fd, (off_t) ISO_ROOT_START, SEEK_SET);
read (fd, &iso_buffer, ISO_SECTOR_SIZE);
- if (iso_buffer.volume_id[0] == 0) {
+ if (iso_buffer.volume_id[0] == 0 && !joliet_label) {
return g_strdup (_("ISO 9660 Volume"));
}
-
+
+ if (joliet_label) {
+ if (strncmp (joliet_label, iso_buffer.volume_id, 16) != 0)
+ return joliet_label;
+ g_free (joliet_label);
+ }
return g_strndup (iso_buffer.volume_id, 32);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]