chore(3p/nix): apply google-readability-casting

Command run: jq <compile_commands.json -r 'map(.file)|.[]' | grep -v '/generated/' | parallel clang-tidy -p compile_commands.json -checks=-*,google-readability-casting --fix

Manual fixes applied in src/nix-env/nix-env.cc, src/libstore/store-api.cc

Change-Id: I406b4be9368c557ca59329bf6f7002704e955f8d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1557
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
Kane York 2020-08-01 17:17:44 -07:00 committed by kanepyork
parent 053a138002
commit 1de00e6c42
40 changed files with 161 additions and 125 deletions

View file

@ -350,7 +350,8 @@ void LocalStore::openDB(State& state, bool create) {
if (sqlite3_step(stmt) != SQLITE_ROW) {
throwSQLiteError(db, "querying journal mode");
}
prevMode = std::string((const char*)sqlite3_column_text(stmt, 0));
prevMode = std::string(
reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0)));
}
if (prevMode != mode &&
sqlite3_exec(db, ("pragma main.journal_mode = " + mode + ";").c_str(),
@ -489,7 +490,7 @@ static void canonicalisePathMetaData_(const Path& path, uid_t fromUid,
However, ignore files that we chown'ed ourselves previously to
ensure that we don't fail on hard links within the same build
(i.e. "touch $out/foo; ln $out/foo $out/bar"). */
if (fromUid != (uid_t)-1 && st.st_uid != fromUid) {
if (fromUid != static_cast<uid_t>(-1) && st.st_uid != fromUid) {
if (S_ISDIR(st.st_mode)) {
throw BuildError(format("invalid file '%1%': is a directory") % path);
}
@ -690,7 +691,8 @@ void LocalStore::queryPathInfoUncached(
info->registrationTime = useQueryPathInfo.getInt(2);
auto s = (const char*)sqlite3_column_text(state->stmtQueryPathInfo, 3);
auto s = reinterpret_cast<const char*>(
sqlite3_column_text(state->stmtQueryPathInfo, 3));
if (s != nullptr) {
info->deriver = s;
}
@ -700,12 +702,14 @@ void LocalStore::queryPathInfoUncached(
info->ultimate = useQueryPathInfo.getInt(5) == 1;
s = (const char*)sqlite3_column_text(state->stmtQueryPathInfo, 6);
s = reinterpret_cast<const char*>(
sqlite3_column_text(state->stmtQueryPathInfo, 6));
if (s != nullptr) {
info->sigs = absl::StrSplit(s, absl::ByChar(' '), absl::SkipEmpty());
}
s = (const char*)sqlite3_column_text(state->stmtQueryPathInfo, 7);
s = reinterpret_cast<const char*>(
sqlite3_column_text(state->stmtQueryPathInfo, 7));
if (s != nullptr) {
info->ca = s;
}
@ -860,8 +864,8 @@ Path LocalStore::queryPathFromHashPart(const std::string& hashPart) {
return "";
}
const char* s =
(const char*)sqlite3_column_text(state->stmtQueryPathFromHashPart, 0);
const char* s = reinterpret_cast<const char*>(
sqlite3_column_text(state->stmtQueryPathFromHashPart, 0));
return (s != nullptr) &&
prefix.compare(0, prefix.size(), s, prefix.size()) == 0
? s