Minor tweaks

This commit is contained in:
bnnm 2021-04-18 13:14:06 +02:00
parent cfb132a92d
commit 6b655d9c53
2 changed files with 4 additions and 2 deletions

View File

@ -691,7 +691,7 @@ static STREAMFILE* open_txth(STREAMFILE* sf) {
/* try "(path/)(.sub.ext).txth" */
get_streamfile_basename(sf,basename,PATH_LIMIT);
subext = filename_extension(basename);
if (subext != NULL) {
if (subext != NULL && subext[0] != '\0') {
get_streamfile_path(sf,filename,PATH_LIMIT);
get_streamfile_ext(sf,fileext,PATH_LIMIT);
strcat(filename,".");

View File

@ -1351,9 +1351,11 @@ static uint32_t hash_sf(STREAMFILE* sf) {
get_streamfile_name(sf, path, sizeof(path));
/* our favorite garbo hash a.k.a FNV-1 32b */
for (i = 0; i < strlen(path); i++) {
i = 0;
while (path[i] != '\0') {
char c = tolower(path[i]);
hash = (hash * 16777619) ^ (uint8_t)c;
i++;
}
return hash;