diff --git a/snappy.cc b/snappy.cc index 6fe5f34..b072e5d 100644 --- a/snappy.cc +++ b/snappy.cc @@ -2041,7 +2041,7 @@ size_t CompressFromIOVec(const struct iovec* iov, size_t iov_cnt, std::string* compressed) { // Compute the number of bytes to be compressed. size_t uncompressed_length = 0; - for (int i = 0; i < iov_cnt; ++i) { + for (size_t i = 0; i < iov_cnt; ++i) { uncompressed_length += iov[i].iov_len; } diff --git a/snappy_benchmark.cc b/snappy_benchmark.cc index 0590142..28570dd 100644 --- a/snappy_benchmark.cc +++ b/snappy_benchmark.cc @@ -164,7 +164,7 @@ void BM_UIOVecSource(benchmark::State& state) { struct iovec iov[kNumEntries]; size_t used_so_far = 0; for (int i = 0; i < kNumEntries; ++i) { - iov[i].iov_base = contents.data() + used_so_far; + iov[i].iov_base = const_cast(contents.data()) + used_so_far; if (used_so_far == contents.size()) { iov[i].iov_len = 0; continue; diff --git a/snappy_unittest.cc b/snappy_unittest.cc index aeb8044..122be0c 100644 --- a/snappy_unittest.cc +++ b/snappy_unittest.cc @@ -170,7 +170,7 @@ struct iovec* GetIOVec(const std::string& input, char*& buf, size_t& num) { int VerifyIOVecSource(const std::string& input) { std::string compressed; std::string copy = input; - char* buf = copy.data(); + char* buf = const_cast(copy.data()); size_t num = 0; struct iovec* iov = GetIOVec(input, buf, num); const size_t written = snappy::CompressFromIOVec(iov, num, &compressed);