File src/filehandling_functions.c changed (mode: 100644) (index c1de709..5af253e) |
... |
... |
seeknode(int tag_table_pos, FILE ** Id) |
1264 |
1264 |
void |
void |
1265 |
1265 |
strip_compression_suffix(char *file) |
strip_compression_suffix(char *file) |
1266 |
1266 |
{ |
{ |
|
1267 |
|
const size_t len = strlen(file); |
|
1268 |
|
assert(len<1024); /* just some random limit */ |
1267 |
1269 |
char *found = 0; |
char *found = 0; |
1268 |
|
int j; |
|
1269 |
|
for (j = 0; j < SuffixesNumber; j++) |
|
|
1270 |
|
|
|
1271 |
|
for (unsigned j = 0; j < SuffixesNumber; j++) |
1270 |
1272 |
{ |
{ |
1271 |
1273 |
if ( (found = strstr(file, suffixes[j].suffix)) != NULL ) |
if ( (found = strstr(file, suffixes[j].suffix)) != NULL ) |
1272 |
1274 |
{ |
{ |
1273 |
|
if ( (file + strlen(file)) - found == strlen(suffixes[j].suffix) ) |
|
|
1275 |
|
if ( file + len == found + strlen(suffixes[j].suffix) ) |
1274 |
1276 |
{ |
{ |
1275 |
1277 |
*found = '\0'; |
*found = '\0'; |
1276 |
1278 |
break; |
break; |
|
... |
... |
strip_compression_suffix(char *file) |
1283 |
1285 |
void |
void |
1284 |
1286 |
strip_info_suffix(char *file) |
strip_info_suffix(char *file) |
1285 |
1287 |
{ |
{ |
|
1288 |
|
const size_t len = strlen(file); |
|
1289 |
|
assert(len<1024); /* just some random limit */ |
|
1290 |
|
|
1286 |
1291 |
char *found = 0; |
char *found = 0; |
1287 |
|
char suffix[6] = ".info"; |
|
|
1292 |
|
const char suffix[6] = ".info"; |
|
1293 |
|
|
1288 |
1294 |
if ( (found = strstr(file, suffix)) != NULL ) |
if ( (found = strstr(file, suffix)) != NULL ) |
1289 |
1295 |
{ |
{ |
1290 |
|
if ( (file + strlen(file)) - found == strlen(suffix) ) |
|
|
1296 |
|
if ( file + len == found + strlen(suffix) ) |
1291 |
1297 |
{ |
{ |
1292 |
1298 |
*found = '\0'; |
*found = '\0'; |
1293 |
1299 |
} |
} |