Skip to content

Commit

Permalink
treewide: fix up gsl incompatibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
catern committed Sep 23, 2021
1 parent 1f0515c commit e6608eb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions include/iqueue.hh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct iqueue_const_iterator
reference operator*() const {
std::size_t size = 0;
void const* ptr = iqueue_data(_iqueue, _id, &size);
_current = {static_cast<gsl::byte const*>(ptr), static_cast<decltype(_current)::index_type>(size)};
_current = {static_cast<gsl::byte const*>(ptr), static_cast<size_t>(size)};
return _current;
}

Expand Down Expand Up @@ -380,7 +380,7 @@ struct iqueue
gsl::span<gsl::byte const> header() const {
std::size_t size = 0;
auto data = iqueue_header(_iqueue, &size);
return {reinterpret_cast<gsl::byte const *>(data), static_cast<decltype(header())::index_type>(size)};
return {reinterpret_cast<gsl::byte const *>(data), static_cast<size_t>(size)};
}

// Returns the file name of the iqueue.
Expand Down
2 changes: 1 addition & 1 deletion src/dump_iqueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int main(int argc, char **argv) {
warnx("Message is unrealistically huge. Truncating to 4096.");
msg = { msg.data(), 4096 };
}
ssize_t written = try_(write(opt.outfd, reinterpret_cast<char const*>(msg.data()), msg.size()));
size_t written = try_(write(opt.outfd, reinterpret_cast<char const*>(msg.data()), msg.size()));
if (written != msg.size()) {
warnx("Partial write? Did I get called with a non-packetized pipe?");
exit(1);
Expand Down
2 changes: 1 addition & 1 deletion src/in2iqueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ gsl::span<gsl::byte> read_fd(int fd) {
static gsl::byte buf[4096];
int ret = try_(read(fd, buf, sizeof(buf)));
if (ret == 0) exit(0);
return { buf, static_cast<ssize_t>(ret) };
return { buf, static_cast<decltype(read_fd(0))::size_type>(ret) };
}

void fd2iqueue(int fd, ts::mmia::cpputils::iqueue& iq) {
Expand Down
2 changes: 1 addition & 1 deletion src/iqueue2out.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void iqueue2fd(ts::mmia::cpputils::iqueue& iq, int fd) {
warnx("Message is unrealistically huge. Truncating to 4096.");
msg = { msg.data(), 4096 };
}
ssize_t written = try_(write(fd, reinterpret_cast<char const*>(msg.data()), msg.size()));
size_t written = try_(write(fd, reinterpret_cast<char const*>(msg.data()), msg.size()));
if (written != msg.size()) {
warnx("Partial write? Did I get called with a non-packetized pipe?");
exit(1);
Expand Down

0 comments on commit e6608eb

Please sign in to comment.