Fix bug in mangle_all.

master
Vreixo Formoso Lopes 15 years ago
parent 08c53aa997
commit 485607ce7b
  1. 10
      libisofs/ecma119_tree.c

@ -583,8 +583,10 @@ mangle_all(struct ecma119_tree_node *dir)
struct ecma119_dir_info d = dir->info.dir;
size_t n_change;
int changed;
size_t digits;
assert(dir->type == ECMA119_DIR);
digits = 1;
do {
changed = 0;
for (i=0; i < d.nchildren; i++) {
@ -598,7 +600,7 @@ mangle_all(struct ecma119_tree_node *dir)
/* mangle the names */
changed = 1;
n_change = j / 10 + 1;
n_change = j / 10 + digits;
for (k=0; k < j; k++) {
mangle_name(&(d.children[i+k]->iso_name),
n_change,
@ -612,6 +614,12 @@ mangle_all(struct ecma119_tree_node *dir)
/* skip ahead by the number of mangled names */
i += j - 1;
}
if (changed) {
/* we need to reorder */
qsort(dir->info.dir.children, dir->info.dir.nchildren,
sizeof(void*), cmp_node);
}
digits++;
} while (changed);
for (i=0; i < d.nchildren; i++) {

Loading…
Cancel
Save