Merge pull request #4228 from Allofich/warn7

Fix array-bounds warnings
This commit is contained in:
Jonathan Campbell 2023-05-03 09:07:14 -07:00 committed by GitHub
commit c25eee850b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -344,7 +344,7 @@ template <class MT> bool String_DBCS_TO_HOST_UTF8(char *d/*CROSS_LEN*/,const cha
// TODO: This is SLOW. Optimize. // TODO: This is SLOW. Optimize.
template <class MT> int SBCS_From_Host_Find(int c,const MT *map,const size_t map_max) { template <class MT> int SBCS_From_Host_Find(int c,const MT *map,const size_t map_max) {
if (morelen && (MT)c<0x20 && map[c] == cp437_to_unicode[c]) return c; if (morelen && (MT)c<0x20 && c >= 0 && c < 256 && map[c] == cp437_to_unicode[c]) return c;
for (size_t i=0;i < map_max;i++) { for (size_t i=0;i < map_max;i++) {
if ((MT)c == map[i]) if ((MT)c == map[i])
return (int)i; return (int)i;

View File

@ -500,7 +500,7 @@ struct fatFromDOSDrive
ffddFile f; ffddFile f;
memcpy(f.path, dir, dirlen); memcpy(f.path, dir, dirlen);
memcpy(f.path + dirlen, dta_name, fend - dta_name + 1); memcpy(f.path + dirlen, dta_name, fend - dta_name + 1);
if (filter && filter->Get(f.path)) continue; if (filter && filter->Get(f.path, sizeof(f.path))) continue;
const bool isLongFileName = (!dot && !dotdot && !(dta_attr & DOS_ATTR_VOLUME)); const bool isLongFileName = (!dot && !dotdot && !(dta_attr & DOS_ATTR_VOLUME));
if (isLongFileName) if (isLongFileName)