Define code style formatter for eclipse and apply it to source.
This commit is contained in:
parent
1ecb735e7c
commit
4c9d83f051
@ -313,6 +313,7 @@
|
|||||||
</profile>
|
</profile>
|
||||||
</scannerConfigBuildInfo>
|
</scannerConfigBuildInfo>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
<cconfiguration id="converted.config.2029700129.1058518760.974771800">
|
<cconfiguration id="converted.config.2029700129.1058518760.974771800">
|
||||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="converted.config.2029700129.1058518760.974771800" moduleId="org.eclipse.cdt.core.settings" name="test">
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="converted.config.2029700129.1058518760.974771800" moduleId="org.eclipse.cdt.core.settings" name="test">
|
||||||
@ -624,6 +625,7 @@
|
|||||||
</profile>
|
</profile>
|
||||||
</scannerConfigBuildInfo>
|
</scannerConfigBuildInfo>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#Fri Dec 28 17:36:33 CET 2007
|
#Fri Dec 28 21:07:56 CET 2007
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
indexer/filesToParseUpFront=
|
indexer/filesToParseUpFront=
|
||||||
indexer/indexAllFiles=true
|
indexer/indexAllFiles=true
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
* the libisofs ring buffer as intermediate memory
|
* the libisofs ring buffer as intermediate memory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct th_data {
|
struct th_data
|
||||||
|
{
|
||||||
IsoRingBuffer *rbuf;
|
IsoRingBuffer *rbuf;
|
||||||
char *path;
|
char *path;
|
||||||
};
|
};
|
||||||
|
91
doc/devel/codestyle.xml
Normal file
91
doc/devel/codestyle.xml
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<profiles version="1">
|
||||||
|
<profile kind="CodeFormatterProfile" name="nglibisofs" version="1">
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.continuation_indentation" value="2"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.lineSplit" value="80"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_conditional_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.tabulation.size" value="4"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_empty_lines" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.tabulation.char" value="space"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_method_declaration" value="next_line"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block_in_case" value="next_line_shifted"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.compact_else_if" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation" value="18"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration" value="18"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.indentation.size" value="4"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_type_declaration" value="next_line"/>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
@ -28,7 +28,8 @@
|
|||||||
# define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
# define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct iso_ring_buffer {
|
struct iso_ring_buffer
|
||||||
|
{
|
||||||
uint8_t buf[BLOCK_SIZE * BUFFER_SIZE];
|
uint8_t buf[BLOCK_SIZE * BUFFER_SIZE];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -73,7 +73,8 @@ size_t calc_dirent_len(Ecma119Image *t, Ecma119Node *n)
|
|||||||
if (need_version_number(t, n)) {
|
if (need_version_number(t, n)) {
|
||||||
ret += 2; /* take into account version numbers */
|
ret += 2; /* take into account version numbers */
|
||||||
}
|
}
|
||||||
if (ret % 2) ret++;
|
if (ret % 2)
|
||||||
|
ret++;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,8 +111,7 @@ size_t calc_dir_size(Ecma119Image *t, Ecma119Node *dir, size_t *ce)
|
|||||||
Ecma119Node *child = dir->info.dir.children[i];
|
Ecma119Node *child = dir->info.dir.children[i];
|
||||||
size_t dirent_len = calc_dirent_len(t, child);
|
size_t dirent_len = calc_dirent_len(t, child);
|
||||||
if (t->rockridge) {
|
if (t->rockridge) {
|
||||||
dirent_len += rrip_calc_len(t, child, 0, 255 - dirent_len,
|
dirent_len += rrip_calc_len(t, child, 0, 255 - dirent_len, &ce_len);
|
||||||
&ce_len);
|
|
||||||
*ce += ce_len;
|
*ce += ce_len;
|
||||||
}
|
}
|
||||||
remaining = BLOCK_SIZE - (len % BLOCK_SIZE);
|
remaining = BLOCK_SIZE - (len % BLOCK_SIZE);
|
||||||
@ -223,8 +223,8 @@ void write_one_dir_record(Ecma119Image *t, Ecma119Node *node, int file_id,
|
|||||||
uint32_t len;
|
uint32_t len;
|
||||||
uint32_t block;
|
uint32_t block;
|
||||||
uint8_t len_dr; /*< size of dir entry without SUSP fields */
|
uint8_t len_dr; /*< size of dir entry without SUSP fields */
|
||||||
uint8_t *name = (file_id >= 0) ? (uint8_t*)&file_id :
|
uint8_t *name = (file_id >= 0) ? (uint8_t*)&file_id
|
||||||
(uint8_t*)node->iso_name;
|
: (uint8_t*)node->iso_name;
|
||||||
|
|
||||||
struct ecma119_dir_record *rec = (struct ecma119_dir_record*)buf;
|
struct ecma119_dir_record *rec = (struct ecma119_dir_record*)buf;
|
||||||
|
|
||||||
@ -710,8 +710,7 @@ write_error:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts,
|
int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img)
|
||||||
Ecma119Image **img)
|
|
||||||
{
|
{
|
||||||
int ret, i;
|
int ret, i;
|
||||||
Ecma119Image *target;
|
Ecma119Image *target;
|
||||||
@ -862,8 +861,7 @@ target_cleanup:;
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int bs_read(struct burn_source *bs, unsigned char *buf, int size)
|
||||||
bs_read(struct burn_source *bs, unsigned char *buf, int size)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
Ecma119Image *t = (Ecma119Image*)bs->data;
|
Ecma119Image *t = (Ecma119Image*)bs->data;
|
||||||
@ -881,15 +879,13 @@ bs_read(struct burn_source *bs, unsigned char *buf, int size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static off_t
|
static off_t bs_get_size(struct burn_source *bs)
|
||||||
bs_get_size(struct burn_source *bs)
|
|
||||||
{
|
{
|
||||||
Ecma119Image *target = (Ecma119Image*)bs->data;
|
Ecma119Image *target = (Ecma119Image*)bs->data;
|
||||||
return target->total_size;
|
return target->total_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void bs_free_data(struct burn_source *bs)
|
||||||
bs_free_data(struct burn_source *bs)
|
|
||||||
{
|
{
|
||||||
Ecma119Image *target = (Ecma119Image*)bs->data;
|
Ecma119Image *target = (Ecma119Image*)bs->data;
|
||||||
|
|
||||||
|
@ -23,7 +23,8 @@ typedef struct ecma119_node Ecma119Node;
|
|||||||
typedef struct Iso_File_Src IsoFileSrc;
|
typedef struct Iso_File_Src IsoFileSrc;
|
||||||
typedef struct Iso_Image_Writer IsoImageWriter;
|
typedef struct Iso_Image_Writer IsoImageWriter;
|
||||||
|
|
||||||
struct ecma119_image {
|
struct ecma119_image
|
||||||
|
{
|
||||||
IsoImage *image;
|
IsoImage *image;
|
||||||
Ecma119Node *root;
|
Ecma119Node *root;
|
||||||
|
|
||||||
@ -51,8 +52,10 @@ struct ecma119_image {
|
|||||||
mode_t file_mode;
|
mode_t file_mode;
|
||||||
mode_t dir_mode;
|
mode_t dir_mode;
|
||||||
|
|
||||||
int sort_files; /**< if sort files or not. Sorting is based of
|
/**
|
||||||
* the weight of each file */
|
* if sort files or not. Sorting is based of the weight of each file
|
||||||
|
*/
|
||||||
|
int sort_files;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In the CD, each file must have an unique inode number. So each
|
* In the CD, each file must have an unique inode number. So each
|
||||||
@ -65,8 +68,9 @@ struct ecma119_image {
|
|||||||
|
|
||||||
uint32_t ms_block; /**< start block for a ms image */
|
uint32_t ms_block; /**< start block for a ms image */
|
||||||
time_t now; /**< Time at which writing began. */
|
time_t now; /**< Time at which writing began. */
|
||||||
off_t total_size; /**< Total size of the output. This only
|
|
||||||
* includes the current volume. */
|
/** Total size of the output. This only includes the current volume. */
|
||||||
|
off_t total_size;
|
||||||
uint32_t vol_space_size;
|
uint32_t vol_space_size;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -249,8 +249,7 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
|
|||||||
} else {
|
} else {
|
||||||
/* symlinks are only supported when RR is enabled */
|
/* symlinks are only supported when RR is enabled */
|
||||||
iso_msg_note(image->image, LIBISO_FILE_IGNORED, "File \"%s\" "
|
iso_msg_note(image->image, LIBISO_FILE_IGNORED, "File \"%s\" "
|
||||||
"ignored. Symlinks need RockRidge extensions.",
|
"ignored. Symlinks need RockRidge extensions.", iso->name);
|
||||||
iso->name);
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -260,8 +259,7 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
|
|||||||
} else {
|
} else {
|
||||||
/* symlinks are only supported when RR is enabled */
|
/* symlinks are only supported when RR is enabled */
|
||||||
iso_msg_note(image->image, LIBISO_FILE_IGNORED, "File \"%s\" "
|
iso_msg_note(image->image, LIBISO_FILE_IGNORED, "File \"%s\" "
|
||||||
"ignored. Special files need RockRidge extensions.",
|
"ignored. Special files need RockRidge extensions.", iso->name);
|
||||||
iso->name);
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -331,8 +329,8 @@ void sort_tree(Ecma119Node *root)
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
qsort(root->info.dir.children, root->info.dir.nchildren,
|
qsort(root->info.dir.children, root->info.dir.nchildren, sizeof(void*),
|
||||||
sizeof(void*), cmp_node_name);
|
cmp_node_name);
|
||||||
for (i = 0; i < root->info.dir.nchildren; i++) {
|
for (i = 0; i < root->info.dir.nchildren; i++) {
|
||||||
if (root->info.dir.children[i]->type == ECMA119_DIR)
|
if (root->info.dir.children[i]->type == ECMA119_DIR)
|
||||||
sort_tree(root->info.dir.children[i]);
|
sort_tree(root->info.dir.children[i]);
|
||||||
@ -378,8 +376,8 @@ int mangle_single_dir(Ecma119Image *img, Ecma119Node *dir, int max_file_len,
|
|||||||
int digits = 1; /* characters to change per name */
|
int digits = 1; /* characters to change per name */
|
||||||
|
|
||||||
/* first, find all child with same name */
|
/* first, find all child with same name */
|
||||||
while (j + 1 < nchildren &&
|
while (j + 1 < nchildren && !cmp_node_name(children + i, children + j
|
||||||
!cmp_node_name(children + i, children + j + 1)) {
|
+ 1)) {
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
if (j == i) {
|
if (j == i) {
|
||||||
@ -538,8 +536,8 @@ int mangle_dir(Ecma119Image *img, Ecma119Node *dir, int max_file_len,
|
|||||||
/* recurse */
|
/* recurse */
|
||||||
for (i = 0; i < dir->info.dir.nchildren; ++i) {
|
for (i = 0; i < dir->info.dir.nchildren; ++i) {
|
||||||
if (dir->info.dir.children[i]->type == ECMA119_DIR) {
|
if (dir->info.dir.children[i]->type == ECMA119_DIR) {
|
||||||
ret = mangle_dir(img, dir->info.dir.children[i],
|
ret = mangle_dir(img, dir->info.dir.children[i], max_file_len,
|
||||||
max_file_len, max_dir_len);
|
max_dir_len);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
/* error */
|
/* error */
|
||||||
return ret;
|
return ret;
|
||||||
@ -575,8 +573,8 @@ int mangle_tree(Ecma119Image *img, int recurse)
|
|||||||
* See IEEE P1282, section 4.1.5 for details
|
* See IEEE P1282, section 4.1.5 for details
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
int create_placeholder(Ecma119Node *parent,
|
int create_placeholder(Ecma119Node *parent, Ecma119Node *real,
|
||||||
Ecma119Node *real, Ecma119Node **node)
|
Ecma119Node **node)
|
||||||
{
|
{
|
||||||
Ecma119Node *ret;
|
Ecma119Node *ret;
|
||||||
|
|
||||||
|
@ -23,7 +23,8 @@ enum ecma119_node_type {
|
|||||||
/**
|
/**
|
||||||
* Struct with info about a node representing a tree
|
* Struct with info about a node representing a tree
|
||||||
*/
|
*/
|
||||||
struct ecma119_dir_info {
|
struct ecma119_dir_info
|
||||||
|
{
|
||||||
/* Block where the directory entries will be written on image */
|
/* Block where the directory entries will be written on image */
|
||||||
size_t block;
|
size_t block;
|
||||||
|
|
||||||
@ -67,7 +68,8 @@ struct ecma119_node
|
|||||||
|
|
||||||
/**< file, symlink, special, directory or placeholder */
|
/**< file, symlink, special, directory or placeholder */
|
||||||
enum ecma119_node_type type;
|
enum ecma119_node_type type;
|
||||||
union {
|
union
|
||||||
|
{
|
||||||
IsoFileSrc *file;
|
IsoFileSrc *file;
|
||||||
// TODO this wastes too much memory, as dirs have much more
|
// TODO this wastes too much memory, as dirs have much more
|
||||||
// atts than other kind of files. Replace with a pointer.
|
// atts than other kind of files. Replace with a pointer.
|
||||||
|
@ -44,8 +44,7 @@ int iso_file_src_cmp(const void *n1, const void *n2)
|
|||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
/* files belong to same device in same fs */
|
/* files belong to same device in same fs */
|
||||||
return (ino_id1 < ino_id2) ? -1 :
|
return (ino_id1 < ino_id2) ? -1 : (ino_id1 > ino_id2) ? 1 : 0;
|
||||||
(ino_id1 > ino_id2) ? 1 : 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,8 +104,7 @@ off_t iso_file_src_get_size(IsoFileSrc *file)
|
|||||||
return iso_stream_get_size(file->stream);
|
return iso_stream_get_size(file->stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int cmp_by_weight(const void *f1, const void *f2)
|
||||||
cmp_by_weight(const void *f1, const void *f2)
|
|
||||||
{
|
{
|
||||||
IsoFileSrc *f = *((IsoFileSrc**)f1);
|
IsoFileSrc *f = *((IsoFileSrc**)f1);
|
||||||
IsoFileSrc *g = *((IsoFileSrc**)f2);
|
IsoFileSrc *g = *((IsoFileSrc**)f2);
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
struct Iso_File_Src {
|
struct Iso_File_Src
|
||||||
|
{
|
||||||
unsigned int prev_img :1; /**< if the file comes from a previous image */
|
unsigned int prev_img :1; /**< if the file comes from a previous image */
|
||||||
uint32_t block; /**< Block where this file will be written on image */
|
uint32_t block; /**< Block where this file will be written on image */
|
||||||
int sort_weight;
|
int sort_weight;
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
* published by the Free Software Foundation. See COPYING file for details.
|
* published by the Free Software Foundation. See COPYING file for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Filesystem/FileSource implementation to access the local filesystem.
|
* Filesystem/FileSource implementation to access the local filesystem.
|
||||||
*/
|
*/
|
||||||
@ -37,7 +36,8 @@ typedef struct
|
|||||||
|
|
||||||
char *path;
|
char *path;
|
||||||
unsigned int openned :2; /* 0: not openned, 1: file, 2:dir */
|
unsigned int openned :2; /* 0: not openned, 1: file, 2:dir */
|
||||||
union {
|
union
|
||||||
|
{
|
||||||
int fd;
|
int fd;
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
} info;
|
} info;
|
||||||
|
@ -14,8 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some functions here will be moved to libisofs.h when we expose
|
* Some functions here will be moved to libisofs.h when we expose Sources.
|
||||||
* Sources.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -233,7 +232,8 @@ typedef struct IsoFileSource_Iface
|
|||||||
*/
|
*/
|
||||||
} IsoFileSourceIface;
|
} IsoFileSourceIface;
|
||||||
|
|
||||||
struct Iso_File_Source {
|
struct Iso_File_Source
|
||||||
|
{
|
||||||
const IsoFileSourceIface *class;
|
const IsoFileSourceIface *class;
|
||||||
int refcount;
|
int refcount;
|
||||||
void *data;
|
void *data;
|
||||||
@ -246,37 +246,44 @@ void iso_file_source_unref(IsoFileSource *src);
|
|||||||
* this are just helpers to invoque methods in class
|
* this are just helpers to invoque methods in class
|
||||||
*/
|
*/
|
||||||
extern inline
|
extern inline
|
||||||
const char* iso_file_source_get_path(IsoFileSource *src) {
|
const char* iso_file_source_get_path(IsoFileSource *src)
|
||||||
|
{
|
||||||
return src->class->get_path(src);
|
return src->class->get_path(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
char* iso_file_source_get_name(IsoFileSource *src) {
|
char* iso_file_source_get_name(IsoFileSource *src)
|
||||||
|
{
|
||||||
return src->class->get_name(src);
|
return src->class->get_name(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
int iso_file_source_lstat(IsoFileSource *src, struct stat *info) {
|
int iso_file_source_lstat(IsoFileSource *src, struct stat *info)
|
||||||
|
{
|
||||||
return src->class->lstat(src, info);
|
return src->class->lstat(src, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
int iso_file_source_stat(IsoFileSource *src, struct stat *info) {
|
int iso_file_source_stat(IsoFileSource *src, struct stat *info)
|
||||||
|
{
|
||||||
return src->class->stat(src, info);
|
return src->class->stat(src, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
int iso_file_source_open(IsoFileSource *src) {
|
int iso_file_source_open(IsoFileSource *src)
|
||||||
|
{
|
||||||
return src->class->open(src);
|
return src->class->open(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
int iso_file_source_close(IsoFileSource *src) {
|
int iso_file_source_close(IsoFileSource *src)
|
||||||
|
{
|
||||||
return src->class->close(src);
|
return src->class->close(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
int iso_file_source_read(IsoFileSource *src, void *buf, size_t count) {
|
int iso_file_source_read(IsoFileSource *src, void *buf, size_t count)
|
||||||
|
{
|
||||||
return src->class->read(src, buf, count);
|
return src->class->read(src, buf, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,12 +294,14 @@ int iso_file_source_readdir(IsoFileSource *src, IsoFileSource **child)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz) {
|
int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
|
||||||
|
{
|
||||||
return src->class->readlink(src, buf, bufsiz);
|
return src->class->readlink(src, buf, bufsiz);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
IsoFilesystem* iso_file_source_get_filesystem(IsoFileSource *src) {
|
IsoFilesystem* iso_file_source_get_filesystem(IsoFileSource *src)
|
||||||
|
{
|
||||||
return src->class->get_filesystem(src);
|
return src->class->get_filesystem(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,8 +224,7 @@ const char *iso_image_get_abstract_file_id(const IsoImage *image)
|
|||||||
return image->abstract_file_id;
|
return image->abstract_file_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void iso_image_set_biblio_file_id(IsoImage *image,
|
void iso_image_set_biblio_file_id(IsoImage *image, const char *biblio_file_id)
|
||||||
const char *biblio_file_id)
|
|
||||||
{
|
{
|
||||||
free(image->biblio_file_id);
|
free(image->biblio_file_id);
|
||||||
image->biblio_file_id = strdup(biblio_file_id);
|
image->biblio_file_id = strdup(biblio_file_id);
|
||||||
|
@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
typedef struct Iso_Image_Rec_Opts IsoImageRecOpts;
|
typedef struct Iso_Image_Rec_Opts IsoImageRecOpts;
|
||||||
|
|
||||||
struct Iso_Image {
|
struct Iso_Image
|
||||||
|
{
|
||||||
|
|
||||||
int refcount;
|
int refcount;
|
||||||
|
|
||||||
@ -63,7 +64,8 @@ struct Iso_Image {
|
|||||||
/**
|
/**
|
||||||
* Options for recursive directory addition
|
* Options for recursive directory addition
|
||||||
*/
|
*/
|
||||||
struct Iso_Image_Rec_Opts {
|
struct Iso_Image_Rec_Opts
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to follow symlinks or just add them as symlinks
|
* Whether to follow symlinks or just add them as symlinks
|
||||||
|
@ -58,7 +58,8 @@ enum IsoHideNodeFlag {
|
|||||||
/**
|
/**
|
||||||
* Holds the options for the image generation.
|
* Holds the options for the image generation.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
int level; /**< ISO level to write at. */
|
int level; /**< ISO level to write at. */
|
||||||
|
|
||||||
/** Which extensions to support. */
|
/** Which extensions to support. */
|
||||||
@ -275,8 +276,7 @@ const char *iso_image_get_abstract_file_id(const IsoImage *image);
|
|||||||
* Fill biblio information for the image. Usually this refers
|
* Fill biblio information for the image. Usually this refers
|
||||||
* to a file on disc. Up to 37 characters.
|
* to a file on disc. Up to 37 characters.
|
||||||
*/
|
*/
|
||||||
void iso_image_set_biblio_file_id(IsoImage *image,
|
void iso_image_set_biblio_file_id(IsoImage *image, const char *biblio_file_id);
|
||||||
const char *biblio_file_id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the biblio information of a image.
|
* Get the biblio information of a image.
|
||||||
|
@ -64,9 +64,8 @@ void iso_msg_warn(IsoImage *img, int error_code, const char *fmt, ...)
|
|||||||
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
libiso_msgs_submit(img->messenger, -1, error_code,
|
libiso_msgs_submit(img->messenger, -1, error_code, LIBISO_MSGS_SEV_WARNING,
|
||||||
LIBISO_MSGS_SEV_WARNING, LIBISO_MSGS_PRIO_MEDIUM,
|
LIBISO_MSGS_PRIO_MEDIUM, msg, 0, 0);
|
||||||
msg, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void iso_msg_sorry(IsoImage *img, int error_code, const char *fmt, ...)
|
void iso_msg_sorry(IsoImage *img, int error_code, const char *fmt, ...)
|
||||||
@ -78,9 +77,8 @@ void iso_msg_sorry(IsoImage *img, int error_code, const char *fmt, ...)
|
|||||||
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
libiso_msgs_submit(img->messenger, -1, error_code,
|
libiso_msgs_submit(img->messenger, -1, error_code, LIBISO_MSGS_SEV_SORRY,
|
||||||
LIBISO_MSGS_SEV_SORRY, LIBISO_MSGS_PRIO_HIGH,
|
LIBISO_MSGS_PRIO_HIGH, msg, 0, 0);
|
||||||
msg, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void iso_msg_fatal(IsoImage *img, int error_code, const char *fmt, ...)
|
void iso_msg_fatal(IsoImage *img, int error_code, const char *fmt, ...)
|
||||||
@ -92,9 +90,8 @@ void iso_msg_fatal(IsoImage *img, int error_code, const char *fmt, ...)
|
|||||||
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
vsnprintf(msg, MAX_MSG_LEN, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
libiso_msgs_submit(img->messenger, -1, error_code,
|
libiso_msgs_submit(img->messenger, -1, error_code, LIBISO_MSGS_SEV_FATAL,
|
||||||
LIBISO_MSGS_SEV_FATAL, LIBISO_MSGS_PRIO_HIGH,
|
LIBISO_MSGS_PRIO_HIGH, msg, 0, 0);
|
||||||
msg, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,8 +118,8 @@ int iso_image_set_msgs_severities(IsoImage *img, char *queue_severity,
|
|||||||
ret = libiso_msgs__text_to_sev(print_severity, &print_sevno, 0);
|
ret = libiso_msgs__text_to_sev(print_severity, &print_sevno, 0);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
ret = libiso_msgs_set_severities(img->messenger, queue_sevno,
|
ret = libiso_msgs_set_severities(img->messenger, queue_sevno, print_sevno,
|
||||||
print_sevno, print_id, 0);
|
print_id, 0);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -181,7 +178,7 @@ int iso_image_obtain_msgs(IsoImage *img, char *minimum_severity,
|
|||||||
strcpy(severity, sev_name);
|
strcpy(severity, sev_name);
|
||||||
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
ex:
|
ex: ;
|
||||||
libiso_msgs_destroy_item(img->messenger, &item, 0);
|
libiso_msgs_destroy_item(img->messenger, &item, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,6 @@ mode_t iso_node_get_mode(const IsoNode *node)
|
|||||||
return node->mode;
|
return node->mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the user id for the node. This attribute is only useful when
|
* Set the user id for the node. This attribute is only useful when
|
||||||
* Rock Ridge extensions are enabled.
|
* Rock Ridge extensions are enabled.
|
||||||
@ -437,8 +436,7 @@ void iso_dir_iter_free(IsoDirIter *iter)
|
|||||||
free(iter);
|
free(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static IsoNode**
|
static IsoNode** iso_dir_find_node(IsoDir *dir, IsoNode *node)
|
||||||
iso_dir_find_node(IsoDir *dir, IsoNode *node)
|
|
||||||
{
|
{
|
||||||
IsoNode **pos;
|
IsoNode **pos;
|
||||||
pos = &(dir->children);
|
pos = &(dir->children);
|
||||||
|
@ -34,7 +34,7 @@ struct Iso_Node
|
|||||||
*/
|
*/
|
||||||
int refcount;
|
int refcount;
|
||||||
|
|
||||||
/**< Type of the IsoNode, do not confuse with mode */
|
/** Type of the IsoNode, do not confuse with mode */
|
||||||
enum IsoNodeType type;
|
enum IsoNodeType type;
|
||||||
|
|
||||||
char *name; /**< Real name, in default charset */
|
char *name; /**< Real name, in default charset */
|
||||||
|
@ -20,8 +20,8 @@ static
|
|||||||
int susp_append(Ecma119Image *t, struct susp_info *susp, uint8_t *data)
|
int susp_append(Ecma119Image *t, struct susp_info *susp, uint8_t *data)
|
||||||
{
|
{
|
||||||
susp->n_susp_fields++;
|
susp->n_susp_fields++;
|
||||||
susp->susp_fields = realloc(susp->susp_fields,
|
susp->susp_fields = realloc(susp->susp_fields, sizeof(void*)
|
||||||
sizeof(void*) * susp->n_susp_fields);
|
* susp->n_susp_fields);
|
||||||
if (susp->susp_fields == NULL) {
|
if (susp->susp_fields == NULL) {
|
||||||
return ISO_MEM_ERROR;
|
return ISO_MEM_ERROR;
|
||||||
}
|
}
|
||||||
@ -34,8 +34,8 @@ static
|
|||||||
int susp_append_ce(Ecma119Image *t, struct susp_info *susp, uint8_t *data)
|
int susp_append_ce(Ecma119Image *t, struct susp_info *susp, uint8_t *data)
|
||||||
{
|
{
|
||||||
susp->n_ce_susp_fields++;
|
susp->n_ce_susp_fields++;
|
||||||
susp->ce_susp_fields = realloc(susp->ce_susp_fields,
|
susp->ce_susp_fields = realloc(susp->ce_susp_fields, sizeof(void*)
|
||||||
sizeof(void*) * susp->n_ce_susp_fields);
|
* susp->n_ce_susp_fields);
|
||||||
if (susp->ce_susp_fields == NULL) {
|
if (susp->ce_susp_fields == NULL) {
|
||||||
return ISO_MEM_ERROR;
|
return ISO_MEM_ERROR;
|
||||||
}
|
}
|
||||||
@ -285,8 +285,8 @@ char *get_rr_name(Ecma119Image *t, Ecma119Node *n)
|
|||||||
* Whether to add or not to CE
|
* Whether to add or not to CE
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
int rrip_add_NM(Ecma119Image *t, struct susp_info *susp,
|
int rrip_add_NM(Ecma119Image *t, struct susp_info *susp, char *name, int size,
|
||||||
char *name, int size, int flags, int ce)
|
int flags, int ce)
|
||||||
{
|
{
|
||||||
uint8_t *NM = malloc(size + 5);
|
uint8_t *NM = malloc(size + 5);
|
||||||
if (NM == NULL) {
|
if (NM == NULL) {
|
||||||
@ -325,8 +325,7 @@ int rrip_add_NM(Ecma119Image *t, struct susp_info *susp,
|
|||||||
* 1 on success, < 0 on error
|
* 1 on success, < 0 on error
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
int rrip_SL_append_comp(size_t *n, uint8_t ***comps,
|
int rrip_SL_append_comp(size_t *n, uint8_t ***comps, char *s, int size, char fl)
|
||||||
char *s, int size, char fl)
|
|
||||||
{
|
{
|
||||||
uint8_t *comp = malloc(size + 2);
|
uint8_t *comp = malloc(size + 2);
|
||||||
if (comp == NULL) {
|
if (comp == NULL) {
|
||||||
@ -363,8 +362,8 @@ int rrip_SL_append_comp(size_t *n, uint8_t ***comps,
|
|||||||
* Whether to add to a continuation area or system use field.
|
* Whether to add to a continuation area or system use field.
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
int rrip_add_SL(Ecma119Image *t, struct susp_info *susp,
|
int rrip_add_SL(Ecma119Image *t, struct susp_info *susp, uint8_t **comp,
|
||||||
uint8_t **comp, size_t n, int ce)
|
size_t n, int ce)
|
||||||
{
|
{
|
||||||
int ret, i, j;
|
int ret, i, j;
|
||||||
|
|
||||||
@ -531,8 +530,8 @@ int susp_add_SP(Ecma119Image *t, struct susp_info *susp)
|
|||||||
* @return
|
* @return
|
||||||
* The size needed for the RR entries in the System Use Area
|
* The size needed for the RR entries in the System Use Area
|
||||||
*/
|
*/
|
||||||
size_t rrip_calc_len(Ecma119Image *t, Ecma119Node *n, int type,
|
size_t rrip_calc_len(Ecma119Image *t, Ecma119Node *n, int type, size_t space,
|
||||||
size_t space, size_t *ce)
|
size_t *ce)
|
||||||
{
|
{
|
||||||
size_t su_size;
|
size_t su_size;
|
||||||
|
|
||||||
@ -884,7 +883,8 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
|
|||||||
if (clen == 0) {
|
if (clen == 0) {
|
||||||
/* this refers to the roor directory, '/' */
|
/* this refers to the roor directory, '/' */
|
||||||
cflag = 1 << 3;
|
cflag = 1 << 3;
|
||||||
} if (clen == 1 && prev[0] == '.') {
|
}
|
||||||
|
if (clen == 1 && prev[0] == '.') {
|
||||||
clen = 0;
|
clen = 0;
|
||||||
cflag = 1 << 1;
|
cflag = 1 << 1;
|
||||||
} else if (clen == 2 && prev[0] == '.' && prev[1] == '.') {
|
} else if (clen == 2 && prev[0] == '.' && prev[1] == '.') {
|
||||||
@ -952,10 +952,8 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
|
|||||||
* and another component, that will go in
|
* and another component, that will go in
|
||||||
* other SL entry
|
* other SL entry
|
||||||
*/
|
*/
|
||||||
ret = rrip_SL_append_comp(&n_comp, &comps,
|
ret = rrip_SL_append_comp(&n_comp, &comps, prev
|
||||||
prev + fit,
|
+ fit, clen - fit - 2, 0);
|
||||||
clen - fit - 2,
|
|
||||||
0);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto add_susp_cleanup;
|
goto add_susp_cleanup;
|
||||||
}
|
}
|
||||||
@ -972,10 +970,8 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto add_susp_cleanup;
|
goto add_susp_cleanup;
|
||||||
}
|
}
|
||||||
ret = rrip_SL_append_comp(&n_comp, &comps,
|
ret = rrip_SL_append_comp(&n_comp, &comps, prev
|
||||||
prev + 248,
|
+ 248, strlen(prev + 248), 0x00);
|
||||||
strlen(prev + 248),
|
|
||||||
0x00);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto add_susp_cleanup;
|
goto add_susp_cleanup;
|
||||||
}
|
}
|
||||||
@ -1076,7 +1072,6 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* "." or ".." entry */
|
/* "." or ".." entry */
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include "ecma119.h"
|
#include "ecma119.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This contains the information about the System Use Fields (SUSP, 4.1),
|
* This contains the information about the System Use Fields (SUSP, 4.1),
|
||||||
* that will be written in the System Use Areas, both in the ISO directory
|
* that will be written in the System Use Areas, both in the ISO directory
|
||||||
@ -66,8 +65,8 @@ struct susp_info
|
|||||||
* @return
|
* @return
|
||||||
* The size needed for the RR entries in the System Use Area
|
* The size needed for the RR entries in the System Use Area
|
||||||
*/
|
*/
|
||||||
size_t rrip_calc_len(Ecma119Image *t, Ecma119Node *n, int type,
|
size_t rrip_calc_len(Ecma119Image *t, Ecma119Node *n, int type, size_t space,
|
||||||
size_t space, size_t *ce);
|
size_t *ce);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill a struct susp_info with the RR/SUSP entries needed for a given
|
* Fill a struct susp_info with the RR/SUSP entries needed for a given
|
||||||
|
20
src/stream.h
20
src/stream.h
@ -98,33 +98,39 @@ void iso_stream_ref(IsoStream *stream);
|
|||||||
void iso_stream_unref(IsoStream *stream);
|
void iso_stream_unref(IsoStream *stream);
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
int iso_stream_open(IsoStream *stream) {
|
int iso_stream_open(IsoStream *stream)
|
||||||
|
{
|
||||||
return stream->class->open(stream);
|
return stream->class->open(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
int iso_stream_close(IsoStream *stream) {
|
int iso_stream_close(IsoStream *stream)
|
||||||
|
{
|
||||||
return stream->class->close(stream);
|
return stream->class->close(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
off_t iso_stream_get_size(IsoStream *stream) {
|
off_t iso_stream_get_size(IsoStream *stream)
|
||||||
|
{
|
||||||
return stream->class->get_size(stream);
|
return stream->class->get_size(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
int iso_stream_read(IsoStream *stream, void *buf, size_t count) {
|
int iso_stream_read(IsoStream *stream, void *buf, size_t count)
|
||||||
|
{
|
||||||
return stream->class->read(stream, buf, count);
|
return stream->class->read(stream, buf, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
int iso_stream_is_repeatable(IsoStream *stream) {
|
int iso_stream_is_repeatable(IsoStream *stream)
|
||||||
|
{
|
||||||
return stream->class->is_repeatable(stream);
|
return stream->class->is_repeatable(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern inline
|
extern inline
|
||||||
int iso_stream_get_id(IsoStream *stream, unsigned int *fs_id,
|
int iso_stream_get_id(IsoStream *stream, unsigned int *fs_id, dev_t *dev_id,
|
||||||
dev_t *dev_id, ino_t *ino_id) {
|
ino_t *ino_id)
|
||||||
|
{
|
||||||
return stream->class->get_id(stream, fs_id, dev_id, ino_id);
|
return stream->class->get_id(stream, fs_id, dev_id, ino_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,8 +458,8 @@ int iso_add_dir_aux(IsoImage *image, IsoDir *parent, IsoFileSource *dir)
|
|||||||
result = builder->create_node(builder, image, file, &new);
|
result = builder->create_node(builder, image, file, &new);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
|
||||||
iso_msg_debug(image, "Error %d when adding file %s",
|
iso_msg_debug(image, "Error %d when adding file %s", result,
|
||||||
result, iso_file_source_get_path(file));
|
iso_file_source_get_path(file));
|
||||||
|
|
||||||
if (image->recOpts->report) {
|
if (image->recOpts->report) {
|
||||||
action = image->recOpts->report(file, result, flag);
|
action = image->recOpts->report(file, result, flag);
|
||||||
|
107
src/util.c
107
src/util.c
@ -28,7 +28,6 @@ int int_pow(int base, int power)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int strconv(const char *str, const char *icharset, const char *ocharset,
|
int strconv(const char *str, const char *icharset, const char *ocharset,
|
||||||
char **output)
|
char **output)
|
||||||
{
|
{
|
||||||
@ -238,8 +237,8 @@ static int valid_d_char(char c)
|
|||||||
|
|
||||||
static int valid_a_char(char c)
|
static int valid_a_char(char c)
|
||||||
{
|
{
|
||||||
return (c >= ' ' && c <= '"') || (c >= '%' && c <= '?')
|
return (c >= ' ' && c <= '"') || (c >= '%' && c <= '?') ||
|
||||||
|| (c >= 'A' && c <= 'Z') || (c == '_');
|
(c >= 'A' && c <= 'Z') || (c == '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -274,7 +273,7 @@ char *iso_2_dirid(const char *src)
|
|||||||
char *iso_1_fileid(const char *src)
|
char *iso_1_fileid(const char *src)
|
||||||
{
|
{
|
||||||
char *dot; /* Position of the last dot in the filename, will be used
|
char *dot; /* Position of the last dot in the filename, will be used
|
||||||
to calculate lname and lext. */
|
* to calculate lname and lext. */
|
||||||
int lname, lext, pos, i;
|
int lname, lext, pos, i;
|
||||||
char dest[13]; /* 13 = 8 (name) + 1 (.) + 3 (ext) + 1 (\0) */
|
char dest[13]; /* 13 = 8 (name) + 1 (.) + 3 (ext) + 1 (\0) */
|
||||||
|
|
||||||
@ -339,8 +338,8 @@ char *iso_2_fileid(const char *src)
|
|||||||
} else {
|
} else {
|
||||||
lext = strlen(dot + 1);
|
lext = strlen(dot + 1);
|
||||||
lname = strlen(src) - lext - 1;
|
lname = strlen(src) - lext - 1;
|
||||||
lnext = (strlen(src) > 31 && lext > 3)
|
lnext = (strlen(src) > 31 && lext > 3) ? (lname < 27 ? 30 - lname : 3)
|
||||||
? (lname < 27 ? 30 - lname : 3) : lext;
|
: lext;
|
||||||
lnname = (strlen(src) > 31) ? 30 - lnext : lname;
|
lnname = (strlen(src) > 31) ? 30 - lnext : lname;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,102 +367,6 @@ char *iso_2_fileid(const char *src)
|
|||||||
return strdup(dest);
|
return strdup(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void iso_dirid(char *src, int maxlen)
|
|
||||||
//{
|
|
||||||
// size_t len, i;
|
|
||||||
//
|
|
||||||
// len = strlen(src);
|
|
||||||
// if (len > maxlen) {
|
|
||||||
// src[maxlen] = '\0';
|
|
||||||
// len = maxlen;
|
|
||||||
// }
|
|
||||||
// for (i = 0; i < len; i++) {
|
|
||||||
// char c = toupper(src[i]);
|
|
||||||
// src[i] = valid_d_char(c) ? c : '_';
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//void iso_1_fileid(char *src)
|
|
||||||
//{
|
|
||||||
// char *dot; /* Position of the last dot in the filename, will be used to
|
|
||||||
// calculate lname and lext. */
|
|
||||||
// int lname, lext, pos, i;
|
|
||||||
//
|
|
||||||
// dot = strrchr(src, '.');
|
|
||||||
//
|
|
||||||
// lext = dot ? strlen(dot + 1) : 0;
|
|
||||||
// lname = strlen(src) - lext - (dot ? 1 : 0);
|
|
||||||
//
|
|
||||||
// /* If we can't build a filename, return. */
|
|
||||||
// if (lname == 0 && lext == 0) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// pos = 0;
|
|
||||||
// /* Convert up to 8 characters of the filename. */
|
|
||||||
// for (i = 0; i < lname && i < 8; i++) {
|
|
||||||
// char c = toupper(src[i]);
|
|
||||||
// src[pos++] = valid_d_char(c) ? c : '_';
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /* This dot is mandatory, even if there is no extension. */
|
|
||||||
// src[pos++] = '.';
|
|
||||||
//
|
|
||||||
// /* Convert up to 3 characters of the extension, if any. */
|
|
||||||
// for (i = 0; i < lext && i < 3; i++) {
|
|
||||||
// char c = toupper(src[lname + 1 + i]);
|
|
||||||
// src[pos++] = valid_d_char(c) ? c : '_';
|
|
||||||
// }
|
|
||||||
// src[pos] = '\0';
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//void iso_2_fileid(char *src)
|
|
||||||
//{
|
|
||||||
// char *dot;
|
|
||||||
// int lname, lext, lnname, lnext, pos, i;
|
|
||||||
//
|
|
||||||
// if (!src)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// dot = strrchr(src, '.');
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * Since the maximum length can be divided freely over the name and
|
|
||||||
// * extension, we need to calculate their new lengths (lnname and
|
|
||||||
// * lnext). If the original filename is too long, we start by trimming
|
|
||||||
// * the extension, but keep a minimum extension length of 3.
|
|
||||||
// */
|
|
||||||
// if (dot == NULL || *(dot + 1) == '\0') {
|
|
||||||
// lname = strlen(src);
|
|
||||||
// lnname = (lname > 30) ? 30 : lname;
|
|
||||||
// lext = lnext = 0;
|
|
||||||
// } else {
|
|
||||||
// lext = strlen(dot + 1);
|
|
||||||
// lname = strlen(src) - lext - 1;
|
|
||||||
// lnext = (strlen(src) > 31 && lext > 3)
|
|
||||||
// ? (lname < 27 ? 30 - lname : 3) : lext;
|
|
||||||
// lnname = (strlen(src) > 31) ? 30 - lnext : lname;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (lnname == 0 && lnext == 0) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// pos = 0;
|
|
||||||
// /* Convert up to lnname characters of the filename. */
|
|
||||||
// for (i = 0; i < lnname; i++) {
|
|
||||||
// char c = toupper(src[i]);
|
|
||||||
// src[pos++] = valid_d_char(c) ? c : '_';
|
|
||||||
// }
|
|
||||||
// src[pos++] = '.';
|
|
||||||
// /* Convert up to lnext characters of the extension, if any. */
|
|
||||||
// for (i = 0; i < lnext; i++) {
|
|
||||||
// char c = toupper(src[lname + 1 + i]);
|
|
||||||
// src[pos++] = valid_d_char(c) ? c : '_';
|
|
||||||
// }
|
|
||||||
// src[pos] = '\0';
|
|
||||||
//}
|
|
||||||
|
|
||||||
int str2d_char(const char *icharset, const char *input, char **output)
|
int str2d_char(const char *icharset, const char *input, char **output)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -16,13 +16,15 @@
|
|||||||
* implementation of Julienne Walker.
|
* implementation of Julienne Walker.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct iso_rbnode {
|
struct iso_rbnode
|
||||||
|
{
|
||||||
void *data;
|
void *data;
|
||||||
struct iso_rbnode *ch[2];
|
struct iso_rbnode *ch[2];
|
||||||
unsigned int red :1;
|
unsigned int red :1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct iso_rbtree {
|
struct iso_rbtree
|
||||||
|
{
|
||||||
struct iso_rbnode *root;
|
struct iso_rbnode *root;
|
||||||
size_t size;
|
size_t size;
|
||||||
int (*compare)(const void *a, const void *b);
|
int (*compare)(const void *a, const void *b);
|
||||||
@ -40,8 +42,7 @@ struct iso_rbtree {
|
|||||||
* @param tree
|
* @param tree
|
||||||
* Location where the tree structure will be stored.
|
* Location where the tree structure will be stored.
|
||||||
*/
|
*/
|
||||||
int
|
int iso_rbtree_new(int (*compare)(const void*, const void*), IsoRBTree **tree)
|
||||||
iso_rbtree_new(int (*compare)(const void*, const void*), IsoRBTree **tree)
|
|
||||||
{
|
{
|
||||||
if (compare == NULL || tree == NULL) {
|
if (compare == NULL || tree == NULL) {
|
||||||
return ISO_NULL_POINTER;
|
return ISO_NULL_POINTER;
|
||||||
@ -75,8 +76,7 @@ void rbtree_destroy_aux(struct iso_rbnode *root, void (*free_data)(void *))
|
|||||||
* should provide a valid free_data function. It will be called for each
|
* should provide a valid free_data function. It will be called for each
|
||||||
* element of the tree, so you can use it to free any related data.
|
* element of the tree, so you can use it to free any related data.
|
||||||
*/
|
*/
|
||||||
void
|
void iso_rbtree_destroy(IsoRBTree *tree, void (*free_data)(void *))
|
||||||
iso_rbtree_destroy(IsoRBTree *tree, void (*free_data)(void *))
|
|
||||||
{
|
{
|
||||||
if (tree == NULL) {
|
if (tree == NULL) {
|
||||||
return;
|
return;
|
||||||
@ -243,7 +243,6 @@ size_t iso_rbtree_get_size(IsoRBTree *tree)
|
|||||||
return tree->size;
|
return tree->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
int rbtree_to_array_aux(struct iso_rbnode *root, void **array, size_t pos)
|
int rbtree_to_array_aux(struct iso_rbnode *root, void **array, size_t pos)
|
||||||
{
|
{
|
||||||
@ -265,8 +264,7 @@ int rbtree_to_array_aux(struct iso_rbnode *root, void **array, size_t pos)
|
|||||||
* no more needed. Note that the array is NULL-terminated, and thus it
|
* no more needed. Note that the array is NULL-terminated, and thus it
|
||||||
* has size + 1 length.
|
* has size + 1 length.
|
||||||
*/
|
*/
|
||||||
void **
|
void ** iso_rbtree_to_array(IsoRBTree *tree)
|
||||||
iso_rbtree_to_array(IsoRBTree *tree)
|
|
||||||
{
|
{
|
||||||
void **array;
|
void **array;
|
||||||
|
|
||||||
|
@ -28,8 +28,7 @@ struct Iso_Image_Writer
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the function all Writers shoudl call to write data to
|
* This is the function all Writers shoudl call to write data to image.
|
||||||
* image.
|
|
||||||
* Currently, it is just a wrapper for write(2) Unix system call.
|
* Currently, it is just a wrapper for write(2) Unix system call.
|
||||||
*
|
*
|
||||||
* It is implemented in ecma119.c
|
* It is implemented in ecma119.c
|
||||||
|
Loading…
x
Reference in New Issue
Block a user