Reduced minimum length of collision avoiding name from 8 to 7
This commit is contained in:
parent
5e1aaca232
commit
afa65e9f2a
@ -787,20 +787,24 @@ int make_really_unique_name(IsoDir *parent, char **name, char **unique_name,
|
|||||||
char *dpt;
|
char *dpt;
|
||||||
|
|
||||||
len = strlen(*name);
|
len = strlen(*name);
|
||||||
if (len < 8) {
|
if (len < 7) {
|
||||||
|
/* There may be up to pow(2.0,32.0)*2048/33 = 266548273400 files
|
||||||
|
The set of increment result characters has 63 elements.
|
||||||
|
pow(63.0,7.0) is nearly 15 times larger than 266548273400.
|
||||||
|
*/
|
||||||
/* Insert underscores before last dot */
|
/* Insert underscores before last dot */
|
||||||
LIBISO_ALLOC_MEM(*unique_name, char, 8 + 1);
|
LIBISO_ALLOC_MEM(*unique_name, char, 7 + 1);
|
||||||
first = len;
|
first = len;
|
||||||
dpt = strrchr(*name, '.');
|
dpt = strrchr(*name, '.');
|
||||||
if (dpt != NULL)
|
if (dpt != NULL)
|
||||||
first = (dpt - *name);
|
first = (dpt - *name);
|
||||||
if (first > 0)
|
if (first > 0)
|
||||||
memcpy(*unique_name, *name, first);
|
memcpy(*unique_name, *name, first);
|
||||||
memset(*unique_name + first, '_', 8 - len);
|
memset(*unique_name + first, '_', 7 - len);
|
||||||
if (len > first)
|
if (len > first)
|
||||||
memcpy(*unique_name + (8 - (len - first)), *name + first,
|
memcpy(*unique_name + (7 - (len - first)), *name + first,
|
||||||
len - first);
|
len - first);
|
||||||
len = 8;
|
len = 7;
|
||||||
pre_check = 1; /* It might now already be unique */
|
pre_check = 1; /* It might now already be unique */
|
||||||
} else {
|
} else {
|
||||||
LIBISO_ALLOC_MEM(*unique_name, char, len + 1);
|
LIBISO_ALLOC_MEM(*unique_name, char, len + 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user