mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
Use const-references in lots of places (preformance-unnecessary-value-param)
This commit is contained in:
parent
92afe64525
commit
5a237d3a3f
27 changed files with 89 additions and 89 deletions
|
@ -38,7 +38,7 @@ AnalyzerSet::~AnalyzerSet()
|
|||
delete analyzer_hash;
|
||||
}
|
||||
|
||||
Analyzer* AnalyzerSet::Find(file_analysis::Tag tag, RecordVal* args)
|
||||
Analyzer* AnalyzerSet::Find(const file_analysis::Tag& tag, RecordVal* args)
|
||||
{
|
||||
HashKey* key = GetKey(tag, args);
|
||||
Analyzer* rval = analyzer_map.Lookup(key);
|
||||
|
@ -46,7 +46,7 @@ Analyzer* AnalyzerSet::Find(file_analysis::Tag tag, RecordVal* args)
|
|||
return rval;
|
||||
}
|
||||
|
||||
bool AnalyzerSet::Add(file_analysis::Tag tag, RecordVal* args)
|
||||
bool AnalyzerSet::Add(const file_analysis::Tag& tag, RecordVal* args)
|
||||
{
|
||||
HashKey* key = GetKey(tag, args);
|
||||
|
||||
|
@ -73,7 +73,7 @@ bool AnalyzerSet::Add(file_analysis::Tag tag, RecordVal* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
Analyzer* AnalyzerSet::QueueAdd(file_analysis::Tag tag, RecordVal* args)
|
||||
Analyzer* AnalyzerSet::QueueAdd(const file_analysis::Tag& tag, RecordVal* args)
|
||||
{
|
||||
HashKey* key = GetKey(tag, args);
|
||||
file_analysis::Analyzer* a = InstantiateAnalyzer(tag, args);
|
||||
|
@ -106,12 +106,12 @@ bool AnalyzerSet::AddMod::Perform(AnalyzerSet* set)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AnalyzerSet::Remove(file_analysis::Tag tag, RecordVal* args)
|
||||
bool AnalyzerSet::Remove(const file_analysis::Tag& tag, RecordVal* args)
|
||||
{
|
||||
return Remove(tag, GetKey(tag, args));
|
||||
}
|
||||
|
||||
bool AnalyzerSet::Remove(file_analysis::Tag tag, HashKey* key)
|
||||
bool AnalyzerSet::Remove(const file_analysis::Tag& tag, HashKey* key)
|
||||
{
|
||||
file_analysis::Analyzer* a =
|
||||
(file_analysis::Analyzer*) analyzer_map.Remove(key);
|
||||
|
@ -139,7 +139,7 @@ bool AnalyzerSet::Remove(file_analysis::Tag tag, HashKey* key)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AnalyzerSet::QueueRemove(file_analysis::Tag tag, RecordVal* args)
|
||||
bool AnalyzerSet::QueueRemove(const file_analysis::Tag& tag, RecordVal* args)
|
||||
{
|
||||
HashKey* key = GetKey(tag, args);
|
||||
|
||||
|
@ -153,7 +153,7 @@ bool AnalyzerSet::RemoveMod::Perform(AnalyzerSet* set)
|
|||
return set->Remove(tag, key);
|
||||
}
|
||||
|
||||
HashKey* AnalyzerSet::GetKey(file_analysis::Tag t, RecordVal* args) const
|
||||
HashKey* AnalyzerSet::GetKey(const file_analysis::Tag& t, RecordVal* args) const
|
||||
{
|
||||
ListVal* lv = new ListVal(TYPE_ANY);
|
||||
lv->Append(t.AsEnumVal()->Ref());
|
||||
|
@ -166,7 +166,7 @@ HashKey* AnalyzerSet::GetKey(file_analysis::Tag t, RecordVal* args) const
|
|||
return key;
|
||||
}
|
||||
|
||||
file_analysis::Analyzer* AnalyzerSet::InstantiateAnalyzer(Tag tag,
|
||||
file_analysis::Analyzer* AnalyzerSet::InstantiateAnalyzer(const Tag& tag,
|
||||
RecordVal* args) const
|
||||
{
|
||||
file_analysis::Analyzer* a = file_mgr->InstantiateAnalyzer(tag, args, file);
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
* @param args an \c AnalyzerArgs record.
|
||||
* @return pointer to an analyzer instance, or a null pointer if not found.
|
||||
*/
|
||||
Analyzer* Find(file_analysis::Tag tag, RecordVal* args);
|
||||
Analyzer* Find(const file_analysis::Tag& tag, RecordVal* args);
|
||||
|
||||
/**
|
||||
* Attach an analyzer to #file immediately.
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
* @param args an \c AnalyzerArgs value which specifies an analyzer.
|
||||
* @return true if analyzer was instantiated/attached, else false.
|
||||
*/
|
||||
bool Add(file_analysis::Tag tag, RecordVal* args);
|
||||
bool Add(const file_analysis::Tag& tag, RecordVal* args);
|
||||
|
||||
/**
|
||||
* Queue the attachment of an analyzer to #file.
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
* @return if successful, a pointer to a newly instantiated analyzer else
|
||||
* a null pointer. The caller does *not* take ownership of the memory.
|
||||
*/
|
||||
file_analysis::Analyzer* QueueAdd(file_analysis::Tag tag, RecordVal* args);
|
||||
file_analysis::Analyzer* QueueAdd(const file_analysis::Tag& tag, RecordVal* args);
|
||||
|
||||
/**
|
||||
* Remove an analyzer from #file immediately.
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
* @param args an \c AnalyzerArgs value which specifies an analyzer.
|
||||
* @return false if analyzer didn't exist and so wasn't removed, else true.
|
||||
*/
|
||||
bool Remove(file_analysis::Tag tag, RecordVal* args);
|
||||
bool Remove(const file_analysis::Tag& tag, RecordVal* args);
|
||||
|
||||
/**
|
||||
* Queue the removal of an analyzer from #file.
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
* @param args an \c AnalyzerArgs value which specifies an analyzer.
|
||||
* @return true if analyzer exists at time of call, else false;
|
||||
*/
|
||||
bool QueueRemove(file_analysis::Tag tag, RecordVal* args);
|
||||
bool QueueRemove(const file_analysis::Tag& tag, RecordVal* args);
|
||||
|
||||
/**
|
||||
* Perform all queued modifications to the current analyzer set.
|
||||
|
@ -107,7 +107,7 @@ protected:
|
|||
* @param args an \c AnalyzerArgs value which specifies an analyzer.
|
||||
* @return the hash key calculated from \a args
|
||||
*/
|
||||
HashKey* GetKey(file_analysis::Tag tag, RecordVal* args) const;
|
||||
HashKey* GetKey(const file_analysis::Tag& tag, RecordVal* args) const;
|
||||
|
||||
/**
|
||||
* Create an instance of a file analyzer.
|
||||
|
@ -115,7 +115,7 @@ protected:
|
|||
* @param args an \c AnalyzerArgs value which specifies an analyzer.
|
||||
* @return a new file analyzer instance.
|
||||
*/
|
||||
file_analysis::Analyzer* InstantiateAnalyzer(file_analysis::Tag tag,
|
||||
file_analysis::Analyzer* InstantiateAnalyzer(const file_analysis::Tag& tag,
|
||||
RecordVal* args) const;
|
||||
|
||||
/**
|
||||
|
@ -131,7 +131,7 @@ protected:
|
|||
* just used for debugging messages.
|
||||
* @param key the hash key which represents the analyzer's \c AnalyzerArgs.
|
||||
*/
|
||||
bool Remove(file_analysis::Tag tag, HashKey* key);
|
||||
bool Remove(const file_analysis::Tag& tag, HashKey* key);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -190,7 +190,7 @@ private:
|
|||
* @param arg_a an analyzer instance to add to an analyzer set.
|
||||
* @param arg_key hash key representing the analyzer's \c AnalyzerArgs.
|
||||
*/
|
||||
RemoveMod(file_analysis::Tag arg_tag, HashKey* arg_key)
|
||||
RemoveMod(const file_analysis::Tag& arg_tag, HashKey* arg_key)
|
||||
: Modification(), tag(arg_tag), key(arg_key) {}
|
||||
~RemoveMod() override {}
|
||||
bool Perform(AnalyzerSet* set) override;
|
||||
|
|
|
@ -100,7 +100,7 @@ void Manager::SetHandle(const string& handle)
|
|||
}
|
||||
|
||||
string Manager::DataIn(const u_char* data, uint64_t len, uint64_t offset,
|
||||
analyzer::Tag tag, Connection* conn, bool is_orig,
|
||||
const analyzer::Tag& tag, Connection* conn, bool is_orig,
|
||||
const string& precomputed_id, const string& mime_type)
|
||||
{
|
||||
string id = precomputed_id.empty() ? GetFileID(tag, conn, is_orig) : precomputed_id;
|
||||
|
@ -129,7 +129,7 @@ string Manager::DataIn(const u_char* data, uint64_t len, uint64_t offset,
|
|||
return id;
|
||||
}
|
||||
|
||||
string Manager::DataIn(const u_char* data, uint64_t len, analyzer::Tag tag,
|
||||
string Manager::DataIn(const u_char* data, uint64_t len, const analyzer::Tag& tag,
|
||||
Connection* conn, bool is_orig, const string& precomputed_id,
|
||||
const string& mime_type)
|
||||
{
|
||||
|
@ -170,13 +170,13 @@ void Manager::DataIn(const u_char* data, uint64_t len, const string& file_id,
|
|||
RemoveFile(file->GetID());
|
||||
}
|
||||
|
||||
void Manager::EndOfFile(analyzer::Tag tag, Connection* conn)
|
||||
void Manager::EndOfFile(const analyzer::Tag& tag, Connection* conn)
|
||||
{
|
||||
EndOfFile(tag, conn, true);
|
||||
EndOfFile(tag, conn, false);
|
||||
}
|
||||
|
||||
void Manager::EndOfFile(analyzer::Tag tag, Connection* conn, bool is_orig)
|
||||
void Manager::EndOfFile(const analyzer::Tag& tag, Connection* conn, bool is_orig)
|
||||
{
|
||||
// Don't need to create a file if we're just going to remove it right away.
|
||||
RemoveFile(GetFileID(tag, conn, is_orig));
|
||||
|
@ -187,7 +187,7 @@ void Manager::EndOfFile(const string& file_id)
|
|||
RemoveFile(file_id);
|
||||
}
|
||||
|
||||
string Manager::Gap(uint64_t offset, uint64_t len, analyzer::Tag tag,
|
||||
string Manager::Gap(uint64_t offset, uint64_t len, const analyzer::Tag& tag,
|
||||
Connection* conn, bool is_orig, const string& precomputed_id)
|
||||
{
|
||||
string id = precomputed_id.empty() ? GetFileID(tag, conn, is_orig) : precomputed_id;
|
||||
|
@ -200,7 +200,7 @@ string Manager::Gap(uint64_t offset, uint64_t len, analyzer::Tag tag,
|
|||
return id;
|
||||
}
|
||||
|
||||
string Manager::SetSize(uint64_t size, analyzer::Tag tag, Connection* conn,
|
||||
string Manager::SetSize(uint64_t size, const analyzer::Tag& tag, Connection* conn,
|
||||
bool is_orig, const string& precomputed_id)
|
||||
{
|
||||
string id = precomputed_id.empty() ? GetFileID(tag, conn, is_orig) : precomputed_id;
|
||||
|
@ -278,7 +278,7 @@ bool Manager::SetExtractionLimit(const string& file_id, RecordVal* args,
|
|||
return file->SetExtractionLimit(args, n);
|
||||
}
|
||||
|
||||
bool Manager::AddAnalyzer(const string& file_id, file_analysis::Tag tag,
|
||||
bool Manager::AddAnalyzer(const string& file_id, const file_analysis::Tag& tag,
|
||||
RecordVal* args) const
|
||||
{
|
||||
File* file = LookupFile(file_id);
|
||||
|
@ -289,7 +289,7 @@ bool Manager::AddAnalyzer(const string& file_id, file_analysis::Tag tag,
|
|||
return file->AddAnalyzer(tag, args);
|
||||
}
|
||||
|
||||
bool Manager::RemoveAnalyzer(const string& file_id, file_analysis::Tag tag,
|
||||
bool Manager::RemoveAnalyzer(const string& file_id, const file_analysis::Tag& tag,
|
||||
RecordVal* args) const
|
||||
{
|
||||
File* file = LookupFile(file_id);
|
||||
|
@ -301,7 +301,7 @@ bool Manager::RemoveAnalyzer(const string& file_id, file_analysis::Tag tag,
|
|||
}
|
||||
|
||||
File* Manager::GetFile(const string& file_id, Connection* conn,
|
||||
analyzer::Tag tag, bool is_orig, bool update_conn,
|
||||
const analyzer::Tag& tag, bool is_orig, bool update_conn,
|
||||
const char* source_name)
|
||||
{
|
||||
if ( file_id.empty() )
|
||||
|
@ -417,7 +417,7 @@ bool Manager::IsIgnored(const string& file_id)
|
|||
return ignored.find(file_id) != ignored.end();
|
||||
}
|
||||
|
||||
string Manager::GetFileID(analyzer::Tag tag, Connection* c, bool is_orig)
|
||||
string Manager::GetFileID(const analyzer::Tag& tag, Connection* c, bool is_orig)
|
||||
{
|
||||
current_file_id.clear();
|
||||
|
||||
|
@ -442,7 +442,7 @@ string Manager::GetFileID(analyzer::Tag tag, Connection* c, bool is_orig)
|
|||
return current_file_id;
|
||||
}
|
||||
|
||||
bool Manager::IsDisabled(analyzer::Tag tag)
|
||||
bool Manager::IsDisabled(const analyzer::Tag& tag)
|
||||
{
|
||||
if ( ! disabled )
|
||||
disabled = internal_const_val("Files::disable")->AsTableVal();
|
||||
|
@ -460,7 +460,7 @@ bool Manager::IsDisabled(analyzer::Tag tag)
|
|||
return rval;
|
||||
}
|
||||
|
||||
Analyzer* Manager::InstantiateAnalyzer(Tag tag, RecordVal* args, File* f) const
|
||||
Analyzer* Manager::InstantiateAnalyzer(const Tag& tag, RecordVal* args, File* f) const
|
||||
{
|
||||
Component* c = Lookup(tag);
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
* indicates the associate file is not going to be analyzed further.
|
||||
*/
|
||||
std::string DataIn(const u_char* data, uint64_t len, uint64_t offset,
|
||||
analyzer::Tag tag, Connection* conn, bool is_orig,
|
||||
const analyzer::Tag& tag, Connection* conn, bool is_orig,
|
||||
const std::string& precomputed_file_id = "",
|
||||
const std::string& mime_type = "");
|
||||
|
||||
|
@ -136,7 +136,7 @@ public:
|
|||
* the \c get_file_handle script-layer event). An empty string
|
||||
* indicates the associated file is not going to be analyzed further.
|
||||
*/
|
||||
std::string DataIn(const u_char* data, uint64_t len, analyzer::Tag tag,
|
||||
std::string DataIn(const u_char* data, uint64_t len, const analyzer::Tag& tag,
|
||||
Connection* conn, bool is_orig,
|
||||
const std::string& precomputed_file_id = "",
|
||||
const std::string& mime_type = "");
|
||||
|
@ -159,7 +159,7 @@ public:
|
|||
* @param tag network protocol over which the file data is transferred.
|
||||
* @param conn network connection over which the file data is transferred.
|
||||
*/
|
||||
void EndOfFile(analyzer::Tag tag, Connection* conn);
|
||||
void EndOfFile(const analyzer::Tag& tag, Connection* conn);
|
||||
|
||||
/**
|
||||
* Signal the end of file data being transferred over a connection in
|
||||
|
@ -167,7 +167,7 @@ public:
|
|||
* @param tag network protocol over which the file data is transferred.
|
||||
* @param conn network connection over which the file data is transferred.
|
||||
*/
|
||||
void EndOfFile(analyzer::Tag tag, Connection* conn, bool is_orig);
|
||||
void EndOfFile(const analyzer::Tag& tag, Connection* conn, bool is_orig);
|
||||
|
||||
/**
|
||||
* Signal the end of file data being transferred using the file identifier.
|
||||
|
@ -191,7 +191,7 @@ public:
|
|||
* the \c get_file_handle script-layer event). An empty string
|
||||
* indicates the associate file is not going to be analyzed further.
|
||||
*/
|
||||
std::string Gap(uint64_t offset, uint64_t len, analyzer::Tag tag,
|
||||
std::string Gap(uint64_t offset, uint64_t len, const analyzer::Tag& tag,
|
||||
Connection* conn, bool is_orig,
|
||||
const std::string& precomputed_file_id = "");
|
||||
|
||||
|
@ -210,7 +210,7 @@ public:
|
|||
* the \c get_file_handle script-layer event). An empty string
|
||||
* indicates the associate file is not going to be analyzed further.
|
||||
*/
|
||||
std::string SetSize(uint64_t size, analyzer::Tag tag, Connection* conn,
|
||||
std::string SetSize(uint64_t size, const analyzer::Tag& tag, Connection* conn,
|
||||
bool is_orig, const std::string& precomputed_file_id = "");
|
||||
|
||||
/**
|
||||
|
@ -276,7 +276,7 @@ public:
|
|||
* @param args a \c AnalyzerArgs value which describes a file analyzer.
|
||||
* @return false if the analyzer failed to be instantiated, else true.
|
||||
*/
|
||||
bool AddAnalyzer(const string& file_id, file_analysis::Tag tag,
|
||||
bool AddAnalyzer(const string& file_id, const file_analysis::Tag& tag,
|
||||
RecordVal* args) const;
|
||||
|
||||
/**
|
||||
|
@ -286,7 +286,7 @@ public:
|
|||
* @param args a \c AnalyzerArgs value which describes a file analyzer.
|
||||
* @return true if the analyzer is active at the time of call, else false.
|
||||
*/
|
||||
bool RemoveAnalyzer(const string& file_id, file_analysis::Tag tag,
|
||||
bool RemoveAnalyzer(const string& file_id, const file_analysis::Tag& tag,
|
||||
RecordVal* args) const;
|
||||
|
||||
/**
|
||||
|
@ -303,7 +303,7 @@ public:
|
|||
* @param f The file analzer is to be associated with.
|
||||
* @return The new analyzer instance or null if tag is invalid.
|
||||
*/
|
||||
Analyzer* InstantiateAnalyzer(Tag tag, RecordVal* args, File* f) const;
|
||||
Analyzer* InstantiateAnalyzer(const Tag& tag, RecordVal* args, File* f) const;
|
||||
|
||||
/**
|
||||
* Returns a set of all matching MIME magic signatures for a given
|
||||
|
@ -359,7 +359,7 @@ protected:
|
|||
* connection-related fields.
|
||||
*/
|
||||
File* GetFile(const string& file_id, Connection* conn = 0,
|
||||
analyzer::Tag tag = analyzer::Tag::Error,
|
||||
const analyzer::Tag& tag = analyzer::Tag::Error,
|
||||
bool is_orig = false, bool update_conn = true,
|
||||
const char* source_name = 0);
|
||||
|
||||
|
@ -390,7 +390,7 @@ protected:
|
|||
* @return #current_file_id, which is a hash of a unique file handle string
|
||||
* set by a \c get_file_handle event handler.
|
||||
*/
|
||||
std::string GetFileID(analyzer::Tag tag, Connection* c, bool is_orig);
|
||||
std::string GetFileID(const analyzer::Tag& tag, Connection* c, bool is_orig);
|
||||
|
||||
/**
|
||||
* Check if analysis is available for files transferred over a given
|
||||
|
@ -400,7 +400,7 @@ protected:
|
|||
* @return whether file analysis is disabled for the analyzer given by
|
||||
* \a tag.
|
||||
*/
|
||||
static bool IsDisabled(analyzer::Tag tag);
|
||||
static bool IsDisabled(const analyzer::Tag& tag);
|
||||
|
||||
private:
|
||||
typedef set<Tag> TagSet;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
using namespace file_analysis;
|
||||
|
||||
X509Common::X509Common(file_analysis::Tag arg_tag, RecordVal* arg_args, File* arg_file)
|
||||
X509Common::X509Common(const file_analysis::Tag& arg_tag, RecordVal* arg_args, File* arg_file)
|
||||
: file_analysis::Analyzer(arg_tag, arg_args, arg_file)
|
||||
{
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ void file_analysis::X509Common::ParseSignedCertificateTimestamps(X509_EXTENSION*
|
|||
delete conn;
|
||||
}
|
||||
|
||||
void file_analysis::X509Common::ParseExtension(X509_EXTENSION* ex, EventHandlerPtr h, bool global)
|
||||
void file_analysis::X509Common::ParseExtension(X509_EXTENSION* ex, const EventHandlerPtr& h, bool global)
|
||||
{
|
||||
char name[256];
|
||||
char oid[256];
|
||||
|
|
|
@ -35,9 +35,9 @@ public:
|
|||
static double GetTimeFromAsn1(const ASN1_TIME* atime, File* f, Reporter* reporter);
|
||||
|
||||
protected:
|
||||
X509Common(file_analysis::Tag arg_tag, RecordVal* arg_args, File* arg_file);
|
||||
X509Common(const file_analysis::Tag& arg_tag, RecordVal* arg_args, File* arg_file);
|
||||
|
||||
void ParseExtension(X509_EXTENSION* ex, EventHandlerPtr h, bool global);
|
||||
void ParseExtension(X509_EXTENSION* ex, const EventHandlerPtr& h, bool global);
|
||||
void ParseSignedCertificateTimestamps(X509_EXTENSION* ext);
|
||||
virtual void ParseExtensionsSpecific(X509_EXTENSION* ex, bool, ASN1_OBJECT*, const char*) = 0;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue