xorriso
1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
![]() ![]() |
#include <time.h>
#include <fcntl.h>
Go to the source code of this file.
Macros | |
#define | MAX(a, b) (((a) > (b)) ? (a) : (b)) |
#define | MIN(a, b) (((a) < (b)) ? (a) : (b)) |
#define | DIV_UP(n, div) ((n + div - 1) / div) |
#define | ROUND_UP(n, mul) (DIV_UP(n, mul) * mul) |
#define | LIBISO_ALLOC_MEM(pt, typ, count) |
#define | LIBISO_ALLOC_MEM_VOID(pt, typ, count) |
#define | LIBISO_FREE_MEM(pt) |
Typedefs | |
typedef struct iso_rbtree | IsoRBTree |
typedef struct iso_htable | IsoHTable |
typedef unsigned int(* | hash_funtion_t) (const void *key) |
typedef int(* | compare_function_t) (const void *a, const void *b) |
typedef void(* | hfree_data_t) (void *key, void *data) |
Functions | |
int | int_pow (int base, int power) |
int | iso_init_locale (int flag) |
int | strconv (const char *input, const char *icharset, const char *ocharset, char **output) |
int | strnconv (const char *str, const char *icharset, const char *ocharset, size_t len, char **output) |
int | strnconvl (const char *str, const char *icharset, const char *ocharset, size_t len, char **output, size_t *out_len) |
int | str2ascii (const char *icharset, const char *input, char **output) |
int | str2ucs (const char *icharset, const char *input, uint16_t **output) |
int | str2utf16be (const char *icharset, const char *input, uint16_t **output) |
char * | iso_1_dirid (const char *src, int relaxed) |
char * | iso_2_dirid (const char *src) |
char * | iso_r_dirid (const char *src, int size, int relaxed) |
char * | iso_1_fileid (const char *src, int relaxed, int force_dots) |
char * | iso_2_fileid (const char *src) |
char * | iso_r_fileid (const char *src, size_t len, int relaxed, int forcedot) |
uint16_t * | iso_j_file_id (const uint16_t *src, int flag) |
uint16_t * | iso_j_dir_id (const uint16_t *src, int flag) |
size_t | ucslen (const uint16_t *str) |
uint16_t * | ucsrchr (const uint16_t *str, char c) |
uint16_t * | ucsdup (const uint16_t *str) |
int | ucscmp (const uint16_t *s1, const uint16_t *s2) |
uint16_t * | ucscpy (uint16_t *dest, const uint16_t *src) |
uint16_t * | ucsncpy (uint16_t *dest, const uint16_t *src, size_t n) |
void | iso_handle_split_utf16 (uint16_t *utf_word) |
int | str2d_char (const char *icharset, const char *input, char **output) |
int | str2a_char (const char *icharset, const char *input, char **output) |
void | iso_lsb (uint8_t *buf, uint32_t num, int bytes) |
void | iso_lsb64 (uint8_t *buf, uint64_t num) |
void | iso_msb (uint8_t *buf, uint32_t num, int bytes) |
void | iso_bb (uint8_t *buf, uint32_t num, int bytes) |
int | iso_lsb_to_buf (char **wpt, uint32_t value, int bytes, int flag) |
uint32_t | iso_read_lsb (const uint8_t *buf, int bytes) |
uint32_t | iso_read_msb (const uint8_t *buf, int bytes) |
uint32_t | iso_read_bb (const uint8_t *buf, int bytes, int *error) |
uint64_t | iso_read_lsb64 (const uint8_t *buf) |
uint64_t | iso_read_msb64 (const uint8_t *buf) |
void | iso_datetime_7 (uint8_t *buf, time_t t, int always_gmt) |
void | iso_datetime_17 (uint8_t *buf, time_t t, int always_gmt) |
time_t | iso_datetime_read_7 (const uint8_t *buf) |
time_t | iso_datetime_read_17 (const uint8_t *buf) |
int | iso_eaccess (const char *path) |
char * | iso_util_strcopy (const char *buf, size_t len) |
char * | iso_util_strcopy_untail (const char *buf, size_t len) |
void | strncpy_pad (char *dest, const char *src, size_t max) |
char * | ucs2str (const char *buf, size_t len) |
int | iso_rbtree_new (int(*compare)(const void *, const void *), IsoRBTree **tree) |
void | iso_rbtree_destroy (IsoRBTree *tree, void(*free_data)(void *)) |
int | iso_rbtree_insert (IsoRBTree *tree, void *data, void **item) |
size_t | iso_rbtree_get_size (IsoRBTree *tree) |
void ** | iso_rbtree_to_array (IsoRBTree *tree, int(*include_item)(void *), size_t *size) |
size_t | iso_rbtree_count_array (IsoRBTree *tree, size_t initial_count, int(*include_item)(void *)) |
int | iso_htable_create (size_t size, hash_funtion_t hash, compare_function_t compare, IsoHTable **table) |
int | iso_htable_add (IsoHTable *table, void *key, void *data) |
int | iso_htable_put (IsoHTable *table, void *key, void *data) |
int | iso_htable_get (IsoHTable *table, void *key, void **data) |
int | iso_htable_remove (IsoHTable *table, void *key, hfree_data_t free_data) |
int | iso_htable_remove_ptr (IsoHTable *table, void *key, hfree_data_t free_data) |
void | iso_htable_destroy (IsoHTable *table, hfree_data_t free_data) |
unsigned int | iso_str_hash (const void *key) |
int | iso_util_encode_len_bytes (uint32_t data, char *buffer, int data_len, int *result_len, int flag) |
int | iso_util_decode_len_bytes (uint32_t *data, char *buffer, int *data_len, int buffer_len, int flag) |
int | iso_util_eval_md5_tag (char *block, int desired, uint32_t lba, void *ctx, uint32_t ctx_start_lba, int *tag_type, uint32_t *next_tag, int flag) |
int | iso_util_tag_magic (int tag_type, char **tag_magic, int *len, int flag) |
int | iso_util_bin_to_hex (char *target, uint8_t *bytes, int num_bytes, int flag) |
int | iso_util_hex_to_bin (char *hex, char *bin, int bin_size, int *bin_count, int flag) |
int | iso_truncate_rr_name (int truncate_mode, int truncate_length, char *name, int flag) |
int | checksum_cx_xinfo_func (void *data, int flag) |
int | checksum_cx_xinfo_cloner (void *old_data, void **new_data, int flag) |
int | checksum_md5_xinfo_func (void *data, int flag) |
int | checksum_md5_xinfo_cloner (void *old_data, void **new_data, int flag) |
int | iso_hfsplus_xinfo_cloner (void *old_data, void **new_data, int flag) |
void * | iso_alloc_mem (size_t size, size_t count, int flag) |
int | iso_clone_mem (char *in, char **out, size_t size) |
int | iso_clone_mgtd_mem (char *in, char **out, size_t size) |
off_t | iso_scanf_io_size (char *text, int flag) |
uint16_t | iso_ntohs (uint16_t v) |
uint16_t | iso_htons (uint16_t v) |
#define LIBISO_ALLOC_MEM | ( | pt, | |
typ, | |||
count | |||
) |
#define LIBISO_ALLOC_MEM_VOID | ( | pt, | |
typ, | |||
count | |||
) |
#define LIBISO_FREE_MEM | ( | pt | ) |
typedef int(* compare_function_t) (const void *a, const void *b) |
typedef struct iso_htable IsoHTable |
typedef struct iso_rbtree IsoRBTree |
int checksum_cx_xinfo_cloner | ( | void * | old_data, |
void ** | new_data, | ||
int | flag | ||
) |
Definition at line 431 of file md5.c.
References ISO_XINFO_NO_CLONE.
Referenced by iso_init_with_flag().
int checksum_cx_xinfo_func | ( | void * | data, |
int | flag | ||
) |
Definition at line 421 of file md5.c.
Referenced by checksum_copy_old_nodes(), checksum_prepare_nodes(), iso_file_src_create(), iso_init_with_flag(), and process_preserved_cx().
int checksum_md5_xinfo_cloner | ( | void * | old_data, |
void ** | new_data, | ||
int | flag | ||
) |
Definition at line 459 of file md5.c.
References ISO_OUT_OF_MEM, and ISO_XINFO_NO_CLONE.
Referenced by iso_init_with_flag().
int checksum_md5_xinfo_func | ( | void * | data, |
int | flag | ||
) |
Definition at line 447 of file md5.c.
Referenced by checksum_copy_old_nodes(), checksum_prepare_nodes(), iso_file_get_md5(), iso_file_make_md5(), iso_file_src_create(), and iso_init_with_flag().
int int_pow | ( | int | base, |
int | power | ||
) |
Definition at line 159 of file util.c.
Referenced by mangle_single_dir().
char* iso_1_dirid | ( | const char * | src, |
int | relaxed | ||
) |
Create a level 1 directory identifier.
src | The identifier, in ASCII encoding. |
relaxed | 0 only allow d-characters, 1 allow also lowe case chars, 2 allow all characters |
Definition at line 882 of file util.c.
References iso_dirid().
Referenced by iso_get_ecma119_name().
char* iso_1_fileid | ( | const char * | src, |
int | relaxed, | ||
int | force_dots | ||
) |
Create a level 1 file identifier that consists of a name, in 8.3 format. Note that version number is not added to the file name
src | The identifier, in ASCII encoding. |
relaxed | 0 only allow d-characters, 1 allow also lowe case chars, 2 allow all characters |
force_dots | If 1 then prepend empty extension by SEPARATOR1 = '.' |
Definition at line 892 of file util.c.
References map_fileid_char(), and valid_d_char().
Referenced by iso_get_ecma119_name().
char* iso_2_dirid | ( | const char * | src | ) |
Create a level 2 directory identifier.
src | The identifier, in ASCII encoding. |
Definition at line 887 of file util.c.
References iso_dirid().
Referenced by iso_get_ecma119_name().
char* iso_2_fileid | ( | const char * | src | ) |
Create a level 2 file identifier. Note that version number is not added to the file name
src | The identifier, in ASCII encoding. |
Definition at line 960 of file util.c.
References valid_d_char().
Referenced by iso_get_ecma119_name().
void* iso_alloc_mem | ( | size_t | size, |
size_t | count, | ||
int | flag | ||
) |
Definition at line 2297 of file util.c.
References iso_msg_submit(), and ISO_OUT_OF_MEM.
Referenced by iso_impsysa_report_blockpath().
void iso_bb | ( | uint8_t * | buf, |
uint32_t | num, | ||
int | bytes | ||
) |
Definition at line 1502 of file util.c.
References iso_lsb(), and iso_msb().
Referenced by ecma119_writer_write_vol_desc(), iso1999_writer_write_vol_desc(), joliet_writer_write_vol_desc(), rrip_add_CL(), rrip_add_PL(), rrip_add_PN(), rrip_add_PX(), susp_make_CE(), susp_update_CE_sizes(), write_one_dir_record(), and zisofs_add_ZF().
int iso_clone_mem | ( | char * | in, |
char ** | out, | ||
size_t | size | ||
) |
Definition at line 2336 of file util.c.
References ISO_OUT_OF_MEM, and ISO_SUCCESS.
Referenced by iso_clone_mgtd_mem(), iso_get_rr_name(), and iso_write_opts_clone().
int iso_clone_mgtd_mem | ( | char * | in, |
char ** | out, | ||
size_t | size | ||
) |
Definition at line 2352 of file util.c.
References iso_clone_mem().
Referenced by hppa_palo_set_path(), and iso_image_set_hppa_palo().
void iso_datetime_17 | ( | uint8_t * | buf, |
time_t | t, | ||
int | always_gmt | ||
) |
Records the date/time into a 17 byte buffer (ECMA-119, 8.4.26.1)
void iso_datetime_7 | ( | uint8_t * | buf, |
time_t | t, | ||
int | always_gmt | ||
) |
Records the date/time into a 7 byte buffer (ECMA-119, 9.1.5)
buf | Buffer where the date will be written |
t | The time to be written |
always_gmt | Always write the date in GMT and not in local time. |
time_t iso_datetime_read_17 | ( | const uint8_t * | buf | ) |
Definition at line 1841 of file util.c.
References timegm().
Referenced by ecma119_determine_now_time(), and read_rr_TF().
time_t iso_datetime_read_7 | ( | const uint8_t * | buf | ) |
int iso_eaccess | ( | const char * | path | ) |
Check whether the caller process has read access to the given local file.
Definition at line 1866 of file util.c.
References ISO_FILE_ACCESS_DENIED, ISO_FILE_BAD_PATH, ISO_FILE_DOESNT_EXIST, ISO_FILE_ERROR, ISO_OUT_OF_MEM, and ISO_SUCCESS.
Referenced by iso_data_source_new_from_file(), and lfs_access().
void iso_handle_split_utf16 | ( | uint16_t * | utf_word | ) |
Check whether utf_word is the first surrogate word of a pair. If so, change it to UTF-16 character '_'.
Definition at line 2326 of file util.c.
References set_ucsbe().
Referenced by iso_j_dir_id(), iso_j_file_id(), ucsncpy(), and ucsncpy_pad().
int iso_hfsplus_xinfo_cloner | ( | void * | old_data, |
void ** | new_data, | ||
int | flag | ||
) |
Definition at line 1864 of file hfsplus.c.
References iso_hfsplus_xinfo_new(), ISO_OUT_OF_MEM, ISO_SUCCESS, and ISO_XINFO_NO_CLONE.
Referenced by iso_init_with_flag().
int iso_htable_add | ( | IsoHTable * | table, |
void * | key, | ||
void * | data | ||
) |
Put an element in a Hash Table. The element will be identified by the given key, that you should use to retrieve the element again.
This function allow duplicates, i.e., two items with the same key. In those cases, the value returned by iso_htable_get() is undefined. If you don't want to allow duplicates, use iso_htable_put() instead;
Both the key and data pointers will be stored internally, so you should free the objects they point to. Use iso_htable_remove() to delete an element from the table.
Definition at line 70 of file util_htable.c.
References iso_htable::cap, iso_hnode::data, iso_htable::hash, iso_hnode_new(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, iso_hnode::key, iso_htable::size, and iso_htable::table.
Referenced by mangle_single_dir().
int iso_htable_create | ( | size_t | size, |
hash_funtion_t | hash, | ||
compare_function_t | compare, | ||
IsoHTable ** | table | ||
) |
Create a new hash table.
size | Number of slots in table. |
hash | Function used to generate |
Definition at line 321 of file util_htable.c.
References iso_htable::cap, iso_htable::compare, iso_htable::hash, ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, ISO_WRONG_ARG_VALUE, iso_htable::size, and iso_htable::table.
Referenced by mangle_single_dir().
void iso_htable_destroy | ( | IsoHTable * | table, |
hfree_data_t | free_data | ||
) |
Destroy the given hash table.
Note that you're responsible to actually destroy the elements by providing a valid free_data function. You can pass NULL if you only want to delete the hash structure.
Definition at line 290 of file util_htable.c.
References iso_htable::cap, iso_hnode::data, iso_hnode::key, iso_hnode::next, and iso_htable::table.
Referenced by mangle_single_dir().
int iso_htable_get | ( | IsoHTable * | table, |
void * | key, | ||
void ** | data | ||
) |
Retrieve an element from the given table.
table | Hash table |
key | Key of the element that will be removed |
data | Will be filled with the element found. Remains untouched if no element with the given key is found. |
Definition at line 144 of file util_htable.c.
References iso_htable::cap, iso_htable::compare, iso_hnode::data, iso_htable::hash, ISO_NULL_POINTER, iso_hnode::key, iso_hnode::next, and iso_htable::table.
Referenced by mangle_single_dir().
int iso_htable_put | ( | IsoHTable * | table, |
void * | key, | ||
void * | data | ||
) |
Like iso_htable_add(), but this doesn't allow dulpicates.
Definition at line 100 of file util_htable.c.
References iso_htable::cap, iso_htable::compare, iso_hnode::data, iso_htable::hash, iso_hnode_new(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, iso_hnode::key, iso_hnode::next, iso_htable::size, and iso_htable::table.
int iso_htable_remove | ( | IsoHTable * | table, |
void * | key, | ||
hfree_data_t | free_data | ||
) |
Remove an item with the given key from the table. In tables that allow duplicates, it is undefined the element that will be deleted.
table | Hash table |
key | Key of the element that will be removed |
free_data | Function that will be called passing as parameters both the key and the element that will be deleted. The user can use it to free the element. You can pass NULL if you don't want to delete the item itself. |
Definition at line 182 of file util_htable.c.
References iso_htable::cap, iso_htable::compare, iso_hnode::data, iso_htable::hash, ISO_NULL_POINTER, iso_hnode::key, iso_hnode::next, iso_htable::size, and iso_htable::table.
int iso_htable_remove_ptr | ( | IsoHTable * | table, |
void * | key, | ||
hfree_data_t | free_data | ||
) |
Like remove, but instead of checking for key equality using the compare function, it just compare the key pointers. If the table allows duplicates, and you provide different keys (i.e. different pointers) to elements with same key (i.e. same content), this function ensure the exact element is removed.
It has the problem that you must provide the same key pointer, and not just a key whose contents are equal. Moreover, if you use the same key (same pointer) to identify several objects, what of those are removed is undefined.
table | Hash table |
key | Key of the element that will be removed |
free_data | Function that will be called passing as parameters both the key and the element that will be deleted. The user can use it to free the element. You can pass NULL if you don't want to delete the item itself. |
Definition at line 236 of file util_htable.c.
References iso_htable::cap, iso_hnode::data, iso_htable::hash, ISO_NULL_POINTER, iso_hnode::key, iso_hnode::next, iso_htable::size, and iso_htable::table.
Referenced by mangle_single_dir().
uint16_t iso_htons | ( | uint16_t | v | ) |
int iso_init_locale | ( | int | flag | ) |
Set up locale by LC_* environment variables.
Definition at line 2038 of file util.c.
Referenced by iso_init_with_flag().
uint16_t* iso_j_dir_id | ( | const uint16_t * | src, |
int | flag | ||
) |
Create a Joliet directory identifier that consists of name and optionally extension. The combined name and extension length will not exceed 128 bytes, and the name and extension will be separated (.). All characters consist of 2 bytes and the resulting string is NULL-terminated by a 2-byte NULL.
flag | bit1= allow 103 characters rather than 64 |
Definition at line 1298 of file util.c.
References iso_handle_split_utf16(), LIBISO_ALLOC_MEM_VOID, LIBISO_FREE_MEM, LIBISO_JOLIET_NAME_MAX, set_ucsbe(), ucsdup(), ucslen(), and valid_j_char().
Referenced by iso_get_joliet_name().
uint16_t* iso_j_file_id | ( | const uint16_t * | src, |
int | flag | ||
) |
Create a Joliet file identifier that consists of name and extension. The combined name and extension length will normally not exceed 64 characters (= 128 bytes). The name and the extension will be separated (.). All characters consist of 2 bytes and the resulting string is NULL-terminated by a 2-byte NULL.
Note that version number and (;1) is not appended.
flag | bit0= no_force_dots bit1= allow 103 characters rather than 64 |
Definition at line 1215 of file util.c.
References cmp_ucsbe(), iso_handle_split_utf16(), LIBISO_ALLOC_MEM_VOID, LIBISO_FREE_MEM, LIBISO_JOLIET_NAME_MAX, set_ucsbe(), ucsdup(), ucslen(), ucsrchr(), and valid_j_char().
Referenced by iso_get_joliet_name().
void iso_lsb | ( | uint8_t * | buf, |
uint32_t | num, | ||
int | bytes | ||
) |
Definition at line 1478 of file util.c.
Referenced by ecma119_writer_write_vol_desc(), eltorito_writer_write_vol_desc(), gpt_tail_writer_write_data(), iso1999_writer_write_vol_desc(), iso_bb(), joliet_writer_write_vol_desc(), make_boot_info_table(), make_dec_alpha_sector(), make_mipsel_boot_block(), patch_grub2_boot_image(), write_path_table(), write_section_entry(), write_section_load_size(), write_validation_entry(), and ziso_stream_compress().
void iso_lsb64 | ( | uint8_t * | buf, |
uint64_t | num | ||
) |
Definition at line 1486 of file util.c.
Referenced by ziso_stream_compress(), and zisofs_add_ZF().
int iso_lsb_to_buf | ( | char ** | wpt, |
uint32_t | value, | ||
int | bytes, | ||
int | flag | ||
) |
Definition at line 1510 of file util.c.
Referenced by iso_write_gpt_entry(), and iso_write_gpt_header_block().
void iso_msb | ( | uint8_t * | buf, |
uint32_t | num, | ||
int | bytes | ||
) |
Definition at line 1494 of file util.c.
Referenced by ecma119_writer_write_vol_desc(), hfsplus_writer_write_data(), iso1999_writer_write_vol_desc(), iso_bb(), iso_htons(), iso_write_apm_entry(), joliet_create_mangled_name(), joliet_writer_write_vol_desc(), mac_time_offset(), make_hppa_palo_sector(), make_mips_volume_header(), make_sun_disk_label(), write_path_table(), write_sb(), and write_sun_partition_entry().
uint16_t iso_ntohs | ( | uint16_t | v | ) |
Definition at line 2308 of file util.c.
References iso_read_msb().
Referenced by get_class(), and iso_get_hfsplus_name().
char* iso_r_dirid | ( | const char * | src, |
int | size, | ||
int | relaxed | ||
) |
Create a dir name suitable for an ISO image with relaxed constraints.
src | The identifier, in ASCII encoding. |
size | Max len for the name |
relaxed | 0 only allow d-characters, 1 allow also lowe case chars, 2 allow all characters |
Create a dir name suitable for an ISO image with relaxed constraints.
size | Max len for the name |
relaxed | bit0+1: 0 only allow d-characters, 1 allow also lowe case chars, 2 allow all 8-bit characters, bit2: allow 7-bit characters (but map lowercase to uppercase if not bit0+1 == 2) |
Definition at line 1026 of file util.c.
References map_fileid_char(), and valid_d_char().
Referenced by iso_get_ecma119_name().
char* iso_r_fileid | ( | const char * | src, |
size_t | len, | ||
int | relaxed, | ||
int | forcedot | ||
) |
Create a file name suitable for an ISO image with relaxed constraints.
src | The identifier, in ASCII encoding. |
len | Max len for the name, without taken the "." into account. |
relaxed | 0 only allow d-characters, 1 allow also lowe case chars, 2 allow all characters |
forcedot | Whether to ensure that "." is added |
Create a file name suitable for an ISO image with level > 1 and with relaxed constraints.
len | Max len for the name, without taken the "." into account. |
relaxed | bit0+1: 0 only allow d-characters, 1 allow also lowe case chars, 2 allow all 8-bit characters, bit2: allow 7-bit characters (but map lowercase to uppercase if not bit0+1 == 2) |
forcedot | Whether to ensure that "." is added |
Definition at line 1090 of file util.c.
References map_fileid_char(), and valid_d_char().
Referenced by iso_get_ecma119_name().
size_t iso_rbtree_count_array | ( | IsoRBTree * | tree, |
size_t | initial_count, | ||
int(*)(void *) | include_item | ||
) |
Predict the size of the array which gets returned by iso_rbtree_to_array().
Definition at line 337 of file util_rbtree.c.
References rbtree_count_array_aux(), and iso_rbtree::root.
Referenced by filesrc_writer_pre_compute().
void iso_rbtree_destroy | ( | IsoRBTree * | tree, |
void(*)(void *) | free_data | ||
) |
Destroy a given tree.
Note that only the structure itself is deleted. To delete the elements, you 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.
Definition at line 84 of file util_rbtree.c.
References rbtree_destroy_aux(), and iso_rbtree::root.
Referenced by ecma119_image_free().
size_t iso_rbtree_get_size | ( | IsoRBTree * | tree | ) |
Get the number of elements in a given tree.
Definition at line 250 of file util_rbtree.c.
References iso_rbtree::size.
int iso_rbtree_insert | ( | IsoRBTree * | tree, |
void * | data, | ||
void ** | item | ||
) |
Inserts a given element in a Red-Black tree.
tree | the tree where to insert |
data | element to be inserted on the tree. It can't be NULL |
item | if not NULL, it will point to a location where the tree element ptr will be stored. If data was inserted, *item == data. If data was already on the tree, *item points to the previously inserted object that is equal to data. |
Definition at line 149 of file util_rbtree.c.
References iso_rbnode::ch, iso_rbtree::compare, iso_rbnode::data, is_red(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, iso_rbnode_new(), iso_rbtree_double(), iso_rbtree_single(), iso_rbnode::red, iso_rbtree::root, and iso_rbtree::size.
Referenced by iso_file_src_add(), and iso_file_src_create().
int iso_rbtree_new | ( | int(*)(const void *, const void *) | compare, |
IsoRBTree ** | tree | ||
) |
Create a new binary tree. libisofs binary trees allow you to add any data passing it as a pointer. You must provide a function suitable for compare two elements.
compare | A function to compare two keys. It takes a pointer to both keys and return 0, -1 or 1 if the first key is equal, less or greater than the second one. |
tree | Location where the tree structure will be stored. |
Create a new binary tree. libisofs binary trees allow you to add any data passing it as a pointer. You must provide a function suitable for compare two elements.
compare | A function to compare two elements. It takes a pointer to both elements and return 0, -1 or 1 if the first element is equal, less or greater than the second one. |
tree | Location where the tree structure will be stored. |
Definition at line 50 of file util_rbtree.c.
References ISO_NULL_POINTER, ISO_OUT_OF_MEM, and ISO_SUCCESS.
Referenced by ecma119_image_new().
void** iso_rbtree_to_array | ( | IsoRBTree * | tree, |
int(*)(void *) | include_item, | ||
size_t * | size | ||
) |
Get an array view of the elements of the tree.
include_item | Function to select which elements to include in the array. It that takes a pointer to an element and returns 1 if the element should be included, 0 if not. If you want to add all elements to the array, you can pass a NULL pointer. |
size | If not null, will be filled with the number of elements in the array, without counting the final NULL item. |
Get an array view of the elements of the tree.
include_item | Function to select which elements to include in the array. It that takes a pointer to an element and returns 1 if the element should be included, 0 if not. If you want to add all elements to the array, you can pass a NULL pointer. |
Definition at line 284 of file util_rbtree.c.
References rbtree_to_array_aux(), iso_rbtree::root, and iso_rbtree::size.
Referenced by filesrc_writer_pre_compute().
uint32_t iso_read_bb | ( | const uint8_t * | buf, |
int | bytes, | ||
int * | error | ||
) |
if error != NULL it will be set to 1 if LSB and MSB integers don't match.
Definition at line 1542 of file util.c.
References iso_read_lsb(), and iso_read_msb().
Referenced by iso_file_source_new_ifs(), iso_image_filesystem_new(), read_dir(), read_pvd_block(), read_pvm(), read_rr_PN(), read_rr_PX(), read_zisofs_ZF(), and susp_iter_next().
uint32_t iso_read_lsb | ( | const uint8_t * | buf, |
int | bytes | ||
) |
Definition at line 1520 of file util.c.
Referenced by iso_read_bb().
uint64_t iso_read_lsb64 | ( | const uint8_t * | buf | ) |
Definition at line 1554 of file util.c.
Referenced by iso_analyze_alpha_boot(), iso_analyze_gpt(), iso_analyze_gpt_backup(), iso_analyze_gpt_head(), iso_analyze_isohybrid(), make_dec_alpha_sector(), read_zisofs_ZF(), ziso_parse_zisofs_head(), and ziso_stream_uncompress().
uint32_t iso_read_msb | ( | const uint8_t * | buf, |
int | bytes | ||
) |
Definition at line 1531 of file util.c.
Referenced by iso_analyze_apm(), iso_analyze_apm_head(), iso_analyze_hppa(), iso_analyze_mips(), iso_analyze_sun(), iso_ivr_zeroize(), iso_ntohs(), iso_read_bb(), and make_mips_volume_header().
uint64_t iso_read_msb64 | ( | const uint8_t * | buf | ) |
Definition at line 1564 of file util.c.
Referenced by iso_analyze_sun().
off_t iso_scanf_io_size | ( | char * | text, |
int | flag | ||
) |
Convert a text into a number of type double and multiply it by unit code [kmgt] (2^10 to 2^40) or [s] (2048) or [d] (512). (Also accepts capital letters.)
text | Input like "42", "223062s", "3m" or "-1g" |
flag | Bitfield for control purposes: bit0= return -1 rather than 0 on failure bit1= if scaled then compute the last byte of the last unit |
Definition at line 2369 of file util.c.
Referenced by iso_ivr_read_number().
unsigned int iso_str_hash | ( | const void * | key | ) |
Hash function suitable for keys that are char strings.
Definition at line 270 of file util_htable.c.
References iso_hnode::key.
Referenced by mangle_single_dir().
int iso_truncate_rr_name | ( | int | truncate_mode, |
int | truncate_length, | ||
char * | name, | ||
int | flag | ||
) |
Definition at line 2425 of file util.c.
References find_utf8_start(), iso_md5_compute(), iso_md5_end(), iso_md5_start(), iso_msg_submit(), ISO_RR_NAME_TOO_LONG, ISO_RR_NAME_TRUNCATED, and ISO_SUCCESS.
Referenced by default_create_file(), default_create_node(), iso_dir_get_node_trunc(), iso_image_truncate_name(), iso_node_set_name_trunc(), iso_tree_clone_trunc(), and iso_truncate_leaf_name().
int iso_util_bin_to_hex | ( | char * | target, |
uint8_t * | bytes, | ||
int | num_bytes, | ||
int | flag | ||
) |
Definition at line 2096 of file util.c.
Referenced by iso_analyze_gpt_backup(), iso_eltorito_report(), and iso_impsysa_report().
int iso_util_decode_len_bytes | ( | uint32_t * | data, |
char * | buffer, | ||
int * | data_len, | ||
int | buffer_len, | ||
int | flag | ||
) |
Decode an integer as LEN,BYTES for being a component in certain AAIP attribute values.
data | returns the decoded value |
buffer | contains the encoded value |
data_len | returns the number of value bytes (without len byte) |
buffer_len | tells the number of valid buffer bytes |
Definition at line 2069 of file util.c.
References ISO_SUCCESS.
Referenced by iso_root_get_isofsca(), and iso_root_get_isofsnt().
int iso_util_encode_len_bytes | ( | uint32_t | data, |
char * | buffer, | ||
int | data_len, | ||
int * | result_len, | ||
int | flag | ||
) |
Encode an integer as LEN,BYTES for being a component in certain AAIP attribute values.
Definition at line 2045 of file util.c.
References ISO_SUCCESS.
Referenced by iso_root_set_isofsca(), and iso_root_set_isofsnt().
int iso_util_eval_md5_tag | ( | char * | block, |
int | desired, | ||
uint32_t | lba, | ||
void * | ctx, | ||
uint32_t | ctx_start_lba, | ||
int * | tag_type, | ||
uint32_t * | next_tag, | ||
int | flag | ||
) |
Definition at line 2235 of file util.c.
References ISO_MD5_AREA_CORRUPTED, iso_md5_clone(), iso_md5_end(), iso_md5_match(), ISO_MD5_TAG_COPIED, ISO_MD5_TAG_MISMATCH, ISO_MD5_TAG_MISPLACED, ISO_MD5_TAG_UNEXPECTED, iso_msg_submit(), and iso_util_decode_md5_tag().
Referenced by iso_src_check_sb_tree().
int iso_util_hex_to_bin | ( | char * | hex, |
char * | bin, | ||
int | bin_size, | ||
int * | bin_count, | ||
int | flag | ||
) |
Definition at line 2107 of file util.c.
Referenced by iso_util_decode_md5_tag().
char* iso_util_strcopy | ( | const char * | buf, |
size_t | len | ||
) |
Copy up to len
chars from buf
and return this newly allocated string. The new string is null-terminated.
Definition at line 1912 of file util.c.
Referenced by iso_util_strcopy_untail(), read_rr_NM(), and read_rr_SL().
char* iso_util_strcopy_untail | ( | const char * | buf, |
size_t | len | ||
) |
Copy up to len
chars from buf
and return this newly allocated string. The new string is null-terminated. Any trailing blanks will be removed.
Definition at line 1925 of file util.c.
References iso_util_strcopy().
Referenced by read_pvm().
int iso_util_tag_magic | ( | int | tag_type, |
char ** | tag_magic, | ||
int * | len, | ||
int | flag | ||
) |
Definition at line 2130 of file util.c.
References ISO_WRONG_ARG_VALUE.
Referenced by iso_md5_write_tag(), and iso_util_decode_md5_tag().
int str2a_char | ( | const char * | icharset, |
const char * | input, | ||
char ** | output | ||
) |
allow NULL input
Definition at line 1444 of file util.c.
References ISO_OUT_OF_MEM, ISO_SUCCESS, str2ascii(), and valid_a_char().
Referenced by ecma119_writer_write_vol_desc(), and iso1999_writer_write_vol_desc().
int str2ascii | ( | const char * | icharset, |
const char * | input, | ||
char ** | output | ||
) |
Convert a given string from any input charset to ASCII
icharset | Input charset. Must be supported by iconv |
input | Input string |
output | Location where the pointer to the output string will be stored |
Definition at line 392 of file util.c.
References ISO_CHARSET_CONV_ERROR, iso_iconv(), iso_iconv_close(), iso_iconv_open(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, and str2wchar().
Referenced by iso_get_ecma119_name(), str2a_char(), and str2d_char().
int str2d_char | ( | const char * | icharset, |
const char * | input, | ||
char ** | output | ||
) |
Convert a given input string to d-chars.
allow NULL input
Definition at line 1410 of file util.c.
References ISO_OUT_OF_MEM, ISO_SUCCESS, str2ascii(), and valid_d_char().
Referenced by ecma119_writer_write_vol_desc().
int str2ucs | ( | const char * | icharset, |
const char * | input, | ||
uint16_t ** | output | ||
) |
Convert a given string from any input charset to UCS-2BE charset, used for Joliet file identifiers.
icharset | Input charset. Must be supported by iconv |
input | Input string |
output | Location where the pointer to the output string will be stored |
Definition at line 558 of file util.c.
References ISO_CHARSET_CONV_ERROR, iso_iconv(), iso_iconv_close(), iso_iconv_open(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, set_ucsbe(), and str2wchar().
Referenced by iso_get_joliet_name(), joliet_create_mangled_name(), and joliet_writer_write_vol_desc().
int str2utf16be | ( | const char * | icharset, |
const char * | input, | ||
uint16_t ** | output | ||
) |
Convert a given string from any input charset to UTF-16BE charset, used for HFS+ file identifiers. (UTF-16 differs from older UCS-2 by having multi word characters.)
icharset | Input charset. Must be supported by iconv |
input | Input string |
output | Location where the pointer to the output string will be stored |
Definition at line 687 of file util.c.
References ISO_CHARSET_CONV_ERROR, iso_iconv(), iso_iconv_close(), iso_iconv_open(), ISO_NULL_POINTER, ISO_OUT_OF_MEM, ISO_SUCCESS, set_ucsbe(), and str2wchar().
Referenced by iso_get_hfsplus_name(), and iso_get_joliet_name().
int strconv | ( | const char * | input, |
const char * | icharset, | ||
const char * | ocharset, | ||
char ** | output | ||
) |
Convert the charset encoding of a given string.
input | Input string |
icharset | Input charset. Must be supported by iconv |
ocharset | Output charset. Must be supported by iconv |
output | Location where the pointer to the output string will be stored |
Definition at line 192 of file util.c.
References ISO_CHARSET_CONV_ERROR, iso_iconv(), iso_iconv_close(), iso_iconv_open(), ISO_OUT_OF_MEM, and ISO_SUCCESS.
Referenced by get_iso1999_name(), get_relaxed_vol_id(), and iso_get_rr_name().
int strnconv | ( | const char * | str, |
const char * | icharset, | ||
const char * | ocharset, | ||
size_t | len, | ||
char ** | output | ||
) |
int strnconvl | ( | const char * | str, |
const char * | icharset, | ||
const char * | ocharset, | ||
size_t | len, | ||
char ** | output, | ||
size_t * | out_len | ||
) |
Definition at line 244 of file util.c.
References ISO_CHARSET_CONV_ERROR, iso_iconv(), iso_iconv_close(), iso_iconv_open(), ISO_OUT_OF_MEM, and ISO_SUCCESS.
Referenced by iso_conv_name_chars(), and strnconv().
void strncpy_pad | ( | char * | dest, |
const char * | src, | ||
size_t | max | ||
) |
Copy up to max
characters from src
to dest
. If src
has less than max
characters, we pad dest with " " characters.
Definition at line 1947 of file util.c.
References MIN.
Referenced by ecma119_writer_write_vol_desc(), and iso1999_writer_write_vol_desc().
char* ucs2str | ( | const char * | buf, |
size_t | len | ||
) |
Convert a Joliet string with a length of len
bytes to a new string in local charset.
Definition at line 1963 of file util.c.
References iso_get_local_charset(), iso_iconv(), iso_iconv_close(), and iso_iconv_open().
int ucscmp | ( | const uint16_t * | s1, |
const uint16_t * | s2 | ||
) |
Like strcmp, but for Joliet strings.
Although each character is 2 bytes, we actually compare byte-by-byte because the words are big-endian. Comparing possibly swapped words would make the sorting order depend on the machine byte order.
Definition at line 1371 of file util.c.
Referenced by cmp_node(), cmp_node_name(), iso_get_joliet_name(), and mangle_single_dir().
uint16_t* ucscpy | ( | uint16_t * | dest, |
const uint16_t * | src | ||
) |
Like strcpy, but for Joliet strings.
Definition at line 1394 of file util.c.
References ucslen().
Referenced by mangle_single_dir().
uint16_t* ucsdup | ( | const uint16_t * | str | ) |
Like strdup, but for Joliet strings.
Definition at line 1352 of file util.c.
References ucslen().
Referenced by iso_j_dir_id(), iso_j_file_id(), and mangle_single_dir().
size_t ucslen | ( | const uint16_t * | str | ) |
Like strlen, but for Joliet strings.
Definition at line 1331 of file util.c.
Referenced by calc_dirent_len(), calc_path_table_size(), create_tree(), iso_conv_name_chars(), iso_get_hfsplus_name(), iso_j_dir_id(), iso_j_file_id(), joliet_create_mangled_name(), mangle_single_dir(), ucscmp(), ucscpy(), ucsdup(), ucsncpy(), ucsncpy_pad(), ucsrchr(), write_one_dir(), and write_path_table().
uint16_t* ucsncpy | ( | uint16_t * | dest, |
const uint16_t * | src, | ||
size_t | n | ||
) |
Like strncpy, but for Joliet strings.
n | Maximum number of characters to copy (2 bytes per char). |
Definition at line 1401 of file util.c.
References iso_handle_split_utf16(), MIN, and ucslen().
Referenced by joliet_create_mangled_name().
uint16_t* ucsrchr | ( | const uint16_t * | str, |
char | c | ||
) |
Like strrchr, but for Joliet strings.
Definition at line 1340 of file util.c.
References cmp_ucsbe(), and ucslen().
Referenced by iso_j_file_id(), and mangle_single_dir().