spicy: Drop ZEEK_VERSION_NUMBER ifdef'ery

Given src/spicy is part of the Zeek tree, these are not necessary and
are probably just remains from the spicy-plugin era.
This commit is contained in:
Arne Welzel 2024-02-22 12:54:55 +01:00
parent 08bf8d47f4
commit 5742f7cc21
2 changed files with 0 additions and 16 deletions

View file

@ -87,11 +87,7 @@ bool FileAnalyzer::Process(int len, const u_char* data) {
file->FileEvent(Spicy::max_file_depth_exceeded, {file_val, analyzer_args, val_mgr->Count(_state.file().depth)}); file->FileEvent(Spicy::max_file_depth_exceeded, {file_val, analyzer_args, val_mgr->Count(_state.file().depth)});
auto tag = spicy_mgr->tagForFileAnalyzer(_state.file().analyzer->Tag()); auto tag = spicy_mgr->tagForFileAnalyzer(_state.file().analyzer->Tag());
#if ZEEK_VERSION_NUMBER >= 50200
AnalyzerViolation("maximal file depth exceeded", reinterpret_cast<const char*>(data), len, tag); AnalyzerViolation("maximal file depth exceeded", reinterpret_cast<const char*>(data), len, tag);
#else
// We don't have an an appropriate way to report this with older Zeeks.
#endif
return false; return false;
} }
@ -101,11 +97,7 @@ bool FileAnalyzer::Process(int len, const u_char* data) {
} catch ( const hilti::rt::RuntimeError& e ) { } catch ( const hilti::rt::RuntimeError& e ) {
STATE_DEBUG_MSG(hilti::rt::fmt("error during parsing, triggering analyzer violation: %s", e.what())); STATE_DEBUG_MSG(hilti::rt::fmt("error during parsing, triggering analyzer violation: %s", e.what()));
auto tag = spicy_mgr->tagForFileAnalyzer(_state.file().analyzer->Tag()); auto tag = spicy_mgr->tagForFileAnalyzer(_state.file().analyzer->Tag());
#if ZEEK_VERSION_NUMBER >= 50200
AnalyzerViolation(e.what(), reinterpret_cast<const char*>(data), len, tag); AnalyzerViolation(e.what(), reinterpret_cast<const char*>(data), len, tag);
#else
// We don't have an an appropriate way to report this with older Zeeks.
#endif
} catch ( const hilti::rt::Exception& e ) { } catch ( const hilti::rt::Exception& e ) {
STATE_DEBUG_MSG(e.what()); STATE_DEBUG_MSG(e.what());
spicy_mgr->analyzerError(_state.file().analyzer, e.description(), spicy_mgr->analyzerError(_state.file().analyzer, e.description(),
@ -122,11 +114,7 @@ void FileAnalyzer::Finish() {
} catch ( const hilti::rt::RuntimeError& e ) { } catch ( const hilti::rt::RuntimeError& e ) {
STATE_DEBUG_MSG(hilti::rt::fmt("error during parsing, triggering analyzer violation: %s", e.what())); STATE_DEBUG_MSG(hilti::rt::fmt("error during parsing, triggering analyzer violation: %s", e.what()));
auto tag = spicy_mgr->tagForFileAnalyzer(_state.file().analyzer->Tag()); auto tag = spicy_mgr->tagForFileAnalyzer(_state.file().analyzer->Tag());
#if ZEEK_VERSION_NUMBER >= 50200
AnalyzerViolation(e.what(), "", 0, tag); AnalyzerViolation(e.what(), "", 0, tag);
#else
// We don't have an an appropriate way to report this with older Zeeks.
#endif
} catch ( const hilti::rt::Exception& e ) { } catch ( const hilti::rt::Exception& e ) {
spicy_mgr->analyzerError(_state.file().analyzer, e.description(), spicy_mgr->analyzerError(_state.file().analyzer, e.description(),
e.location()); // this sets Zeek to skip sending any further input e.location()); // this sets Zeek to skip sending any further input

View file

@ -772,11 +772,7 @@ inline void set_record_field(RecordVal* rval, const IntrusivePtr<RecordType>& rt
if constexpr ( NoConversionNeeded::value ) if constexpr ( NoConversionNeeded::value )
rval->Assign(idx, x); rval->Assign(idx, x);
else if constexpr ( IsSignedInteger::value ) else if constexpr ( IsSignedInteger::value )
#if ZEEK_VERSION_NUMBER >= 50200
rval->Assign(idx, static_cast<int64_t>(x.Ref())); rval->Assign(idx, static_cast<int64_t>(x.Ref()));
#else
rval->Assign(idx, static_cast<int>(x.Ref()));
#endif
else if constexpr ( IsUnsignedInteger::value ) else if constexpr ( IsUnsignedInteger::value )
rval->Assign(idx, static_cast<uint64_t>(x.Ref())); rval->Assign(idx, static_cast<uint64_t>(x.Ref()));
else if constexpr ( std::is_same_v<T, hilti::rt::Bytes> ) else if constexpr ( std::is_same_v<T, hilti::rt::Bytes> )