Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CacheDigest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ CacheDigest::CacheDigest(uint64_t aCapacity, uint8_t bpe) :
mask_size(0),
bits_per_entry(bpe)
{
assert(SQUID_MD5_DIGEST_LENGTH == 16); /* our hash functions rely on 16 byte keys */
static_assert(SQUID_MD5_DIGEST_LENGTH == 16); /* our hash functions rely on 16 byte keys */
updateCapacity(aCapacity);
}

Expand Down
2 changes: 1 addition & 1 deletion src/DiskIO/DiskThreads/aiops_win32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ squidaio_init(void)
/* Create threads and get them to sit in their wait loop */
squidaio_thread_pool = memPoolCreate("aio_thread", sizeof(squidaio_thread_t));

assert(NUMTHREADS > 0);
static_assert(NUMTHREADS > 0);

for (i = 0; i < NUMTHREADS; ++i) {
threadp = (squidaio_thread_t *)squidaio_thread_pool->alloc();
Expand Down
2 changes: 1 addition & 1 deletion src/HttpHeader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void
httpHeaderInitModule(void)
{
/* check that we have enough space for masks */
assert(8 * sizeof(HttpHeaderMask) >= Http::HdrType::enumEnd_);
static_assert(8 * sizeof(HttpHeaderMask) >= Http::HdrType::enumEnd_);

// masks are needed for stats page still
for (auto h : WholeEnum<Http::HdrType>()) {
Expand Down
2 changes: 1 addition & 1 deletion src/fs/rock/RockRebuild.cc
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ Rock::Rebuild::start()
failure("cannot read db header", errno);

// slot prefix of SM_PAGE_SIZE should fit both core entry header and ours
assert(sizeof(DbCellHeader) < SM_PAGE_SIZE);
static_assert(sizeof(DbCellHeader) < SM_PAGE_SIZE);
buf.init(SM_PAGE_SIZE, SM_PAGE_SIZE);

dbOffset = SwapDir::HeaderSize + loadingPos * dbSlotSize;
Expand Down
3 changes: 1 addition & 2 deletions src/fs/rock/RockSwapDir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ int64_t
Rock::SwapDir::slotLimitAbsolute() const
{
// the max value is an invalid one; all values must be below the limit
assert(std::numeric_limits<Ipc::StoreMapSliceId>::max() ==
std::numeric_limits<SlotId>::max());
static_assert(std::numeric_limits<Ipc::StoreMapSliceId>::max() == std::numeric_limits<SlotId>::max());
return std::numeric_limits<SlotId>::max();
}

Expand Down
2 changes: 1 addition & 1 deletion src/htcp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ htcpBuildAuth(char *buf, size_t buflen)
{
htcpAuthHeader auth;
size_t copy_sz = 0;
assert(2 == sizeof(uint16_t));
static_assert(sizeof(uint16_t) == 2);
auth.length = htons(2);
copy_sz += 2;
if (buflen < copy_sz)
Expand Down
4 changes: 2 additions & 2 deletions src/security/Session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ initializeSessionCache()
{
// Check if the MemMap keys and data are enough big to hold
// session ids and session data
assert(SSL_SESSION_ID_SIZE >= MEMMAP_SLOT_KEY_SIZE);
assert(SSL_SESSION_MAX_SIZE >= MEMMAP_SLOT_DATA_SIZE);
static_assert(SSL_SESSION_ID_SIZE >= MEMMAP_SLOT_KEY_SIZE);
static_assert(SSL_SESSION_MAX_SIZE >= MEMMAP_SLOT_DATA_SIZE);

int configuredItems = ::Config.SSL.sessionCacheSize / sizeof(Ipc::MemMap::Slot);
if (IamWorkerProcess() && configuredItems)
Expand Down
4 changes: 2 additions & 2 deletions src/stat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ GetAvgStat(Mgr::IntervalActionData& stats, int minutes, int hours)
StatCounters *l;
double dt;
double ct;
assert(N_COUNT_HIST > 1);
static_assert(N_COUNT_HIST > 1);
assert(minutes > 0 || hours > 0);
f = &CountHist[0];
l = f;
Expand Down Expand Up @@ -1688,7 +1688,7 @@ bool
statSawRecentRequests()
{
const auto recentMinutes = 5;
assert(N_COUNT_HIST > recentMinutes);
static_assert(N_COUNT_HIST > recentMinutes);

// Math below computes the number of requests during the last 0-6 minutes.
// CountHist is based on "minutes passed since Squid start" periods. It cannot
Expand Down
2 changes: 1 addition & 1 deletion src/store_key_md5.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ storeKeyPrivate()
pid_t pid;
int32_t kid;
} key = { 0, getpid(), KidIdentifier };
assert(sizeof(key) == SQUID_MD5_DIGEST_LENGTH);
static_assert(sizeof(key) == SQUID_MD5_DIGEST_LENGTH);
++key.count;
return reinterpret_cast<cache_key*>(&key);
}
Expand Down
2 changes: 1 addition & 1 deletion test-suite/mem_node_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main(int, char *[])
* the store will never trim memory
*/
assert (mem_node::InUseCount() == 1);
assert (SM_PAGE_SIZE > 50);
static_assert(SM_PAGE_SIZE > 50);
aNode->nodeBuffer.length = 45;
assert (aNode->start() == 0);
assert (aNode->end() == 45);
Expand Down
Loading