Minor changes.
This commit is contained in:
parent
002a832ac3
commit
b8aa48038b
@ -92,6 +92,14 @@ int iso_ring_buffer_new(IsoRingBuffer **rbuf)
|
||||
return ISO_SUCCESS;
|
||||
}
|
||||
|
||||
void iso_ring_buffer_free(IsoRingBuffer *buf)
|
||||
{
|
||||
pthread_mutex_destroy(&buf->mutex);
|
||||
pthread_cond_destroy(&buf->empty);
|
||||
pthread_cond_destroy(&buf->full);
|
||||
free(buf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write count bytes into buffer. It blocks until all bytes where written or
|
||||
* reader close the buffer.
|
||||
|
@ -21,13 +21,18 @@ typedef struct iso_ring_buffer IsoRingBuffer;
|
||||
/**
|
||||
* Create a new buffer.
|
||||
*
|
||||
* The created buffer can be freed with free(3)
|
||||
* The created buffer can be freed with iso_ring_buffer_free(3)
|
||||
*
|
||||
* @return
|
||||
* 1 success, < 0 error
|
||||
*/
|
||||
int iso_ring_buffer_new(IsoRingBuffer **rbuf);
|
||||
|
||||
/**
|
||||
* Free a given buffer
|
||||
*/
|
||||
void iso_ring_buffer_free(IsoRingBuffer *buf);
|
||||
|
||||
/**
|
||||
* Write count bytes into buffer. It blocks until all bytes where written or
|
||||
* reader close the buffer.
|
||||
|
@ -31,6 +31,7 @@ void ecma119_image_free(Ecma119Image *t)
|
||||
ecma119_node_free(t->root);
|
||||
iso_image_unref(t->image);
|
||||
iso_rbtree_destroy(t->files, iso_file_src_free);
|
||||
iso_ring_buffer_free(t->buffer);
|
||||
|
||||
for (i = 0; i < t->nwriters; ++i) {
|
||||
IsoImageWriter *writer = t->writers[i];
|
||||
@ -39,7 +40,6 @@ void ecma119_image_free(Ecma119Image *t)
|
||||
}
|
||||
free(t->input_charset);
|
||||
free(t->writers);
|
||||
free(t->buffer);
|
||||
free(t);
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,8 @@ int contains_name(Ecma119Node *dir, const char *name)
|
||||
* but never under 3 characters.
|
||||
*/
|
||||
static
|
||||
int mangle_dir(Ecma119Node *dir, int max_file_len, int max_dir_len)
|
||||
int mangle_dir(Ecma119Image *img, Ecma119Node *dir, int max_file_len,
|
||||
int max_dir_len)
|
||||
{
|
||||
int i, nchildren;
|
||||
Ecma119Node **children;
|
||||
@ -449,6 +450,8 @@ int mangle_dir(Ecma119Node *dir, int max_file_len, int max_dir_len)
|
||||
if (new == NULL) {
|
||||
return ISO_MEM_ERROR;
|
||||
}
|
||||
iso_msg_debug(img->image, "\"%s\" renamed to \"%s\"",
|
||||
children[k]->iso_name, new);
|
||||
free(children[k]->iso_name);
|
||||
children[k]->iso_name = new;
|
||||
/*
|
||||
@ -484,7 +487,7 @@ int mangle_dir(Ecma119Node *dir, int max_file_len, int max_dir_len)
|
||||
for (i = 0; i < nchildren; ++i) {
|
||||
int ret;
|
||||
if (children[i]->type == ECMA119_DIR) {
|
||||
ret = mangle_dir(children[i], max_file_len, max_dir_len);
|
||||
ret = mangle_dir(img, children[i], max_file_len, max_dir_len);
|
||||
if (ret < 0) {
|
||||
/* error */
|
||||
return ret;
|
||||
@ -507,7 +510,7 @@ int mangle_tree(Ecma119Image *img)
|
||||
} else {
|
||||
max_file = max_dir = 31;
|
||||
}
|
||||
return mangle_dir(img->root, max_file, max_dir);
|
||||
return mangle_dir(img, img->root, max_file, max_dir);
|
||||
}
|
||||
|
||||
|
||||
@ -525,8 +528,11 @@ int ecma119_tree_create(Ecma119Image *img)
|
||||
return ret;
|
||||
}
|
||||
img->root = root;
|
||||
|
||||
iso_msg_debug(img->image, "Sorting the low level tree...");
|
||||
sort_tree(root);
|
||||
|
||||
iso_msg_debug(img->image, "Mangling names...");
|
||||
ret = mangle_tree(img);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user