mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Fix a few compiler warnings from MSVC
This commit is contained in:
parent
6bf469b7a8
commit
2e457eb3ea
6 changed files with 20 additions and 21 deletions
10
src/util.cc
10
src/util.cc
|
@ -1128,9 +1128,9 @@ TEST_CASE("util streq")
|
|||
CHECK(streq("abcd", "efgh") == false);
|
||||
}
|
||||
|
||||
int streq(const char* s1, const char* s2)
|
||||
bool streq(const char* s1, const char* s2)
|
||||
{
|
||||
return ! strcmp(s1, s2);
|
||||
return strcmp(s1, s2) == 0;
|
||||
}
|
||||
|
||||
bool starts_with(std::string_view s, std::string_view beginning)
|
||||
|
@ -2282,8 +2282,8 @@ const void* memory_align(const void* ptr, size_t size)
|
|||
|
||||
const char* buf = reinterpret_cast<const char*>(ptr);
|
||||
size_t mask = size - 1; // Assume size is a power of 2.
|
||||
unsigned long l_ptr = reinterpret_cast<unsigned long>(ptr);
|
||||
unsigned long offset = l_ptr & mask;
|
||||
intptr_t l_ptr = reinterpret_cast<intptr_t>(ptr);
|
||||
ptrdiff_t offset = l_ptr & mask;
|
||||
|
||||
if ( offset > 0 )
|
||||
return reinterpret_cast<const void*>(buf - offset + size);
|
||||
|
@ -2322,7 +2322,7 @@ void* memory_align_and_pad(void* ptr, size_t size)
|
|||
|
||||
char* buf = reinterpret_cast<char*>(ptr);
|
||||
size_t mask = size - 1;
|
||||
while ( (reinterpret_cast<unsigned long>(buf) & mask) != 0 )
|
||||
while ( (reinterpret_cast<intptr_t>(buf) & mask) != 0 )
|
||||
// Not aligned - zero pad.
|
||||
*buf++ = '\0';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue