diff options
Diffstat (limited to 'lib/io')
-rw-r--r-- | lib/io/src/dir_entry.c | 68 | ||||
-rw-r--r-- | lib/io/src/dir_tree_iterator.c | 2 | ||||
-rw-r--r-- | lib/io/src/unix/dir_iterator.c | 2 | ||||
-rw-r--r-- | lib/io/src/win32/dir_iterator.c | 2 |
4 files changed, 3 insertions, 71 deletions
diff --git a/lib/io/src/dir_entry.c b/lib/io/src/dir_entry.c index b7f38f5..15f078f 100644 --- a/lib/io/src/dir_entry.c +++ b/lib/io/src/dir_entry.c @@ -28,71 +28,3 @@ dir_entry_t *dir_entry_create(const char *name) memcpy(out->name, name, name_len); return out; } - -dir_entry_xattr_t *dir_entry_xattr_create(const char *key, const sqfs_u8 *value, - size_t value_len) -{ - dir_entry_xattr_t *out; - size_t len, key_len; - - /* key_ley = strlen(key) + 1 */ - key_len = strlen(key); - if (SZ_ADD_OV(key_len, 1, &key_len)) - return NULL; - - /* len = key_len + value_len + 1 + sizeof(*out) */ - if (SZ_ADD_OV(key_len, value_len, &len)) - return NULL; - if (SZ_ADD_OV(len, 1, &len)) - return NULL; - if (SZ_ADD_OV(len, sizeof(*out), &len)) - return NULL; - - out = calloc(1, len); - if (out != NULL) { - out->key = out->data; - out->value = (sqfs_u8 *)out->data + key_len; - out->value_len = value_len; - - memcpy(out->key, key, key_len); - memcpy(out->value, value, value_len); - } - - return out; -} - -dir_entry_xattr_t *dir_entry_xattr_list_copy(const dir_entry_xattr_t *list) -{ - dir_entry_xattr_t *new, *copy = NULL, *copy_last = NULL; - const dir_entry_xattr_t *it; - - for (it = list; it != NULL; it = it->next) { - new = dir_entry_xattr_create(it->key, it->value, - it->value_len); - if (new == NULL) { - dir_entry_xattr_list_free(copy); - return NULL; - } - - if (copy_last == NULL) { - copy = new; - copy_last = new; - } else { - copy_last->next = new; - copy_last = new; - } - } - - return copy; -} - -void dir_entry_xattr_list_free(dir_entry_xattr_t *list) -{ - dir_entry_xattr_t *old; - - while (list != NULL) { - old = list; - list = list->next; - free(old); - } -} diff --git a/lib/io/src/dir_tree_iterator.c b/lib/io/src/dir_tree_iterator.c index 0174d73..25cb1d9 100644 --- a/lib/io/src/dir_tree_iterator.c +++ b/lib/io/src/dir_tree_iterator.c @@ -284,7 +284,7 @@ static int open_file_ro(dir_iterator_t *base, istream_t **out) return it->top->dir->open_file_ro(it->top->dir, out); } -static int read_xattr(dir_iterator_t *base, dir_entry_xattr_t **out) +static int read_xattr(dir_iterator_t *base, sqfs_xattr_t **out) { dir_tree_iterator_t *it = (dir_tree_iterator_t *)base; diff --git a/lib/io/src/unix/dir_iterator.c b/lib/io/src/unix/dir_iterator.c index afbf0c0..9ba200f 100644 --- a/lib/io/src/unix/dir_iterator.c +++ b/lib/io/src/unix/dir_iterator.c @@ -134,7 +134,7 @@ static int dir_open_file_ro(dir_iterator_t *it, istream_t **out) return SQFS_ERROR_UNSUPPORTED; } -static int dir_read_xattr(dir_iterator_t *it, dir_entry_xattr_t **out) +static int dir_read_xattr(dir_iterator_t *it, sqfs_xattr_t **out) { (void)it; *out = NULL; diff --git a/lib/io/src/win32/dir_iterator.c b/lib/io/src/win32/dir_iterator.c index f504b65..b1045f1 100644 --- a/lib/io/src/win32/dir_iterator.c +++ b/lib/io/src/win32/dir_iterator.c @@ -122,7 +122,7 @@ static int dir_iterator_open_file_ro(dir_iterator_t *it, istream_t **out) return SQFS_ERROR_UNSUPPORTED; } -static int dir_iterator_read_xattr(dir_iterator_t *it, dir_entry_xattr_t **out) +static int dir_iterator_read_xattr(dir_iterator_t *it, sqfs_xattr_t **out) { (void)it; *out = NULL; |