buffet: Cleaned up the remaining linter warnings Fixed the remaining warnings from cpplint. So now every file in platform2/buffet conforms to the default linter settings. BUG=None TEST=Code still compiles and unit tests pass Change-Id: I094d06789590c6c76679c1e1c758525898e86923 Reviewed-on: https://chromium-review.googlesource.com/199414 Tested-by: Alex Vakulenko <avakulenko@chromium.org> Reviewed-by: Christopher Wiley <wiley@chromium.org> Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/async_event_sequencer.cc b/buffet/async_event_sequencer.cc index b447c70..bf08d14 100644 --- a/buffet/async_event_sequencer.cc +++ b/buffet/async_event_sequencer.cc
@@ -54,10 +54,10 @@ const std::string& expected_method_name, const std::string& actual_interface_name, const std::string& actual_method_name, bool success) { - CHECK(expected_method_name == actual_method_name) + CHECK_EQ(expected_method_name, actual_method_name) << "Exported DBus method '" << actual_method_name << "' " << "but expected '" << expected_method_name << "'"; - CHECK(expected_interface_name == actual_interface_name) + CHECK_EQ(expected_interface_name, actual_interface_name) << "Exported method DBus interface '" << actual_interface_name << "' " << "but expected '" << expected_interface_name << "'"; finish_handler.Run(success); @@ -67,7 +67,7 @@ void AsyncEventSequencer::RetireRegistration(int registration_number) { const size_t handlers_retired = outstanding_registrations_.erase( registration_number); - CHECK(handlers_retired == 1) + CHECK_EQ(1, handlers_retired) << "Tried to retire invalid handler " << registration_number << ")"; }
diff --git a/buffet/async_event_sequencer.h b/buffet/async_event_sequencer.h index 105be6d..ab5bc1a 100644 --- a/buffet/async_event_sequencer.h +++ b/buffet/async_event_sequencer.h
@@ -19,7 +19,7 @@ // A helper class for coordinating the multiple async tasks. A consumer // may grab any number of callbacks via Get*Handler() and schedule a list -// of completion actions to take. When all handlers obtained bia Get*Handler() +// of completion actions to take. When all handlers obtained via Get*Handler() // have been called, the AsyncEventSequencer will call its CompletionActions. // // Usage: @@ -79,11 +79,11 @@ const std::string& error_message); void PossiblyRunCompletionActions(); - bool started_{false}; - int registration_counter_{0}; + bool started_{false}; // NOLINT - initializer list + int registration_counter_{0}; // NOLINT - initializer list std::set<int> outstanding_registrations_; std::vector<CompletionAction> completion_actions_; - bool had_failures_{false}; + bool had_failures_{false}; // NOLINT - initializer list // Ref counted objects have private destructors. ~AsyncEventSequencer(); friend class base::RefCounted<AsyncEventSequencer>;
diff --git a/buffet/bind_lambda.h b/buffet/bind_lambda.h index 69d948c..0172ab3 100644 --- a/buffet/bind_lambda.h +++ b/buffet/bind_lambda.h
@@ -28,38 +28,38 @@ // R(...) template <typename Lambda, typename R, typename... Args> class LambdaAdapter<Lambda, R(Lambda::*)(Args... args)> { -public: + public: typedef R(RunType)(Args...); LambdaAdapter(Lambda lambda) : lambda_(lambda) {} R Run(Args... args) { return lambda_(args...); } -private: + private: Lambda lambda_; }; // R(...) const template <typename Lambda, typename R, typename... Args> class LambdaAdapter<Lambda, R(Lambda::*)(Args... args) const> { -public: + public: typedef R(RunType)(Args...); LambdaAdapter(Lambda lambda) : lambda_(lambda) {} R Run(Args... args) { return lambda_(args...); } -private: + private: Lambda lambda_; }; template <typename Lambda> class RunnableAdapter : public LambdaAdapter<Lambda, decltype(&Lambda::operator())> { -public: + public: explicit RunnableAdapter(Lambda lambda) : LambdaAdapter<Lambda, decltype(&Lambda::operator())>(lambda) { } }; -} // namespace internal -} // namespace base +} // namespace internal +} // namespace base -#endif // BUFFET_BIND_LAMBDA_H_ +#endif // BUFFET_BIND_LAMBDA_H_
diff --git a/buffet/buffet_client.cc b/buffet/buffet_client.cc index cec73e1..34eb89f 100644 --- a/buffet/buffet_client.cc +++ b/buffet/buffet_client.cc
@@ -19,7 +19,7 @@ #include "buffet/dbus_constants.h" #include "buffet/data_encoding.h" -using namespace buffet::dbus_constants; +using namespace buffet::dbus_constants; // NOLINT(build/namespaces) namespace { static const int default_timeout_ms = 1000; @@ -228,10 +228,10 @@ private: scoped_refptr<dbus::Bus> bus_; - dbus::ObjectProxy* manager_proxy_{nullptr}; + dbus::ObjectProxy* manager_proxy_{nullptr}; // NOLINT - initializer list }; -} // namespace +} // namespace int main(int argc, char** argv) { CommandLine::Init(argc, argv);
diff --git a/buffet/exported_object_manager.h b/buffet/exported_object_manager.h index 14a0b1a..e1d8884 100644 --- a/buffet/exported_object_manager.h +++ b/buffet/exported_object_manager.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef EXPORTED_OBJECT_MANAGER_H_ -#define EXPORTED_OBJECT_MANAGER_H_ +#ifndef BUFFET_EXPORTED_OBJECT_MANAGER_H_ +#define BUFFET_EXPORTED_OBJECT_MANAGER_H_ #include <map> #include <string> @@ -115,4 +115,4 @@ } // namespace buffet -#endif // EXPORTED_OBJECT_MANAGER_H_ +#endif // BUFFET_EXPORTED_OBJECT_MANAGER_H_
diff --git a/buffet/exported_property_set.h b/buffet/exported_property_set.h index 8e535b6..3d7abc5 100644 --- a/buffet/exported_property_set.h +++ b/buffet/exported_property_set.h
@@ -7,6 +7,7 @@ #include <map> #include <string> +#include <vector> #include <base/memory/weak_ptr.h> #include <dbus/exported_object.h> @@ -168,7 +169,7 @@ private: OnUpdateCallback on_update_; - T value_{}; + T value_{}; // NOLINT - initializer list DISALLOW_COPY_AND_ASSIGN(ExportedProperty); };
diff --git a/buffet/manager.h b/buffet/manager.h index d2b2859..a508d81 100644 --- a/buffet/manager.h +++ b/buffet/manager.h
@@ -5,12 +5,14 @@ #ifndef BUFFET_MANAGER_H_ #define BUFFET_MANAGER_H_ +#include <memory> +#include <string> + #include <base/basictypes.h> #include <base/memory/scoped_ptr.h> #include <base/values.h> #include <dbus/message.h> #include <dbus/object_path.h> -#include <memory> #include "buffet/dbus_constants.h" #include "buffet/exported_property_set.h" @@ -27,7 +29,7 @@ public: typedef base::Callback<void(bool success)> OnInitFinish; - Manager(dbus::Bus* bus); + explicit Manager(dbus::Bus* bus); ~Manager(); void Init(const OnInitFinish& cb); @@ -35,7 +37,7 @@ struct Properties: public dbus_utils::ExportedPropertySet { public: dbus_utils::ExportedProperty<std::string> state_; - Properties(dbus::Bus* bus) + explicit Properties(dbus::Bus* bus) : dbus_utils::ExportedPropertySet( bus, dbus::ObjectPath(dbus_constants::kManagerServicePath)) { RegisterProperty(dbus_constants::kManagerInterface, "State", &state_);
diff --git a/buffet/storage_impls.cc b/buffet/storage_impls.cc index 2d2531d..d95538a 100644 --- a/buffet/storage_impls.cc +++ b/buffet/storage_impls.cc
@@ -4,6 +4,8 @@ #include "buffet/storage_impls.h" +#include <string> + #include <base/files/important_file_writer.h> #include <base/json/json_reader.h> #include <base/json/json_writer.h>
diff --git a/buffet/storage_impls.h b/buffet/storage_impls.h index 04d5f0f..6e69084 100644 --- a/buffet/storage_impls.h +++ b/buffet/storage_impls.h
@@ -16,7 +16,7 @@ // Persists the given Value to an atomically written file. class FileStorage : public StorageInterface { public: - FileStorage(const base::FilePath& file_path); + explicit FileStorage(const base::FilePath& file_path); virtual ~FileStorage() = default; virtual std::unique_ptr<base::Value> Load() override; virtual bool Save(const base::Value* config) override;