]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
fixed piglet warnings
authorJoel Cornett <joel.cornett@gmail.com>
Wed, 6 Apr 2016 19:02:46 +0000 (15:02 -0400)
committerJoel Cornett <joel.cornett@gmail.com>
Wed, 6 Apr 2016 19:02:46 +0000 (15:02 -0400)
src/piglet/piglet_output.cc
src/piglet/piglet_runner.cc
src/piglet/piglet_utils.h

index 4dae11009fb2a5ec4732add8de3be10c941e3ec0..813dfba293adad5be1c5da9ab341ad11a66cc135 100644 (file)
@@ -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()
         );
     },
 
index 51811221223f669230533d5b5025fcb048c8a543..bca0510598b8787179b233818dfe3b36782feedb 100644 (file)
@@ -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
index 75897046b6d8bac74e747b25b644573bbad9176f..46a6b3eabb19f269ac2b33906a1fbda25ee5fa02 100644 (file)
@@ -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