]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
fixed some warnings
authorJosh <jrosenba@cisco.com>
Tue, 22 Jul 2014 16:00:22 +0000 (12:00 -0400)
committerJosh <jrosenba@cisco.com>
Tue, 22 Jul 2014 16:00:22 +0000 (12:00 -0400)
12 files changed:
tools/snort2lua/config_states/config_detection.cc
tools/snort2lua/config_states/config_one_string_option.cc
tools/snort2lua/conversion_state.h
tools/snort2lua/keyword_states/kws_rule.cc
tools/snort2lua/output_states/out_syslog.cc
tools/snort2lua/preprocessor_states/pps_ftp_telnet_protocol.cc
tools/snort2lua/preprocessor_states/pps_normalizers.cc
tools/snort2lua/rule_states/rule_base64_decode.cc
tools/snort2lua/rule_states/rule_content.cc
tools/snort2lua/rule_states/rule_file_data.cc
tools/snort2lua/snort2lua.cc
tools/snort2lua/utils/snort2lua_util.cc

index 6d521df51cedbc242b72a637e93bbf550dc5c704..c12d4ff4fa40c1ea446e8a23bb78e4319ee91112 100644 (file)
@@ -254,7 +254,7 @@ bool Detection::convert(std::istringstream& data_stream)
             {
                 ld->add_diff_option_comment("ac-split", "split_any_any");
                 ld->add_diff_option_comment("ac-split", "ac_full_q");
-                bool tmpval2 = !ld->add_option_to_table("split_any_any", true);
+                bool tmpval2 = ld->add_option_to_table("split_any_any", true);
                 bool tmpval1 = ld->add_option_to_table("search_method", "ac_full_q");
                 tmpval = tmpval1 && tmpval2;
 
index ae70bd8f46c7c3ef33310d7c36e43d4e7ef95242..699fae7b8f548df09bb5184f0fea82ff87b25ce4 100644 (file)
@@ -46,23 +46,15 @@ public:
     virtual bool convert(std::istringstream& stream)
     {
         if (snort_option == nullptr ||
-            lua_table == nullptr ||
-            lua_option == nullptr)
+            lua_table == nullptr)
         {
             return false;
         }
 
-        ld->open_table(*lua_table);
-
-        // if the two names are not equal ...
-        if((*snort_option).compare(*lua_option))
-            ld->add_diff_option_comment("config " + *snort_option +
-                ":", *lua_option);
-
         // get length (stringstream will not read spaces...which we want)
-        const int pos = stream.tellg();
+        const std::streamoff pos = stream.tellg();
         stream.seekg(0, stream.end);
-        const int length = ((int) stream.tellg()) - pos;
+        const std::streamoff length = stream.tellg() - pos;
         stream.seekg(pos);
 
         // read argument
@@ -73,8 +65,21 @@ public:
         delete[] arg_c;
         util::trim(arg_s);
 
-        // finally, add to the table
-        bool retval = ld->add_option_to_table(*lua_option, arg_s);
+
+        bool retval;
+        ld->open_table(*lua_table);
+
+        if((lua_option != nullptr) && (*snort_option).compare(*lua_option))
+        {
+            ld->add_diff_option_comment("config " + *snort_option +
+                ":", *lua_option);
+            retval = ld->add_option_to_table(*lua_option, arg_s);
+        }
+        else
+        {
+            retval = ld->add_option_to_table(*snort_option, arg_s);
+        }
+
         ld->close_table();
         return retval;
     }
@@ -86,14 +91,9 @@ template<const std::string *snort_option,
         const std::string *lua_option = nullptr>
 static ConversionState* config_string_ctor(Converter* cv, LuaData* ld)
 {
-    if (lua_option)
-        return new ConfigStringOption<snort_option,
-                                    lua_table,
-                                    lua_option>(cv, ld);
-    else
-        return new ConfigStringOption<snort_option,
-                                    lua_table,
-                                    snort_option>(cv, ld);
+    return new ConfigStringOption<snort_option,
+                                lua_table,
+                                lua_option>(cv, ld);
 }
 
 
index 6f7985773d631ec334e973b9ab3ed892bacd618b..64ff250269c890335de6b61e1553420b6c72d44f 100644 (file)
@@ -258,7 +258,7 @@ protected:
     inline bool set_next_rule_state(std::istringstream& stream)
     {
         std::string keyword;
-        int pos = stream.tellg();
+        std::streamoff pos = stream.tellg();
 
         while(std::getline(stream, keyword, ':'))
         {
index 4f115ad67768633ec60af43a34625842beb7b92d..edc7eeb61fd6f06eaa13ea6853c276fd4374b9c9 100644 (file)
@@ -62,7 +62,7 @@ bool RuleHeader::convert(std::istringstream& data_stream)
 
     // Now, remove the last ')' and anything beyond. We will automatically
     // add that part back when printing each rule.
-    int curr_pos = data_stream.tellg();
+    std::streamoff curr_pos = data_stream.tellg();
     std::string rule_string = data_stream.str();
     std::size_t end_pos = rule_string.rfind(')');
     rule_string = rule_string.substr(0, end_pos);
index 7eac94e0ffda01f1567fe921eacd24f8e9d99a74..6cca1398f2136418c77ae354a7a64958070c3bd3 100644 (file)
@@ -51,7 +51,7 @@ bool AlertSyslog::convert(std::istringstream& data_stream)
     bool retval = true;
 
     ld->open_table("alert_syslog");
-    int pos = data_stream.tellg();
+    std::streamoff pos = data_stream.tellg();
 
     while (data_stream >> keyword)
     {
index 7bfd0e7434add62a69abda56575ed04105580b2e..70028ffdaf6a21f7f5c827dce9ca8f42d1ca65fb 100644 (file)
@@ -80,7 +80,6 @@ std::vector<FtpServer::Command>::iterator FtpServer::get_command(
                             std::string cmd_name,
                             std::vector<FtpServer::Command>::iterator it)
 {
-    bool ftp_test;
     for (; it != commands.end(); ++it)
         if (!cmd_name.compare((*it).name))
             return it;
@@ -138,7 +137,6 @@ bool FtpServer::parse_cmd_validity_cmd(std::istringstream& data_stream)
 {
     std::string command;
     std::string elem;
-    bool first_line = true;
 
     if (!(data_stream >> command) ||
         !(data_stream >> elem) ||
index 9b85caf2b093047d61eb3a0ee5d5b487258f9b49..48d31b7b371388facff14595e177fd5a3845e32f 100644 (file)
@@ -267,7 +267,7 @@ bool TcpNormalizer::convert(std::istringstream& data_stream)
             // loop until we break or reach end of stream
             while (util::get_string(data_stream, keyword, " ,"))
             {
-                int pos = data_stream.tellg();
+                std::streamoff pos = data_stream.tellg();
 
                 if (!keyword.compare("sack"))
                     ld->add_list_to_table("allow_names", "sack");
index af61843c97d11680c536dc72ceaf576055825b7a..d5291c86fb0633ca65feb613ec6bd137c2fdffc8 100644 (file)
@@ -47,7 +47,7 @@ bool Base64Decode::convert(std::istringstream& data_stream)
 {
     std::string args;
     std::string tmp;
-    int pos = data_stream.tellg();
+    std::streamoff pos = data_stream.tellg();
     bool retval = true;
 
     args = util::get_rule_option_args(data_stream);
index 84d06fb30209cec7bd894bf5029da48a0c32e6b7..1014283c27a73318a22d072b400c56227dca1e00 100644 (file)
@@ -51,7 +51,7 @@ bool Content<option_name>::convert(std::istringstream& data_stream)
     std::string keyword;
     std::string val;
     bool retval = true;
-    int pos;
+    std::streamoff pos;
 
     if (!(*option_name).compare("protected_content"))
         ld->make_rule_a_comment();
index 158e076e850d580ee07b2ee3c3c60057c1826c60..2f6884f52a6cf456b641fd5ffd9856dbfea1485f 100644 (file)
@@ -47,7 +47,7 @@ bool FileData::convert(std::istringstream& data_stream)
 {
     std::string args;
     std::string tmp;
-    int pos = data_stream.tellg();
+    std::streamoff pos = data_stream.tellg();
     bool retval = true;
 
     retval = ld->add_rule_option("file_data");
index 4f1fb8e2ca9ebbfc856530d79c22da2e2359e3a7..be228657556978228c87378c7071d7652b97c71c 100644 (file)
@@ -93,7 +93,6 @@ static const char* parse_single_str = "    --single-rule-files, -s\t\tWhen parsi
 static const char* parse_mult_conf_str = "    --mult-conf-files, -n\t\tWhen parsing include file named 'file', write conf data to file.lua (parse_includes must be turn on)";
 static const char* parse_single_conf_str = "    --single-conf-files, -t\t\tWhen parsing include files, pull all data into specified output files";
 static const char* differences_str  = "    --output-differences, -d\t\tlua syntax aside, output to specified files the differences between your Snort and Snort++ configuration";
-static const char* default_str  = "    --output-default \t\toutput all data to specified files";
 static const char* quiet_str  = "    --output-quiet, -d\t\tdon't print to standard out. only output lua and rule syntax to specified files (no comments, errors, or reject)";
 
 enum OptionType
index 9fb02fc35f812ad424dac2007862c0b27a0a3957..c1e9554ea2fb60bcc7079f57b7fc0aa76314d175 100644 (file)
@@ -115,7 +115,7 @@ bool get_string(std::istringstream& stream,
     }
     else
     {
-        int pos = 0;
+        std::streamoff pos = 0;
         option = std::string();
 
         // we don't want an empty string