mirror of
https://github.com/fadden/nulib2.git
synced 2024-05-28 23:41:29 +00:00
The test for really long filename extensions was broken.
This commit is contained in:
parent
486cae404e
commit
80c9b78516
|
@ -182,22 +182,27 @@ AddPreservationString(NulibState* pState,
|
||||||
pExt = nil;
|
pExt = nil;
|
||||||
else
|
else
|
||||||
pExt = FindExtension(pState, pathBuf);
|
pExt = FindExtension(pState, pathBuf);
|
||||||
if (pExt != nil && strlen(pExt+1) < kMaxExtLen) {
|
if (pExt != nil) {
|
||||||
pExt++; /* skip past the '.' */
|
pExt++; /* skip past the '.' */
|
||||||
|
|
||||||
/* if it's strictly decimal-numeric, don't use it (.1, .2, etc) */
|
if (strlen(pExt) >= kMaxExtLen) {
|
||||||
(void) strtoul(pExt, &end, 10);
|
/* too long, forget it */
|
||||||
if (*end == '\0') {
|
|
||||||
pExt = nil;
|
pExt = nil;
|
||||||
} else {
|
} else {
|
||||||
/* if '#' appears in it, don't use it -- it'll confuse us */
|
/* if strictly decimal-numeric, don't use it (.1, .2, etc) */
|
||||||
const char* ccp = pExt;
|
(void) strtoul(pExt, &end, 10);
|
||||||
while (*ccp != '\0') {
|
if (*end == '\0') {
|
||||||
if (*ccp == '#') {
|
pExt = nil;
|
||||||
pExt = nil;
|
} else {
|
||||||
break;
|
/* if '#' appears in it, don't use it -- it'll confuse us */
|
||||||
|
const char* ccp = pExt;
|
||||||
|
while (*ccp != '\0') {
|
||||||
|
if (*ccp == '#') {
|
||||||
|
pExt = nil;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ccp++;
|
||||||
}
|
}
|
||||||
ccp++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user