]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #533 in SNORT/snort3 from ~MIALTIZE/snort3:icc to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Mon, 20 Jun 2016 23:04:47 +0000 (19:04 -0400)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Mon, 20 Jun 2016 23:04:47 +0000 (19:04 -0400)
Squashed commit of the following:

commit 87abb8ece0c1d4c6df6e48ec009b11d77a8c777f
Author: Michael Altizer <mialtize@cisco.com>
Date:   Mon Jun 20 12:45:45 2016 -0400

    Clean up some ICC remarks.

commit 5ed9ca766e264bca1fff2435121b1ee172ef160c
Author: Michael Altizer <mialtize@cisco.com>
Date:   Sat Jun 18 10:15:12 2016 -0400

    cmake: Remove unused FindCHECK.cmake

commit 79eb7287f635f918fdc5845dc37b139220006d6d
Author: Michael Altizer <mialtize@cisco.com>
Date:   Sat Jun 18 01:14:48 2016 -0400

    unit-tests: Improve Catch behavior with ICC

commit 69b9de9e9ba10f5633c3f4d93fa7e2526b38eb2f
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Jun 17 20:09:52 2016 -0400

    unit-tests: Update Catch to v1.5.6

52 files changed:
cmake/FindCHECK.cmake [deleted file]
src/catch/catch.hpp
src/codecs/ip/cd_ipv4.cc
src/codecs/misc/cd_gtp.cc
src/detection/detection_options.cc
src/detection/tag.cc
src/file_api/file_log.cc
src/filters/sfrf_test.cc
src/filters/sfthd_test.cc
src/flow/ha.cc
src/helpers/chunk.cc
src/ips_options/ips_flowbits.cc
src/latency/packet_latency.cc
src/latency/rule_latency.cc
src/managers/ips_manager.cc
src/network_inspectors/packet_capture/packet_capture.cc
src/network_inspectors/port_scan/port_scan.cc
src/network_inspectors/reputation/reputation_parse.cc
src/parser/parser.cc
src/piglet/piglet_output.cc
src/ports/port_table.cc
src/profiler/rule_profiler.cc
src/protocols/ipv4_options.cc
src/protocols/protocol_ids.h
src/search_engines/hyperscan.cc
src/service_inspectors/dce_rpc/dce_co.cc
src/service_inspectors/dce_rpc/dce_common.cc
src/service_inspectors/dce_rpc/dce_smb.cc
src/service_inspectors/dce_rpc/dce_smb_commands.cc
src/service_inspectors/dce_rpc/dce_smb_utils.cc
src/service_inspectors/dce_rpc/dce_tcp_paf.cc
src/service_inspectors/dns/dns.cc
src/service_inspectors/http_inspect/hi_stream_splitter.cc
src/service_inspectors/rpc_decode/rpc_decode.cc
src/service_inspectors/sip/sip_dialog.cc
src/service_inspectors/sip/sip_parser.cc
src/service_inspectors/smtp/smtp_paf.cc
src/sfrt/sfrt_test.cc
src/stream/ip/ip_defrag.cc
src/stream/libtcp/tcp_segment_descriptor.cc
src/stream/stream_api.cc
src/stream/tcp/segment_overlap_editor.cc
src/stream/tcp/tcp_debug_trace.h
src/stream/tcp/tcp_normalizer.cc
src/stream/tcp/tcp_reassembler.cc
src/stream/tcp/tcp_session.cc
src/target_based/sftarget_reader.cc
src/time/stopwatch_test.cc
tools/snort2lua/preprocessor_states/pps_ftp_telnet_protocol.cc
tools/snort2lua/preprocessor_states/pps_perfmonitor.cc
tools/snort2lua/preprocessor_states/pps_sfportscan.cc
tools/snort2lua/preprocessor_states/pps_smtp.cc

