mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
Deprecate the internal int/uint types in favor of the cstdint types they were based on
This commit is contained in:
parent
18e4976c6c
commit
54752ef9a1
218 changed files with 1331 additions and 1323 deletions
|
@ -491,10 +491,10 @@ BitVector::size_type BitVector::FindNext(size_type i) const
|
|||
return block ? bi * bits_per_block + lowest_bit(block) : find_from(bi + 1);
|
||||
}
|
||||
|
||||
uint64 BitVector::Hash() const
|
||||
uint64_t BitVector::Hash() const
|
||||
{
|
||||
u_char buf[SHA256_DIGEST_LENGTH];
|
||||
uint64 digest;
|
||||
uint64_t digest;
|
||||
EVP_MD_CTX* ctx = hash_init(Hash_SHA256);
|
||||
|
||||
for ( size_type i = 0; i < Blocks(); ++i )
|
||||
|
@ -507,11 +507,11 @@ uint64 BitVector::Hash() const
|
|||
|
||||
broker::expected<broker::data> BitVector::Serialize() const
|
||||
{
|
||||
broker::vector v = {static_cast<uint64>(num_bits), static_cast<uint64>(bits.size())};
|
||||
broker::vector v = {static_cast<uint64_t>(num_bits), static_cast<uint64_t>(bits.size())};
|
||||
v.reserve(2 + bits.size());
|
||||
|
||||
for ( size_t i = 0; i < bits.size(); ++i )
|
||||
v.emplace_back(static_cast<uint64>(bits[i]));
|
||||
v.emplace_back(static_cast<uint64_t>(bits[i]));
|
||||
|
||||
return {std::move(v)};
|
||||
}
|
||||
|
@ -522,8 +522,8 @@ std::unique_ptr<BitVector> BitVector::Unserialize(const broker::data& data)
|
|||
if ( ! (v && v->size() >= 2) )
|
||||
return nullptr;
|
||||
|
||||
auto num_bits = caf::get_if<uint64>(&(*v)[0]);
|
||||
auto size = caf::get_if<uint64>(&(*v)[1]);
|
||||
auto num_bits = caf::get_if<uint64_t>(&(*v)[0]);
|
||||
auto size = caf::get_if<uint64_t>(&(*v)[1]);
|
||||
|
||||
if ( ! (num_bits && size) )
|
||||
return nullptr;
|
||||
|
@ -536,7 +536,7 @@ std::unique_ptr<BitVector> BitVector::Unserialize(const broker::data& data)
|
|||
|
||||
for ( size_t i = 0; i < *size; ++i )
|
||||
{
|
||||
auto x = caf::get_if<uint64>(&(*v)[2 + i]);
|
||||
auto x = caf::get_if<uint64_t>(&(*v)[2 + i]);
|
||||
if ( ! x )
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ broker::expected<broker::data> BloomFilter::Serialize() const
|
|||
if ( ! d )
|
||||
return broker::ec::invalid_data; // Cannot serialize
|
||||
|
||||
return {broker::vector{static_cast<uint64>(Type()), std::move(*h), std::move(*d)}};
|
||||
return {broker::vector{static_cast<uint64_t>(Type()), std::move(*h), std::move(*d)}};
|
||||
}
|
||||
|
||||
std::unique_ptr<BloomFilter> BloomFilter::Unserialize(const broker::data& data)
|
||||
|
@ -52,7 +52,7 @@ std::unique_ptr<BloomFilter> BloomFilter::Unserialize(const broker::data& data)
|
|||
if ( ! (v && v->size() == 3) )
|
||||
return nullptr;
|
||||
|
||||
auto type = caf::get_if<uint64>(&(*v)[0]);
|
||||
auto type = caf::get_if<uint64_t>(&(*v)[0]);
|
||||
if ( ! type )
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ CardinalityCounter::CardinalityCounter(CardinalityCounter&& o)
|
|||
CardinalityCounter::CardinalityCounter(double error_margin, double confidence)
|
||||
{
|
||||
int b = OptimalB(error_margin, confidence);
|
||||
Init((uint64) pow(2, b));
|
||||
Init((uint64_t) pow(2, b));
|
||||
|
||||
assert(b == p);
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ broker::expected<broker::data> CardinalityCounter::Serialize() const
|
|||
v.reserve(3 + m);
|
||||
|
||||
for ( size_t i = 0; i < m; ++i )
|
||||
v.emplace_back(static_cast<uint64>(buckets[i]));
|
||||
v.emplace_back(static_cast<uint64_t>(buckets[i]));
|
||||
|
||||
return {std::move(v)};
|
||||
}
|
||||
|
@ -213,8 +213,8 @@ std::unique_ptr<CardinalityCounter> CardinalityCounter::Unserialize(const broker
|
|||
if ( ! (v && v->size() >= 3) )
|
||||
return nullptr;
|
||||
|
||||
auto m = caf::get_if<uint64>(&(*v)[0]);
|
||||
auto V = caf::get_if<uint64>(&(*v)[1]);
|
||||
auto m = caf::get_if<uint64_t>(&(*v)[0]);
|
||||
auto V = caf::get_if<uint64_t>(&(*v)[1]);
|
||||
auto alpha_m = caf::get_if<double>(&(*v)[2]);
|
||||
|
||||
if ( ! (m && V && alpha_m) )
|
||||
|
@ -230,7 +230,7 @@ std::unique_ptr<CardinalityCounter> CardinalityCounter::Unserialize(const broker
|
|||
|
||||
for ( size_t i = 0; i < *m; ++i )
|
||||
{
|
||||
auto x = caf::get_if<uint64>(&(*v)[3 + i]);
|
||||
auto x = caf::get_if<uint64_t>(&(*v)[3 + i]);
|
||||
if ( ! x )
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ broker::expected<broker::data> CounterVector::Serialize() const
|
|||
if ( ! b )
|
||||
return broker::ec::invalid_data; // Cannot serialize
|
||||
|
||||
return {broker::vector{static_cast<uint64>(width), std::move(*b)}};
|
||||
return {broker::vector{static_cast<uint64_t>(width), std::move(*b)}};
|
||||
}
|
||||
|
||||
std::unique_ptr<CounterVector> CounterVector::Unserialize(const broker::data& data)
|
||||
|
@ -176,7 +176,7 @@ std::unique_ptr<CounterVector> CounterVector::Unserialize(const broker::data& da
|
|||
if ( ! (v && v->size() >= 2) )
|
||||
return nullptr;
|
||||
|
||||
auto width = caf::get_if<uint64>(&(*v)[0]);
|
||||
auto width = caf::get_if<uint64_t>(&(*v)[0]);
|
||||
auto bits = BitVector::Unserialize((*v)[1]);
|
||||
|
||||
if ( ! (width && bits) )
|
||||
|
|
|
@ -49,7 +49,7 @@ Hasher::Hasher(size_t arg_k, seed_t arg_seed)
|
|||
broker::expected<broker::data> Hasher::Serialize() const
|
||||
{
|
||||
return {broker::vector{
|
||||
static_cast<uint64>(Type()), static_cast<uint64>(k),
|
||||
static_cast<uint64_t>(Type()), static_cast<uint64_t>(k),
|
||||
seed.h1, seed.h2 }};
|
||||
}
|
||||
|
||||
|
@ -60,10 +60,10 @@ std::unique_ptr<Hasher> Hasher::Unserialize(const broker::data& data)
|
|||
if ( ! (v && v->size() == 4) )
|
||||
return nullptr;
|
||||
|
||||
auto type = caf::get_if<uint64>(&(*v)[0]);
|
||||
auto k = caf::get_if<uint64>(&(*v)[1]);
|
||||
auto h1 = caf::get_if<uint64>(&(*v)[2]);
|
||||
auto h2 = caf::get_if<uint64>(&(*v)[3]);
|
||||
auto type = caf::get_if<uint64_t>(&(*v)[0]);
|
||||
auto k = caf::get_if<uint64_t>(&(*v)[1]);
|
||||
auto h1 = caf::get_if<uint64_t>(&(*v)[2]);
|
||||
auto h2 = caf::get_if<uint64_t>(&(*v)[3]);
|
||||
|
||||
if ( ! (type && k && h1 && h2) )
|
||||
return nullptr;
|
||||
|
|
|
@ -38,7 +38,7 @@ HashKey* TopkVal::GetHash(Val* v) const
|
|||
return key;
|
||||
}
|
||||
|
||||
TopkVal::TopkVal(uint64 arg_size) : OpaqueVal(topk_type)
|
||||
TopkVal::TopkVal(uint64_t arg_size) : OpaqueVal(topk_type)
|
||||
{
|
||||
elementDict = new PDict<Element>;
|
||||
elementDict->SetDeleteFunc(topk_element_hash_delete_func);
|
||||
|
@ -364,7 +364,7 @@ void TopkVal::Encountered(Val* encountered)
|
|||
void TopkVal::IncrementCounter(Element* e, unsigned int count)
|
||||
{
|
||||
Bucket* currBucket = e->parent;
|
||||
uint64 currcount = currBucket->count;
|
||||
uint64_t currcount = currBucket->count;
|
||||
|
||||
// well, let's test if there is a bucket for currcount++
|
||||
std::list<Bucket*>::iterator bucketIter = currBucket->bucketPos;
|
||||
|
@ -432,7 +432,7 @@ broker::expected<broker::data> TopkVal::DoSerialize() const
|
|||
Bucket* b = *it;
|
||||
uint32_t elements_count = b->elements.size();
|
||||
|
||||
d.emplace_back(static_cast<uint64>(b->elements.size()));
|
||||
d.emplace_back(static_cast<uint64_t>(b->elements.size()));
|
||||
d.emplace_back(b->count);
|
||||
|
||||
std::list<Element*>::const_iterator eit = b->elements.begin();
|
||||
|
@ -465,8 +465,8 @@ bool TopkVal::DoUnserialize(const broker::data& data)
|
|||
if ( ! (v && v->size() >= 4) )
|
||||
return false;
|
||||
|
||||
auto size_ = caf::get_if<uint64>(&(*v)[0]);
|
||||
auto numElements_ = caf::get_if<uint64>(&(*v)[1]);
|
||||
auto size_ = caf::get_if<uint64_t>(&(*v)[0]);
|
||||
auto numElements_ = caf::get_if<uint64_t>(&(*v)[1]);
|
||||
auto pruned_ = caf::get_if<bool>(&(*v)[2]);
|
||||
|
||||
if ( ! (size_ && numElements_ && pruned_) )
|
||||
|
@ -492,8 +492,8 @@ bool TopkVal::DoUnserialize(const broker::data& data)
|
|||
|
||||
while ( i < numElements )
|
||||
{
|
||||
auto elements_count = caf::get_if<uint64>(&(*v)[idx++]);
|
||||
auto count = caf::get_if<uint64>(&(*v)[idx++]);
|
||||
auto elements_count = caf::get_if<uint64_t>(&(*v)[idx++]);
|
||||
auto count = caf::get_if<uint64_t>(&(*v)[idx++]);
|
||||
|
||||
if ( ! (elements_count && count) )
|
||||
return false;
|
||||
|
@ -504,7 +504,7 @@ bool TopkVal::DoUnserialize(const broker::data& data)
|
|||
|
||||
for ( uint64_t j = 0; j < *elements_count; j++ )
|
||||
{
|
||||
auto epsilon = caf::get_if<uint64>(&(*v)[idx++]);
|
||||
auto epsilon = caf::get_if<uint64_t>(&(*v)[idx++]);
|
||||
Val* val = bro_broker::data_to_val((*v)[idx++], type);
|
||||
|
||||
if ( ! (epsilon && val) )
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace probabilistic {
|
|||
struct Element;
|
||||
|
||||
struct Bucket {
|
||||
uint64 count;
|
||||
uint64_t count;
|
||||
std::list<Element*> elements;
|
||||
|
||||
// Iterators only get invalidated for removed elements. This one
|
||||
|
@ -26,7 +26,7 @@ struct Bucket {
|
|||
};
|
||||
|
||||
struct Element {
|
||||
uint64 epsilon;
|
||||
uint64_t epsilon;
|
||||
Val* value;
|
||||
Bucket* parent;
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
*
|
||||
* @return A newly initialized TopkVal
|
||||
*/
|
||||
explicit TopkVal(uint64 size);
|
||||
explicit TopkVal(uint64_t size);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
|
@ -167,8 +167,8 @@ private:
|
|||
CompositeHash* hash;
|
||||
std::list<Bucket*> buckets;
|
||||
PDict<Element>* elementDict;
|
||||
uint64 size; // how many elements are we tracking?
|
||||
uint64 numElements; // how many elements do we have at the moment
|
||||
uint64_t size; // how many elements are we tracking?
|
||||
uint64_t numElements; // how many elements do we have at the moment
|
||||
bool pruned; // was this data structure pruned?
|
||||
};
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ function bloomfilter_counting_init%(k: count, cells: count, max: count,
|
|||
|
||||
const Hasher* h = new DefaultHasher(k, seed);
|
||||
|
||||
uint16 width = 1;
|
||||
uint16_t width = 1;
|
||||
while ( max >>= 1 )
|
||||
++width;
|
||||
|
||||
|
@ -180,7 +180,7 @@ function bloomfilter_lookup%(bf: opaque of bloomfilter, x: any%): count
|
|||
reporter->Error("incompatible Bloom filter types");
|
||||
|
||||
else
|
||||
return val_mgr->GetCount(static_cast<uint64>(bfv->Count(x)));
|
||||
return val_mgr->GetCount(static_cast<uint64_t>(bfv->Count(x)));
|
||||
|
||||
return val_mgr->GetCount(0);
|
||||
%}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue