]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #996 in SNORT/snort3 from warnings to master
authorMichael Altizer (mialtize) <mialtize@cisco.com>
Mon, 21 Aug 2017 22:11:58 +0000 (18:11 -0400)
committerMichael Altizer (mialtize) <mialtize@cisco.com>
Mon, 21 Aug 2017 22:11:58 +0000 (18:11 -0400)
Squashed commit of the following:

commit 74780ac195a4bd913c9eda6a0c6d9d14698f431d
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Aug 18 16:16:13 2017 -0400

    build: Clean up some more compiler warnings and remove spurious tabs

26 files changed:
src/detection/detect_trace.cc
src/detection/detect_trace.h
src/helpers/base64_encoder.h
src/ips_options/ips_byte_math.cc
src/ips_options/ips_icmp_id.cc
src/ips_options/ips_icmp_seq.cc
src/ips_options/ips_rpc.cc
src/ips_options/ips_session.cc
src/log/messages.cc
src/log/messages.h
src/main/help.cc
src/main/help.h
src/main/snort_debug.cc
src/main/snort_module.cc
src/main/snort_types.h
src/network_inspectors/appid/detector_plugins/http_url_patterns.h
src/parser/parser.cc
src/ports/port_table.cc
src/search_engines/acsmx2.cc
src/service_inspectors/dce_rpc/smb_message.cc
src/service_inspectors/ftp_telnet/ftp_data.cc
src/service_inspectors/http_inspect/http_enum.h
src/sfip/sf_ip.h
src/utils/util.cc
src/utils/util_cstring.cc
tools/snort2lua/helpers/parse_cmd_line.cc

index ced91eaca01eda2933f10c452365b80f5eb0c8e1..22813b958725d16b3453aaf00d46b4ec62676d95 100644 (file)
@@ -130,7 +130,7 @@ void node_eval_trace(const detection_option_tree_node_t* node, const Cursor& cur
     else
     {
         trace_logf(detection, TRACE_RULE_EVAL, "Reached leaf, cursor name %s, cursor position %u\n",
-                                 name, pos);
+                  name, pos);
     }
 
     if (!trace_enabled(detection_trace, trace_buffer))
index 9dea9b8a15b950ebff5b8205ebedbeef59370bd4..e8c4cfec5064038d8c87f939e99cb96576ec47e8 100644 (file)
 
 enum
 {
-       TRACE_DETECTION_ENGINE = 0x1,
-       TRACE_RULE_EVAL = 0x2,
-       TRACE_BUFFER_MINIMAL = 0x4,
-       TRACE_BUFFER_VERBOSE = 0x8,
-       TRACE_RULE_VARS = 0x10
+    TRACE_DETECTION_ENGINE = 0x1,
+    TRACE_RULE_EVAL = 0x2,
+    TRACE_BUFFER_MINIMAL = 0x4,
+    TRACE_BUFFER_VERBOSE = 0x8,
+    TRACE_RULE_VARS = 0x10
 };
-       
+
 void clear_trace_cursor_info();
 void print_pkt_info(Packet* p);
 void print_pattern(const PatternMatchData* pmd);
index 6c5a8d486462957909a863bcfe4d53508b08f74b..93c6db4dbc4a455090309f4bfa53863250368840 100644 (file)
@@ -40,7 +40,7 @@ public:
     unsigned finish(char* buf);
 
     void reset()
-    { step = step_A, state = 0; }
+    { step = step_A; state = 0; }
 
 private:
     enum Steps { step_A, step_B, step_C };
index 62767ee1febe14671dc73f2e8e13aa64c473be69..f62a281cf94c88ccc2c3fadbf47edb9188f5bafa 100644 (file)
@@ -279,16 +279,16 @@ int ByteMathOption::eval(Cursor& c, Packet* p)
 
 static void parse_base(uint8_t value, ByteMathData& idx)
 {
-       assert(value <= 2);
-       int base[] = { 16, 10, 8 };
-       idx.base = base[value];
+    assert(value <= 2);
+    int base[] = { 16, 10, 8 };
+    idx.base = base[value];
 }
 
 static void parse_endian(uint8_t value, ByteMathData& idx)
 {
-       assert(value <= 1);
-       int endian[] = { ENDIAN_BIG, ENDIAN_LITTLE };
-       set_byte_order(idx.endianess, endian[value], "byte_math");
+    assert(value <= 1);
+    int endian[] = { ENDIAN_BIG, ENDIAN_LITTLE };
+    set_byte_order(idx.endianess, endian[value], "byte_math");
 }
 
 //-------------------------------------------------------------------------
index ad64a62776bebe4bc931212abe7064b1b6e00db5..160f7601df47ada3ad7db485497fddf4e25b162d 100644 (file)
@@ -113,7 +113,7 @@ int IcmpIdOption::eval(Cursor&, Packet* p)
         ((uint8_t)p->ptrs.icmph->type == icmp::Icmp6Types::ECHO_REQUEST ||
         (uint8_t)p->ptrs.icmph->type == icmp::Icmp6Types::ECHO_REPLY) )
     {
-               uint16_t icmp_id = ntohs(p->ptrs.icmph->s_icmp_id);
+        uint16_t icmp_id = ntohs(p->ptrs.icmph->s_icmp_id);
         if ( config.eval( icmp_id ) )
             return DETECTION_OPTION_MATCH;
     }
index 461b0005c01dfae7dd21d9d771212831f6cd502f..506ba1248dec6a37d4b2ed8591ffb7fd158e5d0e 100644 (file)
@@ -112,7 +112,7 @@ int IcmpSeqOption::eval(Cursor&, Packet* p)
         ((uint8_t)p->ptrs.icmph->type == icmp::Icmp6Types::ECHO_REQUEST ||
         (uint8_t)p->ptrs.icmph->type == icmp::Icmp6Types::ECHO_REPLY) )
     {
-               uint16_t icmp_seq = ntohs(p->ptrs.icmph->s_icmp_seq);
+        uint16_t icmp_seq = ntohs(p->ptrs.icmph->s_icmp_seq);
         if ( config.eval( icmp_seq ) )
         {
             return DETECTION_OPTION_MATCH;
index 11b5a5df45a7e3f0257b78f925e09080288ea0a4..a6f71ac4e890ad089e07a37ab86d7754dce5e8ac 100644 (file)
@@ -40,7 +40,7 @@ struct RpcCheckData
     uint32_t program;
     uint32_t version;
     uint32_t procedure;
-    uint32_t flags;    // which fields to check
+    uint32_t flags; // which fields to check
 };
 
 #define RPC_CHECK_VERSION   0x1
@@ -155,7 +155,7 @@ bool RpcOption::is_match(Packet* p)
 // get a 32-bit int from the current location and increment to next int position
 uint32_t RpcOption::get_int(const uint8_t*& data)
 {
-    uint32_t value = extract_32bits(data);     
+    uint32_t value = extract_32bits(data);
     data += 4;
     return value;
 }
index 65d0512459fc89b5f7a1041045e39cf18c1e90e1..fe357e287612d18e3076bc2300a7b02882205924 100644 (file)
@@ -62,9 +62,9 @@
 
 static THREAD_LOCAL ProfileStats sessionPerfStats;
 
-#define SESSION_PRINTABLE      1
-#define SESSION_BINARY         2
-#define SESSION_ALL                    3
+#define SESSION_PRINTABLE   1
+#define SESSION_BINARY      2
+#define SESSION_ALL         3
 
 struct SessionData
 {
index c62b0f03296a449b1f98957713d0cbcdd570eba2..76e4d5c778af6ca232373410979fce7763149e15 100644 (file)
@@ -112,7 +112,7 @@ void ParseError(const char* format, ...)
     parse_errors++;
 }
 
-NORETURN void ParseAbort(const char* format, ...)
+[[noreturn]] void ParseAbort(const char* format, ...)
 {
     char buf[STD_BUF+1];
     va_list ap;
@@ -258,7 +258,7 @@ void ErrorMessage(const char* format,...)
  *
  * Returns: void function
  */
-NORETURN void FatalError(const char* format,...)
+[[noreturn]] void FatalError(const char* format,...)
 {
     char buf[STD_BUF+1];
     va_list ap;
@@ -303,7 +303,7 @@ NORETURN void FatalError(const char* format,...)
     }
 }
 
-void log_safec_error(const char* msg, void*, int e)
+[[noreturn]] void log_safec_error(const char* msg, void*, int e)
 {
     static THREAD_LOCAL unsigned safec_errors = 0;
 
index 3482d6027d5e9d24d8186fc8fd0f71d1e9fc7045..af595badd6b14ad065456da9d9e5f6aa353e2ec1 100644 (file)
@@ -51,7 +51,7 @@ unsigned get_parse_warnings();
 SO_PUBLIC void ParseMessage(const char*, ...) __attribute__((format (printf, 1, 2)));
 SO_PUBLIC void ParseWarning(WarningGroup, const char*, ...) __attribute__((format (printf, 2, 3)));
 SO_PUBLIC void ParseError(const char*, ...) __attribute__((format (printf, 1, 2)));
-SO_PUBLIC NORETURN void ParseAbort(const char*, ...) __attribute__((format (printf, 1, 2)));
+[[noreturn]] SO_PUBLIC void ParseAbort(const char*, ...) __attribute__((format (printf, 1, 2)));
 
 SO_PUBLIC void LogMessage(const char*, ...) __attribute__((format (printf, 1, 2)));
 SO_PUBLIC void LogMessage(FILE* fh, const char*, ...) __attribute__((format (printf, 2, 3)));
@@ -59,9 +59,9 @@ SO_PUBLIC void WarningMessage(const char*, ...) __attribute__((format (printf, 1
 SO_PUBLIC void ErrorMessage(const char*, ...) __attribute__((format (printf, 1, 2)));
 
 // FIXIT-M do not call FatalError() during runtime
-SO_PUBLIC NORETURN void FatalError(const char*, ...) __attribute__((format (printf, 1, 2)));
+[[noreturn]] SO_PUBLIC void FatalError(const char*, ...) __attribute__((format (printf, 1, 2)));
 
-void log_safec_error(const char*, void*, int);
+[[noreturn]] void log_safec_error(const char*, void*, int);
 
 class Dumper
 {
index e86f862aee64358775b4a1c2bc3d19f5e0cffc9a..a8eb6a31358174855d306b3eaa0f89070677362d 100644 (file)
@@ -112,13 +112,13 @@ void help_args(const char* pfx)
     }
 }
 
-NORETURN void help_basic(SnortConfig*, const char*)
+[[noreturn]] void help_basic(SnortConfig*, const char*)
 {
     fprintf(stdout, "%s\n", snort_help);
     exit(0);
 }
 
-NORETURN void help_usage(SnortConfig*, const char* s)
+[[noreturn]] void help_usage(SnortConfig*, const char* s)
 {
     fprintf(stdout, "usage:\n");
     fprintf(stdout, "    %s -?: list options\n", s);
@@ -130,13 +130,13 @@ NORETURN void help_usage(SnortConfig*, const char* s)
     exit(0);
 }
 
-NORETURN void help_options(SnortConfig*, const char* val)
+[[noreturn]] void help_options(SnortConfig*, const char* val)
 {
     help_args(val);
     exit(0);
 }
 
-NORETURN void help_signals(SnortConfig*, const char*)
+[[noreturn]] void help_signals(SnortConfig*, const char*)
 {
     help_signals();
     exit(0);
@@ -149,7 +149,7 @@ enum HelpType
     HT_IPS, HT_LST, HT_MOD, HT_PEG, HT_PLG
 };
 
-NORETURN static void show_help(SnortConfig* sc, const char* val, HelpType ht)
+[[noreturn]] static void show_help(SnortConfig* sc, const char* val, HelpType ht)
 {
     snort_conf = new SnortConfig;
     ScriptManager::load_scripts(sc->script_paths);
@@ -211,12 +211,12 @@ NORETURN static void show_help(SnortConfig* sc, const char* val, HelpType ht)
     exit(0);
 }
 
-NORETURN void help_config(SnortConfig* sc, const char* val)
+[[noreturn]] void help_config(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_CFG);
 }
 
-NORETURN void help_commands(SnortConfig* sc, const char* val)
+[[noreturn]] void help_commands(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_CMD);
 }
@@ -226,48 +226,48 @@ void config_markup(SnortConfig*, const char*)
     Markup::enable();
 }
 
-NORETURN void help_gids(SnortConfig* sc, const char* val)
+[[noreturn]] void help_gids(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_GID);
 }
 
-NORETURN void help_buffers(SnortConfig* sc, const char* val)
+[[noreturn]] void help_buffers(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_BUF);
 }
 
-NORETURN void help_builtin(SnortConfig* sc, const char* val)
+[[noreturn]] void help_builtin(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_IPS);
 }
 
-NORETURN void help_counts(SnortConfig* sc, const char* val)
+[[noreturn]] void help_counts(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_PEG);
 }
 
-NORETURN void help_module(SnortConfig* sc, const char* val)
+[[noreturn]] void help_module(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_MOD);
 }
 
-NORETURN void help_modules(SnortConfig* sc, const char* val)
+[[noreturn]] void help_modules(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_HMO);
 }
 
-NORETURN void help_plugins(SnortConfig* sc, const char* val)
+[[noreturn]] void help_plugins(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_HPL);
 }
 
-NORETURN void help_version(SnortConfig*)
+[[noreturn]] void help_version(SnortConfig*)
 {
     DisplayBanner();
     exit(0);
 }
 
-NORETURN void list_daqs(SnortConfig* sc)
+[[noreturn]] void list_daqs(SnortConfig* sc)
 {
     SFDAQ::load(sc);
     SFDAQ::print_types(cout);
@@ -275,55 +275,55 @@ NORETURN void list_daqs(SnortConfig* sc)
     exit(0);
 }
 
-NORETURN void list_interfaces(SnortConfig*)
+[[noreturn]] void list_interfaces(SnortConfig*)
 {
     PrintAllInterfaces();
     exit(0);
 }
 
-NORETURN void list_modules(SnortConfig* sc, const char* val)
+[[noreturn]] void list_modules(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_LST);
 }
 
-NORETURN void list_plugins(SnortConfig* sc, const char* val)
+[[noreturn]] void list_plugins(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_PLG);
 }
 
-NORETURN void dump_defaults(SnortConfig* sc, const char* val)
+[[noreturn]] void dump_defaults(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_DFL);
 }
 
-NORETURN void dump_builtin_rules(SnortConfig* sc, const char* val)
+[[noreturn]] void dump_builtin_rules(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_DBR);
 }
 
-NORETURN void dump_dynamic_rules(SnortConfig* sc, const char* val)
+[[noreturn]] void dump_dynamic_rules(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_DDR);
 }
 
