5 "@(#)joliet.c 1.68 15/12/30 joerg";
157 size_t fromsize = *fromsizep;
158 size_t tosize = *tosizep;
161 if (fromsize == 0 || tosize == 0)
174 #ifdef HAVE_ICONV_CONST 175 #define __IC_CONST const 180 char *
obuf = (
char *)ob;
185 &
obuf, &osize) == -1) {
189 *fromsizep == fromsize) {
190 ob[0] = 0; ob[1] =
'_';
194 unichar = ob[0] * 256 + ob[1];
198 unsigned char c = *
from;
206 ob[0] = unichar >> 8 & 0xFF;
207 ob[1] = unichar & 0xFF;
212 char *ibuf = (
char *)ob;
216 (
char **)&to, tosizep) == -1) {
220 *tosizep == tosize) {
253 unsigned char *tmpbuf;
276 for (
i = 0; (
i + 1) <
size;
i += 2,
j++) {
292 __IC_CONST
char *
inbuf = (
char *)&tmpbuf[
j];
294 char *
obuf = (
char *)ob;
304 &
obuf, &osize) == -1) {
313 unichar = ob[0] * 256 + ob[1];
327 if (unichar <= 0x1f || unichar == 0x7f)
349 buffer[
i] = unichar >> 8 & 0xFF;
350 buffer[
i + 1] = unichar & 0xFF;
386 while (
string[
j] !=
'\0') {
388 __IC_CONST
char *
inbuf = (
char *)&
string[
j];
390 char *
obuf = (
char *)ob;
400 &
obuf, &osize) == -1) {
420 if (
rtn > 2*maxlen) {
553 unsigned char rtmp[2],
564 rparent = rr->
parent->jpath_index;
565 lparent =
ll->parent->jpath_index;
567 rparent = rr->
self->parent_rec->filedir->jpath_index;
570 lparent =
ll->self->parent_rec->filedir->jpath_index;
572 if (rparent < lparent) {
575 if (rparent > lparent) {
583 if (USE_MAC_NAME(rr->
self)) {
584 rpnt = rr->
self->hfs_ent->name;
587 rpnt = rr->
self->name;
591 if (USE_MAC_NAME(
ll->self)) {
592 lpnt =
ll->self->hfs_ent->name;
595 lpnt =
ll->self->name;
599 rpnt = rr->
self->name;
600 lpnt =
ll->self->name;
606 while (*rpnt && *lpnt) {
639 unsigned int jpindex;
687 _(
"Fatal Joliet goof - directory has amnesia\n"));
690 if (USE_MAC_NAME(de))
712 dpnt->
parent->jpath_index);
714 dpnt->
parent->jpath_index);
715 jpindex = dpnt->
parent->jpath_index;
718 dpnt->
self->parent_rec->filedir->jpath_index);
720 dpnt->
self->parent_rec->filedir->jpath_index);
721 jpindex = dpnt->
self->parent_rec->filedir->jpath_index;
724 if (jpindex > 0xffff) {
725 static int warned = 0;
730 _(
"Unable to generate sane Joliet path tables - too many directories (%u)\n"),
734 _(
"Try to use the option -no-limit-pathtables\n"));
757 if (USE_MAC_NAME(de)) {
787 _(
"Joliet path table lengths do not match %d expected: %d\n"),
799 unsigned int dir_index;
800 char *directory_buffer;
805 unsigned int total_size;
810 directory_buffer = (
char *)
e_malloc(total_size);
811 memset(directory_buffer, 0, total_size);
828 for (s_entry1 =
reloc_dir->contents; s_entry1;
829 s_entry1 = s_entry1->
next) {
834 if (s_entry1 ==
NULL) {
837 _(
"Unable to locate relocated directory\n"));
848 new_reclen = s_entry1->
jreclen;
856 if (USE_MAC_NAME(s_entry1))
878 }
else if (
strcmp(s_entry1->
name,
"..") == 0) {
893 while (finddir && finddir->
self != s_entry1) {
894 finddir = finddir->
next;
898 _(
"Fatal goof - unable to find directory location\n"));
905 memcpy(directory_buffer + dir_index, &jrec,
916 directory_buffer[dir_index++] = 0;
919 directory_buffer[dir_index++] = 1;
922 if (USE_MAC_NAME(s_entry1)) {
925 (
Uchar *) directory_buffer+dir_index,
932 (
Uchar *) directory_buffer+dir_index,
936 dir_index += cvt_len;
940 directory_buffer[dir_index++] = 0;
945 if (dpnt->
jsize != dir_index) {
947 _(
"Unexpected joliet directory length %d expected: %d '%s'\n"),
953 free(directory_buffer);
1004 if (this_dir ==
root &&
1088 unsigned char rtmp[2],
1100 if (USE_MAC_NAME(*
r)) {
1101 rpnt = (*r)->hfs_ent->name;
1108 if (USE_MAC_NAME(*
l)) {
1109 lpnt = (*l)->hfs_ent->name;
1128 #ifdef USE_LARGEFILES 1129 if ((*r)->mxpart == (*l)->mxpart)
1133 _(
"Error: %s and %s have the same Joliet name\n"),
1134 (*r)->whole_name, (*l)->whole_name);
1141 for (; *p1 == *p2; p1++, p2++,
len++) {
1155 if (
strcmp(rpnt,
".") == 0)
1157 if (
strcmp(lpnt,
".") == 0)
1160 if (
strcmp(rpnt,
"..") == 0)
1162 if (
strcmp(lpnt,
"..") == 0)
1179 if (
strcmp(rpnt,
"VIDEO_TS.IFO") == 0)
1181 if (
strcmp(lpnt,
"VIDEO_TS.IFO") == 0)
1186 while (*rpnt && *lpnt) {
1187 if (*rpnt ==
';' && *lpnt !=
';')
1189 if (*rpnt !=
';' && *lpnt ==
';')
1192 if (*rpnt ==
';' && *lpnt ==
';')
1201 if (*rpnt ==
'.' && *lpnt !=
'.')
1203 if (*rpnt !=
'.' && *lpnt ==
'.')
1222 #ifdef USE_LARGEFILES 1226 if ((*r)->mxpart < (*l)->mxpart)
1228 else if ((*r)->mxpart > (*l)->mxpart)
1293 _(
"Joliet file names differ after %d chars\n"),
1297 _(
"Cannot use Joliet, please remove -J from the option list.\n"));
1300 _(
"Try to use the option -joliet-long\n"));
1305 for (
i = 0;
i < dcount - 1;
i++) {
1306 sortlist[
i]->
jnext = sortlist[
i + 1];
1310 *sort_dir = sortlist[0];
1390 UInt32_t starting_extent;
1443 UInt32_t starting_extent;
char opt_type_l_path_table[ISODCL(145, 148)]
char version[ISODCL(7, 7)]
char volume_id[ISODCL(41, 72)]
EXPORT void set_732(void *vp, UInt32_t i)
char application_id[ISODCL(575, 702)]
unsigned char name_len[ISODCL(33, 33)]
LOCAL void generate_joliet_directories(struct directory *node, FILE *outfile)
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
ACPI_SIZE strlen(const char *String)
#define ISO_VD_SUPPLEMENTARY
#define RELOCATED_DIRECTORY
struct output_fragment jpathtable_desc
GLdouble GLdouble GLdouble r
EXPORT void set_721(void *vp, UInt32_t i)
char type_l_path_table[ISODCL(141, 144)]
struct iso_primary_descriptor vol_desc
static UConst char sccsid[]
EXPORT void set_722(void *vp, UInt32_t i)
char opt_type_m_path_table[ISODCL(153, 156)]
char escape_sequences[ISODCL(89, 120)]
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
EXPORT void set_731(void *vp, UInt32_t i)
LOCAL int jdirtree_write(FILE *outfile)
char system_id[ISODCL(9, 40)]
struct directory * subdir
#define sprintf(buf, format,...)
size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
LOCAL void convert_to_unicode(unsigned char *buffer, int size, char *source, siconvt_t *inls)
struct directory * parent
LOCAL int joliet_sort_n_finish(struct directory *this_dir)
LOCAL struct directory ** jpathlist
unsigned char flags[ISODCL(26, 26)]
struct iso_directory_record isorec
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
struct directory_entry * parent_rec
char path_table_size[ISODCL(133, 140)]
LOCAL void assign_joliet_directory_addresses(struct directory *node)
LOCAL int jpathtab_write(FILE *outfile)
LOCAL void build_jpathlist(struct directory *node)
LOCAL int joliet_strlen(char *string, size_t maxlen, siconvt_t *inls) const
#define offsetof(TYPE, MEMBER)
unsigned int jpath_blocks
EXPORT int iso9660_date(char *result, time_t crtime)
#define INHIBIT_JOLIET_ENTRY
struct directory_entry * contents
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
struct output_fragment joliet_desc
LOCAL int jpathtab_size(UInt32_t starting_extent)
char size[ISODCL(11, 18)]
char preparer_id[ISODCL(447, 574)]
#define INHIBIT_UDF_ENTRY
EXPORT int joliet_sort_tree(struct directory *node)
struct iso_directory_record jroot_record
struct directory * reloc_dir
LOCAL int jdirtree_size(UInt32_t starting_extent)
LOCAL void get_joliet_vol_desc(struct iso_primary_descriptor *jvol_desc)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
struct directory_entry * jcontents
char file_structure_version[ISODCL(882, 882)]
int volume_sequence_number
char type_m_path_table[ISODCL(149, 152)]
LOCAL int joliet_compare_dirs(void *rr, const void *ll) const
UInt32_t last_extent_written
char copyright_file_id[ISODCL(703, 739)]
#define memcpy(s1, s2, n)
struct directory_entry * next
struct directory_entry * self
unsigned int jpath_table[4]
char publisher_id[ISODCL(319, 446)]
static SHChangeNotifyEntry s_entry
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
struct output_fragment jdirtree_desc
struct directory_entry * jnext
GLsizei GLsizei GLchar * source
LOCAL void convert_to_unicode __PR((unsigned char *buffer, int size, char *source, siconvt_t *inls))
unsigned int jpath_table_size
char abstract_file_id[ISODCL(740, 776)]
EXPORT void comerrno(int err, char *msg, va_alist)
EXPORT void * e_malloc(size_t size)
unsigned char length[ISODCL(1, 1)]
LOCAL void generate_one_joliet_directory(struct directory *dpnt, FILE *outfile)
LOCAL int jvd_write(FILE *outfile)
LOCAL Uint jpath_table_index
char bibliographic_file_id[ISODCL(777, 813)]
int strcmp(const char *String1, const char *String2)
char volume_set_id[ISODCL(191, 318)]
EXPORT void conv_charset(unsigned char *to, size_t *tosizep, unsigned char *from, size_t *fromsizep, siconvt_t *inls, siconvt_t *onls)
LOCAL int next_jpath_index
EXPORT void set_723(void *vp, UInt32_t i)
LOCAL int generate_joliet_path_tables()
EXPORT void set_733(void *vp, UInt32_t i)
LOCAL int joliet_sort_directory(struct directory_entry **sort_dir)
LOCAL int joliet_compare_paths(void const *r, void const *l)
char root_directory_record[ISODCL(157, 190)]
EXPORT int errmsgno(int err, char *msg, va_alist)
char extent[ISODCL(3, 10)]