From 6b655d9c537cdfa1879f165b2aad47808f021bba Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 18 Apr 2021 13:14:06 +0200 Subject: [PATCH] Minor tweaks --- src/meta/txth.c | 2 +- src/vgmstream.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/meta/txth.c b/src/meta/txth.c index 93474ac5..02711924 100644 --- a/src/meta/txth.c +++ b/src/meta/txth.c @@ -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,"."); diff --git a/src/vgmstream.c b/src/vgmstream.c index 575c83a1..8b9bedf1 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -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;