mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Fix clang-tidy bugprone-implicit-widening-of-multiplication-result warnings
This commit is contained in:
parent
bdb0fad6d5
commit
18983aed02
6 changed files with 10 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
|||
Checks: [-*,
|
||||
bugprone-assignment-in-if-condition,
|
||||
bugprone-branch-clone,
|
||||
bugprone-implicit-widening-of-multiplication-result,
|
||||
]
|
||||
|
|
|
@ -187,9 +187,9 @@ public:
|
|||
|
||||
SWNode* operator()(int row, int col) {
|
||||
// Make sure access is in allowed range.
|
||||
if ( row < 0 || row >= _rows )
|
||||
if ( row < 0 || static_cast<size_t>(row) >= _rows )
|
||||
return nullptr;
|
||||
if ( col < 0 || col >= _cols )
|
||||
if ( col < 0 || static_cast<size_t>(col) >= _cols )
|
||||
return nullptr;
|
||||
|
||||
return &(_nodes[row * _cols + col]);
|
||||
|
@ -215,7 +215,7 @@ private:
|
|||
const String* _s1;
|
||||
const String* _s2;
|
||||
|
||||
int _rows, _cols;
|
||||
size_t _rows, _cols;
|
||||
SWNode* _nodes;
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace zeek {
|
||||
|
||||
constexpr int UID_LEN = 2;
|
||||
constexpr size_t UID_LEN = 2;
|
||||
|
||||
/**
|
||||
* A class for creating/managing UIDs of arbitrary bit-length and converting
|
||||
|
|
|
@ -128,8 +128,8 @@ double X509Common::GetTimeFromAsn1(const ASN1_TIME* atime, file_analysis::File*
|
|||
return 0;
|
||||
}
|
||||
|
||||
lSecondsFromUTC = ((pString[1] - '0') * 10 + (pString[2] - '0')) * 60;
|
||||
lSecondsFromUTC += (pString[3] - '0') * 10 + (pString[4] - '0');
|
||||
lSecondsFromUTC = static_cast<time_t>((pString[1] - '0') * 10) + static_cast<time_t>((pString[2] - '0') * 60);
|
||||
lSecondsFromUTC += static_cast<time_t>((pString[3] - '0') * 10) + (pString[4] - '0');
|
||||
|
||||
if ( *pString == '-' )
|
||||
lSecondsFromUTC = -lSecondsFromUTC;
|
||||
|
|
|
@ -60,7 +60,7 @@ ARPAnalyzer::ARPAnalyzer() : zeek::packet_analysis::Analyzer("ARP") {}
|
|||
#endif
|
||||
|
||||
#ifndef ar_tpa
|
||||
#define ar_tpa(ap) ((caddr_t((ap) + 1)) + 2 * (ap)->ar_hln + (ap)->ar_pln)
|
||||
#define ar_tpa(ap) ((caddr_t((ap) + 1)) + 2 * static_cast<size_t>((ap)->ar_hln) + (ap)->ar_pln)
|
||||
#endif
|
||||
|
||||
#ifndef ARPOP_REVREQUEST
|
||||
|
|
|
@ -299,7 +299,7 @@ static zeek::RecordValPtr build_syn_packet_val(bool is_orig, const zeek::IP_Hdr*
|
|||
|
||||
// Parse TCP options.
|
||||
u_char* options = (u_char*)tcp + sizeof(struct tcphdr);
|
||||
u_char* opt_end = (u_char*)tcp + tcp->th_off * 4;
|
||||
u_char* opt_end = (u_char*)tcp + static_cast<ptrdiff_t>(tcp->th_off * 4);
|
||||
|
||||
while ( options < opt_end ) {
|
||||
unsigned int opt = options[0];
|
||||
|
@ -1462,7 +1462,7 @@ void TCPSessionAdapter::SynWeirds(analyzer::tcp::TCP_Flags flags, analyzer::tcp:
|
|||
int TCPSessionAdapter::ParseTCPOptions(const struct tcphdr* tcp, bool is_orig) {
|
||||
// Parse TCP options.
|
||||
const u_char* options = (const u_char*)tcp + sizeof(struct tcphdr);
|
||||
const u_char* opt_end = (const u_char*)tcp + tcp->th_off * 4;
|
||||
const u_char* opt_end = (const u_char*)tcp + static_cast<ptrdiff_t>(tcp->th_off * 4);
|
||||
std::vector<const u_char*> opts;
|
||||
|
||||
while ( options < opt_end ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue