debugd: Fix coding style and cpplint issues.

BUG=chromium:385849
TEST=`FEATURES=test emerge-$BOARD platform2`
TEST=`cpplint.py --root=src --filter=-build/include src/{*.h,*.cc,*/*.cc}`

Change-Id: Ia2475d6ee287dc727c3b2ffe139e9cc8bfe2e2e5
Reviewed-on: https://chromium-review.googlesource.com/204391
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
diff --git a/debugd/src/anonymizer_tool.cc b/debugd/src/anonymizer_tool.cc
index bdbaf8f..372e4e0 100644
--- a/debugd/src/anonymizer_tool.cc
+++ b/debugd/src/anonymizer_tool.cc
@@ -149,4 +149,4 @@
   return result;
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/anonymizer_tool.h b/debugd/src/anonymizer_tool.h
index aecb1dd..a234bf1 100644
--- a/debugd/src/anonymizer_tool.h
+++ b/debugd/src/anonymizer_tool.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 ANONYMIZER_TOOL_H
-#define ANONYMIZER_TOOL_H
+#ifndef ANONYMIZER_TOOL_H_
+#define ANONYMIZER_TOOL_H_
 
 #include <map>
 #include <string>
@@ -16,7 +16,7 @@
 class AnonymizerTool {
  public:
   AnonymizerTool();
-  virtual ~AnonymizerTool();
+  ~AnonymizerTool();
 
   // Returns an anonymized version of |input|. PII-sensitive data (such as MAC
   // addresses) in |input| is replaced with unique identifiers.
@@ -38,6 +38,6 @@
   DISALLOW_COPY_AND_ASSIGN(AnonymizerTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // ANONYMIZER_TOOL_H
+#endif  // ANONYMIZER_TOOL_H_
diff --git a/debugd/src/cpu_info_parser.cc b/debugd/src/cpu_info_parser.cc
index 5aa5954..b22396a 100644
--- a/debugd/src/cpu_info_parser.cc
+++ b/debugd/src/cpu_info_parser.cc
@@ -4,8 +4,9 @@
 
 #include "cpu_info_parser.h"
 
-#include <fstream>
+#include <fstream>  // NOLINT
 #include <string>
+#include <vector>
 
 #include <base/logging.h>
 #include <base/strings/string_split.h>
diff --git a/debugd/src/crash_sender_tool.cc b/debugd/src/crash_sender_tool.cc
index 400a433..36d69f1 100644
--- a/debugd/src/crash_sender_tool.cc
+++ b/debugd/src/crash_sender_tool.cc
@@ -12,7 +12,7 @@
 
 CrashSenderTool::~CrashSenderTool() { }
 
-void CrashSenderTool::UploadCrashes(DBus::Error& error) {  // NOLINT
+void CrashSenderTool::UploadCrashes(DBus::Error* error) {
   ProcessWithId* p = CreateProcess(false);
   // TODO(jorgelo): This mount namespace shuffling should be handled by
   // minijail.  See http://crbug.com/376987 for details.
@@ -24,4 +24,4 @@
   p->Run();
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/crash_sender_tool.h b/debugd/src/crash_sender_tool.h
index 64fe133..747f71b 100644
--- a/debugd/src/crash_sender_tool.h
+++ b/debugd/src/crash_sender_tool.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 CRASH_SENDER_TOOL_H
-#define CRASH_SENDER_TOOL_H
+#ifndef CRASH_SENDER_TOOL_H_
+#define CRASH_SENDER_TOOL_H_
 
 #include <base/basictypes.h>
 #include <dbus-c++/dbus.h>
@@ -15,9 +15,9 @@
 class CrashSenderTool : public SubprocessTool {
  public:
   CrashSenderTool();
-  ~CrashSenderTool();
+  virtual ~CrashSenderTool();
 
-  void UploadCrashes(DBus::Error& error);  // NOLINT
+  void UploadCrashes(DBus::Error* error);
 
  private:
   DISALLOW_COPY_AND_ASSIGN(CrashSenderTool);
@@ -25,4 +25,4 @@
 
 }  // namespace debugd
 
-#endif  // CRASH_SENDER_TOOL_H
+#endif  // CRASH_SENDER_TOOL_H_
diff --git a/debugd/src/debug_daemon.cc b/debugd/src/debug_daemon.cc
index 4e58b71..4864aae 100644
--- a/debugd/src/debug_daemon.cc
+++ b/debugd/src/debug_daemon.cc
@@ -54,165 +54,169 @@
   dispatcher_->leave();
 }
 
-std::string DebugDaemon::PingStart(const DBus::FileDescriptor& outfd,
-                                   const std::string& destination,
-                                   const std::map<std::string, DBus::Variant>&
-                                       options,
-                                   DBus::Error& error) {
-  return ping_tool_->Start(outfd, destination, options, error);
+std::string DebugDaemon::PingStart(
+    const DBus::FileDescriptor& outfd,
+    const std::string& destination,
+    const std::map<std::string, DBus::Variant>& options,
+    DBus::Error& error) {  // NOLINT
+  return ping_tool_->Start(outfd, destination, options, &error);
 }
 
-void DebugDaemon::PingStop(const std::string& handle, DBus::Error& error) {
-  return ping_tool_->Stop(handle, error);
+void DebugDaemon::PingStop(const std::string& handle,
+                           DBus::Error& error) {  // NOLINT
+  return ping_tool_->Stop(handle, &error);
 }
 
-std::string DebugDaemon::TracePathStart(const DBus::FileDescriptor& outfd,
-                                        const std::string& destination,
-                                        const std::map<std::string,
-                                                       DBus::Variant>& options,
-                                        DBus::Error& error) {
-  return tracepath_tool_->Start(outfd, destination, options, error);
+std::string DebugDaemon::TracePathStart(
+    const DBus::FileDescriptor& outfd,
+    const std::string& destination,
+    const std::map<std::string, DBus::Variant>& options,
+    DBus::Error& error) {  // NOLINT
+  return tracepath_tool_->Start(outfd, destination, options, &error);
 }
 
-void DebugDaemon::TracePathStop(const std::string& handle, DBus::Error& error) {
-  return tracepath_tool_->Stop(handle, error);
+void DebugDaemon::TracePathStop(const std::string& handle,
+                                DBus::Error& error) {  // NOLINT
+  return tracepath_tool_->Stop(handle, &error);
 }
 
 void DebugDaemon::SystraceStart(const std::string& categories,
-                                DBus::Error& error) {
-  (void) systrace_tool_->Start(categories, error);
+                                DBus::Error& error) {  // NOLINT
+  (void) systrace_tool_->Start(categories, &error);
 }
 
 void DebugDaemon::SystraceStop(const DBus::FileDescriptor& outfd,
-    DBus::Error& error) {
-  return systrace_tool_->Stop(outfd, error);
+                               DBus::Error& error) { // NOLINT
+  return systrace_tool_->Stop(outfd, &error);
 }
 
-std::string DebugDaemon::SystraceStatus(DBus::Error& error) { // NOLINT dbuscxx
-  return systrace_tool_->Status(error);
+std::string DebugDaemon::SystraceStatus(DBus::Error& error) {  // NOLINT
+  return systrace_tool_->Status(&error);
 }
 
-std::vector<std::string> DebugDaemon::GetRoutes(const std::map<std::string,
-                                                               DBus::Variant>&
-                                                    options,
-                                                DBus::Error& error) {
-  return route_tool_->GetRoutes(options, error);
+std::vector<std::string> DebugDaemon::GetRoutes(
+    const std::map<std::string, DBus::Variant>& options,
+    DBus::Error& error) {  // NOLINT
+  return route_tool_->GetRoutes(options, &error);
 }
 
-std::string DebugDaemon::GetModemStatus(DBus::Error& error) { // NOLINT dbuscxx
-  return modem_status_tool_->GetModemStatus(error);
+std::string DebugDaemon::GetModemStatus(DBus::Error& error) {  // NOLINT
+  return modem_status_tool_->GetModemStatus(&error);
 }
 
-std::string DebugDaemon::RunModemCommand(
-    const std::string& command,
-    DBus::Error& error) {
+std::string DebugDaemon::RunModemCommand(const std::string& command,
+                                         DBus::Error& error) {  // NOLINT
   return modem_status_tool_->RunModemCommand(command);
 }
 
 std::string DebugDaemon::GetNetworkStatus(DBus::Error& error) { // NOLINT
-  return network_status_tool_->GetNetworkStatus(error);
+  return network_status_tool_->GetNetworkStatus(&error);
 }
 
 std::string DebugDaemon::GetWiMaxStatus(DBus::Error& error) { // NOLINT
-  return wimax_status_tool_->GetWiMaxStatus(error);
+  return wimax_status_tool_->GetWiMaxStatus(&error);
 }
 
 std::vector<uint8> DebugDaemon::GetRichPerfData(const uint32_t& duration,
-                                                DBus::Error& error) {
-  return perf_tool_->GetRichPerfData(duration, error);
+                                                DBus::Error& error) {  // NOLINT
+  return perf_tool_->GetRichPerfData(duration, &error);
 }
 
 void DebugDaemon::GetDebugLogs(const DBus::FileDescriptor& fd,
-                                DBus::Error& error) {
-  debug_logs_tool_->GetDebugLogs(fd, error);
+                               DBus::Error& error) {  // NOLINT
+  debug_logs_tool_->GetDebugLogs(fd, &error);
 }
 
 void DebugDaemon::SetDebugMode(const std::string& subsystem,
-                               DBus::Error& error) {
+                               DBus::Error& error) {  // NOLINT
   debug_mode_tool_->SetDebugMode(subsystem, &error);
 }
 
-std::string DebugDaemon::GetLog(const std::string& name, DBus::Error& error) {
-  return log_tool_->GetLog(name, error);
+std::string DebugDaemon::GetLog(const std::string& name,
+                                DBus::Error& error) {  // NOLINT
+  return log_tool_->GetLog(name, &error);
 }
 
-std::map<std::string, std::string> DebugDaemon::GetAllLogs(DBus::Error& error) { // NOLINT dbuscxx
-  return log_tool_->GetAllLogs(error);
+std::map<std::string, std::string> DebugDaemon::GetAllLogs(
+    DBus::Error& error) {  // NOLINT
+  return log_tool_->GetAllLogs(&error);
 }
 
 std::map<std::string, std::string> DebugDaemon::GetFeedbackLogs(
-    DBus::Error& error) { // NOLINT dbuscxx
-  return log_tool_->GetFeedbackLogs(error);
+    DBus::Error& error) {  // NOLINT
+  return log_tool_->GetFeedbackLogs(&error);
 }
 
 std::map<std::string, std::string> DebugDaemon::GetUserLogFiles(
-    DBus::Error& error) { // NOLINT dbuscxx
-  return log_tool_->GetUserLogFiles(error);
+    DBus::Error& error) {  // NOLINT
+  return log_tool_->GetUserLogFiles(&error);
 }
 
-std::string DebugDaemon::GetExample(DBus::Error& error) { // NOLINT dbuscxx
-  return example_tool_->GetExample(error);
+std::string DebugDaemon::GetExample(DBus::Error& error) {  // NOLINT
+  return example_tool_->GetExample(&error);
 }
 
-std::string DebugDaemon::GetInterfaces(DBus::Error& error) { // NOLINT dbuscxx
+std::string DebugDaemon::GetInterfaces(DBus::Error& error) {  // NOLINT
   return netif_tool_->GetInterfaces(&error);
 }
 
-std::string DebugDaemon::TestICMP(const std::string& host, DBus::Error& error) { // NOLINT dbuscxx
+std::string DebugDaemon::TestICMP(const std::string& host,
+                                  DBus::Error& error) {  // NOLINT
   return icmp_tool_->TestICMP(host, &error);
 }
 
 std::string DebugDaemon::TestICMPWithOptions(
     const std::string& host,
     const std::map<std::string, std::string>& options,
-    DBus::Error& error) { // NOLINT dbuscxx
+    DBus::Error& error) {  // NOLINT
   return icmp_tool_->TestICMPWithOptions(host, options, &error);
 }
 
 std::string DebugDaemon::Smartctl(const std::string& option,
-                                  DBus::Error& error) { // NOLINT
-  return storage_tool_->Smartctl(option, error);
+                                  DBus::Error& error) {  // NOLINT
+  return storage_tool_->Smartctl(option, &error);
 }
 
 std::string DebugDaemon::MemtesterStart(const DBus::FileDescriptor& outfd,
                                         const uint32_t& memory,
-                                        DBus::Error& error) {
-  return memory_tool_->Start(outfd, memory, error);
+                                        DBus::Error& error) {  // NOLINT
+  return memory_tool_->Start(outfd, memory, &error);
 }
 
-void DebugDaemon::MemtesterStop(const std::string& handle, DBus::Error& error) {
-  return memory_tool_->Stop(handle, error);
+void DebugDaemon::MemtesterStop(const std::string& handle,
+                                DBus::Error& error) {  // NOLINT
+  return memory_tool_->Stop(handle, &error);
 }
 
 std::string DebugDaemon::BadblocksStart(const DBus::FileDescriptor& outfd,
-                                        DBus::Error& error) {
-  return storage_tool_->Start(outfd, error);
+                                        DBus::Error& error) {  // NOLINT
+  return storage_tool_->Start(outfd, &error);
 }
 
-void DebugDaemon::BadblocksStop(const std::string& handle, DBus::Error& error) {
-  return storage_tool_->Stop(handle, error);
+void DebugDaemon::BadblocksStop(const std::string& handle,
+                                DBus::Error& error) {  // NOLINT
+  return storage_tool_->Stop(handle, &error);
 }
 
-std::string DebugDaemon::PacketCaptureStart(const DBus::FileDescriptor& statfd,
-                                            const DBus::FileDescriptor& outfd,
-                                            const std::map<std::string,
-                                                            DBus::Variant>&
-                                                 options,
-                                            DBus::Error& error) {
-  return packet_capture_tool_->Start(statfd, outfd, options, error);
+std::string DebugDaemon::PacketCaptureStart(
+    const DBus::FileDescriptor& statfd,
+    const DBus::FileDescriptor& outfd,
+    const std::map<std::string, DBus::Variant>& options,
+    DBus::Error& error) {  // NOLINT
+  return packet_capture_tool_->Start(statfd, outfd, options, &error);
 }
 
 void DebugDaemon::PacketCaptureStop(const std::string& handle,
-                                    DBus::Error& error) {
-  return packet_capture_tool_->Stop(handle, error);
+                                    DBus::Error& error) {  // NOLINT
+  return packet_capture_tool_->Stop(handle, &error);
 }
 
-void DebugDaemon::LogKernelTaskStates(DBus::Error& error) { // NOLINT dbuscxx
-  sysrq_tool_->LogKernelTaskStates(error);
+void DebugDaemon::LogKernelTaskStates(DBus::Error& error) {  // NOLINT
+  sysrq_tool_->LogKernelTaskStates(&error);
 }
 
-void DebugDaemon::UploadCrashes(DBus::Error& error) {  // NOLINT dbuscxx
-  crash_sender_tool_->UploadCrashes(error);
+void DebugDaemon::UploadCrashes(DBus::Error& error) {  // NOLINT
+  crash_sender_tool_->UploadCrashes(&error);
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/debug_daemon.h b/debugd/src/debug_daemon.h
index 4548c3f..a207e93 100644
--- a/debugd/src/debug_daemon.h
+++ b/debugd/src/debug_daemon.h
@@ -2,19 +2,19 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DEBUG_DAEMON_H
-#define DEBUG_DAEMON_H
+#ifndef DEBUG_DAEMON_H_
+#define DEBUG_DAEMON_H_
 
 #include <map>
 #include <string>
+#include <vector>
 
 #include <dbus-c++/dbus.h>
 
-#include "debugd/dbus_adaptors/org.chromium.debugd.h"
-#include "packet_capture_tool.h"
 #include "crash_sender_tool.h"
 #include "debug_logs_tool.h"
 #include "debug_mode_tool.h"
+#include "debugd/dbus_adaptors/org.chromium.debugd.h"
 #include "example_tool.h"
 #include "icmp_tool.h"
 #include "log_tool.h"
@@ -22,6 +22,7 @@
 #include "modem_status_tool.h"
 #include "netif_tool.h"
 #include "network_status_tool.h"
+#include "packet_capture_tool.h"
 #include "perf_tool.h"
 #include "ping_tool.h"
 #include "route_tool.h"
@@ -76,70 +77,74 @@
 
   // Public methods below this point are part of the DBus interface presented by
   // this object, and are documented in </share/org.chromium.debugd.xml>.
-  virtual std::string PingStart(const DBus::FileDescriptor& outfd,
-                                const std::string& dest,
-                                const std::map<std::string,
-                                               DBus::Variant>& options,
-                                DBus::Error& error);
-  virtual void PingStop(const std::string& handle, DBus::Error& error);
-  virtual std::string TracePathStart(const DBus::FileDescriptor& outfd,
-                                     const std::string& destination,
-                                     const std::map<std::string,
-                                                    DBus::Variant>& options,
-                                     DBus::Error& error);
-  virtual void TracePathStop(const std::string& handle, DBus::Error& error);
+  virtual std::string PingStart(
+      const DBus::FileDescriptor& outfd,
+      const std::string& dest,
+      const std::map<std::string, DBus::Variant>& options,
+      DBus::Error& error);  // NOLINT
+  virtual void PingStop(const std::string& handle,
+                        DBus::Error& error);  // NOLINT
+  virtual std::string TracePathStart(
+      const DBus::FileDescriptor& outfd,
+      const std::string& destination,
+      const std::map<std::string, DBus::Variant>& options,
+      DBus::Error& error);  // NOLINT
+  virtual void TracePathStop(const std::string& handle,
+                             DBus::Error& error);  // NOLINT
   virtual void SystraceStart(const std::string& categories,
-                             DBus::Error& error);
+                             DBus::Error& error);  // NOLINT
   virtual void SystraceStop(const DBus::FileDescriptor& outfd,
-                            DBus::Error& error);
-  virtual std::string SystraceStatus(DBus::Error& error); // NOLINT dbuscxx
-  virtual std::vector<std::string> GetRoutes(const std::map<std::string,
-                                                            DBus::Variant>&
-                                                 options,
-                                             DBus::Error& error);
-  virtual std::string GetModemStatus(DBus::Error& error); // NOLINT
+                            DBus::Error& error);  // NOLINT
+  virtual std::string SystraceStatus(DBus::Error& error);  // NOLINT
+  virtual std::vector<std::string> GetRoutes(
+      const std::map<std::string, DBus::Variant>& options,
+      DBus::Error& error);  // NOLINT
+  virtual std::string GetModemStatus(DBus::Error& error);  // NOLINT
   virtual std::string RunModemCommand(const std::string& command,
-                                      DBus::Error& error); // NOLINT
-  virtual std::string GetNetworkStatus(DBus::Error& error); // NOLINT
-  virtual std::string GetWiMaxStatus(DBus::Error& error); // NOLINT
+                                      DBus::Error& error);  // NOLINT
+  virtual std::string GetNetworkStatus(DBus::Error& error);  // NOLINT
+  virtual std::string GetWiMaxStatus(DBus::Error& error);  // NOLINT
   virtual std::vector<uint8> GetRichPerfData(const uint32_t& duration,
-                                             DBus::Error& error); // NOLINT
+                                             DBus::Error& error);  // NOLINT
   virtual void GetDebugLogs(const DBus::FileDescriptor& fd,
-                            DBus::Error& error);
-  virtual void SetDebugMode(const std::string& subsystem, DBus::Error& error);
+                            DBus::Error& error);  // NOLINT
+  virtual void SetDebugMode(const std::string& subsystem,
+                            DBus::Error& error);  // NOLINT
   virtual std::string GetLog(const std::string& name,
-                             DBus::Error& error); // NOLINT
+                             DBus::Error& error);  // NOLINT
   virtual std::map<std::string, std::string> GetAllLogs(
-      DBus::Error& error); // NOLINT
+      DBus::Error& error);  // NOLINT
   virtual std::map<std::string, std::string> GetFeedbackLogs(
-      DBus::Error& error); // NOLINT
+      DBus::Error& error);  // NOLINT
   virtual std::map<std::string, std::string> GetUserLogFiles(
-      DBus::Error& error); // NOLINT
-  virtual std::string GetExample(DBus::Error& error); // NOLINT
-  virtual std::string GetInterfaces(DBus::Error& error); // NOLINT
-  virtual std::string TestICMP(const std::string& host, DBus::Error& error); // NOLINT
+      DBus::Error& error);  // NOLINT
+  virtual std::string GetExample(DBus::Error& error);  // NOLINT
+  virtual std::string GetInterfaces(DBus::Error& error);  // NOLINT
+  virtual std::string TestICMP(const std::string& host,
+                               DBus::Error& error);  // NOLINT
   virtual std::string TestICMPWithOptions(
       const std::string& host,
       const std::map<std::string, std::string>& options,
-      DBus::Error& error); // NOLINT
+      DBus::Error& error);  // NOLINT
   virtual std::string Smartctl(const std::string& option,
-                               DBus::Error& error); // NOLINT
+                               DBus::Error& error);  // NOLINT
   virtual std::string MemtesterStart(const DBus::FileDescriptor& outfd,
                                      const uint32_t& memory,
-                                     DBus::Error& error);
-  virtual void MemtesterStop(const std::string& handle, DBus::Error& error);
+                                     DBus::Error& error);  // NOLINT
+  virtual void MemtesterStop(const std::string& handle,
+                             DBus::Error& error);  // NOLINT
   virtual std::string BadblocksStart(const DBus::FileDescriptor& outfd,
-                                     DBus::Error& error);
-  virtual void BadblocksStop(const std::string& handle, DBus::Error& error);
-  virtual std::string PacketCaptureStart(const DBus::FileDescriptor& statfd,
-                                         const DBus::FileDescriptor& outfd,
-                                         const std::map<std::string,
-                                                        DBus::Variant>&
-                                             options,
-                                         DBus::Error& error);
+                                     DBus::Error& error);  // NOLINT
+  virtual void BadblocksStop(const std::string& handle,
+                             DBus::Error& error);  // NOLINT
+  virtual std::string PacketCaptureStart(
+      const DBus::FileDescriptor& statfd,
+      const DBus::FileDescriptor& outfd,
+      const std::map<std::string, DBus::Variant>& options,
+      DBus::Error& error);  // NOLINT
   virtual void PacketCaptureStop(const std::string& handle,
-                                 DBus::Error& error);
-  virtual void LogKernelTaskStates(DBus::Error& error); // NOLINT
+                                 DBus::Error& error);  // NOLINT
+  virtual void LogKernelTaskStates(DBus::Error& error);  // NOLINT
   virtual void UploadCrashes(DBus::Error& error);  // NOLINT
 
  private:
@@ -167,6 +172,6 @@
   WiMaxStatusTool* wimax_status_tool_;
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // DEBUG_DAEMON_H
+#endif  // DEBUG_DAEMON_H_
diff --git a/debugd/src/debug_logs_tool.cc b/debugd/src/debug_logs_tool.cc
index ff30847..69c5cc0 100644
--- a/debugd/src/debug_logs_tool.cc
+++ b/debugd/src/debug_logs_tool.cc
@@ -17,7 +17,7 @@
 DebugLogsTool::~DebugLogsTool() { }
 
 void DebugLogsTool::GetDebugLogs(const DBus::FileDescriptor& fd,
-                                 DBus::Error& error) {
+                                 DBus::Error* error) {
   chromeos::ProcessImpl p;
   p.AddArg(kTar);
   p.AddArg("-c");
@@ -27,4 +27,4 @@
   p.Run();
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/debug_logs_tool.h b/debugd/src/debug_logs_tool.h
index 83c3bda..31d642d 100644
--- a/debugd/src/debug_logs_tool.h
+++ b/debugd/src/debug_logs_tool.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 DEBUG_LOGS_TOOL_H
-#define DEBUG_LOGS_TOOL_H
+#ifndef DEBUG_LOGS_TOOL_H_
+#define DEBUG_LOGS_TOOL_H_
 
 #include <string>
 
@@ -17,11 +17,12 @@
   DebugLogsTool();
   ~DebugLogsTool();
 
-  void GetDebugLogs(const DBus::FileDescriptor& fd, DBus::Error& error);
+  void GetDebugLogs(const DBus::FileDescriptor& fd, DBus::Error* error);
+
  private:
   DISALLOW_COPY_AND_ASSIGN(DebugLogsTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // DEBUG_LOGS_TOOL_H
+#endif  // DEBUG_LOGS_TOOL_H_
diff --git a/debugd/src/debug_mode_tool.cc b/debugd/src/debug_mode_tool.cc
index c7d784e..1d941c9 100644
--- a/debugd/src/debug_mode_tool.cc
+++ b/debugd/src/debug_mode_tool.cc
@@ -24,16 +24,16 @@
 const char* const kSupplicantService = "fi.w1.wpa_supplicant1";
 const char* const kSupplicantIface = "fi.w1.wpa_supplicant1";
 
-class ManagerProxy
-    : public org::chromium::flimflam::Manager_proxy,
-      public DBus::ObjectProxy {
-  public:
-    ManagerProxy(DBus::Connection* connection, const char* path,
-                 const char* service) :
-        DBus::ObjectProxy(*connection, path, service) { }
-    virtual ~ManagerProxy() { }
-    virtual void PropertyChanged(const std::string&, const DBus::Variant&) { }
-    virtual void StateChanged(const std::string&) { }
+class ManagerProxy : public org::chromium::flimflam::Manager_proxy,
+                     public DBus::ObjectProxy {
+ public:
+  ManagerProxy(DBus::Connection* connection,
+               const char* path,
+               const char* service)
+      : DBus::ObjectProxy(*connection, path, service) {}
+  virtual ~ManagerProxy() {}
+  virtual void PropertyChanged(const std::string&, const DBus::Variant&) {}
+  virtual void StateChanged(const std::string&) {}
 };
 
 #if USE_CELLULAR
@@ -44,40 +44,40 @@
 
 const char* const kModemManager = "ModemManager";
 
-class ModemManagerProxy
-    : public org::freedesktop::ModemManager_proxy,
-      public DBus::ObjectProxy {
-  public:
-    ModemManagerProxy(DBus::Connection* connection, const char* path,
-                      const char* service) :
-        DBus::ObjectProxy(*connection, path, service) { }
-    virtual ~ModemManagerProxy() { }
-    virtual void DeviceAdded(const DBus::Path&) { }
-    virtual void DeviceRemoved(const DBus::Path&) { }
+class ModemManagerProxy : public org::freedesktop::ModemManager_proxy,
+                          public DBus::ObjectProxy {
+ public:
+  ModemManagerProxy(DBus::Connection* connection,
+                    const char* path,
+                    const char* service)
+      : DBus::ObjectProxy(*connection, path, service) {}
+  virtual ~ModemManagerProxy() {}
+  virtual void DeviceAdded(const DBus::Path&) {}
+  virtual void DeviceRemoved(const DBus::Path&) {}
 };
 
-class ModemManager1Proxy
-    : public org::freedesktop::ModemManager1_proxy,
-      public DBus::ObjectProxy {
-  public:
-    ModemManager1Proxy(DBus::Connection* connection, const char* path,
-                       const char* service) :
-        DBus::ObjectProxy(*connection, path, service) { }
-    virtual ~ModemManager1Proxy() { }
-    virtual void DeviceAdded(const DBus::Path&) { }
-    virtual void DeviceRemoved(const DBus::Path&) { }
+class ModemManager1Proxy : public org::freedesktop::ModemManager1_proxy,
+                           public DBus::ObjectProxy {
+ public:
+  ModemManager1Proxy(DBus::Connection* connection,
+                     const char* path,
+                     const char* service)
+      : DBus::ObjectProxy(*connection, path, service) {}
+  virtual ~ModemManager1Proxy() {}
+  virtual void DeviceAdded(const DBus::Path&) {}
+  virtual void DeviceRemoved(const DBus::Path&) {}
 };
 
 #endif  // USE_CELLULAR
 
-class PropertiesProxy
-    : public org::freedesktop::DBus::Properties_proxy,
-      public DBus::ObjectProxy {
-  public:
-    PropertiesProxy(DBus::Connection* connection, const char* path,
-                    const char* service) :
-        DBus::ObjectProxy(*connection, path, service) { }
-    virtual ~PropertiesProxy() { }
+class PropertiesProxy : public org::freedesktop::DBus::Properties_proxy,
+                        public DBus::ObjectProxy {
+ public:
+  PropertiesProxy(DBus::Connection* connection,
+                  const char* path,
+                  const char* service)
+      : DBus::ObjectProxy(*connection, path, service) {}
+  virtual ~PropertiesProxy() {}
 };
 
 DebugModeTool::DebugModeTool(DBus::Connection* connection)
diff --git a/debugd/src/debug_mode_tool.h b/debugd/src/debug_mode_tool.h
index b7a3daa..6abe904 100644
--- a/debugd/src/debug_mode_tool.h
+++ b/debugd/src/debug_mode_tool.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 DEBUG_MODE_TOOL_H
-#define DEBUG_MODE_TOOL_H
+#ifndef DEBUG_MODE_TOOL_H_
+#define DEBUG_MODE_TOOL_H_
 
 #include <string>
 #include <vector>
@@ -28,6 +28,6 @@
   DISALLOW_COPY_AND_ASSIGN(DebugModeTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // DEBUG_MODE_TOOL_H
+#endif  // DEBUG_MODE_TOOL_H_
diff --git a/debugd/src/example_tool.cc b/debugd/src/example_tool.cc
index 8917367..19ba7f9 100644
--- a/debugd/src/example_tool.cc
+++ b/debugd/src/example_tool.cc
@@ -10,21 +10,19 @@
 
 #include "process_with_output.h"
 
-using base::StringPrintf;
-
 namespace debugd {
 
 ExampleTool::ExampleTool() { }
 
 ExampleTool::~ExampleTool() { }
 
-// Tool methods have the same signature as the generated DBus adaptors. Most
-// pertinently, this means they take their DBus::Error argument as a non-const
-// reference (hence the NOLINT). Tool methods are generally written in
-// can't-fail style, since their output is usually going to be displayed to the
-// user; instead of returning a DBus exception, we tend to return a string
-// indicating what went wrong.
-std::string ExampleTool::GetExample(DBus::Error& error) { // NOLINT
+// Tool methods have a similar signature as the generated DBus adaptors, except
+// for the DBus::Error argument, which is passed in as a pointer instead of a
+// reference. Tool methods are generally written in can't-fail style, since
+// their output is usually going to be displayed to the user; instead of
+// returning a DBus exception, we tend to return a string indicating what went
+// wrong.
+std::string ExampleTool::GetExample(DBus::Error* error) {
   std::string path;
   if (!SandboxedProcess::GetHelperPath("example", &path))
     return "<path too long>";
@@ -46,4 +44,4 @@
   return output;
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/example_tool.h b/debugd/src/example_tool.h
index 0b3c148..1232408 100644
--- a/debugd/src/example_tool.h
+++ b/debugd/src/example_tool.h
@@ -4,8 +4,8 @@
 //
 // This is an example of a tool. See </src/example_tool.cc>.
 
-#ifndef EXAMPLE_TOOL_H
-#define EXAMPLE_TOOL_H
+#ifndef EXAMPLE_TOOL_H_
+#define EXAMPLE_TOOL_H_
 
 #include <string>
 
@@ -19,11 +19,12 @@
   ExampleTool();
   ~ExampleTool();
 
-  std::string GetExample(DBus::Error& error); // NOLINT
+  std::string GetExample(DBus::Error* error);
+
  private:
   DISALLOW_COPY_AND_ASSIGN(ExampleTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // !EXAMPLE_TOOL_H
+#endif  // EXAMPLE_TOOL_H_
diff --git a/debugd/src/helpers/capture_packets.cc b/debugd/src/helpers/capture_packets.cc
index 89ce9fa..e7e4e6c 100644
--- a/debugd/src/helpers/capture_packets.cc
+++ b/debugd/src/helpers/capture_packets.cc
@@ -56,7 +56,7 @@
       continue;
     }
     ++packet_count;
-    pcap_dump((u_char *)dumper, &header, packet);
+    pcap_dump(reinterpret_cast<u_char*>(dumper), &header, packet);
   }
 
   pcap_close(pcap);
diff --git a/debugd/src/helpers/icmp.cc b/debugd/src/helpers/icmp.cc
index 2613a9f..e2776b9 100644
--- a/debugd/src/helpers/icmp.cc
+++ b/debugd/src/helpers/icmp.cc
@@ -103,21 +103,22 @@
       continue;
 
     } else if (sscanf(outbuf,
-                    "%d packets transmitted, %d received, %d%% packet loss,"
-                    " time %dms",
-                    &sent, &recvd, &loss, &time) == 4)
+                      "%d packets transmitted, %d received, %d%% packet loss,"
+                      " time %dms",
+                      &sent, &recvd, &loss, &time) == 4) {
       continue;
 
-    else if (sscanf(outbuf,
-                    "%d packets transmitted, %d received, +%d errors,"
-                    " %d%% packet loss, time %dms",
-                    &sent, &recvd, &errors, &loss, &time) == 5)
+    } else if (sscanf(outbuf,
+                      "%d packets transmitted, %d received, +%d errors,"
+                      " %d%% packet loss, time %dms",
+                      &sent, &recvd, &errors, &loss, &time) == 5) {
       continue;
 
-    else if (sscanf(outbuf,
+    } else if (sscanf(outbuf,
                     "rtt min/avg/max/mdev = %f/%f/%f/%f ms",
-                    &min, &avg, &max, &mdev) == 4)
+                    &min, &avg, &max, &mdev) == 4) {
       continue;
+    }
   }
   pclose(out);
   if (time == -1)
diff --git a/debugd/src/helpers/netif.cc b/debugd/src/helpers/netif.cc
index 8794346..61f1731 100644
--- a/debugd/src/helpers/netif.cc
+++ b/debugd/src/helpers/netif.cc
@@ -138,27 +138,27 @@
 
 // Duplicated from </src/helpers/network_status.cc>. Need to figure out how to
 // refactor these.
-class ManagerProxy
-    : public org::chromium::flimflam::Manager_proxy,
-      public DBus::ObjectProxy {
-  public:
-    ManagerProxy(DBus::Connection& connection, const char* path, // NOLINT
-                 const char* service) :
-        DBus::ObjectProxy(connection, path, service) { }
-    virtual ~ManagerProxy() { }
-    virtual void PropertyChanged(const std::string&, const DBus::Variant&) { }
-    virtual void StateChanged(const std::string&) { }
+class ManagerProxy : public org::chromium::flimflam::Manager_proxy,
+                     public DBus::ObjectProxy {
+ public:
+  ManagerProxy(DBus::Connection& connection,  // NOLINT
+               const char* path,
+               const char* service)
+      : DBus::ObjectProxy(connection, path, service) {}
+  virtual ~ManagerProxy() {}
+  virtual void PropertyChanged(const std::string&, const DBus::Variant&) {}
+  virtual void StateChanged(const std::string&) {}
 };
 
-class ServiceProxy
-    : public org::chromium::flimflam::Service_proxy,
-      public DBus::ObjectProxy {
-  public:
-    ServiceProxy(DBus::Connection& connection, const char* path, // NOLINT
-                 const char* service) :
-        DBus::ObjectProxy(connection, path, service) { }
-    virtual ~ServiceProxy() { }
-    virtual void PropertyChanged(const std::string&, const DBus::Variant&) { }
+class ServiceProxy : public org::chromium::flimflam::Service_proxy,
+                     public DBus::ObjectProxy {
+ public:
+  ServiceProxy(DBus::Connection& connection,  // NOLINT
+               const char* path,
+               const char* service)
+      : DBus::ObjectProxy(connection, path, service) {}
+  virtual ~ServiceProxy() {}
+  virtual void PropertyChanged(const std::string&, const DBus::Variant&) {}
 };
 
 class NetInterface {
diff --git a/debugd/src/helpers/network_status.cc b/debugd/src/helpers/network_status.cc
index 17746f0..8ca785a 100644
--- a/debugd/src/helpers/network_status.cc
+++ b/debugd/src/helpers/network_status.cc
@@ -21,49 +21,49 @@
 const char* kFlimflamPath = "/";
 const char* kFlimflamService = "org.chromium.flimflam";
 
-class DeviceProxy
-    : public org::chromium::flimflam::Device_proxy,
-      public DBus::ObjectProxy {
-  public:
-    DeviceProxy(DBus::Connection& connection, const char* path, // NOLINT
-                const char* service) :
-        DBus::ObjectProxy(connection, path, service) { }
-    virtual ~DeviceProxy() { }
-    virtual void PropertyChanged(const std::string&, const DBus::Variant&) { }
+class DeviceProxy : public org::chromium::flimflam::Device_proxy,
+                    public DBus::ObjectProxy {
+ public:
+  DeviceProxy(DBus::Connection& connection,  // NOLINT
+              const char* path,
+              const char* service)
+      : DBus::ObjectProxy(connection, path, service) {}
+  virtual ~DeviceProxy() {}
+  virtual void PropertyChanged(const std::string&, const DBus::Variant&) {}
 };
 
-class IPConfigProxy
-    : public org::chromium::flimflam::IPConfig_proxy,
-      public DBus::ObjectProxy {
-  public:
-    IPConfigProxy(DBus::Connection& connection, const char* path, // NOLINT
-                const char* service) :
-        DBus::ObjectProxy(connection, path, service) { }
-    virtual ~IPConfigProxy() { }
-    virtual void PropertyChanged(const std::string&, const DBus::Variant&) { }
+class IPConfigProxy : public org::chromium::flimflam::IPConfig_proxy,
+                      public DBus::ObjectProxy {
+ public:
+  IPConfigProxy(DBus::Connection& connection,  // NOLINT
+                const char* path,
+                const char* service)
+      : DBus::ObjectProxy(connection, path, service) {}
+  virtual ~IPConfigProxy() {}
+  virtual void PropertyChanged(const std::string&, const DBus::Variant&) {}
 };
 
-class ManagerProxy
-    : public org::chromium::flimflam::Manager_proxy,
-      public DBus::ObjectProxy {
-  public:
-    ManagerProxy(DBus::Connection& connection, const char* path, // NOLINT
-                 const char* service) :
-        DBus::ObjectProxy(connection, path, service) { }
-    virtual ~ManagerProxy() { }
-    virtual void PropertyChanged(const std::string&, const DBus::Variant&) { }
-    virtual void StateChanged(const std::string&) { }
+class ManagerProxy : public org::chromium::flimflam::Manager_proxy,
+                     public DBus::ObjectProxy {
+ public:
+  ManagerProxy(DBus::Connection& connection,  // NOLINT
+               const char* path,
+               const char* service)
+      : DBus::ObjectProxy(connection, path, service) {}
+  virtual ~ManagerProxy() {}
+  virtual void PropertyChanged(const std::string&, const DBus::Variant&) {}
+  virtual void StateChanged(const std::string&) {}
 };
 
-class ServiceProxy
-    : public org::chromium::flimflam::Service_proxy,
-      public DBus::ObjectProxy {
-  public:
-    ServiceProxy(DBus::Connection& connection, const char* path, // NOLINT
-                 const char* service) :
-        DBus::ObjectProxy(connection, path, service) { }
-    virtual ~ServiceProxy() { }
-    virtual void PropertyChanged(const std::string&, const DBus::Variant&) { }
+class ServiceProxy : public org::chromium::flimflam::Service_proxy,
+                     public DBus::ObjectProxy {
+ public:
+  ServiceProxy(DBus::Connection& connection,  // NOLINT
+               const char* path,
+               const char* service)
+      : DBus::ObjectProxy(connection, path, service) {}
+  virtual ~ServiceProxy() {}
+  virtual void PropertyChanged(const std::string&, const DBus::Variant&) {}
 };
 
 Value* GetService(DBus::Connection& conn, DBus::Path& path) { // NOLINT
diff --git a/debugd/src/icmp_tool.cc b/debugd/src/icmp_tool.cc
index cc28f31..488fd12 100644
--- a/debugd/src/icmp_tool.cc
+++ b/debugd/src/icmp_tool.cc
@@ -51,4 +51,4 @@
   return out;
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/icmp_tool.h b/debugd/src/icmp_tool.h
index 6d89334..b4197c4 100644
--- a/debugd/src/icmp_tool.h
+++ b/debugd/src/icmp_tool.h
@@ -2,9 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef ICMP_TOOL_H
-#define ICMP_TOOL_H
+#ifndef ICMP_TOOL_H_
+#define ICMP_TOOL_H_
 
+#include <map>
 #include <string>
 
 #include <base/basictypes.h>
@@ -22,10 +23,11 @@
       const std::string& host,
       const std::map<std::string, std::string>& options,
       DBus::Error* error);
+
  private:
   DISALLOW_COPY_AND_ASSIGN(ICMPTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // ICMP_TOOL_H
+#endif  // ICMP_TOOL_H_
diff --git a/debugd/src/log_tool.cc b/debugd/src/log_tool.cc
index 6cbe8c7..8dbac54 100644
--- a/debugd/src/log_tool.cc
+++ b/debugd/src/log_tool.cc
@@ -4,6 +4,8 @@
 
 #include "log_tool.h"
 
+#include <vector>
+
 #include <glib.h>
 
 #include <base/base64.h>
@@ -217,7 +219,7 @@
   return false;
 }
 
-string LogTool::GetLog(const string& name, DBus::Error& error) { // NOLINT
+string LogTool::GetLog(const string& name, DBus::Error* error) {
   string result;
      GetNamedLogFrom(name, common_logs, &result)
   || GetNamedLogFrom(name, extra_logs, &result)
@@ -230,14 +232,14 @@
     (*map)[logs[i].name] = Run(logs[i]);
 }
 
-LogTool::LogMap LogTool::GetAllLogs(DBus::Error& error) { // NOLINT
+LogTool::LogMap LogTool::GetAllLogs(DBus::Error* error) {
   LogMap result;
   GetLogsFrom(common_logs, &result);
   GetLogsFrom(extra_logs, &result);
   return result;
 }
 
-LogTool::LogMap LogTool::GetFeedbackLogs(DBus::Error& error) { // NOLINT
+LogTool::LogMap LogTool::GetFeedbackLogs(DBus::Error* error) {
   LogMap result;
   GetLogsFrom(common_logs, &result);
   GetLogsFrom(feedback_logs, &result);
@@ -245,7 +247,7 @@
   return result;
 }
 
-LogTool::LogMap LogTool::GetUserLogFiles(DBus::Error& error) {  // NOLINT
+LogTool::LogMap LogTool::GetUserLogFiles(DBus::Error* error) {
   LogMap result;
   for (size_t i = 0; user_logs[i].name; ++i)
     result[user_logs[i].name] = user_logs[i].command;
@@ -260,4 +262,4 @@
   }
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/log_tool.h b/debugd/src/log_tool.h
index 8dff40b..9ca678e 100644
--- a/debugd/src/log_tool.h
+++ b/debugd/src/log_tool.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 LOG_TOOL_H
-#define LOG_TOOL_H
+#ifndef LOG_TOOL_H_
+#define LOG_TOOL_H_
 
 #include <string>
 #include <map>
@@ -20,10 +20,10 @@
 
   typedef std::map<std::string, std::string> LogMap;
 
-  std::string GetLog(const std::string& name, DBus::Error& error); // NOLINT
-  LogMap GetAllLogs(DBus::Error& error); // NOLINT
-  LogMap GetFeedbackLogs(DBus::Error& error); // NOLINT
-  LogMap GetUserLogFiles(DBus::Error& error);  // NOLINT
+  std::string GetLog(const std::string& name, DBus::Error* error);
+  LogMap GetAllLogs(DBus::Error* error);
+  LogMap GetFeedbackLogs(DBus::Error* error);
+  LogMap GetUserLogFiles(DBus::Error* error);
 
  private:
   friend class LogToolTest;
@@ -33,6 +33,6 @@
   DISALLOW_COPY_AND_ASSIGN(LogTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // LOG_TOOL_H
+#endif  // LOG_TOOL_H_
diff --git a/debugd/src/memory_tool.cc b/debugd/src/memory_tool.cc
index 49140c9..7a16d60 100644
--- a/debugd/src/memory_tool.cc
+++ b/debugd/src/memory_tool.cc
@@ -10,14 +10,19 @@
 
 namespace debugd {
 
-const char* kMemtesterpath = "/usr/sbin/memtester";
+namespace {
+
+const char kMemtesterpath[] = "/usr/sbin/memtester";
+
+}  // namespace
 
 MemtesterTool::MemtesterTool() { }
+
 MemtesterTool::~MemtesterTool() { }
 
 std::string MemtesterTool::Start(const DBus::FileDescriptor& outfd,
                                  const uint32_t& memory,
-                                 DBus::Error& error) {
+                                 DBus::Error* error) {
   ProcessWithId* p = CreateProcess(false);
   if (!p)
     return "";
@@ -32,4 +37,4 @@
   return p->id();
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/memory_tool.h b/debugd/src/memory_tool.h
index 626468a..a73e782 100644
--- a/debugd/src/memory_tool.h
+++ b/debugd/src/memory_tool.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 MEMORY_TOOL_H
-#define MEMORY_TOOL_H
+#ifndef MEMORY_TOOL_H_
+#define MEMORY_TOOL_H_
 
 #include <string>
 
@@ -17,13 +17,13 @@
 class MemtesterTool : public SubprocessTool {
  public:
   MemtesterTool();
-  ~MemtesterTool();
+  virtual ~MemtesterTool();
 
   std::string Start(const DBus::FileDescriptor& outfd,
                     const uint32_t& memory,
-                    DBus::Error& error);
+                    DBus::Error* error);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // !TRACEPATH_TOOL_H
+#endif  // MEMORY_TOOL_H_
diff --git a/debugd/src/modem_status_tool.cc b/debugd/src/modem_status_tool.cc
index 4fcffb2..bffd8de 100644
--- a/debugd/src/modem_status_tool.cc
+++ b/debugd/src/modem_status_tool.cc
@@ -16,7 +16,7 @@
 ModemStatusTool::ModemStatusTool() { }
 ModemStatusTool::~ModemStatusTool() { }
 
-std::string ModemStatusTool::GetModemStatus(DBus::Error& error) { // NOLINT
+std::string ModemStatusTool::GetModemStatus(DBus::Error* error) {
   if (!USE_CELLULAR)
     return "";
 
diff --git a/debugd/src/modem_status_tool.h b/debugd/src/modem_status_tool.h
index be01937..8cee1e0 100644
--- a/debugd/src/modem_status_tool.h
+++ b/debugd/src/modem_status_tool.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 MODEM_STATUS_TOOL_H
-#define MODEM_STATUS_TOOL_H
+#ifndef MODEM_STATUS_TOOL_H_
+#define MODEM_STATUS_TOOL_H_
 
 #include <string>
 
@@ -16,21 +16,18 @@
  public:
   ModemStatusTool();
   ~ModemStatusTool();
-
-  std::string GetModemStatus(DBus::Error& error); // NOLINT
-
-  std::string RunModemCommand(const std::string& command); // NOLINT
+  std::string GetModemStatus(DBus::Error* error);
+  std::string RunModemCommand(const std::string& command);
 
  private:
   friend class ModemStatusToolTest;
 
-  std::string SendATCommand(const std::string& command); // NOLINT
-
-  static std::string CollapseNewLines(const std::string& input);  // NOLINT
+  std::string SendATCommand(const std::string& command);
+  static std::string CollapseNewLines(const std::string& input);
 
   DISALLOW_COPY_AND_ASSIGN(ModemStatusTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // MODEM_STATUS_TOOL_H
+#endif  // MODEM_STATUS_TOOL_H_
diff --git a/debugd/src/netif_tool.h b/debugd/src/netif_tool.h
index f0b7493..8b91cf9 100644
--- a/debugd/src/netif_tool.h
+++ b/debugd/src/netif_tool.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 NETIF_TOOL_H
-#define NETIF_TOOL_H
+#ifndef NETIF_TOOL_H_
+#define NETIF_TOOL_H_
 
 #include <string>
 
@@ -18,10 +18,11 @@
   ~NetifTool();
 
   std::string GetInterfaces(DBus::Error* error);
+
  private:
   DISALLOW_COPY_AND_ASSIGN(NetifTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // NETIF_TOOL_H
+#endif  // NETIF_TOOL_H_
diff --git a/debugd/src/network_status_tool.cc b/debugd/src/network_status_tool.cc
index 6944f33..5141fc3 100644
--- a/debugd/src/network_status_tool.cc
+++ b/debugd/src/network_status_tool.cc
@@ -15,7 +15,7 @@
 NetworkStatusTool::NetworkStatusTool() { }
 NetworkStatusTool::~NetworkStatusTool() { }
 
-std::string NetworkStatusTool::GetNetworkStatus(DBus::Error& error) { // NOLINT
+std::string NetworkStatusTool::GetNetworkStatus(DBus::Error* error) {
   std::string path;
   if (!SandboxedProcess::GetHelperPath("network_status", &path))
     return "";
@@ -29,4 +29,4 @@
   return out;
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/network_status_tool.h b/debugd/src/network_status_tool.h
index c4abbf7..01bbcea 100644
--- a/debugd/src/network_status_tool.h
+++ b/debugd/src/network_status_tool.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 NETWORK_STATUS_TOOL_H
-#define NETWORK_STATUS_TOOL_H
+#ifndef NETWORK_STATUS_TOOL_H_
+#define NETWORK_STATUS_TOOL_H_
 
 #include <string>
 
@@ -17,11 +17,12 @@
   NetworkStatusTool();
   ~NetworkStatusTool();
 
-  std::string GetNetworkStatus(DBus::Error& error); // NOLINT
+  std::string GetNetworkStatus(DBus::Error* error);
+
  private:
   DISALLOW_COPY_AND_ASSIGN(NetworkStatusTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // NETWORK_STATUS_TOOL_H
+#endif  // NETWORK_STATUS_TOOL_H_
diff --git a/debugd/src/packet_capture_tool.cc b/debugd/src/packet_capture_tool.cc
index f2fab9c..e1a7b22 100644
--- a/debugd/src/packet_capture_tool.cc
+++ b/debugd/src/packet_capture_tool.cc
@@ -20,7 +20,7 @@
     const DBus::FileDescriptor& status_fd,
     const DBus::FileDescriptor& output_fd,
     const std::map<std::string, DBus::Variant>& options,
-    DBus::Error& error) {
+    DBus::Error* error) {
   std::string exec_path;
   if (!SandboxedProcess::GetHelperPath("capture_utility.sh", &exec_path))
     return "<path too long>";
@@ -38,7 +38,7 @@
   }
   AddValidatedStringOption(options, "ht_location", "--ht-location", p);
   AddValidatedStringOption(
-      options, "monitor_connection_on","--monitor-connection-on", p);
+      options, "monitor_connection_on", "--monitor-connection-on", p);
 
   // Pass the output fd of the pcap as a command line option to the child
   // process.
@@ -75,4 +75,4 @@
   return true;
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/packet_capture_tool.h b/debugd/src/packet_capture_tool.h
index f4fcace..a0be608 100644
--- a/debugd/src/packet_capture_tool.h
+++ b/debugd/src/packet_capture_tool.h
@@ -2,9 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef PACKET_CAPTURE_TOOL_H
-#define PACKET_CAPTURE_TOOL_H
+#ifndef PACKET_CAPTURE_TOOL_H_
+#define PACKET_CAPTURE_TOOL_H_
 
+#include <map>
 #include <string>
 
 #include <base/basictypes.h>
@@ -19,13 +20,13 @@
 class PacketCaptureTool : public SubprocessTool {
  public:
   PacketCaptureTool();
-  ~PacketCaptureTool();
+  virtual ~PacketCaptureTool();
 
   std::string Start(
       const DBus::FileDescriptor& status_fd,
       const DBus::FileDescriptor& output_fd,
       const std::map<std::string, DBus::Variant>& options,
-      DBus::Error& error); // NOLINT
+      DBus::Error* error);
 
  private:
   static bool AddValidatedStringOption(
@@ -37,6 +38,6 @@
   DISALLOW_COPY_AND_ASSIGN(PacketCaptureTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // !PACKET_CAPTURE_TOOL_H
+#endif  // PACKET_CAPTURE_TOOL_H_
diff --git a/debugd/src/perf_tool.cc b/debugd/src/perf_tool.cc
index bc13459..64264c4 100644
--- a/debugd/src/perf_tool.cc
+++ b/debugd/src/perf_tool.cc
@@ -4,8 +4,6 @@
 
 #include "perf_tool.h"
 
-#include <fstream>
-
 #include <base/strings/string_split.h>
 
 #include "cpu_info_parser.h"
@@ -59,22 +57,15 @@
   cpu_info_parser.GetKey(kCPUModelNameKey, &cpu_model_name);
   std::string odds_filename;
   GetOddsFilenameForCPU(cpu_model_name, &odds_filename);
-  std::string odds_file_path = std::string(kCPUOddsFilePrefix) +
-      odds_filename +
-      kCPUOddsFileSuffix;
+  std::string odds_file_path =
+      std::string(kCPUOddsFilePrefix) + odds_filename + kCPUOddsFileSuffix;
   random_selector_.SetOddsFromFile(odds_file_path);
 }
 
 PerfTool::~PerfTool() { }
 
-// Tool methods have the same signature as the generated DBus adaptors. Most
-// pertinently, this means they take their DBus::Error argument as a non-const
-// reference (hence the NOLINT). Tool methods are generally written in
-// can't-fail style, since their output is usually going to be displayed to the
-// user; instead of returning a DBus exception, we tend to return a string
-// indicating what went wrong.
 std::vector<uint8> PerfTool::GetRichPerfData(const uint32_t& duration_secs,
-                                             DBus::Error& error) { // NOLINT
+                                             DBus::Error* error) {
   std::string perf_command_line;
   random_selector_.GetNext(&perf_command_line);
   std::string output_string;
@@ -84,8 +75,8 @@
 
 void PerfTool::GetPerfDataHelper(const uint32_t& duration_secs,
                                  const std::string& perf_command_line,
-                                 DBus::Error& error,
-                                 std::string* data_string) { // NOLINT
+                                 DBus::Error* error,
+                                 std::string* data_string) {
   // This whole method is synchronous, so we create a subprocess, let it run to
   // completion, then gather up its output to return it.
   ProcessWithOutput process;
@@ -105,5 +96,4 @@
   process.GetOutput(data_string);
 }
 
-};  // namespace debugd
-
+}  // namespace debugd
diff --git a/debugd/src/perf_tool.h b/debugd/src/perf_tool.h
index 107e601..dbbb5aa 100644
--- a/debugd/src/perf_tool.h
+++ b/debugd/src/perf_tool.h
@@ -2,10 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef PERF_TOOL_H
-#define PERF_TOOL_H
+#ifndef PERF_TOOL_H_
+#define PERF_TOOL_H_
 
 #include <string>
+#include <vector>
 
 #include <base/basictypes.h>
 #include <dbus-c++/dbus.h>
@@ -23,21 +24,20 @@
   // for |duration_secs| seconds and returns a protobuf containing the collected
   // data.
   std::vector<uint8> GetRichPerfData(const uint32_t& duration_secs,
-                                     DBus::Error& error); // NOLINT
+                                     DBus::Error* error);
  private:
   // Helper function that runs perf for a given |duration_secs| returning the
   // collected data in |data_string|.
   void GetPerfDataHelper(const uint32_t& duration_secs,
                          const std::string& perf_command_line,
-                         DBus::Error& error,
-                         std::string* data_string); // NOLINT
+                         DBus::Error* error,
+                         std::string* data_string);
 
   RandomSelector random_selector_;
 
   DISALLOW_COPY_AND_ASSIGN(PerfTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // !PERF_TOOL_H
-
+#endif  // PERF_TOOL_H_
diff --git a/debugd/src/ping_tool.cc b/debugd/src/ping_tool.cc
index bdad5f2..19d16e4 100644
--- a/debugd/src/ping_tool.cc
+++ b/debugd/src/ping_tool.cc
@@ -19,9 +19,8 @@
 
 std::string PingTool::Start(const DBus::FileDescriptor& outfd,
                             const std::string& destination,
-                            const std::map<std::string, DBus::Variant>&
-                                options,
-                            DBus::Error& error) {
+                            const std::map<std::string, DBus::Variant>& options,
+                            DBus::Error* error) {
   ProcessWithId* p = CreateProcess(true);
   if (!p)
     return "";
@@ -56,4 +55,4 @@
   return p->id();
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/ping_tool.h b/debugd/src/ping_tool.h
index cb44182..abc8ae1 100644
--- a/debugd/src/ping_tool.h
+++ b/debugd/src/ping_tool.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 PING_TOOL_H
-#define PING_TOOL_H
+#ifndef PING_TOOL_H_
+#define PING_TOOL_H_
 
 #include <map>
 #include <string>
@@ -18,14 +18,14 @@
 class PingTool : public SubprocessTool {
  public:
   PingTool();
-  ~PingTool();
+  virtual ~PingTool();
 
   std::string Start(const DBus::FileDescriptor& outfd,
                     const std::string& destination,
                     const std::map<std::string, DBus::Variant>& options,
-                    DBus::Error& error);
+                    DBus::Error* error);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // PING_TOOL_H
+#endif  // PING_TOOL_H_
diff --git a/debugd/src/process_with_id.cc b/debugd/src/process_with_id.cc
index 5e32400..daf950f 100644
--- a/debugd/src/process_with_id.cc
+++ b/debugd/src/process_with_id.cc
@@ -11,15 +11,15 @@
 
 namespace debugd {
 
-ProcessWithId::ProcessWithId() { }
+ProcessWithId::ProcessWithId() {}
 
 bool ProcessWithId::Init() {
-  return SandboxedProcess::Init() && generate_id();
+  return SandboxedProcess::Init() && GenerateId();
 }
 
-bool ProcessWithId::generate_id() {
+bool ProcessWithId::GenerateId() {
   char buf[16];
-  FILE *urandom = fopen("/dev/urandom", "r");
+  FILE* urandom = fopen("/dev/urandom", "r");
   if (!urandom) {
       PLOG(ERROR) << "Can't open /dev/urandom";
       return false;
@@ -35,4 +35,4 @@
   return true;
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/process_with_id.h b/debugd/src/process_with_id.h
index 527e5fc..65d0cef 100644
--- a/debugd/src/process_with_id.h
+++ b/debugd/src/process_with_id.h
@@ -2,8 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef PROCESS_WITH_ID_H
-#define PROCESS_WITH_ID_H
+#ifndef PROCESS_WITH_ID_H_
+#define PROCESS_WITH_ID_H_
+
+#include <string>
 
 #include "sandboxed_process.h"
 
@@ -17,12 +19,13 @@
  public:
   ProcessWithId();
   virtual bool Init();
-  std::string id() const { return id_; }
+  const std::string& id() const { return id_; }
+
  private:
-  bool generate_id();
+  bool GenerateId();
   std::string id_;
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // PROCESS_WITH_ID_H
+#endif  // PROCESS_WITH_ID_H_
diff --git a/debugd/src/process_with_output.cc b/debugd/src/process_with_output.cc
index beee1e3..1cfe332 100644
--- a/debugd/src/process_with_output.cc
+++ b/debugd/src/process_with_output.cc
@@ -48,4 +48,4 @@
   return base::ReadFileToString(outfile_path_, output);
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/process_with_output.h b/debugd/src/process_with_output.h
index 9e34153..89c5627 100644
--- a/debugd/src/process_with_output.h
+++ b/debugd/src/process_with_output.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 PROCESS_WITH_OUTPUT_H
-#define PROCESS_WITH_OUTPUT_H
+#ifndef PROCESS_WITH_OUTPUT_H_
+#define PROCESS_WITH_OUTPUT_H_
 
 #include <string>
 #include <vector>
@@ -24,11 +24,12 @@
   virtual bool Init();
   bool GetOutput(std::string* output);
   bool GetOutputLines(std::vector<std::string>* output);
+
  private:
   base::FilePath outfile_path_;
   FILE *outfile_;
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // PROCESS_WITH_OUTPUT_H
+#endif  // PROCESS_WITH_OUTPUT_H_
diff --git a/debugd/src/random_selector.cc b/debugd/src/random_selector.cc
index 62fc6bd..d619547 100644
--- a/debugd/src/random_selector.cc
+++ b/debugd/src/random_selector.cc
@@ -4,7 +4,7 @@
 
 #include "random_selector.h"
 
-#include <fstream>
+#include <fstream>  // NOLINT
 #include <map>
 #include <cstdlib>
 #include <string>
diff --git a/debugd/src/route_tool.cc b/debugd/src/route_tool.cc
index 47ebe83..8e81b30 100644
--- a/debugd/src/route_tool.cc
+++ b/debugd/src/route_tool.cc
@@ -16,10 +16,8 @@
 RouteTool::RouteTool() { }
 RouteTool::~RouteTool() { }
 
-std::vector<std::string> RouteTool::GetRoutes(const std::map<std::string,
-                                                             DBus::Variant>&
-                                                  options,
-                                              DBus::Error& error) {
+std::vector<std::string> RouteTool::GetRoutes(
+    const std::map<std::string, DBus::Variant>& options, DBus::Error* error) {
   std::vector<std::string> result;
   ProcessWithOutput p;
   if (!p.Init())
@@ -35,4 +33,4 @@
   return result;
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/route_tool.h b/debugd/src/route_tool.h
index 9a6d76e..cd71ee7 100644
--- a/debugd/src/route_tool.h
+++ b/debugd/src/route_tool.h
@@ -2,10 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef ROUTE_TOOL_H
-#define ROUTE_TOOL_H
+#ifndef ROUTE_TOOL_H_
+#define ROUTE_TOOL_H_
 
+#include <map>
 #include <string>
+#include <vector>
 
 #include <base/basictypes.h>
 #include <dbus-c++/dbus.h>
@@ -17,13 +19,13 @@
   RouteTool();
   ~RouteTool();
 
-  std::vector<std::string> GetRoutes(const std::map<std::string,
-                                                     DBus::Variant>& options,
-                                      DBus::Error& error);
+  std::vector<std::string> GetRoutes(
+      const std::map<std::string, DBus::Variant>& options, DBus::Error* error);
+
  private:
   DISALLOW_COPY_AND_ASSIGN(RouteTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // ROUTE_TOOL_H
+#endif  // ROUTE_TOOL_H_
diff --git a/debugd/src/sandboxed_process.cc b/debugd/src/sandboxed_process.cc
index 7499229..be58963 100644
--- a/debugd/src/sandboxed_process.cc
+++ b/debugd/src/sandboxed_process.cc
@@ -63,4 +63,4 @@
   group_ = group;
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/sandboxed_process.h b/debugd/src/sandboxed_process.h
index f335be0..e999a98 100644
--- a/debugd/src/sandboxed_process.h
+++ b/debugd/src/sandboxed_process.h
@@ -2,8 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef SANDBOXED_PROCESS_H
-#define SANDBOXED_PROCESS_H
+#ifndef SANDBOXED_PROCESS_H_
+#define SANDBOXED_PROCESS_H_
+
+#include <string>
 
 #include <chromeos/process.h>
 
@@ -37,6 +39,6 @@
   std::string group_;
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // SANDBOXED_PROCESS_H
+#endif  // SANDBOXED_PROCESS_H_
diff --git a/debugd/src/storage_tool.cc b/debugd/src/storage_tool.cc
index 959d865..fd99e86 100644
--- a/debugd/src/storage_tool.cc
+++ b/debugd/src/storage_tool.cc
@@ -19,7 +19,7 @@
 StorageTool::~StorageTool() { }
 
 std::string StorageTool::Smartctl(const std::string& option,
-                                  DBus::Error& error) {
+                                  DBus::Error* error) {
   std::string path;
   if (!SandboxedProcess::GetHelperPath("storage", &path))
     return "<path too long>";
@@ -55,7 +55,7 @@
 }
 
 std::string StorageTool::Start(const DBus::FileDescriptor& outfd,
-                               DBus::Error& error) {
+                               DBus::Error* error) {
   ProcessWithId* p = CreateProcess(false);
   if (!p)
     return "";
@@ -70,4 +70,4 @@
   return p->id();
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/storage_tool.h b/debugd/src/storage_tool.h
index 3cbc0b2..366f005 100644
--- a/debugd/src/storage_tool.h
+++ b/debugd/src/storage_tool.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 STORAGE_TOOL_H
-#define STORAGE_TOOL_H
+#ifndef STORAGE_TOOL_H_
+#define STORAGE_TOOL_H_
 
 #include <string>
 
@@ -17,16 +17,15 @@
 class StorageTool : public SubprocessTool {
  public:
   StorageTool();
-  ~StorageTool();
+  virtual ~StorageTool();
 
-  std::string Smartctl(const std::string& option,
-                       DBus::Error& error); // NOLINT
-  std::string Start(const DBus::FileDescriptor& outfd,
-                    DBus::Error& error);
+  std::string Smartctl(const std::string& option, DBus::Error* error);
+  std::string Start(const DBus::FileDescriptor& outfd, DBus::Error* error);
+
  private:
   DISALLOW_COPY_AND_ASSIGN(StorageTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // !STORAGE_TOOL_H
+#endif  // STORAGE_TOOL_H_
diff --git a/debugd/src/subprocess_tool.cc b/debugd/src/subprocess_tool.cc
index 1adeca0..a409455 100644
--- a/debugd/src/subprocess_tool.cc
+++ b/debugd/src/subprocess_tool.cc
@@ -4,15 +4,19 @@
 
 #include "subprocess_tool.h"
 
-#include <dbus-c++/dbus.h>
 #include <signal.h>
 
+#include <dbus-c++/dbus.h>
+
 #include "process_with_id.h"
 
 namespace debugd {
 
-const char* kErrorNoSuchProcess =
-    "org.chromium.debugd.error.NoSuchProcess";
+namespace {
+
+const char kErrorNoSuchProcess[] = "org.chromium.debugd.error.NoSuchProcess";
+
+}  // namespace
 
 SubprocessTool::SubprocessTool() { }
 SubprocessTool::~SubprocessTool() { }
@@ -27,9 +31,9 @@
   return p;
 }
 
-void SubprocessTool::Stop(const std::string& handle, DBus::Error& error) {
+void SubprocessTool::Stop(const std::string& handle, DBus::Error* error) {
   if (processes_.count(handle) != 1) {
-    error.set(kErrorNoSuchProcess, handle.c_str());
+    error->set(kErrorNoSuchProcess, handle.c_str());
     return;
   }
   ProcessWithId* p = processes_[handle];
@@ -39,4 +43,4 @@
   delete p;
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/subprocess_tool.h b/debugd/src/subprocess_tool.h
index 898f02d..6b489f3 100644
--- a/debugd/src/subprocess_tool.h
+++ b/debugd/src/subprocess_tool.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 SUBPROCESS_TOOL_H
-#define SUBPROCESS_TOOL_H
+#ifndef SUBPROCESS_TOOL_H_
+#define SUBPROCESS_TOOL_H_
 
 #include <map>
 #include <string>
@@ -21,12 +21,14 @@
   virtual ~SubprocessTool();
 
   virtual ProcessWithId* CreateProcess(bool sandbox);
-  virtual void Stop(const std::string& handle, DBus::Error& error);
+  virtual void Stop(const std::string& handle, DBus::Error* error);
+
  private:
   std::map<std::string, ProcessWithId*> processes_;
+
   DISALLOW_COPY_AND_ASSIGN(SubprocessTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // SUBPROCESS_TOOL_H
+#endif  // SUBPROCESS_TOOL_H_
diff --git a/debugd/src/sysrq_tool.cc b/debugd/src/sysrq_tool.cc
index 625ee15..863e5c0 100644
--- a/debugd/src/sysrq_tool.cc
+++ b/debugd/src/sysrq_tool.cc
@@ -15,18 +15,18 @@
 
 SysrqTool::~SysrqTool() { }
 
-void SysrqTool::LogKernelTaskStates(DBus::Error& error) { // NOLINT
+void SysrqTool::LogKernelTaskStates(DBus::Error* error) {
   int sysrq_trigger = open("/proc/sysrq-trigger", O_WRONLY | O_CLOEXEC);
   if (sysrq_trigger < 0) {
-    error.set(kErrorSysrq, "open");
+    error->set(kErrorSysrq, "open");
     return;
   }
   ssize_t written = write(sysrq_trigger, "t", 1);
   close(sysrq_trigger);
   if (written < 1) {
-    error.set(kErrorSysrq, "write");
+    error->set(kErrorSysrq, "write");
     return;
   }
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/sysrq_tool.h b/debugd/src/sysrq_tool.h
index 1d3b2d7..851d507 100644
--- a/debugd/src/sysrq_tool.h
+++ b/debugd/src/sysrq_tool.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 SYSRQ_TOOL_H
-#define SYSRQ_TOOL_H
+#ifndef SYSRQ_TOOL_H_
+#define SYSRQ_TOOL_H_
 
 #include <base/basictypes.h>
 #include <dbus-c++/dbus.h>
@@ -15,11 +15,12 @@
   SysrqTool();
   ~SysrqTool();
 
-  void LogKernelTaskStates(DBus::Error& error); // NOLINT
+  void LogKernelTaskStates(DBus::Error* error);
+
  private:
   DISALLOW_COPY_AND_ASSIGN(SysrqTool);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // SYSRQ_TOOL_H
+#endif  // SYSRQ_TOOL_H_
diff --git a/debugd/src/systrace_tool.cc b/debugd/src/systrace_tool.cc
index 10b3ca3..fb91337 100644
--- a/debugd/src/systrace_tool.cc
+++ b/debugd/src/systrace_tool.cc
@@ -5,20 +5,28 @@
 #include "systrace_tool.h"
 
 #include <string>
-#include <base/strings/string_split.h>
+#include <vector>
 
+#include <base/strings/string_split.h>
 #include <chromeos/process.h>
 
 #include "process_with_output.h"
 
-using base::StringPrintf;
-
 namespace debugd {
 
 namespace {
 
 const char kSystraceHelper[] = "systrace.sh";
 
+void AddCategoryArgs(ProcessWithOutput* p, const std::string& categories) {
+  std::vector<std::string> pieces;
+  base::SplitString(categories, ' ', &pieces);
+  for (std::vector<std::string>::iterator it = pieces.begin();
+       it != pieces.end();
+       it++)
+    p->AddArg(*it);
+}
+
 }  // namespace
 
 extern const char *kDebugfsGroup;
@@ -26,20 +34,8 @@
 SystraceTool::SystraceTool() { }
 SystraceTool::~SystraceTool() { }
 
-static void add_category_args(ProcessWithOutput& p,
-    const std::string& categories)
-{
-  std::string temp(categories);
-  std::vector<std::string> pieces;
-  base::SplitString(temp, ' ', &pieces);
-  for (std::vector<std::string>::iterator it = pieces.begin();
-      it < pieces.end();
-      it++)
-    p.AddArg(*it);
-}
-
 std::string SystraceTool::Start(const std::string& categories,
-                                DBus::Error& error) {
+                                DBus::Error* error) {
   std::string path;
   if (!SandboxedProcess::GetHelperPath(kSystraceHelper, &path))
     return "";
@@ -50,15 +46,14 @@
   p.Init();
   p.AddArg(path);
   p.AddArg("start");
-  add_category_args(p, categories);
+  AddCategoryArgs(&p, categories);
   p.Run();
   std::string out;
   p.GetOutput(&out);
   return out;
 }
 
-void SystraceTool::Stop(const DBus::FileDescriptor& outfd,
-    DBus::Error& error) {
+void SystraceTool::Stop(const DBus::FileDescriptor& outfd, DBus::Error* error) {
   std::string path;
   if (!SandboxedProcess::GetHelperPath(kSystraceHelper, &path))
     return;
@@ -73,7 +68,7 @@
   p.Run();
 }
 
-std::string SystraceTool::Status(DBus::Error& error) {
+std::string SystraceTool::Status(DBus::Error* error) {
   std::string path;
   if (!SandboxedProcess::GetHelperPath(kSystraceHelper, &path))
     return "";
@@ -89,4 +84,4 @@
   return out;
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/systrace_tool.h b/debugd/src/systrace_tool.h
index 1be168c..4b21f33 100644
--- a/debugd/src/systrace_tool.h
+++ b/debugd/src/systrace_tool.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 SYSTRACE_TOOL_H
-#define SYSTRACE_TOOL_H
+#ifndef SYSTRACE_TOOL_H_
+#define SYSTRACE_TOOL_H_
 
 #include <map>
 #include <string>
@@ -20,11 +20,11 @@
   SystraceTool();
   ~SystraceTool();
 
-  std::string Start(const std::string& categories, DBus::Error& error);
-  void Stop(const DBus::FileDescriptor& outfd, DBus::Error& error);
-  std::string Status(DBus::Error& error);
+  std::string Start(const std::string& categories, DBus::Error* error);
+  void Stop(const DBus::FileDescriptor& outfd, DBus::Error* error);
+  std::string Status(DBus::Error* error);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // SYSTRACE_TOOL_H
+#endif  // SYSTRACE_TOOL_H_
diff --git a/debugd/src/tracepath_tool.cc b/debugd/src/tracepath_tool.cc
index 71ff3f2..0dcbef5 100644
--- a/debugd/src/tracepath_tool.cc
+++ b/debugd/src/tracepath_tool.cc
@@ -4,23 +4,20 @@
 
 #include "tracepath_tool.h"
 
-#include <map>
-#include <string>
-
 #include "process_with_id.h"
 
 namespace debugd {
 
-const char* kTracepath = "/usr/sbin/tracepath";
+const char kTracepath[] = "/usr/sbin/tracepath";
 
 TracePathTool::TracePathTool() { }
 TracePathTool::~TracePathTool() { }
 
-std::string TracePathTool::Start(const DBus::FileDescriptor& outfd,
-                                 const std::string& destination,
-                                 const std::map<std::string, DBus::Variant>&
-                                     options,
-                                 DBus::Error& error) {
+std::string TracePathTool::Start(
+    const DBus::FileDescriptor& outfd,
+    const std::string& destination,
+    const std::map<std::string, DBus::Variant>& options,
+    DBus::Error* error) {
   ProcessWithId* p = CreateProcess(true);
   if (!p)
     return "";
@@ -36,4 +33,4 @@
   return p->id();
 }
 
-};  // namespace debugd
+}  // namespace debugd
diff --git a/debugd/src/tracepath_tool.h b/debugd/src/tracepath_tool.h
index e307147..3119332 100644
--- a/debugd/src/tracepath_tool.h
+++ b/debugd/src/tracepath_tool.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 TRACEPATH_TOOL_H
-#define TRACEPATH_TOOL_H
+#ifndef TRACEPATH_TOOL_H_
+#define TRACEPATH_TOOL_H_
 
 #include <map>
 #include <string>
@@ -18,14 +18,14 @@
 class TracePathTool : public SubprocessTool {
  public:
   TracePathTool();
-  ~TracePathTool();
+  virtual ~TracePathTool();
 
   std::string Start(const DBus::FileDescriptor& outfd,
                     const std::string& destination,
                     const std::map<std::string, DBus::Variant>& options,
-                    DBus::Error& error);
+                    DBus::Error* error);
 };
 
-};  // namespace debugd
+}  // namespace debugd
 
-#endif  // PING_TOOL_H
+#endif  // TRACEPATH_TOOL_H_
diff --git a/debugd/src/wimax_status_tool.cc b/debugd/src/wimax_status_tool.cc
index 6f1844c..15ae53a 100644
--- a/debugd/src/wimax_status_tool.cc
+++ b/debugd/src/wimax_status_tool.cc
@@ -15,7 +15,7 @@
 WiMaxStatusTool::WiMaxStatusTool() {}
 WiMaxStatusTool::~WiMaxStatusTool() {}
 
-std::string WiMaxStatusTool::GetWiMaxStatus(DBus::Error& error) {  // NOLINT
+std::string WiMaxStatusTool::GetWiMaxStatus(DBus::Error* error) {
   if (!USE_WIMAX)
     return "";
 
diff --git a/debugd/src/wimax_status_tool.h b/debugd/src/wimax_status_tool.h
index fbe9281..a1ba1dd 100644
--- a/debugd/src/wimax_status_tool.h
+++ b/debugd/src/wimax_status_tool.h
@@ -5,6 +5,8 @@
 #ifndef WIMAX_STATUS_TOOL_H_
 #define WIMAX_STATUS_TOOL_H_
 
+#include <string>
+
 #include <base/basictypes.h>
 #include <dbus-c++/dbus.h>
 
@@ -15,7 +17,7 @@
   WiMaxStatusTool();
   ~WiMaxStatusTool();
 
-  std::string GetWiMaxStatus(DBus::Error& error);  // NOLINT
+  std::string GetWiMaxStatus(DBus::Error* error);
 
  private:
   DISALLOW_COPY_AND_ASSIGN(WiMaxStatusTool);