diff --git a/cmake/FindCHECK.cmake b/cmake/FindCHECK.cmake
deleted file mode 100644 (file)
index 11da749..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-set(ERROR_MESSAGE
-    "Unable to find libcheck!!  Install libcheck before running
-     'make check' command"
-)
-
-
-find_path (CHECK_INCLUDE_DIR
-    NAMES check.h
-)
-
-find_library(CHECK_LIBRARIES
-    NAMES check
-)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(CHECK
-    REQUIRED_VARS CHECK_INCLUDE_DIR CHECK_LIBRARIES
-    FAIL_MESSAGE "${ERROR_MESSAGE}"
-)
-
-
-
-mark_as_advanced(
-    CHECK_INCLUDE_DIR
-    CHECK_LIBRARIES
-)
-
-
index 2a7146a7f9cbe9c020603e983be04bf5e13e4882..cde076dd27d40d7391d41c7a6434631c17d57118 100644 (file)
@@ -1,6 +1,6 @@
 /*
- *  Catch v1.4.0
- *  Generated: 2016-03-15 07:23:12.623111
+ *  Catch v1.5.6
+ *  Generated: 2016-06-09 19:20:41.460328
  *  ----------------------------------------------------------
  *  This file has been merged from multiple headers. Please don't edit it directly
  *  Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@@ -13,7 +13,9 @@
 
 #define TWOBLUECUBES_CATCH_HPP_INCLUDED
 
-#ifdef __clang__
+#ifdef __ICC
+#    pragma system_header
+#elif __clang__
 #    pragma clang system_header
 #elif defined __GNUC__
 #    pragma GCC system_header
 
 // #included from: internal/catch_suppress_warnings.h
 
-#ifdef __clang__
-#   ifdef __ICC // icpc defines the __clang__ macro
-#       pragma warning(push)
-#       pragma warning(disable: 161 1682)
-#   else // __ICC
-#       pragma clang diagnostic ignored "-Wglobal-constructors"
-#       pragma clang diagnostic ignored "-Wvariadic-macros"
-#       pragma clang diagnostic ignored "-Wc99-extensions"
-#       pragma clang diagnostic ignored "-Wunused-variable"
-#       pragma clang diagnostic push
-#       pragma clang diagnostic ignored "-Wpadded"
-#       pragma clang diagnostic ignored "-Wc++98-compat"
-#       pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
-#       pragma clang diagnostic ignored "-Wswitch-enum"
-#       pragma clang diagnostic ignored "-Wcovered-switch-default"
-#    endif
+#ifdef __ICC
+#   pragma warning(push)
+#   pragma warning(disable: 161 1682)
+#elif __clang__
+#   pragma clang diagnostic ignored "-Wglobal-constructors"
+#   pragma clang diagnostic ignored "-Wvariadic-macros"
+#   pragma clang diagnostic ignored "-Wc99-extensions"
+#   pragma clang diagnostic ignored "-Wunused-variable"
+#   pragma clang diagnostic push
+#   pragma clang diagnostic ignored "-Wpadded"
+#   pragma clang diagnostic ignored "-Wc++98-compat"
+#   pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
+#   pragma clang diagnostic ignored "-Wswitch-enum"
+#   pragma clang diagnostic ignored "-Wcovered-switch-default"
 #elif defined __GNUC__
 #    pragma GCC diagnostic ignored "-Wvariadic-macros"
 #    pragma GCC diagnostic ignored "-Wunused-variable"
 
 // All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11
 
-#if defined(__cplusplus) && __cplusplus >= 201103L
-#  define CATCH_CPP11_OR_GREATER
+#ifdef __cplusplus
+
+#  if __cplusplus >= 201103L
+#    define CATCH_CPP11_OR_GREATER
+#  endif
+
+#  if __cplusplus >= 201402L
+#    define CATCH_CPP14_OR_GREATER
+#  endif
+
 #endif
 
 #ifdef __clang__
@@ -2065,7 +2073,7 @@ namespace Catch {
             __catchResult.useActiveException( Catch::ResultDisposition::Normal ); \
         } \
         INTERNAL_CATCH_REACT( __catchResult ) \
-    } while( Catch::isTrue( false && static_cast<bool>(expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
+    } while( Catch::isTrue( false && !!(expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look
 
 ///////////////////////////////////////////////////////////////////////////////
 #define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \
@@ -3450,7 +3458,7 @@ namespace Catch {
     };
 
     class DebugOutStream : public IStream {
-        std::auto_ptr<StreamBufBase> m_streamBuf;
+        CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf;
         mutable std::ostream m_os;
     public:
         DebugOutStream();
@@ -3598,7 +3606,7 @@ namespace Catch {
         }
         ConfigData m_data;
 
-        std::auto_ptr<IStream const> m_stream;
+        CATCH_AUTO_PTR( IStream const ) m_stream;
         TestSpec m_testSpec;
     };
 
@@ -3618,7 +3626,7 @@ namespace Catch {
 #define STITCH_CLARA_OPEN_NAMESPACE namespace Catch {
 // #included from: ../external/clara.h
 
-// Version 0.0.1.1
+// Version 0.0.2.4
 
 // Only use header guard if we are not using an outer namespace
 #if !defined(TWOBLUECUBES_CLARA_H_INCLUDED) || defined(STITCH_CLARA_OPEN_NAMESPACE)
@@ -3934,6 +3942,10 @@ namespace Tbc {
 #include <stdexcept>
 #include <memory>
 
+#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER)
+#define CLARA_PLATFORM_WINDOWS
+#endif
+
 // Use optional outer namespace
 #ifdef STITCH_CLARA_OPEN_NAMESPACE
 STITCH_CLARA_OPEN_NAMESPACE
@@ -3957,9 +3969,6 @@ namespace Clara {
     const unsigned int consoleWidth = 80;
 #endif
 
-        // Use this to try and stop compiler from warning about unreachable code
-        inline bool isTrue( bool value ) { return value; }
-
         using namespace Tbc;
 
         inline bool startsWith( std::string const& str, std::string const& prefix ) {
@@ -3995,14 +4004,6 @@ namespace Clara {
             else
                 throw std::runtime_error( "Expected a boolean value but did not recognise:\n  '" + _source + "'" );
         }
-        inline void convertInto( bool _source, bool& _dest ) {
-            _dest = _source;
-        }
-        template<typename T>
-        inline void convertInto( bool, T& ) {
-            if( isTrue( true ) )
-                throw std::runtime_error( "Invalid conversion" );
-        }
 
         template<typename ConfigT>
         struct IArgFunction {
@@ -4012,7 +4013,6 @@ namespace Clara {
             IArgFunction( IArgFunction const& ) = default;
 #endif
             virtual void set( ConfigT& config, std::string const& value ) const = 0;
-            virtual void setFlag( ConfigT& config ) const = 0;
             virtual bool takesArg() const = 0;
             virtual IArgFunction* clone() const = 0;
         };
@@ -4034,9 +4034,6 @@ namespace Clara {
             void set( ConfigT& config, std::string const& value ) const {
                 functionObj->set( config, value );
             }
-            void setFlag( ConfigT& config ) const {
-                functionObj->setFlag( config );
-            }
             bool takesArg() const { return functionObj->takesArg(); }
 
             bool isSet() const {
@@ -4049,7 +4046,6 @@ namespace Clara {
         template<typename C>
         struct NullBinder : IArgFunction<C>{
             virtual void set( C&, std::string const& ) const {}
-            virtual void setFlag( C& ) const {}
             virtual bool takesArg() const { return true; }
             virtual IArgFunction<C>* clone() const { return new NullBinder( *this ); }
         };
@@ -4060,9 +4056,6 @@ namespace Clara {
             virtual void set( C& p, std::string const& stringValue ) const {
                 convertInto( stringValue, p.*member );
             }
-            virtual void setFlag( C& p ) const {
-                convertInto( true, p.*member );
-            }
             virtual bool takesArg() const { return !IsBool<M>::value; }
             virtual IArgFunction<C>* clone() const { return new BoundDataMember( *this ); }
             M C::* member;
@@ -4075,11 +4068,6 @@ namespace Clara {
                 convertInto( stringValue, value );
                 (p.*member)( value );
             }
-            virtual void setFlag( C& p ) const {
-                typename RemoveConstRef<M>::type value;
-                convertInto( true, value );
-                (p.*member)( value );
-            }
             virtual bool takesArg() const { return !IsBool<M>::value; }
             virtual IArgFunction<C>* clone() const { return new BoundUnaryMethod( *this ); }
             void (C::*member)( M );
@@ -4093,9 +4081,6 @@ namespace Clara {
                 if( value )
                     (p.*member)();
             }
-            virtual void setFlag( C& p ) const {
-                (p.*member)();
-            }
             virtual bool takesArg() const { return false; }
             virtual IArgFunction<C>* clone() const { return new BoundNullaryMethod( *this ); }
             void (C::*member)();
@@ -4110,9 +4095,6 @@ namespace Clara {
                 if( value )
                     function( obj );
             }
-            virtual void setFlag( C& p ) const {
-                function( p );
-            }
             virtual bool takesArg() const { return false; }
             virtual IArgFunction<C>* clone() const { return new BoundUnaryFunction( *this ); }
             void (*function)( C& );
@@ -4126,11 +4108,6 @@ namespace Clara {
                 convertInto( stringValue, value );
                 function( obj, value );
             }
-            virtual void setFlag( C& obj ) const {
-                typename RemoveConstRef<T>::type value;
-                convertInto( true, value );
-                function( obj, value );
-            }
             virtual bool takesArg() const { return !IsBool<T>::value; }
             virtual IArgFunction<C>* clone() const { return new BoundBinaryFunction( *this ); }
             void (*function)( C&, T );
@@ -4138,8 +4115,20 @@ namespace Clara {
 
     } // namespace Detail
 
-    struct Parser {
-        Parser() : separators( " \t=:" ) {}
+    inline std::vector<std::string> argsToVector( int argc, char const* const* const argv ) {
+        std::vector<std::string> args( static_cast<std::size_t>( argc ) );
+        for( std::size_t i = 0; i < static_cast<std::size_t>( argc ); ++i )
+            args[i] = argv[i];
+
+        return args;
+    }
+
+    class Parser {
+        enum Mode { None, MaybeShortOpt, SlashOpt, ShortOpt, LongOpt, Positional };
+        Mode mode;
+        std::size_t from;
+        bool inQuotes;
+    public:
 
         struct Token {
             enum Type { Positional, ShortOpt, LongOpt };
@@ -4148,38 +4137,75 @@ namespace Clara {
             std::string data;
         };
 
-        void parseIntoTokens( int argc, char const* const argv[], std::vector<Parser::Token>& tokens ) const {
+        Parser() : mode( None ), from( 0 ), inQuotes( false ){}
+
+        void parseIntoTokens( std::vector<std::string> const& args, std::vector<Token>& tokens ) {
             const std::string doubleDash = "--";
-            for( int i = 1; i < argc && argv[i] != doubleDash; ++i )
-                parseIntoTokens( argv[i] , tokens);
-        }
-        void parseIntoTokens( std::string arg, std::vector<Parser::Token>& tokens ) const {
-            while( !arg.empty() ) {
-                Parser::Token token( Parser::Token::Positional, arg );
-                arg = "";
-                if( token.data[0] == '-' ) {
-                    if( token.data.size() > 1 && token.data[1] == '-' ) {
-                        token = Parser::Token( Parser::Token::LongOpt, token.data.substr( 2 ) );
-                    }
-                    else {
-                        token = Parser::Token( Parser::Token::ShortOpt, token.data.substr( 1 ) );
-                        if( token.data.size() > 1 && separators.find( token.data[1] ) == std::string::npos ) {
-                            arg = "-" + token.data.substr( 1 );
-                            token.data = token.data.substr( 0, 1 );
-                        }
-                    }
-                }
-                if( token.type != Parser::Token::Positional ) {
-                    std::size_t pos = token.data.find_first_of( separators );
-                    if( pos != std::string::npos ) {
-                        arg = token.data.substr( pos+1 );
-                        token.data = token.data.substr( 0, pos );
-                    }
-                }
-                tokens.push_back( token );
+            for( std::size_t i = 1; i < args.size() && args[i] != doubleDash; ++i )
+                parseIntoTokens( args[i], tokens);
+        }
+
+        void parseIntoTokens( std::string const& arg, std::vector<Token>& tokens ) {
+            for( std::size_t i = 0; i <= arg.size(); ++i ) {
+                char c = arg[i];
+                if( c == '"' )
+                    inQuotes = !inQuotes;
+                mode = handleMode( i, c, arg, tokens );
             }
         }
-        std::string separators;
+        Mode handleMode( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
+            switch( mode ) {
+                case None: return handleNone( i, c );
+                case MaybeShortOpt: return handleMaybeShortOpt( i, c );
+                case ShortOpt:
+                case LongOpt:
+                case SlashOpt: return handleOpt( i, c, arg, tokens );
+                case Positional: return handlePositional( i, c, arg, tokens );
+                default: throw std::logic_error( "Unknown mode" );
+            }
+        }
+
+        Mode handleNone( std::size_t i, char c ) {
+            if( inQuotes ) {
+                from = i;
+                return Positional;
+            }
+            switch( c ) {
+                case '-': return MaybeShortOpt;
+#ifdef CLARA_PLATFORM_WINDOWS
+                case '/': from = i+1; return SlashOpt;
+#endif
+                default: from = i; return Positional;
+            }
+        }
+        Mode handleMaybeShortOpt( std::size_t i, char c ) {
+            switch( c ) {
+                case '-': from = i+1; return LongOpt;
+                default: from = i; return ShortOpt;
+            }
+        }
+        Mode handleOpt( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
+            if( std::string( ":=\0", 3 ).find( c ) == std::string::npos )
+                return mode;
+
+            std::string optName = arg.substr( from, i-from );
+            if( mode == ShortOpt )
+                for( std::size_t j = 0; j < optName.size(); ++j )
+                    tokens.push_back( Token( Token::ShortOpt, optName.substr( j, 1 ) ) );
+            else if( mode == SlashOpt && optName.size() == 1 )
+                tokens.push_back( Token( Token::ShortOpt, optName ) );
+            else
+                tokens.push_back( Token( Token::LongOpt, optName ) );
+            return None;
+        }
+        Mode handlePositional( std::size_t i, char c, std::string const& arg, std::vector<Token>& tokens ) {
+            if( inQuotes || std::string( "\0", 1 ).find( c ) == std::string::npos )
+                return mode;
+
+            std::string data = arg.substr( from, i-from );
+            tokens.push_back( Token( Token::Positional, data ) );
+            return None;
+        }
     };
 
     template<typename ConfigT>
@@ -4482,21 +4508,21 @@ namespace Clara {
             return oss.str();
         }
 
-        ConfigT parse( int argc, char const* const argv[] ) const {
+        ConfigT parse( std::vector<std::string> const& args ) const {
             ConfigT config;
-            parseInto( argc, argv, config );
+            parseInto( args, config );
             return config;
         }
 
-        std::vector<Parser::Token> parseInto( int argc, char const* argv[], ConfigT& config ) const {
-            std::string processName = argv[0];
+        std::vector<Parser::Token> parseInto( std::vector<std::string> const& args, ConfigT& config ) const {
+            std::string processName = args[0];
             std::size_t lastSlash = processName.find_last_of( "/\\" );
             if( lastSlash != std::string::npos )
                 processName = processName.substr( lastSlash+1 );
             m_boundProcessName.set( config, processName );
             std::vector<Parser::Token> tokens;
             Parser parser;
-            parser.parseIntoTokens( argc, argv, tokens );
+            parser.parseIntoTokens( args, tokens );
             return populate( tokens, config );
         }
 
@@ -4527,7 +4553,7 @@ namespace Clara {
                                     arg.boundField.set( config, tokens[++i].data );
                             }
                             else {
-                                arg.boundField.setFlag( config );
+                                arg.boundField.set( config, "true" );
                             }
                             break;
                         }
@@ -5235,6 +5261,8 @@ namespace Catch
         bool aborting;
     };
 
+    class MultipleReporters;
+
     struct IStreamingReporter : IShared {
         virtual ~IStreamingReporter();
 
@@ -5262,6 +5290,8 @@ namespace Catch
         virtual void testRunEnded( TestRunStats const& testRunStats ) = 0;
 
         virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
+
+        virtual MultipleReporters* tryAsMulti() { return CATCH_NULL; }
     };
 
     struct IReporterFactory : IShared {
@@ -5479,6 +5509,10 @@ namespace TestCaseTracking {
         virtual void addChild( Ptr<ITracker> const& child ) = 0;
         virtual ITracker* findChild( std::string const& name ) = 0;
         virtual void openChild() = 0;
+
+        // Debug/ checking
+        virtual bool isSectionTracker() const = 0;
+        virtual bool isIndexTracker() const = 0;
     };
 
     class TrackerContext {
@@ -5603,6 +5637,10 @@ namespace TestCaseTracking {
                     m_parent->openChild();
             }
         }
+
+        virtual bool isSectionTracker() const CATCH_OVERRIDE { return false; }
+        virtual bool isIndexTracker() const CATCH_OVERRIDE { return false; }
+
         void open() {
             m_runState = Executing;
             moveToThis();
@@ -5666,13 +5704,16 @@ namespace TestCaseTracking {
         {}
         virtual ~SectionTracker();
 
+        virtual bool isSectionTracker() const CATCH_OVERRIDE { return true; }
+
         static SectionTracker& acquire( TrackerContext& ctx, std::string const& name ) {
             SectionTracker* section = CATCH_NULL;
 
             ITracker& currentTracker = ctx.currentTracker();
             if( ITracker* childTracker = currentTracker.findChild( name ) ) {
-                section = dynamic_cast<SectionTracker*>( childTracker );
-                assert( section );
+                assert( childTracker );
+                assert( childTracker->isSectionTracker() );
+                section = static_cast<SectionTracker*>( childTracker );
             }
             else {
                 section = new SectionTracker( name, ctx, &currentTracker );
@@ -5697,13 +5738,16 @@ namespace TestCaseTracking {
         {}
         virtual ~IndexTracker();
 
+        virtual bool isIndexTracker() const CATCH_OVERRIDE { return true; }
+
         static IndexTracker& acquire( TrackerContext& ctx, std::string const& name, int size ) {
             IndexTracker* tracker = CATCH_NULL;
 
             ITracker& currentTracker = ctx.currentTracker();
             if( ITracker* childTracker = currentTracker.findChild( name ) ) {
-                tracker = dynamic_cast<IndexTracker*>( childTracker );
-                assert( tracker );
+                assert( childTracker );
+                assert( childTracker->isIndexTracker() );
+                tracker = static_cast<IndexTracker*>( childTracker );
             }
             else {
                 tracker = new IndexTracker( name, ctx, &currentTracker, size );
@@ -6306,10 +6350,10 @@ namespace Catch {
             Catch::cout() << "For more detail usage please see the project docs\n" << std::endl;
         }
 
-        int applyCommandLine( int argc, char const* argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
+        int applyCommandLine( int argc, char const* const* const argv, OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) {
             try {
                 m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail );
-                m_unusedTokens = m_cli.parseInto( argc, argv, m_configData );
+                m_unusedTokens = m_cli.parseInto( Clara::argsToVector( argc, argv ), m_configData );
                 if( m_configData.showHelp )
                     showHelp( m_configData.processName );
                 m_config.reset();
@@ -6333,16 +6377,13 @@ namespace Catch {
             m_config.reset();
         }
 
-        int run( int argc, char const* argv[] ) {
+        int run( int argc, char const* const* const argv ) {
 
             int returnCode = applyCommandLine( argc, argv );
             if( returnCode == 0 )
                 returnCode = run();
             return returnCode;
         }
-        int run( int argc, char* argv[] ) {
-            return run( argc, const_cast<char const**>( argv ) );
-        }
 
         int run() {
             if( m_configData.showHelp )
@@ -6406,13 +6447,31 @@ namespace Catch {
 #include <iostream>
 #include <algorithm>
 
+#ifdef CATCH_CPP14_OR_GREATER
+#include <random>
+#endif
+
 namespace Catch {
 
-    struct LexSort {
-        bool operator() (TestCase i,TestCase j) const { return (i<j);}
-    };
     struct RandomNumberGenerator {
-        int operator()( int n ) const { return std::rand() % n; }
+        typedef int result_type;
+
+        result_type operator()( result_type n ) const { return std::rand() % n; }
+
+#ifdef CATCH_CPP14_OR_GREATER
+        static constexpr result_type min() { return 0; }
+        static constexpr result_type max() { return 1000000; }
+        result_type operator()() const { return std::rand() % max(); }
+#endif
+        template<typename V>
+        static void shuffle( V& vector ) {
+            RandomNumberGenerator rng;
+#ifdef CATCH_CPP14_OR_GREATER
+            std::shuffle( vector.begin(), vector.end(), rng );
+#else
+            std::random_shuffle( vector.begin(), vector.end(), rng );
+#endif
+        }
     };
 
     inline std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
@@ -6421,14 +6480,12 @@ namespace Catch {
 
         switch( config.runOrder() ) {
             case RunTests::InLexicographicalOrder:
-                std::sort( sorted.begin(), sorted.end(), LexSort() );
+                std::sort( sorted.begin(), sorted.end() );
                 break;
             case RunTests::InRandomOrder:
                 {
                     seedRng( config );
-
-                    RandomNumberGenerator rng;
-                    std::random_shuffle( sorted.begin(), sorted.end(), rng );
+                    RandomNumberGenerator::shuffle( sorted );
                 }
                 break;
             case RunTests::InDeclarationOrder:
@@ -6447,13 +6504,15 @@ namespace Catch {
             it != itEnd;
             ++it ) {
             std::pair<std::set<TestCase>::const_iterator, bool> prev = seenFunctions.insert( *it );
-            if( !prev.second ){
-                Catch::cerr()
-                << Colour( Colour::Red )
-                << "error: TEST_CASE( \"" << it->name << "\" ) already defined.\n"
-                << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n"
-                << "\tRedefined at " << it->getTestCaseInfo().lineInfo << std::endl;
-                exit(1);
+            if( !prev.second ) {
+                std::ostringstream ss;
+
+                ss  << Colour( Colour::Red )
+                    << "error: TEST_CASE( \"" << it->name << "\" ) already defined.\n"
+                    << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n"
+                    << "\tRedefined at " << it->getTestCaseInfo().lineInfo << std::endl;
+
+                throw std::runtime_error(ss.str());
             }
         }
     }
@@ -7512,7 +7571,7 @@ namespace Catch {
         return os;
     }
 
-    Version libraryVersion( 1, 4, 0, "", 0 );
+    Version libraryVersion( 1, 5, 6, "", 0 );
 
 }
 
@@ -8491,13 +8550,18 @@ public: // IStreamingReporter
                 ++it )
             (*it)->skipTest( testInfo );
     }
+
+    virtual MultipleReporters* tryAsMulti() CATCH_OVERRIDE {
+        return this;
+    }
+
 };
 
 Ptr<IStreamingReporter> addReporter( Ptr<IStreamingReporter> const& existingReporter, Ptr<IStreamingReporter> const& additionalReporter ) {
     Ptr<IStreamingReporter> resultingReporter;
 
     if( existingReporter ) {
-        MultipleReporters* multi = dynamic_cast<MultipleReporters*>( existingReporter.get() );
+        MultipleReporters* multi = existingReporter->tryAsMulti();
         if( !multi ) {
             multi = new MultipleReporters;
             resultingReporter = Ptr<IStreamingReporter>( multi );
@@ -8677,7 +8741,7 @@ namespace Catch {
 
         virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {}
 
-        virtual bool assertionEnded( AssertionStats const& assertionStats ) {
+        virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE {
             assert( !m_sectionStack.empty() );
             SectionNode& sectionNode = *m_sectionStack.back();
             sectionNode.assertions.push_back( assertionStats );
@@ -9068,12 +9132,10 @@ namespace Catch {
 
 #define TWOBLUECUBES_CATCH_REENABLE_WARNINGS_H_INCLUDED
 
-#ifdef __clang__
-#    ifdef __ICC // icpc defines the __clang__ macro
-#        pragma warning(pop)
-#    else
-#        pragma clang diagnostic pop
-#    endif
+#ifdef __ICC
+#    pragma warning(pop)
+#elif __clang__
+#    pragma clang diagnostic pop
 #elif defined __GNUC__
 #    pragma GCC diagnostic pop
 #endif
index 1c47767283249da52751ff3861a1b50d6f2fa40c..5bbf623d8f93fa13016393d805b1d93064a4dde7 100644 (file)
@@ -188,7 +188,7 @@ bool Ipv4Codec::decode(const RawData& raw, CodecData& codec, DecodeData& snort)
     if (ip_len > raw.len)
     {
         DebugFormat(DEBUG_DECODE,
-            "IP Len field is %d bytes bigger than captured length.\n"
+            "IP Len field is %u bytes bigger than captured length.\n"
             "    (ip.len: %u, cap.len: %u)\n",
             ip_len - raw.len, ip_len, raw.len);
 
@@ -207,8 +207,8 @@ bool Ipv4Codec::decode(const RawData& raw, CodecData& codec, DecodeData& snort)
     if (ip_len < hlen)
     {
         DebugFormat(DEBUG_DECODE,
-            "IP dgm len (%d bytes) < IP hdr "
-            "len (%d bytes), packet discarded\n", ip_len, hlen);
+            "IP dgm len (%u bytes) < IP hdr "
+            "len (%hu bytes), packet discarded\n", ip_len, hlen);
 
         codec_event(codec, DECODE_IPV4_DGRAM_LT_IPHDR);
         return false;
index f4e1ad2baec63c9a9d9c3076488ed5f97d93fee3..d119daaa7b7c64f41465f6401a34415756120d66 100644 (file)
@@ -119,7 +119,7 @@ bool GtpCodec::decode(const RawData& raw, CodecData& codec, DecodeData& dd)
 
         if (raw.len != ((unsigned int)ntohs(hdr->length) + len))
         {
-            DebugFormat(DEBUG_DECODE, "Calculated length %d != %d in header.\n",
+            DebugFormat(DEBUG_DECODE, "Calculated length %u != %hu in header.\n",
                 raw.len - len, ntohs(hdr->length));
             codec_event(codec, DECODE_GTP_BAD_LEN);
             return false;
@@ -175,7 +175,7 @@ bool GtpCodec::decode(const RawData& raw, CodecData& codec, DecodeData& dd)
 
         if (raw.len != ((unsigned int)ntohs(hdr->length) + GTP_MIN_LEN))
         {
-            DebugFormat(DEBUG_DECODE, "Calculated length %d != %d in header.\n",
+            DebugFormat(DEBUG_DECODE, "Calculated length %u != %hu in header.\n",
                 raw.len - GTP_MIN_LEN, ntohs(hdr->length));
             codec_event(codec, DECODE_GTP_BAD_LEN);
             return false;
index 59b5edc93ce64a19200e2119a6086b3c70270447..9a027914c7cb9dc80655a405d5220fc7bd5a7cb8 100644 (file)
@@ -432,7 +432,7 @@ int detection_option_node_evaluate(
                 {
                     // none of the services match
                     DebugFormat(DEBUG_DETECT,
-                        "[**] SID %d not matched because of service mismatch (%d!=%d [**]\n",
+                        "[**] SID %u not matched because of service mismatch (%d!=%d [**]\n",
                         sig_info.id, app_proto, sig_info.services[0].service_ordinal);
 
                     break;  // out of case
index 5c6042d9f197cd90cf689847ee1d683a21bc1d82..e7217c795ec81b20c7efa8f9b30e3df5bc68c54a 100644 (file)
@@ -473,7 +473,7 @@ int CheckTagList(Packet* p, Event* event, void** log_list)
         return 0;
     }
 
-    DebugFormat(DEBUG_FLOW,"Host Tags Active: %d   Session Tags Active: %d\n",
+    DebugFormat(DEBUG_FLOW,"Host Tags Active: %u   Session Tags Active: %u\n",
         sfxhash_count(host_tag_cache_ptr), sfxhash_count(ssn_tag_cache_ptr));
 
     DebugMessage(DEBUG_FLOW, "[*] Checking session tag list (forward)...\n");
index 5aff718cd99f46251b3f7df2594c629af2f942c5..746b968be38da1d758f5db9fbbad4e60cdc17229 100644 (file)
@@ -201,7 +201,7 @@ public:
     FileLog(FileLogConfig& conf) { config = conf; }
 
     void show(SnortConfig*) override;
-    void eval(Packet*) override { };
+    void eval(Packet*) override { }
 
     bool configure(SnortConfig*) override
     {
index d58dd7f3e50b31a418097822d15877939c524051..8f7427f5a544e0cbd6745a97230cd08b82bae445 100644 (file)
@@ -975,7 +975,7 @@ static int EventCheck(int i)
     if ( p->expect == status )
         return 1;
 
-    printf("event[%d](%d,%d): exp %d, got %d\n",
+    printf("event[%u](%u,%u): exp %d, got %d\n",
         p->seq, p->gid, p->sid, p->expect, status);
     return 0;
 }
@@ -988,7 +988,7 @@ static int CapCheck(int i)
     if ( RULE_ORIG == status )
         return 1;
 
-    printf("cap[%d](%d,%d): exp %d, got %d\n",
+    printf("cap[%u](%u,%u): exp %d, got %d\n",
         p->seq, p->gid, p->sid, RULE_ORIG, status);
     return 0;
 }
index 2bdb84ea7fbb48f8193a2048d3bfe8bfd8956792..6c2f404df7618d9b59ac68f9a62023bf9c0606d5 100644 (file)
@@ -843,7 +843,7 @@ static int EventCheck(int i)
     if ( p->expect == status )
         return 1;
 
-    printf("event[%d](%d,%d): exp %d, got %d\n",
+    printf("event[%u](%u,%u): exp %d, got %d\n",
         p->seq, p->gid, p->sid, p->expect, status);
     return 0;
 }
@@ -871,7 +871,7 @@ static int CapCheck(int i)
     if ( expect == status )
         return 1;
 
-    printf("cap[%d](%d,%d): exp %d, got %d\n",
+    printf("cap[%u](%u,%u): exp %d, got %d\n",
         p->seq, p->gid, p->sid, expect, status);
     return 0;
 }
@@ -885,7 +885,7 @@ static int PacketCheck(int i)
     if ( p->expect == status )
         return 1;
 
-    printf("packet[%d](%d,%d): exp %d, got %d\n",
+    printf("packet[%u](%u,%u): exp %d, got %d\n",
         p->seq, p->gid, p->sid, p->expect, status);
     return 0;
 }
index 6714ab68cc43c810ae5d316e505bc594ef387c9a..eabff397f1e684ab2b860ac863bc7e0db4dfc10b 100644 (file)
@@ -468,7 +468,7 @@ void HighAvailability::receive_handler(SCMessage* sc_msg)
 {
     assert(sc_msg);
 
-    DebugFormat(DEBUG_HA,"HighAvailability::receive_handler: port: %d, length: %d\n",
+    DebugFormat(DEBUG_HA,"HighAvailability::receive_handler: port: %hu, length: %u\n",
         sc_msg->hdr->port, sc_msg->content_length);
 
     // SC received messages must have reference back to SideChannel object
index f95af86c1e9a94c9dd109604bb86ff7234c208ac..e37b69d1934ec4608f17380c4d2a637c040838d6 100644 (file)
@@ -88,7 +88,6 @@ bool init_chunk(
 TEST_CASE( "chunk initialization", "[chunk]" )
 {
     Lua::State lua(true);
-    bool result;
 
     string test_chunk = "function init() return true end";
     string test_args_table = "args = { a = 1, b = 2 }";
index cdd8093e42345f568cc7f36b02124dd6d1e1731b..5949c75575a6c2ba43743f68fc5392fce31e87d6 100644 (file)
@@ -826,7 +826,7 @@ static void printOutFlowbits(FLOWBITS_OP* flowbits)
     DebugFormat(DEBUG_FLOWBITS, "%s: name = %s\n", s_name, flowbits->name);
     DebugFormat(DEBUG_FLOWBITS, "%s: eval = %d\n", s_name, flowbits->eval);
     DebugFormat(DEBUG_FLOWBITS, "%s: num_ids = %d\n", s_name, flowbits->num_ids);
-    DebugFormat(DEBUG_FLOWBITS, "%s: grp_id = %d\n", s_name, flowbits->group_id);
+    DebugFormat(DEBUG_FLOWBITS, "%s: grp_id = %u\n", s_name, flowbits->group_id);
     DebugFormat(DEBUG_FLOWBITS, "%s: group_name = %s\n", s_name, flowbits->group);
 
     for (int i = 0; i < flowbits->num_ids; i++)
index c39d422bd4936eaea4334be4114f4d2aec3e5034..2e7f4087ea0e0dcf4d99124ea5659aa91cb4819a 100644 (file)
@@ -268,7 +268,7 @@ void PacketLatency::tterm()
 namespace t_packet_latency
 {
 
-struct MockConfigWrapper : packet_latency::ConfigWrapper
+struct MockConfigWrapper : public packet_latency::ConfigWrapper
 {
     PacketLatencyConfig config;
 
@@ -276,14 +276,14 @@ struct MockConfigWrapper : packet_latency::ConfigWrapper
     { return &config; }
 };
 
-struct EventHandlerSpy : packet_latency::EventHandler
+struct EventHandlerSpy : public packet_latency::EventHandler
 {
     unsigned count = 0;
     void handle(const packet_latency::Event&) override
     { ++count; }
 };
 
-struct MockClock : ClockTraits<hr_clock>
+struct MockClock : public ClockTraits<hr_clock>
 {
     static hr_time t;
 
index 358f536b377b7d305362a8893a303b807ccdc42e..3cdc883c62dc9565c6ab820774fe4b7f38c0144c 100644 (file)
@@ -381,7 +381,7 @@ void RuleLatency::tterm()
 namespace t_rule_latency
 {
 
-struct MockConfigWrapper : rule_latency::ConfigWrapper
+struct MockConfigWrapper : public rule_latency::ConfigWrapper
 {
     RuleLatencyConfig config;
 
@@ -389,14 +389,14 @@ struct MockConfigWrapper : rule_latency::ConfigWrapper
     { return &config; }
 };
 
-struct EventHandlerSpy : rule_latency::EventHandler
+struct EventHandlerSpy : public rule_latency::EventHandler
 {
     unsigned count = 0;
     void handle(const rule_latency::Event&) override
     { ++count; }
 };
 
-struct MockClock : ClockTraits<hr_clock>
+struct MockClock : public ClockTraits<hr_clock>
 {
     static hr_time t;
 
index 07cb9753b3276d8386b0e0aa096f9196ec3fc26e..c026b8bf02314e2fb2ce63e1d31ac2b97dfd736f 100644 (file)
@@ -192,7 +192,7 @@ bool IpsManager::option_begin(
 
     if ( opt->api->max_per_rule && (++opt->count > opt->api->max_per_rule) )
     {
-        ParseError("%s allowed only %d time(s) per rule",
+        ParseError("%s allowed only %u time(s) per rule",
             opt->api->base.name, opt->api->max_per_rule);
         return false;
     }
index 9062b4004534f2f6614ac3859d11539d0a895286..23b05868045f7aad87900325ed10cbefcb945c9d 100644 (file)
@@ -221,7 +221,7 @@ const BaseApi* nin_packet_capture = &pc_api.base;
 #endif
 
 #ifdef UNIT_TEST
-Packet* init_null_packet()
+static Packet* init_null_packet()
 {
     static Packet p(false);
     static DAQ_PktHdr_t h;
@@ -317,7 +317,6 @@ TEST_CASE("blank filter", "[PacketCapture]")
     auto null_packet = init_null_packet();
 
     const uint8_t cooked[] = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-    struct pcap_pkthdr hdr;
 
     Packet p(false);
     DAQ_PktHdr_t daq_hdr;
index c842e1629f3113d0839a6f7ff1b210777c4ab8e5..28e0b793dff6d4219675d3873f2a5f22848529e7 100644 (file)
@@ -309,7 +309,7 @@ static int MakeOpenPortInfo(
         return -1;
 
     SnortSnprintf((char*)buffer, PROTO_BUFFER_SIZE,
-        "Open Port: %u\n", *((unsigned short*)user));
+        "Open Port: %hu\n", *((unsigned short*)user));
 
     dsize = SnortStrnlen((const char*)buffer, PROTO_BUFFER_SIZE);
     *total_size += dsize;
index e9d45ffc4d1691968addede0233c7669f1e0cf2e..b52a313c29d40036f28c6ef8903af36c0cefc7cb 100644 (file)
@@ -354,9 +354,9 @@ static int AddIPtoList(sfip_t* ipAddr,INFO ipInfo_ptr, ReputationConfig* config)
     {
 #ifdef DEBUG_MSGS
         IPrepInfo* result;
-        DebugFormat(DEBUG_REPUTATION, "Number of entries input: %d, in table: %d \n",
+        DebugFormat(DEBUG_REPUTATION, "Number of entries input: %d, in table: %u \n",
             totalNumEntries,sfrt_flat_num_entries(config->iplist) );
-        DebugFormat(DEBUG_REPUTATION, "Memory allocated: %d \n",sfrt_flat_usage(config->iplist) );
+        DebugFormat(DEBUG_REPUTATION, "Memory allocated: %u \n",sfrt_flat_usage(config->iplist) );
         result = (IPrepInfo*)sfrt_flat_lookup((void*)ipAddr, config->iplist);
         if (nullptr != result)
         {
index 849f961d308088b542b6fc094cdd1ca167752c2b..a10095eaab4d468682d0ed343c741d11e4d8f50c 100644 (file)
@@ -536,13 +536,13 @@ SnortConfig* ParseSnortConf(const SnortConfig* boot_conf, const char* fname)
 
     if ( *fname )
     {
-        Shell* sh = sc->policy_map->get_shell();
+        sh = sc->policy_map->get_shell();
         sh->set_file(fname);
     }
 
     for ( unsigned i = 0; true; i++ )
     {
-        Shell* sh = sc->policy_map->get_shell(i);
+        sh = sc->policy_map->get_shell(i);
 
         if ( !sh )
             break;
index 05b119c55144a6ddcd524e90e10166f419a6fd89..bb07d5b5a049005cb374885263c0714887fc926a 100644 (file)
@@ -85,7 +85,7 @@ const struct Output unit_test_output =
     [](const Summary& sum) -> void
     {
         printf(
-            "%f: Checks: %d, Failures: %d, Errors: %d\n",
+            "%f: Checks: %u, Failures: %u, Errors: %u\n",
             calc_percent(sum.passed, sum.total()),
             sum.total(), sum.failed, sum.errors
         );
@@ -96,7 +96,7 @@ const struct Output unit_test_output =
     [](const Test& t, unsigned i) -> void
     {
         printf(
-            "%s:%c:piglet:(%s::%s):%d: %s\n",
+            "%s:%c:piglet:(%s::%s):%u: %s\n",
             t.chunk->filename.c_str(), get_result_short(t.result),
             t.type.c_str(), t.name.c_str(), i, get_result_long(t.result)
         );
@@ -125,9 +125,9 @@ const struct Output pretty_output =  // FIXIT-L don't want to include this
         if ( sum.failed || sum.errors )
         {
             printf(
-                " - Passed: \x1b[32m%d\x1b[0m, "
-                "Failed: \x1b[31m%d\x1b[0m, "
-                "Errors: \x1b[33m%d\x1b[0m",
+                " - Passed: \x1b[32m%u\x1b[0m, "
+                "Failed: \x1b[31m%u\x1b[0m, "
+                "Errors: \x1b[33m%u\x1b[0m",
                 sum.passed, sum.failed, sum.errors
             );
         }
@@ -137,7 +137,7 @@ const struct Output pretty_output =  // FIXIT-L don't want to include this
     [](const Test& t, unsigned i) -> void
     {
         printf(
-            "%d) \x1b[34m%s::%s\x1b[0m: %s\n",
+            "%u) \x1b[34m%s::%s\x1b[0m: %s\n",
             i, t.type.c_str(), t.name.c_str(), t.chunk->filename.c_str()
         );
     },
@@ -186,7 +186,7 @@ const struct Output verbose_output =
     {
         printf("=========================================\n");
         printf(
-            "%0.f%% - passed: %d/%d, failed: %d, errors: %d\n",
+            "%0.f%% - passed: %u/%u, failed: %u, errors: %u\n",
             calc_percent(sum.passed, sum.total()),
             sum.passed, sum.total(), sum.failed, sum.errors
         );
index 6bc970d749a93abb2b8c745bf1d0d17a80dd7836..1e639a3c518793ed1c80cf34c228222c18877d47 100644 (file)
@@ -298,18 +298,18 @@ static PortObject2* _merge_N_pol(
     {
         for (i=1; i<pol_cnt; i++)
         {
-            DebugFormat(DEBUG_PORTLISTS,"*** %d rules in object %d\n",
+            DebugFormat(DEBUG_PORTLISTS,"*** %u rules in object %d\n",
                 ((PortObject*)pol[i])->rule_list->count,i);
             PortObjectAppendEx2(ponew, (PortObject*)pol[i]);
             DebugFormat(DEBUG_PORTLISTS,
-                "*** merged port-object[%d], %d rules\n",
+                "*** merged port-object[%d], %u rules\n",
                 i,ponew->rule_hash->count);
         }
         PortObjectNormalize( (PortObject*)ponew);
     }
 
     DebugFormat(DEBUG_PORTLISTS,
-        "*** merged %d port objects, %d rules\n",
+        "*** merged %d port objects, %u rules\n",
         pol_cnt,ponew->rule_hash->count);
     DebugMessage(DEBUG_PORTLISTS,"*** merged ponew - follows: \n");
     // PortObjectPrint2(ponew);
index 5edde55add5b4d4d0ac31a3873c518bef3423109..cfd7279d146cbdd2c5770c4c6318b58c6f22c8e8 100644 (file)
@@ -443,7 +443,6 @@ TEST_CASE( "otn state", "[profiler][rule_profiler]" )
 
 TEST_CASE( "rule entry", "[profiler][rule_profiler]" )
 {
-    SigInfo sig_info;
     auto entry = make_rule_entry(3_ticks, 2_ticks, 3, 2);
     entry.state.alerts = 77;
     entry.state.latency_timeouts = 5;
index c901f5aa3491ab450d5d094c68c958e885b57d4d..32d7f1aa28839e03598e85348280e5d107a67786 100644 (file)
@@ -32,7 +32,7 @@ const IpOptions& IpOptionIteratorIter::operator*() const
 
 IpOptionIterator::IpOptionIterator(const IP4Hdr* const ip4_header, const Packet* const p)
 {
-    const uint8_t* const hdr = (const uint8_t* const)ip4_header;
+    const uint8_t* const hdr = (const uint8_t*)ip4_header;
     start_ptr = hdr + IP4_HEADER_LEN;
     end_ptr = start_ptr;
 
@@ -52,7 +52,7 @@ IpOptionIterator::IpOptionIterator(const IP4Hdr* const ip4_header, const Packet*
 
 IpOptionIterator::IpOptionIterator(const IP4Hdr* const ip4_header, const uint8_t valid_hdr_len)
 {
-    const uint8_t* const hdr = (const uint8_t* const)ip4_header;
+    const uint8_t* const hdr = (const uint8_t*)ip4_header;
     start_ptr = hdr + IP4_HEADER_LEN;
 
     if (valid_hdr_len < IP4_HEADER_LEN)
index baff79f87a6ae7be471cbe6df690101037ee8dec..4c807f28086750a544555eb53d1d2b39ebca282b 100644 (file)
  */
 
 //  Convert enum to a value cast to the enum's underlying type.
-template<typename En>
-constexpr auto to_utype(En t)->typename std::underlying_type<En>::type
+template<typename E>
+inline constexpr typename std::underlying_type<E>::type to_utype(E enumerator)
 {
-    return static_cast<typename std::underlying_type<En>::type>(t);
+    return static_cast<typename std::underlying_type<E>::type>(enumerator);
 }
 
 using ProtocolIndex = uint8_t;
index 0961cc993789057a78000663a645db3314b8b8e0..b2a035c423a0c6b363ab7ea5f77fd28432c5fd2a 100644 (file)
@@ -195,7 +195,7 @@ void HyperscanMpse::user_dtor()
 
 int HyperscanMpse::prep_patterns(SnortConfig* sc)
 {
-    hs_compile_error_t* err = nullptr;
+    hs_compile_error_t* errptr = nullptr;
     std::vector<const char*> pats;
     std::vector<unsigned> flags;
     std::vector<unsigned> ids;
@@ -210,11 +210,11 @@ int HyperscanMpse::prep_patterns(SnortConfig* sc)
     }
 
     if ( hs_compile_multi(&pats[0], &flags[0], &ids[0], pvector.size(), HS_MODE_BLOCK,
-            nullptr, &hs_db, &err) or !hs_db )
+            nullptr, &hs_db, &errptr) or !hs_db )
     {
-        // FIXIT-L emit data from err
+        // FIXIT-L emit data from errptr
         ParseError("can't compile pattern database '%s'", "hs_compile_multi");
-        hs_free_compile_error(err);
+        hs_free_compile_error(errptr);
         return -1;
     }
 
index 6d949ab590be47697ead03e0deef77a40254591d..b06f29836f330052dd1e48d7192b61ce8333982c 100644 (file)
@@ -638,10 +638,10 @@ static void DCE2_CoCtxReq(DCE2_SsnData* sd, DCE2_CoTracker* cot, const DceRpcCoH
         }
 
         DebugFormat(DEBUG_DCE_COMMON, "Added Context item to queue.\n"
-            " Context id: %u\n"
+            " Context id: %hu\n"
             " Interface: %s\n"
-            " Interface major version: %u\n"
-            " Interface minor version: %u\n",
+            " Interface major version: %hu\n"
+            " Interface minor version: %hu\n",
             ctx_node->ctx_id,
             DCE2_UuidToStr(&ctx_node->iface, DCERPC_BO_FLAG__NONE),
             ctx_node->iface_vers_maj, ctx_node->iface_vers_min);
@@ -688,10 +688,10 @@ static void dce_co_process_ctx_result(DCE2_SsnData* sd,DCE2_CoTracker* cot,
     }
 
     DebugFormat(DEBUG_DCE_COMMON, "Adding Context item to context item list.\n"
-        " Context id: %u\n"
+        " Context id: %hu\n"
         " Interface: %s\n"
-        " Interface major version: %u\n"
-        " Interface minor version: %u\n",
+        " Interface major version: %hu\n"
+        " Interface minor version: %hu\n",
         ctx_node->ctx_id,
         DCE2_UuidToStr(&ctx_node->iface, DCERPC_BO_FLAG__NONE),
         ctx_node->iface_vers_maj, ctx_node->iface_vers_min);
@@ -2322,7 +2322,7 @@ void DCE2_CoProcess(DCE2_SsnData* sd, DCE2_CoTracker* cot,
         if (data_len < frag_len)
         {
             DebugFormat(DEBUG_DCE_COMMON,
-                "Not enough data in packet for fragment length: %u\n", frag_len);
+                "Not enough data in packet for fragment length: %hu\n", frag_len);
 
             /* Set frag length so we don't have to check it again in seg code */
             seg->frag_len = frag_len;
index 8ee127f7fc7029a16cc9ce68a0863b3d1dda263b..fa7ec2c52ce7e5b5b8c3f8ca45766d1bad21d812 100644 (file)
@@ -144,13 +144,13 @@ static void DCE2_PrintRoptions(DCE2_Roptions* ropts)
     {
         DebugFormat(DEBUG_DCE_COMMON, "  Iface: %s\n", DCE2_UuidToStr(&ropts->iface,
             DCERPC_BO_FLAG__NONE));
-        DebugFormat(DEBUG_DCE_COMMON, "  Iface version: %u\n", ropts->iface_vers_maj);
+        DebugFormat(DEBUG_DCE_COMMON, "  Iface version: %hu\n", ropts->iface_vers_maj);
     }
     if (ropts->opnum == DCE2_SENTINEL)
         DebugMessage(DEBUG_DCE_COMMON, "  Opnum: unset\n");
     else
     {
-        DebugFormat(DEBUG_DCE_COMMON, "  Opnum: %u\n", ropts->opnum);
+        DebugFormat(DEBUG_DCE_COMMON, "  Opnum: %d\n", ropts->opnum);
     }
     if (ropts->stub_data != nullptr)
         DebugFormat(DEBUG_DCE_COMMON, "  Stub data: %p\n", ropts->stub_data);
index 6fc9f4a3f6f2b597ddc5a3805ad8e6a165a26360..1914e9800a0ab5a8c92300318c2946906aece068 100644 (file)
@@ -736,7 +736,7 @@ static DCE2_SmbRequestTracker* DCE2_SmbFindRequestTracker(DCE2_SmbSsnData* ssd,
     Profile profile(dce2_smb_pstat_smb_req);
 
     DebugFormat(DEBUG_DCE_SMB, "Find request tracker => "
-        "Uid: %u, Tid: %u, Pid: %u, Mid: %u ... ", uid, tid, pid, mid);
+        "Uid: %hu, Tid: %hu, Pid: %hu, Mid: %hu ... ", uid, tid, pid, mid);
 
     DCE2_SmbRequestTracker* tmp_rtracker = &ssd->rtracker;
     int smb_com = SmbCom(smb_hdr);
@@ -1346,7 +1346,7 @@ static DCE2_SmbRequestTracker* DCE2_SmbInspect(DCE2_SmbSsnData* ssd, const SmbNt
             if (DCE2_SmbFindTid(ssd, SmbTid(smb_hdr)) != DCE2_RET__SUCCESS)
             {
                 DebugFormat(DEBUG_DCE_SMB,
-                    "Couldn't find Tid (%u)\n", SmbTid(smb_hdr));
+                    "Couldn't find Tid (%hu)\n", SmbTid(smb_hdr));
                 return nullptr;
             }
 
@@ -1830,7 +1830,7 @@ static void DCE2_SmbProcess(DCE2_SmbSsnData* ssd)
             // See if there is enough data to process the NetBIOS header
             if (data_len < data_need)
             {
-                DebugFormat(DEBUG_DCE_SMB, "Data len(%u) < NetBIOS SS header(%u). "
+                DebugFormat(DEBUG_DCE_SMB, "Data len(%hu) < NetBIOS SS header(%u). "
                     "Queueing data.\n", data_len, data_need);
 
                 // FIXIT-M port segmentation code
@@ -1897,7 +1897,7 @@ static void DCE2_SmbProcess(DCE2_SmbSsnData* ssd)
             // See if there is enough data to process the SMB header
             if (data_len < data_need)
             {
-                DebugFormat(DEBUG_DCE_SMB, "Data len (%u) < "
+                DebugFormat(DEBUG_DCE_SMB, "Data len (%hu) < "
                     "NetBIOS SS header + SMB header (%u). Queueing data.\n",
                     data_len, data_need);
 
index a517868a830230199166513aa62b5c79e2cde6f4..0d306868f005c81282caa7e53ff80398d38210c2 100644 (file)
@@ -1728,12 +1728,12 @@ DCE2_Ret DCE2_SmbTreeConnectAndX(DCE2_SmbSsnData* ssd, const SmbNtHdr* smb_hdr,
         {
         case SERVICE_IPC:
             DebugFormat(DEBUG_DCE_SMB,
-                "Tid (%u) is an IPC tree.\n", tid);
+                "Tid (%hu) is an IPC tree.\n", tid);
             break;
         case SERVICE_DISK:
             is_ipc = false;
             DebugFormat(DEBUG_DCE_SMB,
-                "Tid (%u) is a DISK tree.\n", tid);
+                "Tid (%hu) is a DISK tree.\n", tid);
             break;
         default:
             return DCE2_RET__IGNORE;
@@ -1844,7 +1844,7 @@ DCE2_Ret DCE2_SmbTreeConnect(DCE2_SmbSsnData* ssd, const SmbNtHdr* smb_hdr,
         uint16_t tid = SmbTid(smb_hdr);
         DCE2_SmbInsertTid(ssd, tid, ssd->cur_rtracker->is_ipc);
 
-        DebugFormat(DEBUG_DCE_SMB, "Tid (%u) %s an IPC tree\n", tid,
+        DebugFormat(DEBUG_DCE_SMB, "Tid (%hu) %s an IPC tree\n", tid,
             (ssd->cur_rtracker->is_ipc) ? "is" : "is not");
     }
 
index 0dbf1370d042e2b9ff6f548debe1e937d51ff831..6c01ff76e881cbddb0193868806bc98c75e7a390 100644 (file)
@@ -151,7 +151,7 @@ void DCE2_SmbInsertUid(DCE2_SmbSsnData* ssd, const uint16_t uid)
 {
     Profile profile(dce2_smb_pstat_smb_uid);
 
-    DebugFormat(DEBUG_DCE_SMB, "Inserting Uid: %u\n", uid);
+    DebugFormat(DEBUG_DCE_SMB, "Inserting Uid: %hu\n", uid);
 
     if (ssd->uid == DCE2_SENTINEL)
     {
@@ -180,7 +180,7 @@ void DCE2_SmbRemoveUid(DCE2_SmbSsnData* ssd, const uint16_t uid)
 
     Profile profile(dce2_smb_pstat_smb_uid);
 
-    DebugFormat(DEBUG_DCE_SMB,"Removing Uid: %u\n", uid);
+    DebugFormat(DEBUG_DCE_SMB,"Removing Uid: %hu\n", uid);
 
     if ((ssd->uid != DCE2_SENTINEL) && (ssd->uid == (int)uid))
         ssd->uid = DCE2_SENTINEL;
@@ -326,10 +326,10 @@ DCE2_SmbRequestTracker* DCE2_SmbNewRequestTracker(DCE2_SmbSsnData* ssd,
         dce2_smb_stats.smb_max_outstanding_requests = ssd->outstanding_requests;
 
     DebugFormat(DEBUG_DCE_SMB, "Added new request tracker => "
-        "Uid: %u, Tid: %u, Pid: %u, Mid: %u\n",
+        "Uid: %hu, Tid: %hu, Pid: %hu, Mid: %d\n",
         rtracker->uid, rtracker->tid, rtracker->pid, rtracker->mid);
     DebugFormat(DEBUG_DCE_SMB,
-        "Current outstanding requests: %u\n", ssd->outstanding_requests);
+        "Current outstanding requests: %hu\n", ssd->outstanding_requests);
 
     return rtracker;
 }
@@ -347,7 +347,7 @@ DCE2_SmbFileTracker* DCE2_SmbNewFileTracker(DCE2_SmbSsnData* ssd,
         return nullptr;
 
     DebugFormat(DEBUG_DCE_SMB, "Creating new file tracker "
-        "with Uid: %u, Tid: %u, Fid: 0x%04X\n", uid, tid, fid);
+        "with Uid: %hu, Tid: %hu, Fid: 0x%04X\n", uid, tid, fid);
 
     DCE2_SmbFileTracker* ftracker = nullptr;
     if (ssd->ftracker.fid == DCE2_SENTINEL)
@@ -449,7 +449,7 @@ DCE2_SmbFileTracker* DCE2_SmbFindFileTracker(DCE2_SmbSsnData* ssd,
     Profile profile(dce2_smb_pstat_smb_fid);
 
     DebugFormat(DEBUG_DCE_SMB, "Finding file tracker with "
-        "Uid: %u, Tid: %u, Fid: 0x%04X ... ", uid, tid, fid);
+        "Uid: %hu, Tid: %hu, Fid: 0x%04X ... ", uid, tid, fid);
 
     DCE2_SmbFileTracker* ftracker;
     if ((ssd->ftracker.fid != DCE2_SENTINEL) && (ssd->ftracker.fid == (int)fid))
@@ -523,7 +523,7 @@ DCE2_SmbFileTracker* DCE2_SmbFindFileTracker(DCE2_SmbSsnData* ssd,
     }
 
     DebugFormat(DEBUG_DCE_SMB, "Found with "
-        "Uid: %u, Tid: %u, Fid: 0x%04X\n",
+        "Uid: %hu, Tid: %hu, Fid: 0x%04X\n",
         ftracker->uid, ftracker->tid, ftracker->fid);
     return ftracker;
 }
@@ -645,7 +645,7 @@ void DCE2_SmbFileTrackerDataFree(void* data)
         return;
 
     DebugFormat(DEBUG_DCE_SMB, "Freeing file tracker: "
-        "Uid: %u, Tid: %u, Fid: 0x%04X\n",
+        "Uid: %hu, Tid: %hu, Fid: 0x%04X\n",
         ftracker->uid, ftracker->tid, ftracker->fid);
 
     DCE2_SmbCleanFileTracker(ftracker);
@@ -724,7 +724,7 @@ void DCE2_SmbRemoveRequestTracker(DCE2_SmbSsnData* ssd,
     }
 
     DebugFormat(DEBUG_DCE_SMB, "Removing request tracker => "
-        "Uid: %u, Tid: %u, Pid: %u, Mid: %u ... ",
+        "Uid: %hu, Tid: %hu, Pid: %hu, Mid: %d ... ",
         rtracker->uid, rtracker->tid, rtracker->pid, rtracker->mid);
 
     if (rtracker == &ssd->rtracker)
@@ -838,7 +838,7 @@ void DCE2_SmbRequestTrackerDataFree(void* data)
         return;
 
     DebugFormat(DEBUG_DCE_SMB, "Freeing request tracker: "
-        "Uid: %u, Tid: %u, Pid: %u, Mid: %u\n",
+        "Uid: %hu, Tid: %hu, Pid: %hu, Mid: %d\n",
         rtracker->uid, rtracker->tid, rtracker->pid, rtracker->mid);
 
     DCE2_SmbCleanRequestTracker(rtracker);
@@ -863,7 +863,7 @@ void DCE2_SmbRemoveTid(DCE2_SmbSsnData* ssd, const uint16_t tid)
 {
     Profile profile(dce2_smb_pstat_smb_tid);
 
-    DebugFormat(DEBUG_DCE_SMB, "Removing Tid: %u\n", tid);
+    DebugFormat(DEBUG_DCE_SMB, "Removing Tid: %hu\n", tid);
 
     if ((ssd->tid != DCE2_SENTINEL) && ((ssd->tid & 0x0000ffff) == (int)tid))
         ssd->tid = DCE2_SENTINEL;
@@ -913,7 +913,7 @@ void DCE2_SmbInsertTid(DCE2_SmbSsnData* ssd,
         || ((ssd->max_file_depth == -1) && DCE2_ScSmbFileDepth(
         (dce2SmbProtoConf*)ssd->sd.config) == -1)))
     {
-        DebugFormat(DEBUG_DCE_SMB, "Not inserting TID (%u) "
+        DebugFormat(DEBUG_DCE_SMB, "Not inserting TID (%hu) "
             "because it's not IPC and not inspecting normal file "
             "data.", tid);
         return;
@@ -921,13 +921,13 @@ void DCE2_SmbInsertTid(DCE2_SmbSsnData* ssd,
 
     if (is_ipc && DCE2_ScSmbFileInspectionOnly((dce2SmbProtoConf*)ssd->sd.config))
     {
-        DebugFormat(DEBUG_DCE_SMB, "Not inserting TID (%u) "
+        DebugFormat(DEBUG_DCE_SMB, "Not inserting TID (%hu) "
             "because it's IPC and only inspecting normal file "
             "data.", tid);
         return;
     }
 
-    DebugFormat(DEBUG_DCE_SMB, "Inserting Tid: %u\n", tid);
+    DebugFormat(DEBUG_DCE_SMB, "Inserting Tid: %hu\n", tid);
     int insert_tid = (int)tid;
     // Set a bit so as to distinguish between IPC and non-IPC TIDs
     if (!is_ipc)
@@ -1027,7 +1027,7 @@ void DCE2_SmbQueueTmpFileTracker(DCE2_SmbSsnData* ssd,
     Profile profile(dce2_smb_pstat_smb_fid);
 
     DebugFormat(DEBUG_DCE_SMB, "Queueing file tracker "
-        "with Uid: %u, Tid: %u\n", uid, tid);
+        "with Uid: %hu, Tid: %hu\n", uid, tid);
 
     DCE2_SmbFileTracker* ftracker = (DCE2_SmbFileTracker*)
         snort_calloc(sizeof(DCE2_SmbFileTracker));
index c197902a19cccf2ef24dfc4b03f1642c0edc56a9..24f098a5f8c81191bd04137958c20522cc4d6681 100644 (file)
@@ -97,7 +97,7 @@ static StreamSplitter::Status dce2_tcp_paf(DCE2_PafTcpData* ds, Flow* flow, cons
         }
     }
 
-    DebugFormat(DEBUG_DCE_TCP, "Start state: %u\n", ds->paf_state);
+    DebugFormat(DEBUG_DCE_TCP, "Start state: %d\n", ds->paf_state);
     start_state = (uint8_t)ds->paf_state;
 
     while (n < len)
@@ -140,7 +140,7 @@ static StreamSplitter::Status dce2_tcp_paf(DCE2_PafTcpData* ds, Flow* flow, cons
                 return StreamSplitter::ABORT;
             }
 
-            DebugFormatNoFileLine(DEBUG_DCE_TCP, "Fragment length: %u\n", ds->frag_len);
+            DebugFormatNoFileLine(DEBUG_DCE_TCP, "Fragment length: %hu\n", ds->frag_len);
 
             /* Increment n here so we can continue */
             n += ds->frag_len - (uint8_t)ds->paf_state;
@@ -149,7 +149,7 @@ static StreamSplitter::Status dce2_tcp_paf(DCE2_PafTcpData* ds, Flow* flow, cons
              * flush just before it */
             if ((num_requests == 1) || (n <= len))
                 tmp_fp += ds->frag_len;
-            DebugFormatNoFileLine(DEBUG_DCE_TCP, "Requests: %u\n", num_requests);
+            DebugFormatNoFileLine(DEBUG_DCE_TCP, "Requests: %d\n", num_requests);
             ds->paf_state = DCE2_PAF_TCP_STATES__0;
             continue;      // we incremented n already
         default:
index cfad963644fcf1efe14d96ba54f1d234020664d9..2af9ca68b17297447f3dde6de70ce7b2d7502978 100644 (file)
@@ -873,8 +873,8 @@ static void ParseDNSResponseMessage(Packet* p, DNSData* dnsSessionData)
                 {
                 case DNS_RESP_STATE_RR_RDATA_START:
                     DebugFormat(DEBUG_DNS,
-                        "DNS ANSWER RR %d: type %d, class %d, "
-                        "ttl %d rdlength %d\n", i,
+                        "DNS ANSWER RR %d: type %hu, class %hu, "
+                        "ttl %u rdlength %hu\n", i,
                         dnsSessionData->curr_rr.type,
                         dnsSessionData->curr_rr.dns_class,
                         dnsSessionData->curr_rr.ttl,
@@ -926,8 +926,8 @@ static void ParseDNSResponseMessage(Packet* p, DNSData* dnsSessionData)
                 {
                 case DNS_RESP_STATE_RR_RDATA_START:
                     DebugFormat(DEBUG_DNS,
-                        "DNS AUTH RR %d: type %d, class %d, "
-                        "ttl %d rdlength %d\n", i,
+                        "DNS AUTH RR %d: type %hu, class %hu, "
+                        "ttl %u rdlength %hu\n", i,
                         dnsSessionData->curr_rr.type,
                         dnsSessionData->curr_rr.dns_class,
                         dnsSessionData->curr_rr.ttl,
@@ -979,8 +979,8 @@ static void ParseDNSResponseMessage(Packet* p, DNSData* dnsSessionData)
                 {
                 case DNS_RESP_STATE_RR_RDATA_START:
                     DebugFormat(DEBUG_DNS,
-                        "DNS ADDITONAL RR %d: type %d, class %d, "
-                        "ttl %d rdlength %d\n", i,
+                        "DNS ADDITONAL RR %d: type %hu, class %hu, "
+                        "ttl %u rdlength %hu\n", i,
                         dnsSessionData->curr_rr.type,
                         dnsSessionData->curr_rr.dns_class,
                         dnsSessionData->curr_rr.ttl,
index 9ea511c616e020070f01d0e3a8f6abe216d4a5c9..89625202c47cab5324a323e1484ab9eeae5abab7 100644 (file)
@@ -585,7 +585,7 @@ static void hi_link_check()
 
 static bool hi_fsm_compile()
 {
-    unsigned i = 0, j;
+    unsigned i = 0;
     unsigned max = sizeof(hi_rule) / sizeof(hi_rule[0]);
     unsigned next, extra = 0;
 
@@ -607,12 +607,12 @@ static bool hi_fsm_compile()
     next = max;
 
     for ( i = 0; i < hi_fsm_size; i++ )
-        for ( j = 0; j < 256; j++ )
+        for ( int j = 0; j < 256; j++ )
             hi_fsm[i].cell[j].next = TBD;
 
     for ( i = 0; i < max; i++ )
     {
-        int prev = i, j, n = strlen(hi_rule[i].event);
+        int prev = i, n = strlen(hi_rule[i].event);
         const char* event = hi_rule[i].event;
 
         hi_link(hi_fsm+i, event, hi_rule+i);
@@ -622,7 +622,7 @@ static bool hi_fsm_compile()
             printf("Expanding %s at %u\n", hi_rule[i].event, next);
 #endif
 
-        for ( j = 1; j < n; j++ )
+        for ( int j = 1; j < n; j++ )
         {
             event = hi_rule[i].event + j;
             hi_link(hi_fsm+next, event, hi_rule+i);
@@ -802,7 +802,7 @@ static void hi_pipe_push(Hi5State* s_req, Flow* ssn)
     uint32_t nreq = s_req->pipe & 0xFF;
     uint32_t pipe = s_req->pipe >> 8;
 
-    DebugFormat(DEBUG_STREAM_PAF, "%s: nreq=%d, pipe=0x%X\n", __func__, nreq, pipe);
+    DebugFormat(DEBUG_STREAM_PAF, "%s: nreq=%u, pipe=0x%X\n", __func__, nreq, pipe);
 
     if ( nreq == MAX_PIPELINE )
     {
@@ -830,7 +830,7 @@ static void hi_pipe_pop(Hi5State* s_rsp, Flow* ssn)
     uint32_t nreq = s_req->pipe & 0xFF;
     uint32_t pipe = s_req->pipe >> 8;
 
-    DebugFormat(DEBUG_STREAM_PAF, "%s: nreq=%d, pipe=0x%X\n", __func__, nreq, pipe);
+    DebugFormat(DEBUG_STREAM_PAF, "%s: nreq=%u, pipe=0x%X\n", __func__, nreq, pipe);
 
     // FIXIT-L valgrind: Conditional jump or move depends on uninitialised value(s)
     if ( nreq == 0 || nreq == PIPELINE_RUPTURED )
@@ -885,7 +885,7 @@ static StreamSplitter::Status hi_scan_fsm(Hi5State* s, int c)
     get_state(prev, before, sizeof(before));
     get_state(s->fsm, after, sizeof(after));
     DebugFormat(DEBUG_STREAM_PAF,
-        "%s: %s(%u)[0x%2X, '%c'] -> %d,%s(%u)\n",
+        "%s: %s(%hhu)[0x%2X, '%c'] -> %d,%s(%hhu)\n",
         __func__, before, prev, c, isgraph(c) ? c : '.',
         cell->action, after, s->fsm);
 #endif
@@ -1045,7 +1045,7 @@ static void hi_reset(Hi5State* s, uint32_t flags)
     }
     s->flags = 0;
 
-    DebugFormat(DEBUG_STREAM_PAF, "%s: fsm=%u, flags=0x%X\n", __func__, s->fsm, s->flags);
+    DebugFormat(DEBUG_STREAM_PAF, "%s: fsm=%hhu, flags=0x%X\n", __func__, s->fsm, s->flags);
 }
 
 //--------------------------------------------------------------------
index bf9b6d1a16cdeab6b17b8d7117141a4b58b9daea..8b6b92617a91aa7aff64c72377db65403e841bf0 100644 (file)
@@ -207,7 +207,7 @@ static RpcStatus RpcStatefulInspection(RpcDecodeConfig* rconfig,
         if (dsize < rsdata->ignore)
         {
             DebugFormat(DEBUG_RPC,
-                "STATEFUL: Ignoring %u bytes\n", dsize);
+                "STATEFUL: Ignoring %hu bytes\n", dsize);
 
             rsdata->ignore -= dsize;
 
@@ -237,7 +237,7 @@ static RpcStatus RpcStatefulInspection(RpcDecodeConfig* rconfig,
             if (dsize < RPC_FRAG_HDR_SIZE)
             {
                 DebugFormat(DEBUG_RPC,
-                    "STATEFUL: Not enough data for frag header: %u\n",
+                    "STATEFUL: Not enough data for frag header: %hu\n",
                     dsize);
 
                 RpcPreprocEvent(rconfig, rsdata, RPC_INCOMPLETE_SEGMENT);
@@ -256,7 +256,7 @@ static RpcStatus RpcStatefulInspection(RpcDecodeConfig* rconfig,
             if (dsize < (RPC_FRAG_HDR_SIZE + rsdata->frag_len))
             {
                 DebugFormat(DEBUG_RPC,
-                    "STATEFUL: Not enough data for fragment: %u\n",
+                    "STATEFUL: Not enough data for fragment: %hu\n",
                     dsize);
 
                 RpcPreprocEvent(rconfig, rsdata, RPC_INCOMPLETE_SEGMENT);
@@ -304,7 +304,7 @@ static RpcStatus RpcStatefulInspection(RpcDecodeConfig* rconfig,
                 {
                     DebugFormat(DEBUG_RPC,
                         "STATEFUL: Not enough data for frag header "
-                        "(%u): %u\n", need, dsize);
+                        "(%d): %hu\n", need, dsize);
 
                     RpcPreprocEvent(rconfig, rsdata, RPC_INCOMPLETE_SEGMENT);
 
@@ -330,7 +330,7 @@ static RpcStatus RpcStatefulInspection(RpcDecodeConfig* rconfig,
             if (dsize < need)
             {
                 DebugFormat(DEBUG_RPC,
-                    "STATEFUL: Not enough data for fragment (%u): %u\n",
+                    "STATEFUL: Not enough data for fragment (%d): %hu\n",
                     need, dsize);
 
                 RpcPreprocEvent(rconfig, rsdata, RPC_INCOMPLETE_SEGMENT);
@@ -769,13 +769,13 @@ static int ConvertRPC(RpcDecodeConfig* rconfig, RpcSsnData* rsdata, Packet* p)
         if ((length + 4 != psize) && !(p->packet_flags & PKT_REBUILT_STREAM))
         {
             DebugFormat(DEBUG_RPC, "It's not the only thing in this buffer!"
-                " length: %d psize: %d!\n", length, psize);
+                " length: %u psize: %u!\n", length, psize);
             return RPC_MULTIPLE_RECORD;
         }
         else if ( length == 0 )
         {
             DebugFormat(DEBUG_RPC, "Zero-length RPC fragment detected."
-                " length: %d psize: %d.\n", length, psize);
+                " length: %u psize: %u.\n", length, psize);
             return RPC_ZERO_LENGTH_FRAGMENT;
         }
         return 0;
@@ -838,7 +838,7 @@ static int ConvertRPC(RpcDecodeConfig* rconfig, RpcSsnData* rsdata, Packet* p)
              * psize's might be allowed */
 
             DebugFormat(DEBUG_RPC, "Integer Overflow"
-                " field(%d) exceeds packet size(%d)\n",
+                " field(%u) exceeds packet size(%u)\n",
                 length, psize);
             return RPC_LARGE_FRAGSIZE;
         }
@@ -848,7 +848,7 @@ static int ConvertRPC(RpcDecodeConfig* rconfig, RpcSsnData* rsdata, Packet* p)
         if (length > psize)
         {
             DebugFormat(DEBUG_RPC, "Length of"
-                " field(%d) exceeds packet size(%d)\n",
+                " field(%u) exceeds packet size(%u)\n",
                 length, psize);
             return RPC_INCOMPLETE_SEGMENT;
         }
@@ -857,8 +857,8 @@ static int ConvertRPC(RpcDecodeConfig* rconfig, RpcSsnData* rsdata, Packet* p)
             /* The entire request is larger than our current packet
              *  size
              */
-            DebugFormat(DEBUG_RPC, " Decoded Length (%d)"
-                "exceeds packet size(%d)\n",
+            DebugFormat(DEBUG_RPC, " Decoded Length (%u)"
+                "exceeds packet size(%u)\n",
                 decoded_len, psize);
             return RPC_LARGE_FRAGSIZE;
         }
@@ -874,7 +874,7 @@ static int ConvertRPC(RpcDecodeConfig* rconfig, RpcSsnData* rsdata, Packet* p)
             fragcount++;
 
             DebugFormat(DEBUG_RPC,
-                "length: %d size: %d decoded_len: %d\n",
+                "length: %u size: %u decoded_len: %u\n",
                 length, psize, decoded_len);
 
             ret = SafeMemcpy(norm_index, data_index, length, decode_buf_start, decode_buf_end);
@@ -906,12 +906,12 @@ static int ConvertRPC(RpcDecodeConfig* rconfig, RpcSsnData* rsdata, Packet* p)
      */
     if (decoded_len + ((fragcount - 1) * 4) != psize)
     {
-        DebugFormat(DEBUG_RPC, "decoded len does not compute: %d\n",
+        DebugFormat(DEBUG_RPC, "decoded len does not compute: %u\n",
             decoded_len);
         return RPC_MULTIPLE_RECORD;
     }
 
-    DebugFormat(DEBUG_RPC, "New size: %d\n", decoded_len);
+    DebugFormat(DEBUG_RPC, "New size: %u\n", decoded_len);
         DebugMessage(DEBUG_RPC, "converted data:\n");
     //LogNetData(data, decoded_len, p);
 
index dc08d70c48c529fd13c4d08ecc27e1ac815ec2df..47122c8fdb8d66a7650d45ff1866336fded90d7b 100644 (file)
@@ -49,7 +49,7 @@ static SIP_DialogData* SIP_addDialog(SIPMsg*, SIP_DialogData*, SIP_DialogList*);
 static int SIP_deleteDialog(SIP_DialogData*, SIP_DialogList*);
 
 #ifdef DEBUG_MSGS
-void SIP_displayMedias(SIP_MediaList* dList);
+static void SIP_displayMedias(SIP_MediaList* dList);
 #endif
 
 /********************************************************************
@@ -149,7 +149,7 @@ static int SIP_processInvite(SIPMsg* sipMsg, SIP_DialogData* dialog, SIP_DialogL
     // check whether this invite has authorization information
     if ((SIP_DLG_AUTHENCATING != dialog->state) && (NULL != sipMsg->authorization))
     {
-        DebugFormat(DEBUG_SIP, "Dialog state code: %u\n",
+        DebugFormat(DEBUG_SIP, "Dialog state code: %hu\n",
             dialog->status_code);
 
         SnortEventqAdd(GID_SIP, SIP_EVENT_AUTH_INVITE_REPLAY_ATTACK);
@@ -402,9 +402,9 @@ static int SIP_ignoreChannels(SIP_DialogData* dialog, Packet* p, SIP_PROTO_CONF*
     while ((NULL != mdataA)&&(NULL != mdataB))
     {
         //void *ssn;
-        DebugFormat(DEBUG_SIP, "Ignoring channels Source IP: %s Port: %u\n",
+        DebugFormat(DEBUG_SIP, "Ignoring channels Source IP: %s Port: %hu\n",
             sfip_to_str(&mdataA->maddress), mdataA->mport);
-        DebugFormat(DEBUG_SIP, "Ignoring channels Destine IP: %s Port: %u\n",
+        DebugFormat(DEBUG_SIP, "Ignoring channels Destine IP: %s Port: %hu\n",
             sfip_to_str(&mdataB->maddress), mdataB->mport);
 
         /* Call into Streams to mark data channel as something to ignore. */
@@ -544,7 +544,7 @@ void SIP_displayMedias(SIP_MediaList* dList)
         mdata =  currSession->medias;
         while (NULL != mdata)
         {
-            DebugFormat(DEBUG_SIP, "Media IP: %s, port: %u, number of ports %u\n",
+            DebugFormat(DEBUG_SIP, "Media IP: %s, port: %hu, number of ports %hhu\n",
                 sfip_to_str(&mdata->maddress), mdata->mport, mdata->numPort);
             mdata = mdata->nextM;
         }
@@ -573,7 +573,7 @@ static SIP_DialogData* SIP_addDialog(SIPMsg* sipMsg, SIP_DialogData* currDialog,
 {
     SIP_DialogData* dialog;
 
-    DebugFormat(DEBUG_SIP, "Add Dialog id: %u, From: %u, To: %u, status code: %u\n",
+    DebugFormat(DEBUG_SIP, "Add Dialog id: %u, From: %u, To: %u, status code: %hu\n",
         sipMsg->dlgID.callIdHash,sipMsg->dlgID.fromTagHash,sipMsg->dlgID.toTagHash,
         sipMsg->status_code);
 
index b74aaac27d89b68e0cc3dfd0e55fedd12379d732..4694fe393cf188add7cd0ede2badb37fa6a31518 100644 (file)
@@ -416,7 +416,7 @@ static int sip_startline_parse(SIPMsg* msg, const char* buff, char* end, char**
         if (space == NULL)
             return false;
         msg->uriLen = space - msg->uri;
-        DebugFormat(DEBUG_SIP, "uri: %.*s, length: %u\n", msg->uriLen, msg->uri,
+        DebugFormat(DEBUG_SIP, "uri: %.*s, length: %hu\n", msg->uriLen, msg->uri,
             msg->uriLen);
         if (0 == msg->uriLen)
             SnortEventqAdd(GID_SIP, SIP_EVENT_EMPTY_REQUEST_URI);
@@ -1203,7 +1203,7 @@ static int sip_parse_sdp_m(SIPMsg* msg, const char* start, const char* end)
     mdata->nextM = msg->mediaSession->medias;
     mdata->maddress = msg->mediaSession->maddress_default;
     msg->mediaSession->medias = mdata;
-    DebugFormat(DEBUG_SIP, "Media IP: %s, Media port %u, number of media: %d\n",
+    DebugFormat(DEBUG_SIP, "Media IP: %s, Media port %hu, number of media: %d\n",
         sfip_to_str(&mdata->maddress), mdata->mport, mdata->numPort);
     return SIP_PARSE_SUCCESS;
 }
index 252225bd9233ebfb5974fd22514afdb6f6712cc2..ecaa1d707e599596cd1e5bb684500dc6a50fc1e7 100644 (file)
@@ -228,7 +228,7 @@ static inline bool process_command(SmtpPafData* pfdata,  uint8_t val)
         /* Continue finding the data length ...*/
         if (get_length(val, &pfdata->length) != SMTP_PAF_LENGTH_CONTINUE)
         {
-            DebugFormat(DEBUG_SMTP, "Find data length: %d\n",
+            DebugFormat(DEBUG_SMTP, "Find data length: %u\n",
                 pfdata->length);
             pfdata->cmd_info.cmd_state = SMTP_PAF_CMD_DATA_END_STATE;
         }
index 0f8c64d20f115b161cd52f20c17e03658a9a158b..7ca7d6c826a14bacf59c6fa898f766e0e782a368 100644 (file)
@@ -70,7 +70,7 @@ static void test_sfrt_remove_after_insert()
 
     num_entries = sizeof(ip_lists)/sizeof(ip_lists[0]);
     if ( s_debug )
-        printf("Number of entries: %d \n",num_entries);
+        printf("Number of entries: %u \n",num_entries);
 
     dir = sfrt_new(DIR_16_4x4_16x5_4x4, IPv6, num_entries + 1, 200);
 
@@ -144,8 +144,8 @@ static void test_sfrt_remove_after_insert()
 
     if ( s_debug )
     {
-        printf("Usage: %d bytes\n", sfrt_usage(dir));
-        printf("Number of entries: %d \n", sfrt_num_entries(dir));
+        printf("Usage: %u bytes\n", sfrt_usage(dir));
+        printf("Number of entries: %u \n", sfrt_num_entries(dir));
     }
 
     sfrt_free(dir);
@@ -161,7 +161,7 @@ static void test_sfrt_remove_after_insert_all()
     num_entries = sizeof(ip_lists)/sizeof(ip_lists[0]);
 
     if ( s_debug )
-        printf("Number of entries: %d \n",num_entries);
+        printf("Number of entries: %u \n",num_entries);
 
     dir = sfrt_new(DIR_16_4x4_16x5_4x4, IPv6, num_entries + 1, 200);
 
@@ -207,8 +207,8 @@ static void test_sfrt_remove_after_insert_all()
 
     if ( s_debug )
     {
-        printf("Usage: %d bytes\n", sfrt_usage(dir));
-        printf("Number of entries: %d \n", sfrt_num_entries(dir));
+        printf("Usage: %u bytes\n", sfrt_usage(dir));
+        printf("Number of entries: %u \n", sfrt_num_entries(dir));
     }
 
     /*remove all entries*/
@@ -235,7 +235,7 @@ static void test_sfrt_remove_after_insert_all()
         /*check the next entry still exist*/
         if (index + 1 < num_entries)
         {
-            IP_entry* ip_entry =  &(ip_lists[index + 1]);
+            ip_entry =  &(ip_lists[index + 1]);
             /*Parse IP*/
             if (ip_entry->ip_str)
                 sfip_pton(ip_entry->ip_str, &ip);
@@ -245,8 +245,8 @@ static void test_sfrt_remove_after_insert_all()
 
     if ( s_debug )
     {
-        printf("Usage: %d bytes\n", sfrt_usage(dir));
-        printf("Number of entries: %d \n", sfrt_num_entries(dir));
+        printf("Usage: %u bytes\n", sfrt_usage(dir));
+        printf("Number of entries: %u \n", sfrt_num_entries(dir));
     }
 
     sfrt_free(dir);
index ed8f6dd7ccba622904ae6bffc8466d0fe1102d2f..78d95e30002105a157ee88cbb80dcd2a375dcca2 100644 (file)
@@ -497,8 +497,8 @@ static inline int FragCheckFirstLast(const Packet* const p,
         {
             ft->calculated_size = endOfThisFrag;
 
-            DebugFormat(DEBUG_FRAG, "Got last frag, Bytes: %d, "
-                "Calculated size: %d\n",
+            DebugFormat(DEBUG_FRAG, "Got last frag, Bytes: %u, "
+                "Calculated size: %u\n",
                 ft->frag_bytes,
                 ft->calculated_size);
         }
@@ -618,7 +618,7 @@ static inline int checkTinyFragments(
             if (p->dsize <= engine->min_fragment_length)
             {
                 DebugFormat(DEBUG_FRAG,
-                    "Frag: Received fragment size(%d) is not more than configured min_fragment_length (%d)\n",
+                    "Frag: Received fragment size(%d) is not more than configured min_fragment_length (%u)\n",
                     p->dsize, engine->min_fragment_length);
                 EventTinyFragments(engine);
                 return 1;
@@ -628,7 +628,7 @@ static inline int checkTinyFragments(
             if (trimmedLength <= engine->min_fragment_length)
             {
                 DebugFormat(DEBUG_FRAG,
-                    "Frag: # of New octets in Received fragment(%d) is not more than configured min_fragment_length (%d)\n",
+                    "Frag: # of New octets in Received fragment(%u) is not more than configured min_fragment_length (%u)\n",
                     trimmedLength, engine->min_fragment_length);
                 EventTinyFragments(engine);
                 return 1;
@@ -707,7 +707,7 @@ static inline int FragIsComplete(FragTracker* ft)
         }
 
         DebugFormat(DEBUG_FRAG,
-            "   Calc size (%d) != frag bytes (%d)\n",
+            "   Calc size (%u) != frag bytes (%u)\n",
             ft->calculated_size, ft->frag_bytes);
 
         /*
@@ -1150,7 +1150,7 @@ void Defrag::process(Packet* p, FragTracker* ft)
         {
             DebugFormat(DEBUG_FRAG,
                 "[FRAG] Fragment discarded due to low TTL "
-                "[0x%X->0x%X], TTL: %d  " "Offset: %d Length: %d\n",
+                "[0x%X->0x%X], TTL: %d  " "Offset: %d Length: %hu\n",
                 ntohl(p->ptrs.ip_api.get_ip4h()->get_src()),
                 ntohl(p->ptrs.ip_api.get_ip4h()->get_dst()),
                 p->ptrs.ip_api.ttl(), frag_offset,
@@ -1214,7 +1214,7 @@ void Defrag::process(Packet* p, FragTracker* ft)
         {
         case FRAG_INSERT_FAILED:
             DebugFormat(DEBUG_FRAG, "WARNING: Insert into Fraglist failed, "
-                "(offset: %u).\n", frag_offset);
+                "(offset: %hu).\n", frag_offset);
             return;
 
         case FRAG_INSERT_TTL:
@@ -1225,7 +1225,7 @@ void Defrag::process(Packet* p, FragTracker* ft)
                 DebugFormat(DEBUG_FRAG,
                     "[FRAG] Fragment discarded due to large TTL Delta "
                     "[0x%X->0x%X], TTL: %d  orig TTL: %d "
-                    "Offset: %d Length: %d\n",
+                    "Offset: %hu Length: %hu\n",
                     ntohl(p->ptrs.ip_api.get_ip4h()->get_src()),
                     ntohl(p->ptrs.ip_api.get_ip4h()->get_dst()),
                     p->ptrs.ip_api.ttl(), ft->ttl, frag_offset,
@@ -1242,13 +1242,13 @@ void Defrag::process(Packet* p, FragTracker* ft)
 
         case FRAG_INSERT_TIMEOUT:
             DebugFormat(DEBUG_FRAG, "WARNING: Insert into Fraglist failed due to timeout, "
-                "(offset: %u).\n", frag_offset);
+                "(offset: %hu).\n", frag_offset);
             return;
 
         case FRAG_INSERT_OVERLAP_LIMIT:
             DebugFormat(DEBUG_FRAG,
                 "WARNING: Excessive IP fragment overlap, "
-                "(More: %u, offset: %u, offsetSize: %u).\n",
+                "(More: %d, offset: %d, offsetSize: %hu).\n",
                 (p->ptrs.decode_flags & DECODE_MF),
                 (frag_offset << 3), p->dsize);
             ip_stats.discards++;
@@ -2288,7 +2288,7 @@ int Defrag::add_frag_node(
     ft->frag_bytes += newfrag->size;
 
     DebugFormat(DEBUG_FRAG,
-        "[#] accumulated bytes on FragTracker %d, count"
+        "[#] accumulated bytes on FragTracker %u, count"
         " %d\n", ft->frag_bytes, ft->fraglist_count);
 
     *retFrag = newfrag;
@@ -2361,7 +2361,7 @@ int Defrag::dup_frag_node(
     ft->frag_bytes += newfrag->size;
 
     DebugFormat(DEBUG_FRAG,
-        "[#] accumulated bytes on FragTracker %d, count"
+        "[#] accumulated bytes on FragTracker %u, count"
         " %d\n", ft->frag_bytes, ft->fraglist_count);
 
     *retFrag = newfrag;
index 3d71fd46bef48ee577ed6dc920ade4ca7e21b8bb..9b13407012563b3fac3802b52452084659894b44 100644 (file)
@@ -70,7 +70,7 @@ uint32_t TcpSegmentDescriptor::init_mss(uint16_t* value)
         if ( opt.code == TcpOptCode::MAXSEG )
         {
             *value = extract_16bits(opt.data);
-            DebugFormat(DEBUG_STREAM_STATE, "Found MSS %u\n", *value);
+            DebugFormat(DEBUG_STREAM_STATE, "Found MSS %hu\n", *value);
             return TF_MSS;
         }
     }
index b8eebb65a53cf6633941b9a9d23cd054323821b9..917657d3f12b1c136621a56988cd1a7da7fb0840 100644 (file)
@@ -834,7 +834,6 @@ TEST_CASE("Stream API", "[stream_api][stream]")
     {
         Packet* pkt = get_syn_packet(flow);
         pkt->flow->session = new TcpSession(flow);
-        int dir;
 
         Stream::stop_inspection(flow, pkt, SSN_DIR_FROM_SERVER, 0, 0);
         bool ignored = Stream::ignored_session(flow, pkt);
@@ -848,7 +847,6 @@ TEST_CASE("Stream API", "[stream_api][stream]")
     {
         Packet* pkt = get_syn_ack_packet(flow);
         pkt->flow->session = new TcpSession(flow);
-        int dir;
 
         Stream::stop_inspection(flow, pkt, SSN_DIR_FROM_SERVER, 0, 0);
         bool ignored = Stream::ignored_session(flow, pkt);
@@ -861,7 +859,6 @@ TEST_CASE("Stream API", "[stream_api][stream]")
     {
         Packet* pkt = get_syn_packet(flow);
         pkt->flow->session = new TcpSession(flow);
-        int dir;
 
         Stream::stop_inspection(flow, pkt, SSN_DIR_FROM_CLIENT, 0, 0);
         bool ignored = Stream::ignored_session(flow, pkt);
@@ -875,7 +872,6 @@ TEST_CASE("Stream API", "[stream_api][stream]")
     {
         Packet* pkt = get_syn_ack_packet(flow);
         pkt->flow->session = new TcpSession(flow);
-        int dir;
 
         Stream::stop_inspection(flow, pkt, SSN_DIR_FROM_CLIENT, 0, 0);
         bool ignored = Stream::ignored_session(flow, pkt);
@@ -888,7 +884,6 @@ TEST_CASE("Stream API", "[stream_api][stream]")
     {
         Packet* pkt = get_syn_packet(flow);
         pkt->flow->session = new TcpSession(flow);
-        int dir;
 
         Stream::stop_inspection(flow, pkt, SSN_DIR_BOTH, 0, 0);
         bool ignored = Stream::ignored_session(flow, pkt);
@@ -902,7 +897,6 @@ TEST_CASE("Stream API", "[stream_api][stream]")
     {
         Packet* pkt = get_syn_ack_packet(flow);
         pkt->flow->session = new TcpSession(flow);
-        int dir;
 
         Stream::stop_inspection(flow, pkt, SSN_DIR_BOTH, 0, 0);
         bool ignored = Stream::ignored_session(flow, pkt);
index ff0b10790503081619c6f3f3d797b265ba4c4d98..2e460439a1221f99c67b2461b58ea75bfb3d846f 100644 (file)
@@ -121,7 +121,7 @@ int SegmentOverlapEditor::eval_right()
 void SegmentOverlapEditor::drop_old_segment()
 {
     DebugFormat(DEBUG_STREAM_STATE,
-        "full right overlap, dropping old segment at seq %d, size %d\n",
+        "full right overlap, dropping old segment at seq %u, size %hu\n",
         right->seq, right->payload_size);
 
     TcpSegmentNode* drop_seg = right;
@@ -219,8 +219,6 @@ int SegmentOverlapEditor::left_overlap_trim_first()
 
 int SegmentOverlapEditor::left_overlap_keep_last()
 {
-    int rc = STREAM_INSERT_OK;
-
     DebugFormat(DEBUG_STREAM_STATE, "left overlap %d\n", overlap);
 
     len = tsd->get_seg_len();
@@ -259,7 +257,7 @@ int SegmentOverlapEditor::left_overlap_keep_last()
         }
     }
 
-    return rc;
+    return STREAM_INSERT_OK;
 }
 
 void SegmentOverlapEditor::right_overlap_truncate_existing()
index f07dd74ff3591c609484083cb4e1c94777e81cb1..4ee2aaa70167169b5ddd2341062100c7e50b7a9f 100644 (file)
@@ -66,14 +66,14 @@ inline void TraceEvent(const Packet* p, TcpSegmentDescriptor*, uint32_t txd, uin
 
     uint32_t rseq = ( txd ) ? h->seq() - txd : h->seq();
     uint32_t rack = ( rxd ) ? h->ack() - rxd : h->ack();
-    fprintf(stdout, "\n" FMTu64("-3") " %s=0x%02x Seq=%-4u Ack=%-4u Win=%-4u Len=%-4u%s\n",
+    fprintf(stdout, "\n" FMTu64("-3") " %s=0x%02x Seq=%-4u Ack=%-4u Win=%-4hu Len=%-4hu%s\n",
         //"\n" FMTu64("-3") " %s=0x%02x Seq=%-4u Ack=%-4u Win=%-4u Len=%-4u End=%-4u%s\n",
         pc.total_from_daq, flags, h->th_flags, rseq, rack, h->win(), p->dsize, order);
 }
 
 inline void TraceSession(const Flow* lws)
 {
-    fprintf(stdout, "    LWS: ST=0x%x SF=0x%x CP=%u SP=%u\n", (unsigned)lws->session_state,
+    fprintf(stdout, "    LWS: ST=0x%x SF=0x%x CP=%hu SP=%hu\n", (unsigned)lws->session_state,
         lws->ssn_state.session_flags, lws->client_port, lws->server_port);
 }
 
index 97d16df89f95c4a661dfb65dcbcaf232fca9fdbd..54bbcf542f55057a2d8135932f953c6dcb31e810 100644 (file)
@@ -309,7 +309,7 @@ int TcpNormalizer::validate_paws_timestamp(TcpSegmentDescriptor& tsd)
     {
         /* this packet is from way too far into the future */
         DebugFormat(DEBUG_STREAM_STATE,
-            "packet PAWS timestamp way too far ahead of last packet %ld %d...\n",
+            "packet PAWS timestamp way too far ahead of last packet %ld %u...\n",
             tsd.get_pkt()->pkth->ts.tv_sec, peer_tracker->get_ts_last_packet() );
         //inc_tcp_discards();
         ( ( TcpSession* )tsd.get_flow()->session )->tel.set_tcp_event(EVENT_BAD_TIMESTAMP);
index 1ef3214c7711bca131f6a05457071ed5c1b8590d..8ae2c14cc8011520cd3fed586829403dbf204cc7 100644 (file)
@@ -222,7 +222,7 @@ int TcpReassembler::add_reassembly_segment(TcpSegmentDescriptor& tsd, int16_t le
     {
         // zero size data because of trimming.  Don't insert it
         DebugFormat(DEBUG_STREAM_STATE, "zero size TCP data after left & right trimming "
-            "(len: %d slide: %d trunc: %d)\n", len, slide, trunc_len);
+            "(len: %hd slide: %u trunc: %u)\n", len, slide, trunc_len);
         inc_tcp_discards();
         tracker->normalizer->trim_win_payload(tsd);
 
@@ -265,7 +265,7 @@ int TcpReassembler::add_reassembly_segment(TcpSegmentDescriptor& tsd, int16_t le
     tsd.get_pkt()->packet_flags |= PKT_STREAM_INSERT;
 
     DebugFormat(DEBUG_STREAM_STATE,
-        "added %d bytes on segment list @ seq: 0x%X, total %u, %d segments queued\n",
+        "added %hu bytes on segment list @ seq: 0x%X, total %u, %u segments queued\n",
         tsn->payload_size, tsn->seq, seg_bytes_logical, get_pending_segment_count(0));
 
 #ifdef SEG_TEST
@@ -287,7 +287,7 @@ int TcpReassembler::dup_reassembly_segment(TcpSegmentNode* left, TcpSegmentNode*
     queue_reassembly_segment(left, tsn);
 
     DebugFormat(DEBUG_STREAM_STATE,
-        "added %d bytes on segment list @ seq: 0x%X, total %u, %d segments queued\n",
+        "added %hu bytes on segment list @ seq: 0x%X, total %u, %u segments queued\n",
         tsn->payload_size, tsn->seq, seg_bytes_logical, get_pending_segment_count(0));
 
     *retSeg = tsn;
@@ -343,7 +343,7 @@ int TcpReassembler::purge_to_seq(uint32_t flush_seq)
 
     tsn = seglist.head;
 
-    DebugFormat(DEBUG_STREAM_STATE, "In purge_to_seq, start seq = 0x%X end seq = 0x%X delta %d\n",
+    DebugFormat(DEBUG_STREAM_STATE, "In purge_to_seq, start seq = 0x%X end seq = 0x%X delta %u\n",
         tsn->seq, flush_seq, flush_seq-tsn->seq);
 
     while ( tsn )
@@ -561,7 +561,7 @@ int TcpReassembler::flush_data_segments(Packet* p, uint32_t toSeq, uint8_t* flus
 
     DEBUG_WRAP(bytes_queued -= bytes_flushed; );
     DebugFormat(DEBUG_STREAM_STATE,
-        "flushed %d bytes / %d segs on stream, %d bytes still queued\n",
+        "flushed %hu bytes / %u segs on stream, %u bytes still queued\n",
         bytes_flushed, segs, bytes_queued);
 
     return bytes_flushed;
@@ -648,7 +648,7 @@ int TcpReassembler::_flush_to_seq(uint32_t bytes, Packet* p, uint32_t pkt_flags)
 
         if (footprint == 0)
         {
-            DebugFormat(DEBUG_STREAM_STATE, "Negative footprint, bailing %d (0x%X - 0x%X)\n",
+            DebugFormat(DEBUG_STREAM_STATE, "Negative footprint, bailing %u (0x%X - 0x%X)\n",
                 footprint, stop_seq, seglist_base_seq);
             return bytes_processed;
         }
@@ -1212,7 +1212,7 @@ void TcpReassembler::insert_segment_in_empty_seglist(TcpSegmentDescriptor& tsd)
     add_reassembly_segment(tsd, tsd.get_seg_len(), overlap, 0, tsd.get_seg_seq() + overlap, NULL);
 
     DebugFormat(DEBUG_STREAM_STATE,
-        "Attached new queue to seglist, %d bytes queued, base_seq 0x%X\n",
+        "Attached new queue to seglist, %u bytes queued, base_seq 0x%X\n",
         tsd.get_seg_len() - overlap, seglist_base_seq);
 }
 
@@ -1249,7 +1249,7 @@ void TcpReassembler::init_overlap_editor(TcpSegmentDescriptor& tsd)
         for ( tsn = seglist.head; tsn; tsn = tsn->next )
         {
             DEBUG_WRAP(
-                DebugFormat(DEBUG_STREAM_STATE, "tsn: %p  seq: 0x%X  size: %hu delta: %d\n",
+                DebugFormat(DEBUG_STREAM_STATE, "tsn: %p  seq: 0x%X  size: %hu delta: %u\n",
                 (void*) tsn, tsn->seq, tsn->payload_size, ( tsn->seq - base_seq ) - last);
                 last = tsn->seq - base_seq;
                 lastptr = tsn;
@@ -1272,7 +1272,7 @@ void TcpReassembler::init_overlap_editor(TcpSegmentDescriptor& tsd)
         for ( tsn = seglist.tail; tsn; tsn = tsn->prev )
         {
             DEBUG_WRAP(
-                DebugFormat(DEBUG_STREAM_STATE, "tsn: %p  seq: 0x%X  size: %hu delta: %d\n",
+                DebugFormat(DEBUG_STREAM_STATE, "tsn: %p  seq: 0x%X  size: %hu delta: %u\n",
                 (void*) tsn, tsn->seq, tsn->payload_size, ( tsn->seq - base_seq ) - last);
                 last = tsn->seq - base_seq;
                 lastptr = tsn;
@@ -1304,11 +1304,11 @@ int TcpReassembler::insert_segment_in_seglist(TcpSegmentDescriptor& tsd)
     int rc = STREAM_INSERT_OK;
 
     DebugFormat(DEBUG_STREAM_STATE,
-        "Queuing %d bytes on stream!\nbase_seq: %X seq: %X  seq_end: %X\n",
+        "Queuing %u bytes on stream!\nbase_seq: %X seq: %X  seq_end: %X\n",
         tsd.get_end_seq() - tsd.get_seg_seq(), seglist_base_seq, tsd.get_seg_seq(),
         tsd.get_end_seq());
 
-    DebugFormat(DEBUG_STREAM_STATE, "%d segments on seglist\n", get_pending_segment_count(0));
+    DebugFormat(DEBUG_STREAM_STATE, "%u segments on seglist\n", get_pending_segment_count(0));
     DebugMessage(DEBUG_STREAM_STATE, "!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+\n");
     DebugMessage(DEBUG_STREAM_STATE, "!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+\n");
 
index e7a50f384cae584585751c673f8c5e4d6331d131..bbca3f2dbaa86957bf5a8aea7e14134420db787e 100644 (file)
@@ -1107,7 +1107,7 @@ int TcpSession::process(Packet* p)
         sfip_ntop(p->ptrs.ip_api.get_dst(), dst_addr, sizeof(dst_addr));
 
         DebugFormat((DEBUG_STREAM|DEBUG_STREAM_STATE),
-            "Got TCP Packet %s:%d ->  %s:%d %s\nseq: 0x%X   ack:0x%X  dsize: %u\n",
+            "Got TCP Packet %s:%hu ->  %s:%hu %s\nseq: 0x%X   ack:0x%X  dsize: %hu\n",
             src_addr, p->ptrs.sp, dst_addr, p->ptrs.dp, flagbuf,
             p->ptrs.tcph->seq(), p->ptrs.tcph->ack(), p->dsize);
     );
index 7a0b57c94082096d8f82a220ed594f0e41fca768..368c13164f98b9d85e6736714672145099a5aad3 100644 (file)
@@ -208,7 +208,7 @@ static void PrintHostAttributeEntry(HostAttributeEntry* host)
         host->ipAddr.bits);
 
     DebugFormat(DEBUG_ATTRIBUTE,
-        "\tPolicy Information: frag:%s (%u) stream: %s (%u)\n",
+        "\tPolicy Information: frag:%s (%hhu) stream: %s (%hhu)\n",
         "look-me-up", host->hostInfo.fragPolicy,
         "look-me-up", host->hostInfo.streamPolicy);
 
index 140262c7ef9bae5a06d74302fe5486d23db0242d..b986ec0fa1fe3f486c2326511ec4874bde5e975c 100644 (file)
@@ -25,7 +25,7 @@
 namespace t_stopwatch
 {
 
-struct Clock : ClockTraits<hr_clock>
+struct Clock : public ClockTraits<hr_clock>
 {
     static time_point now()
     { return time; }
index 38d3931fcb4ba4ea0f230a26adfc0610d65f7c54..971a85897520f65c5bd8fb4b8e1142810b417103 100644 (file)
@@ -46,9 +46,6 @@ private:
         std::string format;
         int length;
 
-        inline bool operator==(Command c)
-        { return (!name.compare(c.name)); }
-
         Command() : name(std::string()),
             format(std::string()),
             length(command_default_len) { }
index 7f0e83d85390ea42e94f345d90753e96085b55dc..ad06777b7f8d788b68ac7941e9258383ddcd1a02 100644 (file)
@@ -38,30 +38,9 @@ public:
 
 private:
     bool output_set = false;
-
-    bool parse_file_option(std::istringstream& data_stream,
-        std::string orig_name,
-        std::string option_name,
-        std::string new_file_name);
 };
 } // namespace
 
-bool PerfMonitor::parse_file_option(std::istringstream& data_stream,
-    std::string orig_name,
-    std::string option_name,
-    std::string new_file_name)
-{
-    bool tmpval;
-
-    table_api.add_comment(orig_name + " deprecated. If '" + option_name +
-        " = true', Snort++ automatically prints to '" + new_file_name + "'");
-    tmpval = table_api.add_option(option_name, true);
-
-    if (eat_option(data_stream)) // we no longer care about the file name.
-        return tmpval;
-    return false;
-}
-
 bool PerfMonitor::convert(std::istringstream& data_stream)
 {
     std::string keyword;
index 9c08087add8fa901e3e844e5d570282ffb73a58a..4668832259b517105b6a1ac699052d8268e53ec3 100644 (file)
@@ -36,10 +36,8 @@ public:
     virtual bool convert(std::istringstream& data_stream);
 
 private:
-    bool parse_list(std::string table_name, std::istringstream& data_stream);
     bool parse_option(std::string table_name, std::istringstream& data_stream);
     bool add_portscan_global_option(std::string name, std::istringstream& data_stream);
-    // a wrapper for parse_list.  adds an addition '[..]' around the string
     bool parse_ip_list(std::string table_name, std::istringstream& data_stream);
 };
 } // namespace
@@ -65,20 +63,6 @@ bool PortScan::parse_ip_list(std::string list_name, std::istringstream& data_str
     return table_api.add_option(list_name, prev);
 }
 
-bool PortScan::parse_list(std::string list_name, std::istringstream& data_stream)
-{
-    std::string elem;
-    bool retval = true;
-
-    if (!(data_stream >> elem) || (elem != "{"))
-        return false;
-
-    while (data_stream >> elem && elem != "}")
-        retval && table_api.add_list(list_name, elem) && retval;
-
-    return retval;
-}
-
 bool PortScan::parse_option(std::string list_name, std::istringstream& data_stream)
 {
     std::string elem;
index 817ebf29a379bdb09d99a573886e5a57ef8a3e7e..04161fe5b7253724873b71b6822274d0585859d5 100644 (file)
@@ -42,9 +42,6 @@ private:
         std::string format;
         int length;
 
-        inline bool operator==(Command c)
-        { return (!name.compare(c.name)); }
-
         Command() : name(std::string()),
             format(std::string()),
             length(command_default_len) { }