Skip to content

Commit b9cdc42

Browse files
committed
1 parent a2218dc commit b9cdc42

25 files changed

+60
-56
lines changed

base/cvd/.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Checks: &checks >-
88
readability-avoid-const-params-in-decls,
99
readability-const-return-type,
1010
readability-container-size-empty,
11+
readability-inconsistent-declaration-parameter-name,
1112

1213
UseColor: true
1314

base/cvd/cuttlefish/common/libs/fs/shared_fd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class WeakFD {
249249
class ScopedMMap {
250250
public:
251251
ScopedMMap();
252-
ScopedMMap(void* ptr, size_t size);
252+
ScopedMMap(void* ptr, size_t len);
253253
ScopedMMap(const ScopedMMap& other) = delete;
254254
ScopedMMap& operator=(const ScopedMMap& other) = delete;
255255
ScopedMMap(ScopedMMap&& other);

base/cvd/cuttlefish/common/libs/fs/shared_fd_stream.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int SharedFDStreambuf::underflow() {
5757
return static_cast<int>(*gptr());
5858
}
5959

60-
std::streamsize SharedFDStreambuf::xsgetn(char* dst, std::streamsize count) {
60+
std::streamsize SharedFDStreambuf::xsgetn(char* dest, std::streamsize count) {
6161
std::streamsize bytes_read = 0;
6262
while (bytes_read < count) {
6363
if (in_avail() == 0) {
@@ -67,7 +67,7 @@ std::streamsize SharedFDStreambuf::xsgetn(char* dst, std::streamsize count) {
6767
}
6868
std::streamsize buffer_count =
6969
std::min(static_cast<std::streamsize>(in_avail()), count - bytes_read);
70-
std::memcpy(dst + bytes_read, gptr(), buffer_count);
70+
std::memcpy(dest + bytes_read, gptr(), buffer_count);
7171
gbump(buffer_count);
7272
bytes_read += buffer_count;
7373
}
@@ -84,10 +84,10 @@ int SharedFDStreambuf::overflow(int c) {
8484
return c;
8585
}
8686

87-
std::streamsize SharedFDStreambuf::xsputn(const char* src,
87+
std::streamsize SharedFDStreambuf::xsputn(const char* source,
8888
std::streamsize count) {
8989
return static_cast<std::streamsize>(
90-
WriteAll(shared_fd_, src, static_cast<std::size_t>(count)));
90+
WriteAll(shared_fd_, source, static_cast<std::size_t>(count)));
9191
}
9292

9393
int SharedFDStreambuf::pbackfail(int c) {
@@ -107,4 +107,4 @@ SharedFDOstream::SharedFDOstream(SharedFD shared_fd)
107107
SharedFDIstream::SharedFDIstream(SharedFD shared_fd)
108108
: std::istream(nullptr), buf_(shared_fd) { rdbuf(&buf_); }
109109

110-
} // namespace cuttlefish
110+
} // namespace cuttlefish

base/cvd/cuttlefish/common/libs/utils/files.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@
2828
namespace cuttlefish {
2929
bool FileExists(const std::string& path, bool follow_symlinks = true);
3030
Result<dev_t> FileDeviceId(const std::string& path);
31-
Result<bool> CanHardLink(const std::string& path1, const std::string& path2);
31+
Result<bool> CanHardLink(const std::string& source,
32+
const std::string& destination);
3233
Result<ino_t> FileInodeNumber(const std::string& path);
33-
Result<bool> AreHardLinked(const std::string& path1, const std::string& path2);
34+
Result<bool> AreHardLinked(const std::string& source,
35+
const std::string& destination);
3436
Result<std::string> CreateHardLink(const std::string& target,
3537
const std::string& hardlink,
3638
bool overwrite_existing = false);

base/cvd/cuttlefish/common/libs/utils/flag_parser.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,10 +591,11 @@ Flag GflagsCompatFlag(const std::string& name,
591591
}
592592

593593
Flag GflagsCompatFlag(const std::string& name, std::vector<bool>& value,
594-
const bool def_val) {
594+
const bool default_value) {
595595
return GflagsCompatFlag(name)
596596
.Getter([&value]() { return fmt::format("{}", fmt::join(value, ",")); })
597-
.Setter([&name, &value, def_val](const FlagMatch& match) -> Result<void> {
597+
.Setter([&name, &value,
598+
default_value](const FlagMatch& match) -> Result<void> {
598599
if (match.value.empty()) {
599600
value.clear();
600601
return {};
@@ -606,7 +607,7 @@ Flag GflagsCompatFlag(const std::string& name, std::vector<bool>& value,
606607
output_vals.reserve(str_vals.size());
607608
for (const auto& str_val : str_vals) {
608609
if (str_val.empty()) {
609-
output_vals.push_back(def_val);
610+
output_vals.push_back(default_value);
610611
} else {
611612
output_vals.push_back(CF_EXPECT(ParseBool(str_val, name)));
612613
}

base/cvd/cuttlefish/common/libs/utils/flag_parser.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ class Flag {
8989
/* Examines a list of arguments, removing any matches from the list and
9090
* invoking the `Setter` for every match. Returns `false` if the callback ever
9191
* returns `false`. Non-matches are left in place. */
92-
Result<void> Parse(std::vector<std::string>& flags) const;
93-
Result<void> Parse(std::vector<std::string>&& flags) const;
92+
Result<void> Parse(std::vector<std::string>& arguments) const;
93+
Result<void> Parse(std::vector<std::string>&& arguments) const;
9494

9595
/* Write gflags `--helpxml` style output for a string-type flag. */
9696
bool WriteGflagsCompatXml(std::ostream&) const;

base/cvd/cuttlefish/common/libs/utils/subprocess.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ SubprocessOptions SubprocessOptions::Verbose(bool verbose) && {
131131
}
132132

133133
#ifdef __linux__
134-
SubprocessOptions& SubprocessOptions::ExitWithParent(bool v) & {
135-
exit_with_parent_ = v;
134+
SubprocessOptions& SubprocessOptions::ExitWithParent(bool exit_with_parent) & {
135+
exit_with_parent_ = exit_with_parent;
136136
return *this;
137137
}
138-
SubprocessOptions SubprocessOptions::ExitWithParent(bool v) && {
139-
exit_with_parent_ = v;
138+
SubprocessOptions SubprocessOptions::ExitWithParent(bool exit_with_parent) && {
139+
exit_with_parent_ = exit_with_parent;
140140
return std::move(*this);
141141
}
142142
#endif

base/cvd/cuttlefish/common/libs/utils/subprocess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ std::ostream& operator<<(std::ostream& out, const Command& command);
340340
* If some setup fails, `command` fails to start, or `command` exits due to a
341341
* signal, the return value will be negative.
342342
*/
343-
int RunWithManagedStdio(Command&& command, const std::string* stdin,
343+
int RunWithManagedStdio(Command&& cmd_tmp, const std::string* stdin,
344344
std::string* stdout, std::string* stderr,
345345
SubprocessOptions options = SubprocessOptions());
346346

base/cvd/cuttlefish/common/libs/utils/tee_logging.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,19 +274,19 @@ static std::vector<SeverityTarget> SeverityTargetsForFiles(
274274
}
275275

276276
TeeLogger LogToFiles(const std::vector<std::string>& files,
277-
const std::string& prefix) {
278-
return TeeLogger(SeverityTargetsForFiles(files), prefix);
277+
const std::string& log_prefix) {
278+
return TeeLogger(SeverityTargetsForFiles(files), log_prefix);
279279
}
280280

281281
TeeLogger LogToStderrAndFiles(
282-
const std::vector<std::string>& files, const std::string& prefix,
282+
const std::vector<std::string>& files, const std::string& log_prefix,
283283
MetadataLevel stderr_level,
284284
std::optional<android::base::LogSeverity> stderr_severity) {
285285
std::vector<SeverityTarget> log_severities = SeverityTargetsForFiles(files);
286286
log_severities.push_back(
287287
SeverityTarget{stderr_severity ? *stderr_severity : ConsoleSeverity(),
288288
SharedFD::Dup(/* stderr */ 2), stderr_level});
289-
return TeeLogger(log_severities, prefix);
289+
return TeeLogger(log_severities, log_prefix);
290290
}
291291

292292
} // namespace cuttlefish

base/cvd/cuttlefish/common/libs/utils/tee_logging.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ TeeLogger LogToFiles(const std::vector<std::string>& files,
6767
TeeLogger LogToStderrAndFiles(
6868
const std::vector<std::string>& files, const std::string& log_prefix = "",
6969
MetadataLevel stderr_level = MetadataLevel::ONLY_MESSAGE,
70-
std::optional<android::base::LogSeverity> stderr_serverity = std::nullopt);
70+
std::optional<android::base::LogSeverity> stderr_severity = std::nullopt);
7171

7272
std::string StripColorCodes(const std::string& str);
7373

0 commit comments

Comments
 (0)