+ char vol_id[32];
+ int i, convflags;
+ size_t convbytes;
+ u_int16_t *uchp;
+
+ /*
+ * On Joliet CDs use the UCS-2 volume identifier.
+ *
+ * This name can have up to 15 UCS-2 chars and is
+ * terminated with 0x0000 or padded with 0x0020.
+ */
+ convflags = UTF_DECOMPOSED;
+ if (BYTE_ORDER != BIG_ENDIAN)
+ convflags |= UTF_REVERSE_ENDIAN;
+ for (i = 0, uchp = (u_int16_t *)sup->volume_id; i < 15 && uchp[i]; ++i);
+ if ((utf8_encodestr((u_int16_t *)sup->volume_id, (i * 2), vol_id,
+ &convbytes, sizeof(vol_id), 0, convflags) == 0)
+ && convbytes && (vol_id[0] != ' ')) {
+ char * strp;
+
+ /* Remove trailing spaces */
+ strp = vol_id + convbytes - 1;
+ while (strp > vol_id && *strp == ' ')
+ *strp-- = '\0';
+ bcopy(vol_id, isomp->volume_id, convbytes);
+ }
+