]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Don’t use ssize_t
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 25 Jul 2021 14:20:21 +0000 (16:20 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 25 Jul 2021 14:24:39 +0000 (16:24 +0200)
It’s not portable to Windows.

src/Result.cpp
src/Util.cpp

index 99bf34febcd22257b09e419da123d13a0f1d68d6..202ce820cbf7119d4229a171fc788b21d72d4e9b 100644 (file)
@@ -424,7 +424,7 @@ Result::Writer::write_embedded_file_entry(CacheEntryWriter& writer,
   while (remain > 0) {
     uint8_t buf[CCACHE_READ_BUFFER_SIZE];
     size_t n = std::min(remain, static_cast<uint64_t>(sizeof(buf)));
-    ssize_t bytes_read = read(*file, buf, n);
+    auto bytes_read = read(*file, buf, n);
     if (bytes_read == -1) {
       if (errno == EINTR) {
         continue;
index d8b856572b4ce01f93ebf6fd20b24c0f638aa315..24ce1bbd921a50cc5cfd33353e42710ae8f2b706 100644 (file)
@@ -1014,7 +1014,7 @@ parse_size(const std::string& value)
 bool
 read_fd(int fd, DataReceiver data_receiver)
 {
-  ssize_t n;
+  int64_t n;
   char buffer[CCACHE_READ_BUFFER_SIZE];
   while ((n = read(fd, buffer, sizeof(buffer))) != 0) {
     if (n == -1 && errno != EINTR) {
@@ -1046,7 +1046,7 @@ read_file(const std::string& path, size_t size_hint)
     throw core::Error(strerror(errno));
   }
 
-  ssize_t ret = 0;
+  int64_t ret = 0;
   size_t pos = 0;
   std::string result;
   result.resize(size_hint);
@@ -1083,7 +1083,7 @@ read_link(const std::string& path)
 {
   size_t buffer_size = path_max(path);
   std::unique_ptr<char[]> buffer(new char[buffer_size]);
-  ssize_t len = readlink(path.c_str(), buffer.get(), buffer_size - 1);
+  const auto len = readlink(path.c_str(), buffer.get(), buffer_size - 1);
   if (len == -1) {
     return "";
   }
@@ -1440,9 +1440,9 @@ wipe_path(const std::string& path)
 void
 write_fd(int fd, const void* data, size_t size)
 {
-  ssize_t written = 0;
+  int64_t written = 0;
   do {
-    ssize_t count =
+    const auto count =
       write(fd, static_cast<const uint8_t*>(data) + written, size - written);
     if (count == -1) {
       if (errno != EAGAIN && errno != EINTR) {