{
path = std::string(path_prefix);
path += ".XXXXXX";
- fd = Fd(mkstemp(const_cast<char*>(path.data()))); // cast needed before C++17
+ fd = Fd(mkstemp(&path[0]));
return bool(fd);
}
result.resize(2 * result.size());
}
const size_t max_read = result.size() - pos;
- char* data = const_cast<char*>(result.data()); // cast needed before C++17
- ret = read(*fd, data + pos, max_read);
+ ret = read(*fd, &result[pos], max_read);
if (ret == 0 || (ret == -1 && errno != EINTR)) {
break;
}
}
// Bytes between p and q are pending to be hashed.
- const char* p = data.data();
- char* q = const_cast<char*>(data.data()); // cast needed before C++17
- const char* end = data.c_str() + data.length();
+ const char* p = &data[0];
+ char* q = &data[0];
+ const char* end = p + data.length();
// There must be at least 7 characters (# 1 "x") left to potentially find an
// include file path.