From: Joel Cornett Date: Wed, 6 Apr 2016 19:02:46 +0000 (-0400) Subject: fixed piglet warnings X-Git-Tag: 3.0.0-233~472^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5f817c6f23be0c75cb2bfa30033ce526069ccab;p=thirdparty%2Fsnort3.git fixed piglet warnings --- diff --git a/src/piglet/piglet_output.cc b/src/piglet/piglet_output.cc index 4dae11009..813dfba29 100644 --- a/src/piglet/piglet_output.cc +++ b/src/piglet/piglet_output.cc @@ -97,7 +97,7 @@ const struct Output unit_test_output = { printf( "%s:%c:piglet:(%s::%s):%d: %s\n", - t.chunk.filename.c_str(), get_result_short(t.result), + t.chunk->filename.c_str(), get_result_short(t.result), t.type.c_str(), t.name.c_str(), i, get_result_long(t.result) ); } @@ -139,7 +139,7 @@ const struct Output pretty_output = { printf( "%d) \x1b[34m%s::%s\x1b[0m: %s\n", - i, t.type.c_str(), t.name.c_str(), t.chunk.filename.c_str() + i, t.type.c_str(), t.name.c_str(), t.chunk->filename.c_str() ); }, [](const Test& t, unsigned) -> void @@ -197,7 +197,7 @@ const struct Output verbose_output = { printf( "[%u] - %s::%s - %s\n", - i, t.type.c_str(), t.name.c_str(), t.chunk.filename.c_str() + i, t.type.c_str(), t.name.c_str(), t.chunk->filename.c_str() ); }, diff --git a/src/piglet/piglet_runner.cc b/src/piglet/piglet_runner.cc index 518112212..bca051059 100644 --- a/src/piglet/piglet_runner.cc +++ b/src/piglet/piglet_runner.cc @@ -43,7 +43,7 @@ static inline bool load_chunk(lua_State* L, const Chunk& chunk) static bool setup_globals(lua_State* L, Test& t) { // Add script_dir env var - Lua::set_script_dir(L, SCRIPT_DIR_VARNAME, t.chunk.filename); + Lua::set_script_dir(L, SCRIPT_DIR_VARNAME, t.chunk->filename); return false; } @@ -57,7 +57,7 @@ static bool configure_test(lua_State* L, Test& t) return true; } - if ( load_chunk(L, t.chunk) ) + if ( load_chunk(L, *t.chunk) ) { t.set_error("couldn't load test chunk"); t.set_error(lua_tostring(L, -1)); @@ -133,7 +133,7 @@ void Runner::run(const struct Output& output, Test& t, unsigned i) } auto p = Manager::instantiate( - state, t.chunk.target, t.type, t.name, t.use_defaults); + state, t.chunk->target, t.type, t.name, t.use_defaults); // FIXIT-L: This injection is a hack so we can log the test header // with all the parsed information filled in diff --git a/src/piglet/piglet_utils.h b/src/piglet/piglet_utils.h index 75897046b..46a6b3eab 100644 --- a/src/piglet/piglet_utils.h +++ b/src/piglet/piglet_utils.h @@ -80,7 +80,7 @@ struct Test ERROR }; - const Chunk& chunk; + const Chunk* chunk; Timer timer; Result result = NA; @@ -98,7 +98,7 @@ struct Test messages.push_back(s); } - Test(const Chunk& ch) : chunk { ch } { } + Test(const Chunk& ch) : chunk { &ch } { } }; } // namespace Piglet