Merge pull request #999 from devnexen/gcc13_build_fixes

addressing few gcc 13 analyser warnings.
This commit is contained in:
Yamagi 2023-05-08 21:16:55 +02:00 committed by GitHub
commit a241fd50e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 12 deletions

View file

@ -575,19 +575,23 @@ void
Sys_RemoveDir(const char *path)
{
char filepath[MAX_OSPATH];
DIR *directory = opendir(path);
struct dirent *file;
DIR *directory;
if (Sys_IsDir(path))
{
while ((file = readdir(directory)) != NULL)
directory = opendir(path);
if (directory)
{
snprintf(filepath, MAX_OSPATH, "%s/%s", path, file->d_name);
Sys_Remove(filepath);
}
while ((file = readdir(directory)) != NULL)
{
snprintf(filepath, MAX_OSPATH, "%s/%s", path, file->d_name);
Sys_Remove(filepath);
}
closedir(directory);
Sys_Remove(path);
closedir(directory);
Sys_Remove(path);
}
}
}

View file

@ -5472,9 +5472,8 @@ PlayerDirectoryList(void)
}
// malloc directories
char** data = (char**)malloc(num * sizeof(char*));
YQ2_COM_CHECK_OOM(data, "malloc()", num * sizeof(char*))
memset(data, 0, num * sizeof(char*));
char** data = (char**)calloc(num, sizeof(char*));
YQ2_COM_CHECK_OOM(data, "calloc()", num * sizeof(char*))
s_directory.data = data;
s_directory.num = num;
@ -5523,8 +5522,8 @@ PlayerModelList(void)
qboolean result = true;
// malloc models
data = (char**)malloc(MAX_PLAYERMODELS * sizeof(char*));
memset(data, 0, MAX_PLAYERMODELS * sizeof(char*));
data = (char**)calloc(MAX_PLAYERMODELS, sizeof(char*));
YQ2_COM_CHECK_OOM(data, "calloc()", MAX_PLAYERMODELS * sizeof(char*))
s_modelname.data = data;
s_modelname.num = 0;