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
6 changes: 3 additions & 3 deletions iocore/eventsystem/unit_tests/test_MIOBufferWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ struct MIOBuffer {
#include "MIOBufferWriter.cc"

IOBufferBlock iobb[1];
int iobbIdx{0};
unsigned int iobbIdx{0};

const int BlockSize = 11 * 11;
const unsigned int BlockSize = 11 * 11;
char block[BlockSize];
int blockUsed{0};
unsigned int blockUsed{0};

std::int64_t
IOBufferBlock::write_avail()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ TEST_CASE("content_range to/from string - valid", "[AWS][slice][utility]")
bool const strstat(exprange.toStringClosed(gotbuf, &gotlen));

CHECK(strstat);
CHECK(gotlen == expstr.size());
CHECK(gotlen == static_cast<int>(expstr.size()));
CHECK(expstr == std::string(gotbuf));

ContentRange gotrange;
Expand Down
6 changes: 3 additions & 3 deletions proxy/http2/unit_tests/test_Http2Frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ TEST_CASE("Http2Frame", "[http2][Http2Frame]")
uint8_t hdr_block_len = sizeof(hdr_block);

Http2PushPromiseFrame frame(id, flags, pp, hdr_block, hdr_block_len);
uint64_t written = frame.write_to(miob);
int64_t written = frame.write_to(miob);

CHECK(written == HTTP2_FRAME_HEADER_LEN + sizeof(Http2StreamId) + hdr_block_len);
CHECK(written == static_cast<int64_t>(HTTP2_FRAME_HEADER_LEN + sizeof(Http2StreamId) + hdr_block_len));
CHECK(written == miob_r->read_avail());

uint8_t buf[32] = {0};
uint64_t read = miob_r->read(buf, written);
int64_t read = miob_r->read(buf, written);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick question on this on this looked odd. should miob_r->read(buf, written); return an unsigned?

or does it return a signed so you are changing uint64_t to init64_t to avoid a warning?

Copy link
Contributor

@dragon512 dragon512 Feb 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might have found the answer... it looks like we are having lots of size_t values as return values.. so you are getting a lot of these issues

unit_tests/test_Http2Frame.cc:44:19: error: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'size_t' {aka 'long unsigned int'} [-Werror=sign-compare]
     CHECK(written == HTTP2_FRAME_HEADER_LEN + sizeof(Http2StreamId) + hdr_block_len);

Makes me wish we had a std::length_t type to deal with this as size_t is not really the correct type.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The answer is use ssize_t.

CHECK(read == written);

uint8_t expected[] = {
Expand Down
4 changes: 2 additions & 2 deletions proxy/logging/unit-tests/test_LogUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ test(const MIMEField *pairs, int numPairs, const char *asciiResult, int extraUnm

int binAlignSize = marshalMimeHdr(numPairs ? &hdr : nullptr, nullptr);

REQUIRE(binAlignSize < sizeof(binBuf));
REQUIRE(binAlignSize < static_cast<int>(sizeof(binBuf)));

hdr.reset();

Expand All @@ -72,7 +72,7 @@ test(const MIMEField *pairs, int numPairs, const char *asciiResult, int extraUnm

char *bp = binBuf;

int asciiSize = unmarshalMimeHdr(&bp, asciiBuf, std::strlen(asciiResult) + extraUnmarshalSpace);
unsigned int asciiSize = unmarshalMimeHdr(&bp, asciiBuf, std::strlen(asciiResult) + extraUnmarshalSpace);

REQUIRE(asciiSize == std::strlen(asciiResult));

Expand Down
2 changes: 1 addition & 1 deletion src/tscore/unit_tests/test_Errata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ TEST_CASE("Basic Errata test with id,code and text", "[errata]")
{
ts::Errata err;
int id{1};
int code{2};
unsigned int code{2};
std::string text{"Some error text"};

err.push(id, code, text);
Expand Down
2 changes: 1 addition & 1 deletion src/tscore/unit_tests/test_IntrusiveHashMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ TEST_CASE("IntrusiveHashMap", "[libts][IntrusiveHashMap]")

size_t nb = map.bucket_count();
std::bitset<64> marks;
for (int i = 1; i <= 63; ++i) {
for (unsigned int i = 1; i <= 63; ++i) {
std::string name;
ts::bwprint(name, "{} squared is {}", i, i * i);
Thing *thing = new Thing(name);
Expand Down
892 changes: 588 additions & 304 deletions tests/include/catch.hpp

Large diffs are not rendered by default.