mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-02-16 02:30:54 +00:00
Fix compiler warnings, explicitly cast by default
This commit is contained in:
@@ -22,7 +22,7 @@ private:
|
||||
std::string::size_type p;
|
||||
if (Buf.at(0) == '\n'){
|
||||
p = Buf.find('\n',1);
|
||||
if(p != -1){
|
||||
if(p != std::string::npos){
|
||||
std::string R = Buf.substr(1,p-1);
|
||||
std::string_view B(R.c_str(),R.find(char(0)));
|
||||
GParser(c, B.data());
|
||||
@@ -31,7 +31,7 @@ private:
|
||||
}
|
||||
}else{
|
||||
p = Buf.find('\n');
|
||||
if(p == -1)Buf.clear();
|
||||
if(p == std::string::npos)Buf.clear();
|
||||
else{
|
||||
Buf = Buf.substr(p);
|
||||
Manage(c);
|
||||
|
||||
@@ -20,17 +20,16 @@ struct LuaArg{
|
||||
for(std::any arg : args){
|
||||
if(!arg.has_value())return;
|
||||
std::string Type = arg.type().name();
|
||||
if(Type.find("bool") != -1){
|
||||
if(Type.find("bool") != std::string::npos){
|
||||
lua_pushboolean(State,std::any_cast<bool>(arg));
|
||||
}
|
||||
if(Type.find("basic_string") != -1 || Type.find("char") != -1){
|
||||
if(Type.find("basic_string") != std::string::npos || Type.find("char") != std::string::npos){
|
||||
lua_pushstring(State,std::any_cast<std::string>(arg).c_str());
|
||||
}
|
||||
if(Type.find("int") != -1){
|
||||
if(Type.find("int") != std::string::npos){
|
||||
lua_pushinteger(State,std::any_cast<int>(arg));
|
||||
}
|
||||
if(Type.find("float") != -1){
|
||||
lua_pushnumber(State,std::any_cast<float>(arg));
|
||||
if(Type.find("float") != std::string::npos){ lua_pushnumber(State,std::any_cast<float>(arg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user