Store joliet-related info in Ecma119Image target insted of Writer.

In fact, this is not a good decission, writer is a better place for 
writer dependent data, but for now I prefer to store anything in the 
target. Later we can improve Writer encapsulation.
This commit is contained in:
Vreixo Formoso 2008-01-06 17:52:58 +01:00
parent 4b0833f62c
commit bd0f787f61
4 changed files with 16 additions and 12 deletions

View File

@ -825,6 +825,7 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
target->iso_level = opts->level;
target->rockridge = opts->rockridge;
target->joliet = 0; //TODO opts->joliet;
target->ino = 0;
target->omit_version_numbers = opts->omit_version_numbers;
target->allow_deep_paths = opts->allow_deep_paths;

View File

@ -20,6 +20,7 @@
typedef struct ecma119_image Ecma119Image;
typedef struct ecma119_node Ecma119Node;
typedef struct joliet_node JolietNode;
typedef struct Iso_File_Src IsoFileSrc;
typedef struct Iso_Image_Writer IsoImageWriter;
@ -32,6 +33,7 @@ struct ecma119_image
/* extensions */
unsigned int rockridge :1;
unsigned int joliet :1;
/* relaxed constraints */
unsigned int omit_version_numbers :1;
@ -95,6 +97,11 @@ struct ecma119_image
uint32_t path_table_size;
uint32_t l_path_table_pos;
uint32_t m_path_table_pos;
/*
* Joliet related information
*/
JolietNode *joliet_root;
/*
* Number of pad blocks that we need to write. Padding blocks are blocks

View File

@ -245,17 +245,14 @@ void sort_tree(JolietNode *root)
}
static
int joliet_tree_create(IsoImageWriter *writer)
int joliet_tree_create(Ecma119Image *t)
{
int ret;
JolietNode *root;
Ecma119Image *t;
if (writer == NULL || writer->target == NULL) {
if (t == NULL) {
return ISO_NULL_POINTER;
}
t = writer->target;
ret = create_tree(t, (IsoNode*)t->image->root, &root, 0);
if (ret <= 0) {
@ -266,14 +263,14 @@ int joliet_tree_create(IsoImageWriter *writer)
return ret;
}
/* the Joliet tree is stored in the writer data field */
writer->data = root;
/* the Joliet tree is stored in Ecma119Image target */
t->joliet_root = root;
iso_msg_debug(t->image->messenger, "Sorting the Joliet tree...");
sort_tree(root);
//iso_msg_debug(t->image->messenger, "Mangling Joliet names...");
// FIXME ret = mangle_tree(writer, 1);
// FIXME ret = mangle_tree(t, 1);
return ISO_SUCCESS;
}
@ -303,7 +300,8 @@ static
int joliet_writer_free_data(IsoImageWriter *writer)
{
/* free the Joliet tree */
joliet_node_free(writer->data);
Ecma119Image *t = writer->target;
joliet_node_free(t->joliet_root);
return ISO_SUCCESS;
}
@ -326,7 +324,7 @@ int joliet_writer_create(Ecma119Image *target)
iso_msg_debug(target->image->messenger,
"Creating low level Joliet tree...");
ret = joliet_tree_create(writer);
ret = joliet_tree_create(target);
if (ret < 0) {
return ret;
}

View File

@ -17,8 +17,6 @@
#include "libisofs.h"
#include "ecma119.h"
typedef struct joliet_node JolietNode;
enum joliet_node_type {
JOLIET_FILE,
JOLIET_DIR