mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-20 08:21:08 +00:00
addressing few gcc 13 analyser warnings.
This commit is contained in:
parent
f67b65c00a
commit
571f3f6fec
2 changed files with 15 additions and 12 deletions
|
@ -575,19 +575,23 @@ void
|
||||||
Sys_RemoveDir(const char *path)
|
Sys_RemoveDir(const char *path)
|
||||||
{
|
{
|
||||||
char filepath[MAX_OSPATH];
|
char filepath[MAX_OSPATH];
|
||||||
DIR *directory = opendir(path);
|
|
||||||
struct dirent *file;
|
struct dirent *file;
|
||||||
|
DIR *directory;
|
||||||
|
|
||||||
if (Sys_IsDir(path))
|
if (Sys_IsDir(path))
|
||||||
{
|
{
|
||||||
while ((file = readdir(directory)) != NULL)
|
directory = opendir(path);
|
||||||
|
if (directory)
|
||||||
{
|
{
|
||||||
snprintf(filepath, MAX_OSPATH, "%s/%s", path, file->d_name);
|
while ((file = readdir(directory)) != NULL)
|
||||||
Sys_Remove(filepath);
|
{
|
||||||
}
|
snprintf(filepath, MAX_OSPATH, "%s/%s", path, file->d_name);
|
||||||
|
Sys_Remove(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
closedir(directory);
|
closedir(directory);
|
||||||
Sys_Remove(path);
|
Sys_Remove(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5458,9 +5458,8 @@ PlayerDirectoryList(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// malloc directories
|
// malloc directories
|
||||||
char** data = (char**)malloc(num * sizeof(char*));
|
char** data = (char**)calloc(num, sizeof(char*));
|
||||||
YQ2_COM_CHECK_OOM(data, "malloc()", num * sizeof(char*))
|
YQ2_COM_CHECK_OOM(data, "calloc()", num * sizeof(char*))
|
||||||
memset(data, 0, num * sizeof(char*));
|
|
||||||
|
|
||||||
s_directory.data = data;
|
s_directory.data = data;
|
||||||
s_directory.num = num;
|
s_directory.num = num;
|
||||||
|
@ -5509,8 +5508,8 @@ PlayerModelList(void)
|
||||||
qboolean result = true;
|
qboolean result = true;
|
||||||
|
|
||||||
// malloc models
|
// malloc models
|
||||||
data = (char**)malloc(MAX_PLAYERMODELS * sizeof(char*));
|
data = (char**)calloc(MAX_PLAYERMODELS, sizeof(char*));
|
||||||
memset(data, 0, MAX_PLAYERMODELS * sizeof(char*));
|
YQ2_COM_CHECK_OOM(data, "calloc()", MAX_PLAYERMODELS * sizeof(char*))
|
||||||
|
|
||||||
s_modelname.data = data;
|
s_modelname.data = data;
|
||||||
s_modelname.num = 0;
|
s_modelname.num = 0;
|
||||||
|
|
Loading…
Reference in a new issue