Run the ClangTidy analyser on the AudioProcessing submodule of WebRTC.
This CL contains automatically applied fixes suggested by the
ClangTidy analyzer (http://clang.llvm.org/extra/clang-tidy/). The
following kinds of fixes is present:
* renaming variables when the names in the method signature don't
match the names in the method definition
(ClangTidy:readability-inconsistent-declaration-parameter-name)
* ClangTidy:readability-container-size-empty,
ClangTidy:misc-unused-using-decls,
ClangTidy:performance-unnecessary-value-param,
ClangTidy:readability-redundant-control-flow
This is a 'pilot' CL to check if automatic code analyzers can
feasibly be integrated into the WebRTC infrastructuve.
The renamings have been manually expected for consistency with
surrounding code. In echo_cancellation.cc, I changed several names in
the function implementation to match the function declaration. The
tool suggested changing everything to match the function definitions
instead.
Bug: None
Change-Id: Id3b7ba18c51f15b025f26090c7bdcc642e48d8fd
Reviewed-on: https://chromium-review.googlesource.com/635766
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19630}
diff --git a/webrtc/modules/audio_processing/audio_processing_unittest.cc b/webrtc/modules/audio_processing/audio_processing_unittest.cc
index 243a140..de070f3 100644
--- a/webrtc/modules/audio_processing/audio_processing_unittest.cc
+++ b/webrtc/modules/audio_processing/audio_processing_unittest.cc
@@ -237,7 +237,7 @@
}
#endif
-void OpenFileAndWriteMessage(const std::string filename,
+void OpenFileAndWriteMessage(const std::string& filename,
const MessageLite& msg) {
FILE* file = fopen(filename.c_str(), "wb");
ASSERT_TRUE(file != NULL);
@@ -253,7 +253,7 @@
fclose(file);
}
-std::string ResourceFilePath(std::string name, int sample_rate_hz) {
+std::string ResourceFilePath(const std::string& name, int sample_rate_hz) {
std::ostringstream ss;
// Resource files are all stereo.
ss << name << sample_rate_hz / 1000 << "_stereo";
@@ -265,7 +265,7 @@
// have competing filenames.
std::map<std::string, std::string> temp_filenames;
-std::string OutputFilePath(std::string name,
+std::string OutputFilePath(const std::string& name,
int input_rate,
int output_rate,
int reverse_input_rate,
@@ -307,7 +307,7 @@
remove(kv.second.c_str());
}
-void OpenFileAndReadMessage(std::string filename, MessageLite* msg) {
+void OpenFileAndReadMessage(const std::string& filename, MessageLite* msg) {
FILE* file = fopen(filename.c_str(), "rb");
ASSERT_TRUE(file != NULL);
ReadMessageFromFile(file, msg);
@@ -2438,7 +2438,7 @@
size_t num_output_channels,
size_t num_reverse_input_channels,
size_t num_reverse_output_channels,
- std::string output_file_prefix) {
+ const std::string& output_file_prefix) {
Config config;
config.Set<ExperimentalAgc>(new ExperimentalAgc(false));
std::unique_ptr<AudioProcessing> ap(AudioProcessing::Create(config));