Define code style formatter for eclipse and apply it to source.

This commit is contained in:
Vreixo Formoso 2007-12-28 22:10:17 +01:00
parent 1ecb735e7c
commit 4c9d83f051
31 changed files with 1018 additions and 1019 deletions

View File

@ -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">

View File

@ -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

View File

@ -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;
}; };
@ -46,7 +47,7 @@ void *write_function(void *arg)
} }
res = 1; res = 1;
while ( (bytes = read(fd, tmp, WRITE_CHUNK)) > 0 ) { while ( (bytes = read(fd, tmp, WRITE_CHUNK)) > 0) {
res = iso_ring_buffer_write(data->rbuf, tmp, bytes); res = iso_ring_buffer_write(data->rbuf, tmp, bytes);
if (res <= 0) { if (res <= 0) {
break; break;
@ -55,10 +56,10 @@ void *write_function(void *arg)
iso_ring_buffer_writer_close(data->rbuf); iso_ring_buffer_writer_close(data->rbuf);
pthread_exit(NULL); pthread_exit(NULL);
<<<<<<<<<<<<<<<<<<<<<<<<< */ <<<<<<<<<<<<<<<<<<<<<<<<< */
// if (rand() > 2000000000) { // if (rand() > 2000000000) {
// fprintf(stderr, "Writer sleeping\n"); // fprintf(stderr, "Writer sleeping\n");
// sleep(1); // sleep(1);
// } // }
} }
fprintf(stderr, "Writer finish: %d\n", res); fprintf(stderr, "Writer finish: %d\n", res);
@ -74,16 +75,16 @@ void *read_function(void *arg)
int res = 1; int res = 1;
struct th_data *data = (struct th_data *) arg; struct th_data *data = (struct th_data *) arg;
while ( (res = iso_ring_buffer_read(data->rbuf, tmp, READ_CHUNK)) > 0 ) { while ( (res = iso_ring_buffer_read(data->rbuf, tmp, READ_CHUNK)) > 0) {
write(1, tmp, READ_CHUNK); write(1, tmp, READ_CHUNK);
/* To test premature reader exit >>>>>>>>>>> /* To test premature reader exit >>>>>>>>>>>
iso_ring_buffer_reader_close(data->rbuf); iso_ring_buffer_reader_close(data->rbuf);
pthread_exit(NULL); pthread_exit(NULL);
<<<<<<<<<<<<<<<<<<<<<<<<< */ <<<<<<<<<<<<<<<<<<<<<<<<< */
// if (rand() > 2000000000) { // if (rand() > 2000000000) {
// fprintf(stderr, "Reader sleeping\n"); // fprintf(stderr, "Reader sleeping\n");
// sleep(1); // sleep(1);
// } // }
} }
fprintf(stderr, "Reader finish: %d\n", res); fprintf(stderr, "Reader finish: %d\n", res);

91
doc/devel/codestyle.xml Normal file
View 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>

View File

@ -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];
/* /*
@ -41,8 +42,8 @@ struct iso_ring_buffer {
size_t wpos; size_t wpos;
/* flags to report if read or writer threads ends execution */ /* flags to report if read or writer threads ends execution */
unsigned int rend:1; unsigned int rend :1;
unsigned int wend:1; unsigned int wend :1;
/* just for statistical purposes */ /* just for statistical purposes */
unsigned int times_full; unsigned int times_full;

View File

@ -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;
@ -433,7 +433,7 @@ int write_one_dir(Ecma119Image *t, Ecma119Node *dir)
len += info.suf_len; len += info.suf_len;
} }
if ( (buf + len - buffer) > BLOCK_SIZE ) { if ( (buf + len - buffer) > BLOCK_SIZE) {
/* dir doesn't fit in current block */ /* dir doesn't fit in current block */
ret = iso_write(t, buffer, BLOCK_SIZE); ret = iso_write(t, buffer, BLOCK_SIZE);
if (ret < 0) { if (ret < 0) {
@ -496,7 +496,7 @@ int write_path_table(Ecma119Image *t, Ecma119Node **pathlist, int l_type)
Ecma119Node *dir; Ecma119Node *dir;
uint32_t path_table_size; uint32_t path_table_size;
int parent = 0; int parent = 0;
int ret = ISO_SUCCESS; int ret= ISO_SUCCESS;
path_table_size = 0; path_table_size = 0;
write_int = l_type ? iso_lsb : iso_msb; write_int = l_type ? iso_lsb : iso_msb;
@ -575,7 +575,7 @@ int write_path_tables(Ecma119Image *t)
/* Write L Path Table */ /* Write L Path Table */
ret = write_path_table(t, pathlist, 0); ret = write_path_table(t, pathlist, 0);
write_path_tables_exit:; write_path_tables_exit: ;
free(pathlist); free(pathlist);
return ret; return ret;
} }
@ -702,7 +702,7 @@ void *write_function(void *arg)
iso_ring_buffer_writer_close(target->buffer); iso_ring_buffer_writer_close(target->buffer);
pthread_exit(NULL); pthread_exit(NULL);
write_error:; write_error: ;
iso_msg_fatal(target->image, LIBISO_WRITE_ERROR, iso_msg_fatal(target->image, LIBISO_WRITE_ERROR,
"Image write error, code %d", res); "Image write error, code %d", res);
iso_ring_buffer_writer_close(target->buffer); iso_ring_buffer_writer_close(target->buffer);
@ -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;
@ -857,13 +856,12 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts,
*img = target; *img = target;
return ISO_SUCCESS; return ISO_SUCCESS;
target_cleanup:; target_cleanup: ;
ecma119_image_free(target); ecma119_image_free(target);
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;
@ -927,7 +923,7 @@ int iso_image_create(IsoImage *image, Ecma119WriteOpts *opts,
{ {
int ret; int ret;
struct burn_source *source; struct burn_source *source;
Ecma119Image *target = NULL; Ecma119Image *target= NULL;
if (image == NULL || opts == NULL || burn_src == NULL) { if (image == NULL || opts == NULL || burn_src == NULL) {
return ISO_NULL_POINTER; return ISO_NULL_POINTER;

View File

@ -23,36 +23,39 @@ 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;
unsigned int iso_level:2; unsigned int iso_level :2;
/* extensions */ /* extensions */
unsigned int rockridge:1; unsigned int rockridge :1;
/* relaxed constraints */ /* relaxed constraints */
unsigned int omit_version_numbers:1; unsigned int omit_version_numbers :1;
unsigned int allow_deep_paths:1; unsigned int allow_deep_paths :1;
// int relaxed_constraints; /**< see ecma119_relaxed_constraints_flag */ // int relaxed_constraints; /**< see ecma119_relaxed_constraints_flag */
/* /*
* Mode replace. If one of these flags is set, the correspodent values are * Mode replace. If one of these flags is set, the correspodent values are
* replaced with values below. * replaced with values below.
*/ */
unsigned int replace_uid:1; unsigned int replace_uid :1;
unsigned int replace_gid:1; unsigned int replace_gid :1;
unsigned int replace_file_mode:1; unsigned int replace_file_mode :1;
unsigned int replace_dir_mode:1; unsigned int replace_dir_mode :1;
uid_t uid; uid_t uid;
gid_t gid; gid_t gid;
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;
/* /*

View File

@ -25,7 +25,7 @@ int get_iso_name(Ecma119Image *img, IsoNode *iso, char **name)
{ {
int ret; int ret;
char *ascii_name; char *ascii_name;
char *isoname = NULL; char *isoname= NULL;
if (iso->name == NULL) { if (iso->name == NULL) {
/* it is not necessarily an error, it can be the root */ /* it is not necessarily an error, it can be the root */
@ -214,7 +214,7 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
int ret; int ret;
Ecma119Node *node; Ecma119Node *node;
int max_path; int max_path;
char *iso_name = NULL; char *iso_name= NULL;
if (image == NULL || iso == NULL || tree == NULL) { if (image == NULL || iso == NULL || tree == NULL) {
return ISO_NULL_POINTER; return ISO_NULL_POINTER;
@ -239,7 +239,7 @@ int create_tree(Ecma119Image *image, IsoNode *iso, Ecma119Node **tree,
} }
} }
switch(iso->type) { switch (iso->type) {
case LIBISO_FILE: case LIBISO_FILE:
ret = create_file(image, (IsoFile*)iso, &node); ret = create_file(image, (IsoFile*)iso, &node);
break; break;
@ -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;
@ -634,7 +632,7 @@ int reparent(Ecma119Node *child, Ecma119Node *parent)
Ecma119Node *placeholder; Ecma119Node *placeholder;
/* replace the child in the original parent with a placeholder */ /* replace the child in the original parent with a placeholder */
for ( i = 0; i < child->parent->info.dir.nchildren; i++) { for (i = 0; i < child->parent->info.dir.nchildren; i++) {
if (child->parent->info.dir.children[i] == child) { if (child->parent->info.dir.children[i] == child) {
ret = create_placeholder(child->parent, child, &placeholder); ret = create_placeholder(child->parent, child, &placeholder);
if (ret < 0) { if (ret < 0) {
@ -656,8 +654,8 @@ int reparent(Ecma119Node *child, Ecma119Node *parent)
/* add the child to its new parent */ /* add the child to its new parent */
child->parent = parent; child->parent = parent;
parent->info.dir.nchildren++; parent->info.dir.nchildren++;
parent->info.dir.children = realloc( parent->info.dir.children, parent->info.dir.children = realloc(parent->info.dir.children,
sizeof(void*) * parent->info.dir.nchildren ); sizeof(void*) * parent->info.dir.nchildren);
parent->info.dir.children[parent->info.dir.nchildren - 1] = child; parent->info.dir.children[parent->info.dir.nchildren - 1] = child;
return ISO_SUCCESS; return ISO_SUCCESS;
} }

View File

@ -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.

View File

@ -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);

View File

@ -14,8 +14,9 @@
#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;
IsoStream *stream; IsoStream *stream;

View File

@ -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.
*/ */
@ -29,15 +28,16 @@
/* /*
* We can share a local filesystem object, as it has no private atts. * We can share a local filesystem object, as it has no private atts.
*/ */
IsoFilesystem *lfs = NULL; IsoFilesystem *lfs= NULL;
typedef struct typedef struct
{ {
/* IsoFilesystem *fs; It seems not needed */ /* IsoFilesystem *fs; It seems not needed */
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;
@ -77,7 +77,7 @@ int lfs_lstat(IsoFileSource *src, struct stat *info)
int err; int err;
/* error, choose an appropriate return code */ /* error, choose an appropriate return code */
switch(errno) { switch (errno) {
case EACCES: case EACCES:
err = ISO_FILE_ACCESS_DENIED; err = ISO_FILE_ACCESS_DENIED;
break; break;
@ -116,7 +116,7 @@ int lfs_stat(IsoFileSource *src, struct stat *info)
int err; int err;
/* error, choose an appropriate return code */ /* error, choose an appropriate return code */
switch(errno) { switch (errno) {
case EACCES: case EACCES:
err = ISO_FILE_ACCESS_DENIED; err = ISO_FILE_ACCESS_DENIED;
break; break;
@ -176,7 +176,7 @@ int lfs_open(IsoFileSource *src)
* parsed in the lstat call above * parsed in the lstat call above
*/ */
if (data->openned == 0) { if (data->openned == 0) {
switch(errno) { switch (errno) {
case EACCES: case EACCES:
err = ISO_FILE_ACCESS_DENIED; err = ISO_FILE_ACCESS_DENIED;
break; break;
@ -205,7 +205,7 @@ int lfs_close(IsoFileSource *src)
} }
data = src->data; data = src->data;
switch(data->openned) { switch (data->openned) {
case 1: /* not dir */ case 1: /* not dir */
ret = close(data->info.fd) == 0 ? ISO_SUCCESS : ISO_FILE_ERROR; ret = close(data->info.fd) == 0 ? ISO_SUCCESS : ISO_FILE_ERROR;
break; break;
@ -232,14 +232,14 @@ int lfs_read(IsoFileSource *src, void *buf, size_t count)
} }
data = src->data; data = src->data;
switch(data->openned) { switch (data->openned) {
case 1: /* not dir */ case 1: /* not dir */
{ {
int ret; int ret;
ret = read(data->info.fd, buf, count); ret = read(data->info.fd, buf, count);
if (ret < 0) { if (ret < 0) {
/* error on read */ /* error on read */
switch(errno) { switch (errno) {
case EINTR: case EINTR:
ret = ISO_INTERRUPTED; ret = ISO_INTERRUPTED;
break; break;
@ -273,7 +273,7 @@ int lfs_readdir(IsoFileSource *src, IsoFileSource **child)
} }
data = src->data; data = src->data;
switch(data->openned) { switch (data->openned) {
case 1: /* not dir */ case 1: /* not dir */
return ISO_FILE_IS_NOT_DIR; return ISO_FILE_IS_NOT_DIR;
case 2: /* directory */ case 2: /* directory */
@ -292,7 +292,7 @@ int lfs_readdir(IsoFileSource *src, IsoFileSource **child)
else else
return 0; /* EOF */ return 0; /* EOF */
} }
if (strcmp(entry->d_name,".") && strcmp(entry->d_name,"..")) { if (strcmp(entry->d_name, ".") && strcmp(entry->d_name, "..")) {
break; break;
} }
} }
@ -342,7 +342,7 @@ int lfs_readlink(IsoFileSource *src, char *buf, size_t bufsiz)
size = readlink(data->path, buf, bufsiz - 1); size = readlink(data->path, buf, bufsiz - 1);
if (size < 0) { if (size < 0) {
/* error */ /* error */
switch(errno) { switch (errno) {
case EACCES: case EACCES:
return ISO_FILE_ACCESS_DENIED; return ISO_FILE_ACCESS_DENIED;
case ENOTDIR: case ENOTDIR:

View File

@ -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);
} }

View File

@ -77,7 +77,7 @@ int iso_image_new(const char *name, IsoImage **image)
return res; return res;
} }
img->refcount = 1; img->refcount = 1;
img->recOpts = calloc(1,sizeof(IsoImageRecOpts)); img->recOpts = calloc(1, sizeof(IsoImageRecOpts));
if (img->recOpts == NULL) { if (img->recOpts == NULL) {
libiso_msgs_destroy(&img->messenger, 0); libiso_msgs_destroy(&img->messenger, 0);
iso_node_builder_unref(img->builder); iso_node_builder_unref(img->builder);
@ -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);

View File

@ -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

View File

@ -58,15 +58,16 @@ 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. */
unsigned int rockridge:1; unsigned int rockridge :1;
/* relaxed constraints */ /* relaxed constraints */
unsigned int omit_version_numbers:1; unsigned int omit_version_numbers :1;
unsigned int allow_deep_paths:1; unsigned int allow_deep_paths :1;
//int relaxed_constraints; /**< see ecma119_relaxed_constraints_flag */ //int relaxed_constraints; /**< see ecma119_relaxed_constraints_flag */
//unsigned int copy_eltorito:1; //unsigned int copy_eltorito:1;
@ -79,7 +80,7 @@ typedef struct {
*/ */
/**< If files should be sorted based on their weight. */ /**< If files should be sorted based on their weight. */
unsigned int sort_files:1; unsigned int sort_files :1;
/** /**
* The following options set the default values for files and directory * The following options set the default values for files and directory
@ -92,10 +93,10 @@ typedef struct {
* below. Note that for mode attributes, only the permissions are set, the * below. Note that for mode attributes, only the permissions are set, the
* file type remains unchanged. * file type remains unchanged.
*/ */
unsigned int replace_dir_mode:2; unsigned int replace_dir_mode :2;
unsigned int replace_file_mode:2; unsigned int replace_file_mode :2;
unsigned int replace_uid:2; unsigned int replace_uid :2;
unsigned int replace_gid:2; unsigned int replace_gid :2;
mode_t dir_mode; /** Mode to use on dirs when replace_dir_mode == 2. */ mode_t dir_mode; /** Mode to use on dirs when replace_dir_mode == 2. */
mode_t file_mode; /** Mode to use on files when replace_file_mode == 2. */ mode_t file_mode; /** Mode to use on files when replace_file_mode == 2. */
@ -103,7 +104,7 @@ typedef struct {
gid_t gid; /** gid to use when replace_gid == 2. */ gid_t gid; /** gid to use when replace_gid == 2. */
char *output_charset; /**< NULL to use default charset */ char *output_charset; /**< NULL to use default charset */
// uint32_t ms_block; // uint32_t ms_block;
/**< /**<
* Start block for multisession. When this is greater than 0, * Start block for multisession. When this is greater than 0,
* it's suppossed to be the lba of the next writable address * it's suppossed to be the lba of the next writable address
@ -116,22 +117,22 @@ typedef struct {
* will be written again to the new image. Use this with new * will be written again to the new image. Use this with new
* images or if you plan to modify an existin image. * images or if you plan to modify an existin image.
*/ */
// struct data_source* src; // struct data_source* src;
// /**< // /**<
// * When modifying a image, this is the source of the original // * When modifying a image, this is the source of the original
// * image, used to read file contents. // * image, used to read file contents.
// * Otherwise it can be NULL. // * Otherwise it can be NULL.
// */ // */
// uint8_t *overwrite; // uint8_t *overwrite;
// /**< // /**<
// * When not NULL, it should point to a buffer of at least // * When not NULL, it should point to a buffer of at least
// * 64KiB, where libisofs will write the contents that should // * 64KiB, where libisofs will write the contents that should
// * be written at the beginning of a overwriteable media, to // * be written at the beginning of a overwriteable media, to
// * grow the image. // * grow the image.
// * You shoudl initialize the buffer either with 0s, or with // * You shoudl initialize the buffer either with 0s, or with
// * the contents of the first blocks of the image you're // * the contents of the first blocks of the image you're
// * growing. In most cases, 0 is good enought. // * growing. In most cases, 0 is good enought.
// */ // */
} Ecma119WriteOpts; } Ecma119WriteOpts;
/** /**
@ -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.
@ -659,9 +659,9 @@ int iso_file_get_sort_weight(IsoFile *file);
int iso_tree_add_new_dir(IsoDir *parent, const char *name, IsoDir **dir); int iso_tree_add_new_dir(IsoDir *parent, const char *name, IsoDir **dir);
/* /*
TODO #00007 expose Strem and thi function: TODO #00007 expose Strem and thi function:
int iso_tree_add_new_file(IsoDir *parent, const char *name, stream, file) int iso_tree_add_new_file(IsoDir *parent, const char *name, stream, file)
*/ */
/** /**
* Add a new symlink to the directory tree. Permissions are set to 0777, * Add a new symlink to the directory tree. Permissions are set to 0777,

View File

@ -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;
@ -152,7 +149,7 @@ int iso_image_obtain_msgs(IsoImage *img, char *minimum_severity,
{ {
int ret, minimum_sevno, sevno, priority; int ret, minimum_sevno, sevno, priority;
char *textpt, *sev_name; char *textpt, *sev_name;
struct libiso_msgs_item *item = NULL; struct libiso_msgs_item *item= NULL;
if (img == NULL) if (img == NULL)
return 0; return 0;
@ -168,20 +165,20 @@ int iso_image_obtain_msgs(IsoImage *img, char *minimum_severity,
if (ret <= 0) if (ret <= 0)
goto ex; goto ex;
strncpy(msg_text, textpt, ISO_MSGS_MESSAGE_LEN-1); strncpy(msg_text, textpt, ISO_MSGS_MESSAGE_LEN-1);
if(strlen(textpt) >= ISO_MSGS_MESSAGE_LEN) if (strlen(textpt) >= ISO_MSGS_MESSAGE_LEN)
msg_text[ISO_MSGS_MESSAGE_LEN-1] = 0; msg_text[ISO_MSGS_MESSAGE_LEN-1] = 0;
severity[0]= 0; severity[0]= 0;
ret = libiso_msgs_item_get_rank(item, &sevno, &priority, 0); ret = libiso_msgs_item_get_rank(item, &sevno, &priority, 0);
if(ret <= 0) if (ret <= 0)
goto ex; goto ex;
ret = libiso_msgs__sev_to_text(sevno, &sev_name, 0); ret = libiso_msgs__sev_to_text(sevno, &sev_name, 0);
if(ret <= 0) if (ret <= 0)
goto ex; goto ex;
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;
} }

View File

@ -31,7 +31,7 @@ void iso_node_ref(IsoNode *node)
void iso_node_unref(IsoNode *node) void iso_node_unref(IsoNode *node)
{ {
if (--node->refcount == 0) { if (--node->refcount == 0) {
switch(node->type) { switch (node->type) {
case LIBISO_DIR: case LIBISO_DIR:
{ {
IsoNode *child = ((IsoDir*)node)->children; IsoNode *child = ((IsoDir*)node)->children;
@ -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);

View File

@ -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 */

View File

@ -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;
@ -754,7 +753,7 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
int ret; int ret;
size_t i; size_t i;
Ecma119Node *node; Ecma119Node *node;
char *name = NULL; char *name= NULL;
if (t == NULL || n == NULL || info == NULL) { if (t == NULL || n == NULL || info == NULL) {
return ISO_NULL_POINTER; return ISO_NULL_POINTER;
@ -841,7 +840,7 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
size_t namelen; size_t namelen;
/* this two are only defined for symlinks */ /* this two are only defined for symlinks */
uint8_t **comps = NULL; /* components of the SL field */ uint8_t **comps= NULL; /* components of the SL field */
size_t n_comp = 0; /* number of components */ size_t n_comp = 0; /* number of components */
name = get_rr_name(t, n); name = get_rr_name(t, n);
@ -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 */
@ -1113,7 +1108,7 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
free(name); free(name);
return ISO_SUCCESS; return ISO_SUCCESS;
add_susp_cleanup:; add_susp_cleanup: ;
free(name); free(name);
susp_info_free(info); susp_info_free(info);
return ret; return ret;
@ -1160,7 +1155,7 @@ int rrip_write_ce_fields(Ecma119Image *t, struct susp_info *info)
{ {
size_t i; size_t i;
uint8_t padding[BLOCK_SIZE]; uint8_t padding[BLOCK_SIZE];
int ret = ISO_SUCCESS; int ret= ISO_SUCCESS;
if (info->n_ce_susp_fields == 0) { if (info->n_ce_susp_fields == 0) {
return ret; return ret;
@ -1181,7 +1176,7 @@ int rrip_write_ce_fields(Ecma119Image *t, struct susp_info *info)
ret = iso_write(t, padding, i); ret = iso_write(t, padding, i);
} }
write_ce_field_cleanup:; write_ce_field_cleanup: ;
/* free ce_susp_fields */ /* free ce_susp_fields */
for (i = 0; i < info->n_ce_susp_fields; ++i) { for (i = 0; i < info->n_ce_susp_fields; ++i) {
free(info->ce_susp_fields[i]); free(info->ce_susp_fields[i]);

View File

@ -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

View File

@ -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);
} }

View File

@ -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);

View File

@ -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)
{ {
@ -190,7 +189,7 @@ int str2ascii(const char *icharset, const char *input, char **output)
} }
n = iconv(conv, &src, &inbytes, &ret, &outbytes); n = iconv(conv, &src, &inbytes, &ret, &outbytes);
while(n == -1) { while (n == -1) {
/* The destination buffer is too small. Stops here. */ /* The destination buffer is too small. Stops here. */
if (errno == E2BIG) if (errno == E2BIG)
break; break;
@ -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
@ -253,7 +252,7 @@ char *iso_dirid(const char *src, int size)
len = size; len = size;
} }
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
char c = toupper(src[i]); char c= toupper(src[i]);
name[i] = valid_d_char(c) ? c : '_'; name[i] = valid_d_char(c) ? c : '_';
} }
@ -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) */
@ -295,7 +294,7 @@ char *iso_1_fileid(const char *src)
/* Convert up to 8 characters of the filename. */ /* Convert up to 8 characters of the filename. */
for (i = 0; i < lname && i < 8; i++) { for (i = 0; i < lname && i < 8; i++) {
char c = toupper(src[i]); char c= toupper(src[i]);
dest[pos++] = valid_d_char(c) ? c : '_'; dest[pos++] = valid_d_char(c) ? c : '_';
} }
@ -305,7 +304,7 @@ char *iso_1_fileid(const char *src)
/* Convert up to 3 characters of the extension, if any. */ /* Convert up to 3 characters of the extension, if any. */
for (i = 0; i < lext && i < 3; i++) { for (i = 0; i < lext && i < 3; i++) {
char c = toupper(src[lname + 1 + i]); char c= toupper(src[lname + 1 + i]);
dest[pos++] = valid_d_char(c) ? c : '_'; dest[pos++] = valid_d_char(c) ? c : '_';
} }
@ -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;
} }
@ -352,7 +351,7 @@ char *iso_2_fileid(const char *src)
/* Convert up to lnname characters of the filename. */ /* Convert up to lnname characters of the filename. */
for (i = 0; i < lnname; i++) { for (i = 0; i < lnname; i++) {
char c = toupper(src[i]); char c= toupper(src[i]);
dest[pos++] = valid_d_char(c) ? c : '_'; dest[pos++] = valid_d_char(c) ? c : '_';
} }
@ -360,7 +359,7 @@ char *iso_2_fileid(const char *src)
/* Convert up to lnext characters of the extension, if any. */ /* Convert up to lnext characters of the extension, if any. */
for (i = 0; i < lnext; i++) { for (i = 0; i < lnext; i++) {
char c = toupper(src[lname + 1 + i]); char c= toupper(src[lname + 1 + i]);
dest[pos++] = valid_d_char(c) ? c : '_'; dest[pos++] = valid_d_char(c) ? c : '_';
} }
@ -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;
@ -490,7 +393,7 @@ int str2d_char(const char *icharset, const char *input, char **output)
len = strlen(ascii); len = strlen(ascii);
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {
char c = toupper(ascii[i]); char c= toupper(ascii[i]);
ascii[i] = valid_d_char(c) ? c : '_'; ascii[i] = valid_d_char(c) ? c : '_';
} }
@ -524,7 +427,7 @@ int str2a_char(const char *icharset, const char *input, char **output)
len = strlen(ascii); len = strlen(ascii);
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {
char c = toupper(ascii[i]); char c= toupper(ascii[i]);
ascii[i] = valid_a_char(c) ? c : '_'; ascii[i] = valid_a_char(c) ? c : '_';
} }

View File

@ -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;
@ -116,7 +116,7 @@ struct iso_rbnode *iso_rbnode_new(void *data)
{ {
struct iso_rbnode *rn = malloc(sizeof(struct iso_rbnode)); struct iso_rbnode *rn = malloc(sizeof(struct iso_rbnode));
if ( rn != NULL ) { if (rn != NULL) {
rn->data = data; rn->data = data;
rn->red = 1; rn->red = 1;
rn->ch[0] = NULL; rn->ch[0] = NULL;
@ -159,7 +159,7 @@ int iso_rbtree_insert(IsoRBTree *tree, void *data, void **item)
new = data; new = data;
added = 1; added = 1;
} else { } else {
struct iso_rbnode head = {0}; /* False tree root */ struct iso_rbnode head = { 0 }; /* False tree root */
struct iso_rbnode *g, *t; /* Grandparent & parent */ struct iso_rbnode *g, *t; /* Grandparent & parent */
struct iso_rbnode *p, *q; /* Iterator & parent */ struct iso_rbnode *p, *q; /* Iterator & parent */
@ -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;

View File

@ -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