Cosmetics: address cppcheck warnings

This commit is contained in:
Felipe Zimmerle
2020-01-27 18:11:08 -03:00
parent 68ef2dece3
commit fe98ce4c7d
53 changed files with 358 additions and 279 deletions

View File

@@ -39,7 +39,7 @@ namespace modsecurity {
namespace engine {
bool Lua::isCompatible(std::string script, Lua *l, std::string *error) {
bool Lua::isCompatible(const std::string &script, Lua *l, std::string *error) {
#ifdef WITH_LUA
std::string lua(".lua");
std::string err;
@@ -63,7 +63,7 @@ bool Lua::isCompatible(std::string script, Lua *l, std::string *error) {
}
bool Lua::load(std::string script, std::string *err) {
bool Lua::load(const std::string &script, std::string *err) {
#ifdef WITH_LUA
lua_State *L = NULL;
L = luaL_newstate();

View File

@@ -53,7 +53,7 @@ class LuaScriptBlob {
}
const char *read(size_t *len) {
const char *read(size_t *len) const {
*len = m_len;
return (const char *)m_data;
}
@@ -68,9 +68,9 @@ class Lua {
public:
Lua() { }
bool load(std::string script, std::string *err);
bool load(const std::string &script, std::string *err);
int run(Transaction *t, const std::string &str="");
static bool isCompatible(std::string script, Lua *l, std::string *error);
static bool isCompatible(const std::string &script, Lua *l, std::string *error);
#ifdef WITH_LUA
static int blob_keeper(lua_State *L, const void *p, size_t sz, void *ud);