-NORETURN void dump_msg_map(SnortConfig* sc, const char* val)
+[[noreturn]] void dump_msg_map(SnortConfig* sc, const char* val)
 {
     show_help(sc, val, HT_DMM);
 }
 
-NORETURN void dump_rule_hex(SnortConfig*, const char* val)
+[[noreturn]] void dump_rule_hex(SnortConfig*, const char* val)
 {
     SoManager::rule_to_hex(val);
     exit(0);
 }
 
-NORETURN void dump_rule_text(SnortConfig*, const char* val)
+[[noreturn]] void dump_rule_text(SnortConfig*, const char* val)
 {
     SoManager::rule_to_text(val);
     exit(0);
 }
 
-NORETURN void dump_version(SnortConfig*)
+[[noreturn]] void dump_version(SnortConfig*)
 {
     cout << VERSION << endl;
     exit(0);
index 2f249b01c194fc333333b45a77c906c3b9a40def..f2242b9e7513e073046c76e3145bcae8a16ac92b 100644 (file)
@@ -28,33 +28,33 @@ struct SnortConfig;
 void config_markup(SnortConfig*, const char*);
 
 void help_args(const char* pfx);
-void help_basic(SnortConfig*, const char*);
-void help_usage(SnortConfig*, const char*);
-void help_options(SnortConfig*, const char*);
-void help_signals(SnortConfig*, const char*);
-void help_config(SnortConfig* sc, const char*);
-void help_commands(SnortConfig* sc, const char*);
-void help_gids(SnortConfig* sc, const char*);
-void help_buffers(SnortConfig* sc, const char*);
-void help_builtin(SnortConfig* sc, const char*);
-void help_module(SnortConfig* sc, const char*);
-void help_modules(SnortConfig* sc, const char*);
-void help_plugins(SnortConfig* sc, const char*);
-void help_version(SnortConfig*);
-void help_counts(SnortConfig* sc, const char*);
-
-void list_modules(SnortConfig* sc, const char*);
-void list_plugins(SnortConfig* sc, const char*);
-void list_interfaces(SnortConfig*);
-void list_daqs(SnortConfig* sc);
-
-void dump_defaults(SnortConfig* sc, const char*);
-void dump_builtin_rules(SnortConfig* sc, const char*);
-void dump_dynamic_rules(SnortConfig* sc, const char*);
-void dump_msg_map(SnortConfig* sc, const char*);
-void dump_rule_hex(SnortConfig* sc, const char*);
-void dump_rule_text(SnortConfig* sc, const char*);
-void dump_version(SnortConfig* sc);
+[[noreturn]] void help_basic(SnortConfig*, const char*);
+[[noreturn]] void help_usage(SnortConfig*, const char*);
+[[noreturn]] void help_options(SnortConfig*, const char*);
+[[noreturn]] void help_signals(SnortConfig*, const char*);
+[[noreturn]] void help_config(SnortConfig* sc, const char*);
+[[noreturn]] void help_commands(SnortConfig* sc, const char*);
+[[noreturn]] void help_gids(SnortConfig* sc, const char*);
+[[noreturn]] void help_buffers(SnortConfig* sc, const char*);
+[[noreturn]] void help_builtin(SnortConfig* sc, const char*);
+[[noreturn]] void help_module(SnortConfig* sc, const char*);
+[[noreturn]] void help_modules(SnortConfig* sc, const char*);
+[[noreturn]] void help_plugins(SnortConfig* sc, const char*);
+[[noreturn]] void help_version(SnortConfig*);
+[[noreturn]] void help_counts(SnortConfig* sc, const char*);
+
+[[noreturn]] void list_modules(SnortConfig* sc, const char*);
+[[noreturn]] void list_plugins(SnortConfig* sc, const char*);
+[[noreturn]] void list_interfaces(SnortConfig*);
+[[noreturn]] void list_daqs(SnortConfig* sc);
+
+[[noreturn]] void dump_defaults(SnortConfig* sc, const char*);
+[[noreturn]] void dump_builtin_rules(SnortConfig* sc, const char*);
+[[noreturn]] void dump_dynamic_rules(SnortConfig* sc, const char*);
+[[noreturn]] void dump_msg_map(SnortConfig* sc, const char*);
+[[noreturn]] void dump_rule_hex(SnortConfig* sc, const char*);
+[[noreturn]] void dump_rule_text(SnortConfig* sc, const char*);
+[[noreturn]] void dump_version(SnortConfig* sc);
 
 #endif
 
index 7b216679e48dd68e562eb8f70f6f6d7d6edad44b..97fd84ad18fa6576a350913164330f55b0ae217f 100644 (file)
@@ -104,11 +104,11 @@ static inline void trace_vprintf(const char* name, Trace mask, const char* file,
     if ( !trace_enabled(mask, flags) )
         return;
 
-    char buf[STD_BUF]; 
+    char buf[STD_BUF];
     int buf_len = sizeof(buf);
     char* buf_ptr = buf;
     int size;
-       
+
     if (name)
     {   
         size = snprintf(buf, buf_len, "%s: ", name);
@@ -120,7 +120,7 @@ static inline void trace_vprintf(const char* name, Trace mask, const char* file,
             buf_len -= size;
         }
     }
-       
+
     if ( file )
     {
         size = snprintf(buf_ptr, buf_len, "%s:%d: ", file, line);
index 3b6a069262415d5ccfafc1fc2b2520700a669e88..0cbf94fd2f19d68fbbd857ea18e4956c476d654b 100644 (file)
@@ -95,19 +95,19 @@ static const Command snort_cmds[] =
 // why not
 //-------------------------------------------------------------------------
 
-NORETURN static void c2x(const char* s)
+[[noreturn]] static void c2x(const char* s)
 {
     printf("'%c' = 0x%2.2X (%d)\n", s[0], s[0], s[0]);
     exit(0);
 }
 
-NORETURN static void x2c(unsigned x)
+[[noreturn]] static void x2c(unsigned x)
 {
     printf("0x%2.2X (%u) = '%c'\n", x, x, static_cast<char>(x));
     exit(0);
 }
 
-NORETURN static void x2s(const char* s)
+[[noreturn]] static void x2s(const char* s)
 {
     bool inv;
     string out, in = "\"";
index 33b191e6c8ddd03ec3052bbfdb3418d5397421da..23c5c4119af3605d1b27577f90df504fb52d3081 100644 (file)
@@ -59,18 +59,6 @@ typedef uint16_t Port;
 #endif
 #endif
 
-/* specifies that a function does not return
- * used for quieting Visual Studio warnings */
-#ifdef _MSC_VER
-# if _MSC_VER >= 1400
-#  define NORETURN __declspec(noreturn)
-# else
-#  define NORETURN
-# endif
-#else
-# define NORETURN __attribute__ ((noreturn))
-#endif
-
 #if !defined(__GNUC__) || __GNUC__ < 2 || \
     (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
 #define __attribute__(x)    /* delete __attribute__ if non-gcc or gcc1 */
index ffe619d77ac6406b0a93723a6d9252b97119d560..252b75b1033a5d4bc78df8eb986967fa3f9eeb10 100644 (file)
@@ -228,20 +228,20 @@ typedef std::vector<CHPMatchCandidate> CHPMatchTally;
 
 struct ChpMatchDescriptor
 {
-       void free_rewrite_buffers()
-       {
+    void free_rewrite_buffers()
+    {
         for (unsigned i = 0; i < NUMBER_OF_PTYPES; i++)
             if (chp_rewritten[i])
             {
                 snort_free(chp_rewritten[i]);
                 chp_rewritten[i] = nullptr;
             }
-       }
+    }
 
-       void sort_chp_matches()
-       {
-           chp_matches[cur_ptype].sort(ChpMatchDescriptor::comp_chp_actions);
-       }
+    void sort_chp_matches()
+    {
+        chp_matches[cur_ptype].sort(ChpMatchDescriptor::comp_chp_actions);
+    }
 
     PatternType cur_ptype;
     char* buffer[NUMBER_OF_PTYPES] = { nullptr };
index de5b7901cc7a74cf216053f973375f18bbdb8818..b481c1b3c15ae380ac88cb2e402f9a6948fb232d 100644 (file)
@@ -779,7 +779,7 @@ RuleTreeNode* deleteRtnFromOtn(OptTreeNode* otn, SnortConfig* sc)
     return deleteRtnFromOtn(otn, get_ips_policy()->policy_id, sc);
 }
 
-uint32_t rtn_hash_func(SFHASHFCN*, unsigned char *k, int)
+static uint32_t rtn_hash_func(SFHASHFCN*, unsigned char *k, int)
 {
     uint32_t a,b,c;
     RuleTreeNodeKey* rtnk = (RuleTreeNodeKey*)k;
@@ -800,7 +800,7 @@ uint32_t rtn_hash_func(SFHASHFCN*, unsigned char *k, int)
     return c;
 }
 
-int rtn_compare_func(const void *k1, const void *k2, size_t)
+static int rtn_compare_func(const void *k1, const void *k2, size_t)
 {
     RuleTreeNodeKey* rtnk1 = (RuleTreeNodeKey*)k1;
     RuleTreeNodeKey* rtnk2 = (RuleTreeNodeKey*)k2;
@@ -814,7 +814,7 @@ int rtn_compare_func(const void *k1, const void *k2, size_t)
     if (same_headers(rtnk1->rtn, rtnk2->rtn))
         return 0;
     
-       return 1;
+    return 1;
 }
 
 /**Add RTN to OTN for a particular OTN.
index fb0ba6242c7d8bcc8d4eb0d1d026efe588d60d23..561ab88403697757c5839c78cc9bc8449b889a8c 100644 (file)
@@ -583,7 +583,7 @@ static inline SF_LIST** create_port_lists(PortTable* p)
     SF_LIST** parray = (SF_LIST**)snort_calloc(sizeof(SF_LIST*), SFPO_MAX_PORTS);
     assert(parray);
 
-       PortObject* po;
+    PortObject* po;
     SF_LNODE* lpos;
     for ( po = (PortObject*)sflist_first(p->pt_polist, &lpos);
           po;
@@ -653,9 +653,9 @@ static int PortTableCompileMergePortObjects(PortTable* p)
             po;
             po = (PortObject*)sflist_next(&lpos) )
         {
-                       if (pol_cnt < SFPO_MAX_LPORTS )
+            if (pol_cnt < SFPO_MAX_LPORTS )
             {
-                               pol[ pol_cnt++ ] = po;
+                pol[ pol_cnt++ ] = po;
             }
         }
         p->pt_port_object[i] = 0;
@@ -685,8 +685,8 @@ static int PortTableCompileMergePortObjects(PortTable* p)
         DEBUG_WRAP(DebugMessage(DEBUG_PORTLISTS, "\n"); fflush(stdout); );
     }
 
-       delete_port_lists(optimized_pl);
-       snort_free(optimized_pl);
+    delete_port_lists(optimized_pl);
+    snort_free(optimized_pl);
 
     /*
      * Normalize the Ports so they indicate only the ports that
index 5a2f5cc7ffab826cf6f42ff99336c2bd361fba40..0dde93532ae22bc9b99565d7cab84d665b63733f 100644 (file)
@@ -350,16 +350,16 @@ static void AC_FREE_DFA(void* p, int n, int sizeofstate)
 static int List_GetNextStateOpt( ACSM_STRUCT2 * acsm,
     trans_node_t **acsmTransTableOpt, int state, int input )
 {
-       int index = state * acsm->acsmAlphabetSize + input;
-       trans_node_t * t = acsmTransTableOpt[index];
+    int index = state * acsm->acsmAlphabetSize + input;
+    trans_node_t * t = acsmTransTableOpt[index];
 
-       if ( t )
-               return t->next_state;
+    if ( t )
+        return t->next_state;
 
-       if( state == 0 )
+    if( state == 0 )
         return 0;
 
-       return ACSM_FAIL_STATE2; /* Fail state ??? */
+    return ACSM_FAIL_STATE2; /* Fail state ??? */
 }
 
 
@@ -408,34 +408,34 @@ static int List_GetNextState2(ACSM_STRUCT2* acsm, int state, int input)
  *  Put Next State - Head insertion, and transition updates
  */
 static int List_PutNextStateOpt( ACSM_STRUCT2 * acsm, trans_node_t **acsmTransTableOpt,
-               int state, int input, int next_state )
+        int state, int input, int next_state )
 {
-       int index = state * acsm->acsmAlphabetSize + input;
+    int index = state * acsm->acsmAlphabetSize + input;
 
-       trans_node_t *t = acsmTransTableOpt[index];
+    trans_node_t *t = acsmTransTableOpt[index];
 
-       if ( t )
-       {
-               t->next_state = next_state;
-               return 0;
-       }
+    if ( t )
+    {
+        t->next_state = next_state;
+        return 0;
+    }
 
-       /* Definitely not an existing transition - add it */
-       trans_node_t * tnew = (trans_node_t*)AC_MALLOC(sizeof(trans_node_t),
-                       ACSM2_MEMORY_TYPE__TRANSTABLE);
+    /* Definitely not an existing transition - add it */
+    trans_node_t * tnew = (trans_node_t*)AC_MALLOC(sizeof(trans_node_t),
+            ACSM2_MEMORY_TYPE__TRANSTABLE);
 
-       if( !tnew )
-               return -1;
+    if( !tnew )
+        return -1;
 
-       tnew->key        = input;
-       tnew->next_state = next_state;
-       tnew->next               = acsm->acsmTransTable[state];
-       acsm->acsmTransTable[state] = tnew;
-       acsm->acsmNumTrans++;
+    tnew->key        = input;
+    tnew->next_state = next_state;
+    tnew->next       = acsm->acsmTransTable[state];
+    acsm->acsmTransTable[state] = tnew;
+    acsm->acsmNumTrans++;
 
-       acsmTransTableOpt[index] = tnew;
+    acsmTransTableOpt[index] = tnew;
 
-       return 0;
+    return 0;
 }
 
 /*
@@ -741,19 +741,19 @@ static void Convert_NFA_To_DFA(ACSM_STRUCT2* acsm)
     for (int i=0; i<acsm->acsmAlphabetSize; i++)
     {
         if ( int s = List_GetNextStateOpt(acsm, acsmTransTableOpt, 0, i) )
-               {
-                       if ( !queue_array[s] )
-                       {
-               queue.push_back(s);
-                               queue_array[s] = true;
-                       }
-               }
+        {
+            if ( !queue_array[s] )
+            {
+                queue.push_back(s);
+                queue_array[s] = true;
+            }
+        }
     }
 
     /* Start building the next layer of transitions */
     for ( auto r : queue )
     {
-               queue_array[r] = false;
+        queue_array[r] = false;
 
         /* Process this states layer */
         for (int i = 0; i < acsm->acsmAlphabetSize; i++)
@@ -762,11 +762,11 @@ static void Convert_NFA_To_DFA(ACSM_STRUCT2* acsm)
 
             if ( (acstate_t)s != ACSM_FAIL_STATE2 && s != 0 )
             {
-                               if ( !queue_array[s] )
-                               {
-                                       queue.push_back(s);
-                                       queue_array[s] = true;
-                               }
+                if ( !queue_array[s] )
+                {
+                    queue.push_back(s);
+                    queue_array[s] = true;
+                }
             }
             else
             {
@@ -780,8 +780,8 @@ static void Convert_NFA_To_DFA(ACSM_STRUCT2* acsm)
         }
     }
 
-       snort_free(queue_array);
-       snort_free(acsmTransTableOpt);
+    snort_free(queue_array);
+    snort_free(acsmTransTableOpt);
 }
 
 /*
index 5e2b3e3cd48b121611b8c5864deb60898d76124e..d15e47ad1d6d147789c39d4e66b1e22b1fbe4265 100644 (file)
@@ -1338,34 +1338,34 @@ static DCE2_SmbSsnData* dce2_create_new_smb_session(Packet* p, dce2SmbProtoConf*
 {
     Profile profile(dce2_smb_pstat_new_session);
 
-       DebugMessage(DEBUG_DCE_SMB, "DCE over SMB packet detected\n");
-       DebugMessage(DEBUG_DCE_SMB, "Creating new session\n");
+    DebugMessage(DEBUG_DCE_SMB, "DCE over SMB packet detected\n");
+    DebugMessage(DEBUG_DCE_SMB, "Creating new session\n");
 
     DCE2_SmbSsnData* dce2_smb_sess = set_new_dce2_smb_session(p);
-       if ( dce2_smb_sess )
-       {
-               dce2_smb_sess->dialect_index = DCE2_SENTINEL;
-               dce2_smb_sess->max_outstanding_requests = 10;  // Until Negotiate/SessionSetupAndX
-               dce2_smb_sess->cli_data_state = DCE2_SMB_DATA_STATE__NETBIOS_HEADER;
-               dce2_smb_sess->srv_data_state = DCE2_SMB_DATA_STATE__NETBIOS_HEADER;
-               dce2_smb_sess->pdu_state = DCE2_SMB_PDU_STATE__COMMAND;
-               dce2_smb_sess->uid = DCE2_SENTINEL;
-               dce2_smb_sess->tid = DCE2_SENTINEL;
-               dce2_smb_sess->ftracker.fid_v1 = DCE2_SENTINEL;
-               dce2_smb_sess->rtracker.mid = DCE2_SENTINEL;
-               dce2_smb_sess->max_file_depth = FileService::get_max_file_depth();
-
-               DCE2_ResetRopts(&dce2_smb_sess->sd.ropts);
-
-               dce2_smb_stats.smb_sessions++;
-               DebugFormat(DEBUG_DCE_SMB,"Created (%p)\n", (void*)dce2_smb_sess);
-
-               dce2_smb_sess->sd.trans = DCE2_TRANS_TYPE__SMB;
-               dce2_smb_sess->sd.server_policy = config->common.policy;
-               dce2_smb_sess->sd.client_policy = DCE2_POLICY__WINXP;
-               dce2_smb_sess->sd.wire_pkt = p;
-               dce2_smb_sess->sd.config = (void*)config;
-       }
+    if ( dce2_smb_sess )
+    {
+        dce2_smb_sess->dialect_index = DCE2_SENTINEL;
+        dce2_smb_sess->max_outstanding_requests = 10;  // Until Negotiate/SessionSetupAndX
+        dce2_smb_sess->cli_data_state = DCE2_SMB_DATA_STATE__NETBIOS_HEADER;
+        dce2_smb_sess->srv_data_state = DCE2_SMB_DATA_STATE__NETBIOS_HEADER;
+        dce2_smb_sess->pdu_state = DCE2_SMB_PDU_STATE__COMMAND;
+        dce2_smb_sess->uid = DCE2_SENTINEL;
+        dce2_smb_sess->tid = DCE2_SENTINEL;
+        dce2_smb_sess->ftracker.fid_v1 = DCE2_SENTINEL;
+        dce2_smb_sess->rtracker.mid = DCE2_SENTINEL;
+        dce2_smb_sess->max_file_depth = FileService::get_max_file_depth();
+
+        DCE2_ResetRopts(&dce2_smb_sess->sd.ropts);
+
+        dce2_smb_stats.smb_sessions++;
+        DebugFormat(DEBUG_DCE_SMB,"Created (%p)\n", (void*)dce2_smb_sess);
+
+        dce2_smb_sess->sd.trans = DCE2_TRANS_TYPE__SMB;
+        dce2_smb_sess->sd.server_policy = config->common.policy;
+        dce2_smb_sess->sd.client_policy = DCE2_POLICY__WINXP;
+        dce2_smb_sess->sd.wire_pkt = p;
+        dce2_smb_sess->sd.config = (void*)config;
+    }
 
     return dce2_smb_sess;
 }
index e8c73275dbd57c9ae8461f9e52e4fd948d339835..090e154f5994b3eeb0b8d97e9e84e073dd0b1955 100644 (file)
@@ -277,7 +277,7 @@ void FtpData::eval(Packet* p)
 
 StreamSplitter* FtpData::get_splitter(bool to_server)
 {
-       return new FtpDataSplitter(to_server);
+    return new FtpDataSplitter(to_server);
 }
 
 //-------------------------------------------------------------------------
index 8055a97761eadd789ebd5152d66873b175db7fb4..910aae3906a3d4cb31a3901ab9d017d8315c69ce 100644 (file)
@@ -90,11 +90,11 @@ enum MethodId {
     METH_REBIND, METH_UNBIND, METH_UNLINK, METH_UPDATEREDIRECTREF,
 
     METH__WEBDAV_LOW=1000,  // All WebDAV related methods go after this.
-       METH_PROPFIND, METH_PROPPATCH, METH_MKCOL, METH_COPY, METH_MOVE,
-       METH_LOCK, METH_UNLOCK, METH_SEARCH, METH_BCOPY, METH_BDELETE,
-       METH_BMOVE, METH_BPROPFIND, METH_BPROPPATCH, METH_NOTIFY, METH_POLL,
-       METH_SUBSCRIBE, METH_UNSUBSCRIBE, METH_X_MS_ENUMATTS,
-       METH__WEBDAV_HIGH       // All WebDAV related methods go before this.
+    METH_PROPFIND, METH_PROPPATCH, METH_MKCOL, METH_COPY, METH_MOVE,
+    METH_LOCK, METH_UNLOCK, METH_SEARCH, METH_BCOPY, METH_BDELETE,
+    METH_BMOVE, METH_BPROPFIND, METH_BPROPPATCH, METH_NOTIFY, METH_POLL,
+    METH_SUBSCRIBE, METH_UNSUBSCRIBE, METH_X_MS_ENUMATTS,
+    METH__WEBDAV_HIGH       // All WebDAV related methods go before this.
 };
 
 // URI formats
index 39442f3b8cf79b52db3cf55ced3ee2d78e30341a..a38bf6718d30a1bbfba67acbd8adc0e3facfd095 100644 (file)
@@ -76,7 +76,7 @@ struct SO_PUBLIC SfIp
     /* Returns true if the IPv6 address appears mapped. */
     bool is_mapped() const;
     bool is_loopback() const;
-       bool is_private() const;
+    bool is_private() const;
 
     const char* ntop(char* buf, int bufsize) const;
     const char* ntoa() const;
index 52251215704235c50828892eb578439c3280ee01..2f17b0edd604ade1e3a98886206fd806e7d7282a 100644 (file)
@@ -495,7 +495,7 @@ std::string read_infile(const char* key, const char* fname)
     else
     {
         ParseError("can't open file %s = %s: %s", key, fname, get_error(errno));
-       return "";      
+        return "";  
     }
 
     return line;
index 47b156d7c57a38dc1900eb54ab9f180acfc4d36d..d47cdf45b365a4b51be424155721a3af3fd239ea 100644 (file)
@@ -340,4 +340,5 @@ int safe_snprintf(char* s, size_t n, const char* format, ... )
         len = 0;
 
     return len;
-}
\ No newline at end of file
+}
+
index 80c20e3924a8a1a9065946d2a2098c043851f78f..38bf0110729a862e447919037765e7686bcf1059 100644 (file)
@@ -72,7 +72,6 @@ const std::string get_rule_file()
 { return rule_file.empty() ? get_out_file() : rule_file; }
 
 static void help_args(const char* pfx, const char* /*val*/);
