Adaptions to new HFS+ blessing interface by Vladimir Serbinenko.

This commit is contained in:
Thomas Schmitt 2012-05-25 18:19:46 +02:00
parent ab11c954d9
commit 1842921b2c
2 changed files with 23 additions and 7 deletions

View File

@ -622,6 +622,7 @@ struct ecma119_image
uint32_t hfsp_nleafs; uint32_t hfsp_nleafs;
uint32_t hfsp_curleaf; uint32_t hfsp_curleaf;
uint32_t hfsp_nnodes; uint32_t hfsp_nnodes;
uint32_t hfsp_bless_id[ISO_HFSPLUS_BLESS_MAX];
/* /*
* ISO 9660:1999 related information * ISO 9660:1999 related information

View File

@ -110,6 +110,13 @@ int set_hfsplus_name(Ecma119Image *t, char *name, HFSPlusNode *node)
uint16_t val = ntohs (*iptr); uint16_t val = ntohs (*iptr);
uint8_t high = val >> 8; uint8_t high = val >> 8;
uint8_t low = val & 0xff; uint8_t low = val & 0xff;
if (val == ':')
{
*optr++ = htons ('/');
continue;
}
if (val >= 0xac00 && val <= 0xd7a3) if (val >= 0xac00 && val <= 0xd7a3)
{ {
uint16_t s, l, v, t; uint16_t s, l, v, t;
@ -243,6 +250,7 @@ int create_tree(Ecma119Image *t, IsoNode *iso, uint32_t parent_id)
{ {
int ret; int ret;
uint32_t cat_id, cleaf; uint32_t cat_id, cleaf;
int i;
if (t == NULL || iso == NULL) { if (t == NULL || iso == NULL) {
return ISO_NULL_POINTER; return ISO_NULL_POINTER;
@ -259,6 +267,10 @@ int create_tree(Ecma119Image *t, IsoNode *iso, uint32_t parent_id)
cat_id = t->hfsp_cat_id++; cat_id = t->hfsp_cat_id++;
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++)
if (t->hfsplus_blessed[i] == iso)
t->hfsp_bless_id[i] = cat_id;
set_hfsplus_name (t, iso->name, &t->hfsp_leafs[t->hfsp_curleaf]); set_hfsplus_name (t, iso->name, &t->hfsp_leafs[t->hfsp_curleaf]);
t->hfsp_leafs[t->hfsp_curleaf].node = iso; t->hfsp_leafs[t->hfsp_curleaf].node = iso;
t->hfsp_leafs[t->hfsp_curleaf].cat_id = cat_id; t->hfsp_leafs[t->hfsp_curleaf].cat_id = cat_id;
@ -472,6 +484,7 @@ write_sb (Ecma119Image *t)
struct hfsplus_volheader sb; struct hfsplus_volheader sb;
static char buffer[1024]; static char buffer[1024];
int ret; int ret;
int i;
iso_msg_debug(t->image->id, "Write HFS+ superblock"); iso_msg_debug(t->image->id, "Write HFS+ superblock");
@ -521,14 +534,13 @@ write_sb (Ecma119Image *t)
iso_msb ((uint8_t *) &sb.catalog_file.extents[0].count, 2 * t->hfsp_nnodes, 4); iso_msb ((uint8_t *) &sb.catalog_file.extents[0].count, 2 * t->hfsp_nnodes, 4);
iso_msg_debug(t->image->id, "catalog_file_start = %d\n", (int)t->hfsp_catalog_file_start); iso_msg_debug(t->image->id, "catalog_file_start = %d\n", (int)t->hfsp_catalog_file_start);
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++)
iso_msb ((uint8_t *) (&sb.ppc_bootdir + i
+ (i == ISO_HFSPLUS_BLESS_OSX_FOLDER)),
t->hfsp_bless_id[i], 4);
/* /*
FIXME: set: FIXME: set:
uint32_t ppc_bootdir;
uint32_t intel_bootfile;
uint32_t showfolder;
uint32_t os9folder;
uint32_t unused;
uint32_t osxfolder;
uint64_t num_serial; uint64_t num_serial;
*/ */
@ -735,7 +747,6 @@ int hfsplus_writer_write_data(IsoImageWriter *writer)
4); 4);
memcpy (common->file_creator, memcpy (common->file_creator,
xinfo->creator_code, 4); xinfo->creator_code, 4);
/* use xinfo */;
} }
else if (ret < 0) else if (ret < 0)
return ret; return ret;
@ -938,6 +949,7 @@ int hfsplus_writer_create(Ecma119Image *target)
int level = 0; int level = 0;
IsoNode *pos; IsoNode *pos;
IsoDir *dir; IsoDir *dir;
int i;
writer = malloc(sizeof(IsoImageWriter)); writer = malloc(sizeof(IsoImageWriter));
if (writer == NULL) { if (writer == NULL) {
@ -961,6 +973,9 @@ int hfsplus_writer_create(Ecma119Image *target)
return ret; return ret;
} }
for (i = 0; i < ISO_HFSPLUS_BLESS_MAX; i++)
target->hfsp_bless_id[i] = 0;
target->hfsp_nleafs = 2 * (target->hfsp_nfiles + target->hfsp_ndirs); target->hfsp_nleafs = 2 * (target->hfsp_nfiles + target->hfsp_ndirs);
target->hfsp_curleaf = 0; target->hfsp_curleaf = 0;