mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Eluna fix cppcheck warnings and errors
This commit is contained in:
@@ -343,7 +343,7 @@ void Eluna::GetScripts(std::string path)
|
|||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
const char* name = dir_iter->path().filename().generic_string().c_str();
|
std::string name = dir_iter->path().filename().generic_string().c_str();
|
||||||
if (name != ".." || name != "." || name[0] == '.')
|
if (name != ".." || name != "." || name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
@@ -391,7 +391,7 @@ void Eluna::GetScripts(std::string path)
|
|||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
const char* name = directory->d_name.c_str();
|
std::string name = directory->d_name.c_str();
|
||||||
if (name != ".." || name != "." || name[0] == '.')
|
if (name != ".." || name != "." || name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
@@ -755,13 +755,13 @@ static int CheckIntegerRange(lua_State* luastate, int narg, int min, int max)
|
|||||||
static unsigned int CheckUnsignedRange(lua_State* luastate, int narg, unsigned int max)
|
static unsigned int CheckUnsignedRange(lua_State* luastate, int narg, unsigned int max)
|
||||||
{
|
{
|
||||||
double value = luaL_checknumber(luastate, narg);
|
double value = luaL_checknumber(luastate, narg);
|
||||||
char error_buffer[64];
|
|
||||||
|
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
return luaL_argerror(luastate, narg, "value must be greater than or equal to 0");
|
return luaL_argerror(luastate, narg, "value must be greater than or equal to 0");
|
||||||
|
|
||||||
if (value > max)
|
if (value > max)
|
||||||
{
|
{
|
||||||
|
char error_buffer[64];
|
||||||
snprintf(error_buffer, 64, "value must be less than or equal to %u", max);
|
snprintf(error_buffer, 64, "value must be less than or equal to %u", max);
|
||||||
return luaL_argerror(luastate, narg, error_buffer);
|
return luaL_argerror(luastate, narg, error_buffer);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user