summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2020-05-15 00:15:35 +0200
committerGitHub <noreply@github.com>2020-05-15 00:15:35 +0200
commit13144a08e496b89b34093ffd3d810d3442df3c44 (patch)
tree406d79e17b69560564fdb0972a3c50542a3a96c6 /src/Bindings
parentGenerate "LuaState_Typedefs.inc" before running clang-tidy (diff)
downloadcuberite-13144a08e496b89b34093ffd3d810d3442df3c44.tar
cuberite-13144a08e496b89b34093ffd3d810d3442df3c44.tar.gz
cuberite-13144a08e496b89b34093ffd3d810d3442df3c44.tar.bz2
cuberite-13144a08e496b89b34093ffd3d810d3442df3c44.tar.lz
cuberite-13144a08e496b89b34093ffd3d810d3442df3c44.tar.xz
cuberite-13144a08e496b89b34093ffd3d810d3442df3c44.tar.zst
cuberite-13144a08e496b89b34093ffd3d810d3442df3c44.zip
Diffstat (limited to 'src/Bindings')
-rw-r--r--src/Bindings/LuaServerHandle.cpp4
-rw-r--r--src/Bindings/LuaState.cpp2
-rw-r--r--src/Bindings/LuaState.h2
-rw-r--r--src/Bindings/LuaUDPEndpoint.cpp2
-rw-r--r--src/Bindings/ManualBindings.cpp8
-rw-r--r--src/Bindings/PluginLua.cpp2
-rw-r--r--src/Bindings/PluginManager.cpp10
7 files changed, 15 insertions, 15 deletions
diff --git a/src/Bindings/LuaServerHandle.cpp b/src/Bindings/LuaServerHandle.cpp
index ab6436dc7..1162d87c0 100644
--- a/src/Bindings/LuaServerHandle.cpp
+++ b/src/Bindings/LuaServerHandle.cpp
@@ -36,8 +36,8 @@ void cLuaServerHandle::SetServerHandle(cServerHandlePtr a_ServerHandle, cLuaServ
{
ASSERT(m_ServerHandle == nullptr); // The handle can be set only once
- m_ServerHandle = a_ServerHandle;
- m_Self = a_Self;
+ m_ServerHandle = std::move(a_ServerHandle);
+ m_Self = std::move(a_Self);
}
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index c1612e6a1..3b9d30933 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -2014,7 +2014,7 @@ bool cLuaState::CheckParamStaticSelf(const char * a_SelfClassName)
-bool cLuaState::IsParamUserType(int a_ParamIdx, AString a_UserType)
+bool cLuaState::IsParamUserType(int a_ParamIdx, const AString & a_UserType)
{
ASSERT(IsValid());
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h
index 8caa7fef4..f17bd0485 100644
--- a/src/Bindings/LuaState.h
+++ b/src/Bindings/LuaState.h
@@ -815,7 +815,7 @@ public:
bool CheckParamStaticSelf(const char * a_SelfClassName);
/** Returns true if the specified parameter is of the specified class. */
- bool IsParamUserType(int a_ParamIdx, AString a_UserType);
+ bool IsParamUserType(int a_ParamIdx, const AString & a_UserType);
/** Returns true if the specified parameter is a number. */
bool IsParamNumber(int a_ParamIdx);
diff --git a/src/Bindings/LuaUDPEndpoint.cpp b/src/Bindings/LuaUDPEndpoint.cpp
index 779efcbce..c98be13d3 100644
--- a/src/Bindings/LuaUDPEndpoint.cpp
+++ b/src/Bindings/LuaUDPEndpoint.cpp
@@ -40,7 +40,7 @@ bool cLuaUDPEndpoint::Open(UInt16 a_Port, cLuaUDPEndpointPtr a_Self)
ASSERT(m_Self == nullptr); // Must not be opened yet
ASSERT(m_Endpoint == nullptr);
- m_Self = a_Self;
+ m_Self = std::move(a_Self);
m_Endpoint = cNetwork::CreateUDPEndpoint(a_Port, *this);
return m_Endpoint->IsOpen();
}
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 0713ec49b..1aeadb602 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -409,7 +409,7 @@ static int tolua_LOG(lua_State * tolua_S)
}
// Log the message:
- cLogger::GetInstance().LogSimple(GetLogMessage(tolua_S).c_str(), LogLevel);
+ cLogger::GetInstance().LogSimple(GetLogMessage(tolua_S), LogLevel);
return 0;
}
@@ -427,7 +427,7 @@ static int tolua_LOGINFO(lua_State * tolua_S)
return 0;
}
- cLogger::GetInstance().LogSimple(GetLogMessage(tolua_S).c_str(), cLogger::llInfo);
+ cLogger::GetInstance().LogSimple(GetLogMessage(tolua_S), cLogger::llInfo);
return 0;
}
@@ -445,7 +445,7 @@ static int tolua_LOGWARN(lua_State * tolua_S)
return 0;
}
- cLogger::GetInstance().LogSimple(GetLogMessage(tolua_S).c_str(), cLogger::llWarning);
+ cLogger::GetInstance().LogSimple(GetLogMessage(tolua_S), cLogger::llWarning);
return 0;
}
@@ -463,7 +463,7 @@ static int tolua_LOGERROR(lua_State * tolua_S)
return 0;
}
- cLogger::GetInstance().LogSimple(GetLogMessage(tolua_S).c_str(), cLogger::llError);
+ cLogger::GetInstance().LogSimple(GetLogMessage(tolua_S), cLogger::llError);
return 0;
}
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index 13e2084ca..abac8b9a8 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -108,7 +108,7 @@ bool cPluginLua::Load(void)
std::string PluginPath = GetLocalFolder() + "/";
// List all Lua files for this plugin. Info.lua has a special handling - make it the last to load:
- AStringVector Files = cFile::GetFolderContents(PluginPath.c_str());
+ AStringVector Files = cFile::GetFolderContents(PluginPath);
AStringVector LuaFiles;
bool HasInfoLua = false;
for (AStringVector::const_iterator itr = Files.begin(), end = Files.end(); itr != end; ++itr)
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index b57f3779f..88bc82172 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -57,7 +57,7 @@ void cPluginManager::RefreshPluginList(void)
{
// Get a list of currently available folders:
AString PluginsPath = GetPluginsPath() + "/";
- AStringVector Contents = cFile::GetFolderContents(PluginsPath.c_str());
+ AStringVector Contents = cFile::GetFolderContents(PluginsPath);
AStringVector Folders;
for (auto & item: Contents)
{
@@ -1401,7 +1401,7 @@ bool cPluginManager::BindCommand(
auto & reg = m_Commands[a_Command];
reg.m_Plugin = a_Plugin;
- reg.m_Handler = a_Handler;
+ reg.m_Handler = std::move(a_Handler);
reg.m_Permission = a_Permission;
reg.m_HelpString = a_HelpString;
return true;
@@ -1508,7 +1508,7 @@ bool cPluginManager::BindConsoleCommand(
auto & reg = m_ConsoleCommands[a_Command];
reg.m_Plugin = a_Plugin;
- reg.m_Handler = a_Handler;
+ reg.m_Handler = std::move(a_Handler);
reg.m_Permission = "";
reg.m_HelpString = a_HelpString;
return true;
@@ -1739,7 +1739,7 @@ AStringVector cPluginManager::GetFoldersToLoad(cSettingsRepositoryInterface & a_
// Get the old format plugin list, and migrate it.
// Upgrade path added on 2020-03-27
auto OldValues = a_Settings.GetValues("Plugins");
- for (auto NameValue : OldValues)
+ for (const auto & NameValue : OldValues)
{
AString ValueName = NameValue.first;
if (ValueName.compare("Plugin") == 0)
@@ -1759,7 +1759,7 @@ AStringVector cPluginManager::GetFoldersToLoad(cSettingsRepositoryInterface & a_
// Get the list of plugins to load:
auto Values = a_Settings.GetValues("Plugins");
- for (auto NameValue : Values)
+ for (const auto & NameValue : Values)
{
AString Enabled = NameValue.second;
if (Enabled == "1")