-static void print_args(const char* pfx, const char* /*val*/);
 
 //-------------------------------------------------------------------------
 // arg foo
@@ -171,7 +170,7 @@ bool ArgList::get_arg(const char*& key, const char*& val)
     return false;
 }
 
-static void help_usage()
+[[noreturn]] static void help_usage()
 {
     std::cout << "usage:\n";
     std::cout << "    -?: list options\n";
@@ -283,14 +282,14 @@ static void print_version(const char* /*key*/, const char* /*val*/)
 }
 
 #ifdef REG_TEST
-static void print_binder_order(const char* /*key*/, const char* /*val*/)
+[[noreturn]] static void print_binder_order(const char* /*key*/, const char* /*val*/)
 {
     print_binder_priorities();
     exit(0);
 }
 #endif
 
-static void help(const char* key, const char* val)
+[[noreturn]] static void help(const char* key, const char* val)
 {
     std::cout << Markup::head(3) << "Usage: snort2lua [OPTIONS]... -c <snort_conf> ...\n";
     std::cout << "\n";
@@ -319,7 +318,7 @@ static void help(const char* key, const char* val)
     exit(0);
 }
 
-static void print_args(const char* key, const char* val)
+[[noreturn]] static void print_args(const char* key, const char* val)
 {
     help_args(key, val);
     exit(0);