Improves conformance to the Google C++ Style Guide (by Greg Miller).

git-svn-id: http://googletest.googlecode.com/svn/trunk@607 861a406c-534a-0410-8894-cb66d6ee9925
diff --git a/include/gtest/gtest-spi.h b/include/gtest/gtest-spi.h
index b226e55..f63fa9a 100644
--- a/include/gtest/gtest-spi.h
+++ b/include/gtest/gtest-spi.h
@@ -223,7 +223,7 @@
         (substr));\
     {\
       ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
-          ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS,\
+          ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
           &gtest_failures);\
       if (::testing::internal::AlwaysTrue()) { statement; }\
     }\
diff --git a/include/gtest/gtest-test-part.h b/include/gtest/gtest-test-part.h
index 8aeea14..4615147 100644
--- a/include/gtest/gtest-test-part.h
+++ b/include/gtest/gtest-test-part.h
@@ -96,6 +96,7 @@
 
   // Returns true iff the test part fatally failed.
   bool fatally_failed() const { return type_ == kFatalFailure; }
+
  private:
   Type type_;
 
diff --git a/include/gtest/gtest.h b/include/gtest/gtest.h
index c196990..2d570a2 100644
--- a/include/gtest/gtest.h
+++ b/include/gtest/gtest.h
@@ -52,6 +52,7 @@
 #define GTEST_INCLUDE_GTEST_GTEST_H_
 
 #include <limits>
+#include <ostream>
 #include <vector>
 
 #include "gtest/internal/gtest-internal.h"
@@ -672,7 +673,6 @@
   const TestResult* result() const { return &result_; }
 
  private:
-
 #if GTEST_HAS_DEATH_TEST
   friend class internal::DefaultDeathTestFactory;
 #endif  // GTEST_HAS_DEATH_TEST
@@ -1456,11 +1456,11 @@
 // Implements the helper function for {ASSERT|EXPECT}_LE
 GTEST_IMPL_CMP_HELPER_(LE, <=);
 // Implements the helper function for {ASSERT|EXPECT}_LT
-GTEST_IMPL_CMP_HELPER_(LT, < );
+GTEST_IMPL_CMP_HELPER_(LT, <);
 // Implements the helper function for {ASSERT|EXPECT}_GE
 GTEST_IMPL_CMP_HELPER_(GE, >=);
 // Implements the helper function for {ASSERT|EXPECT}_GT
-GTEST_IMPL_CMP_HELPER_(GT, > );
+GTEST_IMPL_CMP_HELPER_(GT, >);
 
 #undef GTEST_IMPL_CMP_HELPER_
 
diff --git a/include/gtest/gtest_pred_impl.h b/include/gtest/gtest_pred_impl.h
index 3805f85..30ae712 100644
--- a/include/gtest/gtest_pred_impl.h
+++ b/include/gtest/gtest_pred_impl.h
@@ -27,7 +27,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-// This file is AUTOMATICALLY GENERATED on 09/24/2010 by command
+// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
 // 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!
 //
 // Implements a family of generic predicate assertion macros.
@@ -98,7 +98,7 @@
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT1.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, v1),\
+  GTEST_ASSERT_(pred_format(#v1, v1), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED1.  Don't use
@@ -144,7 +144,7 @@
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT2.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2),\
+  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED2.  Don't use
@@ -197,7 +197,7 @@
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT3.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3),\
+  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED3.  Don't use
@@ -257,7 +257,7 @@
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT4.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4),\
+  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED4.  Don't use
@@ -324,7 +324,7 @@
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT5.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
-  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5),\
+  GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED5.  Don't use
diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h
index 0493892..3c8463b 100644
--- a/include/gtest/internal/gtest-port.h
+++ b/include/gtest/internal/gtest-port.h
@@ -812,6 +812,7 @@
       ptr_ = p;
     }
   }
+
  private:
   T* ptr_;
 
@@ -1110,7 +1111,7 @@
   // Blocks until the controller thread notifies. Must be called from a test
   // thread.
   void WaitForNotification() {
-    while(!notified_) {
+    while (!notified_) {
       SleepMilliseconds(10);
     }
   }
@@ -1754,7 +1755,6 @@
 template <>
 class TypeWithSize<8> {
  public:
-
 #if GTEST_OS_WINDOWS
   typedef __int64 Int;
   typedef unsigned __int64 UInt;
diff --git a/include/gtest/internal/gtest-string.h b/include/gtest/internal/gtest-string.h
index dc3a07b..a902450 100644
--- a/include/gtest/internal/gtest-string.h
+++ b/include/gtest/internal/gtest-string.h
@@ -47,10 +47,10 @@
 #endif
 
 #include <string.h>
-#include "gtest/internal/gtest-port.h"
-
 #include <string>
 
+#include "gtest/internal/gtest-port.h"
+
 namespace testing {
 namespace internal {
 
@@ -223,14 +223,14 @@
   // Converting a ::std::string or ::string containing an embedded NUL
   // character to a String will result in the prefix up to the first
   // NUL character.
-  String(const ::std::string& str) {
+  String(const ::std::string& str) {  // NOLINT
     ConstructNonNull(str.c_str(), str.length());
   }
 
   operator ::std::string() const { return ::std::string(c_str(), length()); }
 
 #if GTEST_HAS_GLOBAL_STRING
-  String(const ::string& str) {
+  String(const ::string& str) {  // NOLINT
     ConstructNonNull(str.c_str(), str.length());
   }
 
diff --git a/include/gtest/internal/gtest-tuple.h b/include/gtest/internal/gtest-tuple.h
index d1af50e..399e84d 100644
--- a/include/gtest/internal/gtest-tuple.h
+++ b/include/gtest/internal/gtest-tuple.h
@@ -1,4 +1,6 @@
-// This file was GENERATED by a script.  DO NOT EDIT BY HAND!!!
+// This file was GENERATED by command:
+//     pump.py gtest-tuple.h.pump
+// DO NOT EDIT BY HAND!!!
 
 // Copyright 2009 Google Inc.
 // All Rights Reserved.
@@ -140,34 +142,54 @@
 struct TupleElement;
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> { typedef T0 type; };
+struct TupleElement<true, 0, GTEST_10_TUPLE_(T)> {
+  typedef T0 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> { typedef T1 type; };
+struct TupleElement<true, 1, GTEST_10_TUPLE_(T)> {
+  typedef T1 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> { typedef T2 type; };
+struct TupleElement<true, 2, GTEST_10_TUPLE_(T)> {
+  typedef T2 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> { typedef T3 type; };
+struct TupleElement<true, 3, GTEST_10_TUPLE_(T)> {
+  typedef T3 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> { typedef T4 type; };
+struct TupleElement<true, 4, GTEST_10_TUPLE_(T)> {
+  typedef T4 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> { typedef T5 type; };
+struct TupleElement<true, 5, GTEST_10_TUPLE_(T)> {
+  typedef T5 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> { typedef T6 type; };
+struct TupleElement<true, 6, GTEST_10_TUPLE_(T)> {
+  typedef T6 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> { typedef T7 type; };
+struct TupleElement<true, 7, GTEST_10_TUPLE_(T)> {
+  typedef T7 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> { typedef T8 type; };
+struct TupleElement<true, 8, GTEST_10_TUPLE_(T)> {
+  typedef T8 type;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> { typedef T9 type; };
+struct TupleElement<true, 9, GTEST_10_TUPLE_(T)> {
+  typedef T9 type;
+};
 
 }  // namespace gtest_internal
 
@@ -708,37 +730,59 @@
 template <typename Tuple> struct tuple_size;
 
 template <GTEST_0_TYPENAMES_(T)>
-struct tuple_size<GTEST_0_TUPLE_(T)> { static const int value = 0; };
+struct tuple_size<GTEST_0_TUPLE_(T)> {
+  static const int value = 0;
+};
 
 template <GTEST_1_TYPENAMES_(T)>
-struct tuple_size<GTEST_1_TUPLE_(T)> { static const int value = 1; };
+struct tuple_size<GTEST_1_TUPLE_(T)> {
+  static const int value = 1;
+};
 
 template <GTEST_2_TYPENAMES_(T)>
-struct tuple_size<GTEST_2_TUPLE_(T)> { static const int value = 2; };
+struct tuple_size<GTEST_2_TUPLE_(T)> {
+  static const int value = 2;
+};
 
 template <GTEST_3_TYPENAMES_(T)>
-struct tuple_size<GTEST_3_TUPLE_(T)> { static const int value = 3; };
+struct tuple_size<GTEST_3_TUPLE_(T)> {
+  static const int value = 3;
+};
 
 template <GTEST_4_TYPENAMES_(T)>
-struct tuple_size<GTEST_4_TUPLE_(T)> { static const int value = 4; };
+struct tuple_size<GTEST_4_TUPLE_(T)> {
+  static const int value = 4;
+};
 
 template <GTEST_5_TYPENAMES_(T)>
-struct tuple_size<GTEST_5_TUPLE_(T)> { static const int value = 5; };
+struct tuple_size<GTEST_5_TUPLE_(T)> {
+  static const int value = 5;
+};
 
 template <GTEST_6_TYPENAMES_(T)>
-struct tuple_size<GTEST_6_TUPLE_(T)> { static const int value = 6; };
+struct tuple_size<GTEST_6_TUPLE_(T)> {
+  static const int value = 6;
+};
 
 template <GTEST_7_TYPENAMES_(T)>
-struct tuple_size<GTEST_7_TUPLE_(T)> { static const int value = 7; };
+struct tuple_size<GTEST_7_TUPLE_(T)> {
+  static const int value = 7;
+};
 
 template <GTEST_8_TYPENAMES_(T)>
-struct tuple_size<GTEST_8_TUPLE_(T)> { static const int value = 8; };
+struct tuple_size<GTEST_8_TUPLE_(T)> {
+  static const int value = 8;
+};
 
 template <GTEST_9_TYPENAMES_(T)>
-struct tuple_size<GTEST_9_TUPLE_(T)> { static const int value = 9; };
+struct tuple_size<GTEST_9_TUPLE_(T)> {
+  static const int value = 9;
+};
 
 template <GTEST_10_TYPENAMES_(T)>
-struct tuple_size<GTEST_10_TUPLE_(T)> { static const int value = 10; };
+struct tuple_size<GTEST_10_TUPLE_(T)> {
+  static const int value = 10;
+};
 
 template <int k, class Tuple>
 struct tuple_element {
diff --git a/include/gtest/internal/gtest-tuple.h.pump b/include/gtest/internal/gtest-tuple.h.pump
index ef51909..238e8fc 100644
--- a/include/gtest/internal/gtest-tuple.h.pump
+++ b/include/gtest/internal/gtest-tuple.h.pump
@@ -118,8 +118,9 @@
 
 $for i [[
 template <GTEST_$(n)_TYPENAMES_(T)>
-struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T)> [[]]
-{ typedef T$i type; };
+struct TupleElement<true, $i, GTEST_$(n)_TUPLE_(T)> {
+  typedef T$i type;
+};
 
 
 ]]
@@ -220,7 +221,9 @@
 
 $for j [[
 template <GTEST_$(j)_TYPENAMES_(T)>
-struct tuple_size<GTEST_$(j)_TUPLE_(T)> { static const int value = $j; };
+struct tuple_size<GTEST_$(j)_TUPLE_(T)> {
+  static const int value = $j;
+};
 
 
 ]]
diff --git a/include/gtest/internal/gtest-type-util.h b/include/gtest/internal/gtest-type-util.h
index 597aeaf..ed58fce 100644
--- a/include/gtest/internal/gtest-type-util.h
+++ b/include/gtest/internal/gtest-type-util.h
@@ -72,7 +72,7 @@
   // so we have to demangle it.
 #   if GTEST_HAS_CXXABI_H_
   using abi::__cxa_demangle;
-#   endif // GTEST_HAS_CXXABI_H_
+#   endif  // GTEST_HAS_CXXABI_H_
   char* const readable_name = __cxa_demangle(name, 0, 0, &status);
   const String name_str(status == 0 ? readable_name : name);
   free(readable_name);
@@ -3300,7 +3300,9 @@
 // INSTANTIATE_TYPED_TEST_CASE_P().
 
 template <typename T>
-struct TypeList { typedef Types1<T> type; };
+struct TypeList {
+  typedef Types1<T> type;
+};
 
 template <typename T1, typename T2, typename T3, typename T4, typename T5,
     typename T6, typename T7, typename T8, typename T9, typename T10,
diff --git a/include/gtest/internal/gtest-type-util.h.pump b/include/gtest/internal/gtest-type-util.h.pump
index 8198e10..cdeb7a4 100644
--- a/include/gtest/internal/gtest-type-util.h.pump
+++ b/include/gtest/internal/gtest-type-util.h.pump
@@ -70,7 +70,7 @@
   // so we have to demangle it.
 #   if GTEST_HAS_CXXABI_H_
   using abi::__cxa_demangle;
-#   endif // GTEST_HAS_CXXABI_H_
+#   endif  // GTEST_HAS_CXXABI_H_
   char* const readable_name = __cxa_demangle(name, 0, 0, &status);
   const String name_str(status == 0 ? readable_name : name);
   free(readable_name);
@@ -279,7 +279,9 @@
 // INSTANTIATE_TYPED_TEST_CASE_P().
 
 template <typename T>
-struct TypeList { typedef Types1<T> type; };
+struct TypeList {
+  typedef Types1<T> type;
+};
 
 
 $range i 1..n
diff --git a/samples/sample10_unittest.cc b/samples/sample10_unittest.cc
index 2813d04..0051cd5 100644
--- a/samples/sample10_unittest.cc
+++ b/samples/sample10_unittest.cc
@@ -89,8 +89,7 @@
     // You can generate a failure in any event handler except
     // OnTestPartResult. Just use an appropriate Google Test assertion to do
     // it.
-    EXPECT_TRUE(difference <= 0)
-        << "Leaked " << difference << " unit(s) of Water!";
+    EXPECT_LE(difference, 0) << "Leaked " << difference << " unit(s) of Water!";
   }
 
   int initially_allocated_;
diff --git a/samples/sample1_unittest.cc b/samples/sample1_unittest.cc
index a8a7c79..aefc4f1 100644
--- a/samples/sample1_unittest.cc
+++ b/samples/sample1_unittest.cc
@@ -81,7 +81,7 @@
   // test case.
   EXPECT_EQ(1, Factorial(-5));
   EXPECT_EQ(1, Factorial(-1));
-  EXPECT_TRUE(Factorial(-10) > 0);
+  EXPECT_GT(Factorial(-10), 0);
 
   // <TechnicalDetails>
   //
diff --git a/samples/sample2.h b/samples/sample2.h
index 5b57e60..cb485c7 100644
--- a/samples/sample2.h
+++ b/samples/sample2.h
@@ -44,7 +44,6 @@
   const MyString& operator=(const MyString& rhs);
 
  public:
-
   // Clones a 0-terminated C string, allocating memory using new.
   static const char* CloneCString(const char* a_c_string);
 
diff --git a/samples/sample2_unittest.cc b/samples/sample2_unittest.cc
index 3792fa5..4fa19b7 100644
--- a/samples/sample2_unittest.cc
+++ b/samples/sample2_unittest.cc
@@ -79,7 +79,7 @@
 // Tests the c'tor that accepts a C string.
 TEST(MyString, ConstructorFromCString) {
   const MyString s(kHelloString);
-  EXPECT_TRUE(strcmp(s.c_string(), kHelloString) == 0);
+  EXPECT_EQ(0, strcmp(s.c_string(), kHelloString));
   EXPECT_EQ(sizeof(kHelloString)/sizeof(kHelloString[0]) - 1,
             s.Length());
 }
@@ -88,7 +88,7 @@
 TEST(MyString, CopyConstructor) {
   const MyString s1(kHelloString);
   const MyString s2 = s1;
-  EXPECT_TRUE(strcmp(s2.c_string(), kHelloString) == 0);
+  EXPECT_EQ(0, strcmp(s2.c_string(), kHelloString));
 }
 
 // Tests the Set method.
@@ -96,12 +96,12 @@
   MyString s;
 
   s.Set(kHelloString);
-  EXPECT_TRUE(strcmp(s.c_string(), kHelloString) == 0);
+  EXPECT_EQ(0, strcmp(s.c_string(), kHelloString));
 
   // Set should work when the input pointer is the same as the one
   // already in the MyString object.
   s.Set(s.c_string());
-  EXPECT_TRUE(strcmp(s.c_string(), kHelloString) == 0);
+  EXPECT_EQ(0, strcmp(s.c_string(), kHelloString));
 
   // Can we set the MyString to NULL?
   s.Set(NULL);
diff --git a/samples/sample3-inl.h b/samples/sample3-inl.h
index 46369a0..7e3084d 100644
--- a/samples/sample3-inl.h
+++ b/samples/sample3-inl.h
@@ -60,7 +60,7 @@
  private:
   // Creates a node with a given element value.  The next pointer is
   // set to NULL.
-  QueueNode(const E& an_element) : element_(an_element), next_(NULL) {}
+  explicit QueueNode(const E& an_element) : element_(an_element), next_(NULL) {}
 
   // We disable the default assignment operator and copy c'tor.
   const QueueNode& operator = (const QueueNode&);
@@ -72,8 +72,7 @@
 
 template <typename E>  // E is the element type.
 class Queue {
-public:
-
+ public:
   // Creates an empty queue.
   Queue() : head_(NULL), last_(NULL), size_(0) {}
 
@@ -168,6 +167,6 @@
   // We disallow copying a queue.
   Queue(const Queue&);
   const Queue& operator = (const Queue&);
- };
+};
 
 #endif  // GTEST_SAMPLES_SAMPLE3_INL_H_
diff --git a/samples/sample5_unittest.cc b/samples/sample5_unittest.cc
index f63c29e..43d8e57 100644
--- a/samples/sample5_unittest.cc
+++ b/samples/sample5_unittest.cc
@@ -101,7 +101,7 @@
   // Tests factorial of negative numbers.
   EXPECT_EQ(1, Factorial(-5));
   EXPECT_EQ(1, Factorial(-1));
-  EXPECT_TRUE(Factorial(-10) > 0);
+  EXPECT_GT(Factorial(-10), 0);
 
   // Tests factorial of 0.
   EXPECT_EQ(1, Factorial(0));
diff --git a/scripts/gen_gtest_pred_impl.py b/scripts/gen_gtest_pred_impl.py
index d35b4f0..3e7ab04 100755
--- a/scripts/gen_gtest_pred_impl.py
+++ b/scripts/gen_gtest_pred_impl.py
@@ -117,7 +117,7 @@
 
 // Makes sure this header is not included before gtest.h.
 #ifndef GTEST_INCLUDE_GTEST_GTEST_H_
-#error Do not include gtest_pred_impl.h directly.  Include gtest.h instead.
+# error Do not include gtest_pred_impl.h directly.  Include gtest.h instead.
 #endif  // GTEST_INCLUDE_GTEST_GTEST_H_
 
 // This header implements a family of generic predicate assertion
@@ -256,7 +256,7 @@
 // Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT%(n)s.
 // Don't use this in your code.
 #define GTEST_PRED_FORMAT%(n)s_(pred_format, %(vs)s, on_failure)\\
-  GTEST_ASSERT_(pred_format(%(vts)s, %(vs)s),\\
+  GTEST_ASSERT_(pred_format(%(vts)s, %(vs)s), \\
                 on_failure)
 
 // Internal macro for implementing {EXPECT|ASSERT}_PRED%(n)s.  Don't use
diff --git a/src/gtest-death-test.cc b/src/gtest-death-test.cc
index 0a0f83b..36a2e3a 100644
--- a/src/gtest-death-test.cc
+++ b/src/gtest-death-test.cc
@@ -913,6 +913,7 @@
   char* const* Argv() {
     return &args_[0];
   }
+
  private:
   std::vector<char*> args_;
 };
diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h
index d869f0f..1ea31a1 100644
--- a/src/gtest-internal-inl.h
+++ b/src/gtest-internal-inl.h
@@ -196,6 +196,7 @@
     GTEST_FLAG(stream_result_to) = stream_result_to_;
     GTEST_FLAG(throw_on_failure) = throw_on_failure_;
   }
+
  private:
   // Fields for saving the original values of flags.
   bool also_run_disabled_tests_;
diff --git a/src/gtest-port.cc b/src/gtest-port.cc
index 6e8dca2..9648eee 100644
--- a/src/gtest-port.cc
+++ b/src/gtest-port.cc
@@ -514,7 +514,6 @@
  public:
   // The ctor redirects the stream to a temporary file.
   CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
-
 # if GTEST_OS_WINDOWS
     char temp_dir_path[MAX_PATH + 1] = { '\0' };  // NOLINT
     char temp_file_path[MAX_PATH + 1] = { '\0' };  // NOLINT
diff --git a/src/gtest.cc b/src/gtest.cc
index e407ee9..f2e84af 100644
--- a/src/gtest.cc
+++ b/src/gtest.cc
@@ -3864,7 +3864,6 @@
   // process. In either case the user does not want to see pop-up dialogs
   // about crashes - they are expected.
   if (impl()->catch_exceptions() || in_death_test_child_process) {
-
 # if !GTEST_OS_WINDOWS_MOBILE
     // SetErrorMode doesn't exist on CE.
     SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
@@ -3895,7 +3894,6 @@
           0x0,                                    // Clear the following flags:
           _WRITE_ABORT_MSG | _CALL_REPORTFAULT);  // pop-up window, core dump.
 # endif
-
   }
 #endif  // GTEST_HAS_SEH
 
diff --git a/src/gtest_main.cc b/src/gtest_main.cc
index a09bbe0..f302822 100644
--- a/src/gtest_main.cc
+++ b/src/gtest_main.cc
@@ -27,13 +27,12 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#include <iostream>
+#include <stdio.h>
 
 #include "gtest/gtest.h"
 
 GTEST_API_ int main(int argc, char **argv) {
-  std::cout << "Running main() from gtest_main.cc\n";
-
+  printf("Running main() from gtest_main.cc\n");
   testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
 }
diff --git a/test/gtest-death-test_test.cc b/test/gtest-death-test_test.cc
index 54f5a1a..5a4a989 100644
--- a/test/gtest-death-test_test.cc
+++ b/test/gtest-death-test_test.cc
@@ -896,6 +896,7 @@
   virtual void Abort(AbortReason reason) {
     parent_->abort_args_.push_back(reason);
   }
+
  private:
   MockDeathTestFactory* const parent_;
   const TestRole role_;
diff --git a/test/gtest-linked_ptr_test.cc b/test/gtest-linked_ptr_test.cc
index 0d5508a..6fcf512 100644
--- a/test/gtest-linked_ptr_test.cc
+++ b/test/gtest-linked_ptr_test.cc
@@ -148,8 +148,7 @@
     "A0 dtor\n"
     "A3 dtor\n"
     "A1 dtor\n",
-    history->GetString().c_str()
-  );
+    history->GetString().c_str());
 }
 
 }  // Unnamed namespace
diff --git a/test/gtest-listener_test.cc b/test/gtest-listener_test.cc
index 2aa08ef..1008608 100644
--- a/test/gtest-listener_test.cc
+++ b/test/gtest-listener_test.cc
@@ -55,7 +55,7 @@
 
 class EventRecordingListener : public TestEventListener {
  public:
-  EventRecordingListener(const char* name) : name_(name) {}
+  explicit EventRecordingListener(const char* name) : name_(name) {}
 
  protected:
   virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {
diff --git a/test/gtest-param-test_test.cc b/test/gtest-param-test_test.cc
index 94a53d9..cf61866 100644
--- a/test/gtest-param-test_test.cc
+++ b/test/gtest-param-test_test.cc
@@ -606,6 +606,7 @@
           << "has not been run as expected.";
     }
   }
+
  private:
   TestGenerationEnvironment() : fixture_constructor_count_(0), set_up_count_(0),
                                 tear_down_count_(0), test_body_count_(0) {}
@@ -674,6 +675,7 @@
 
     EXPECT_TRUE(collected_parameters_ == expected_values);
   }
+
  protected:
   int current_parameter_;
   static vector<int> collected_parameters_;
diff --git a/test/gtest-param-test_test.h b/test/gtest-param-test_test.h
index d0f6556..26ea122 100644
--- a/test/gtest-param-test_test.h
+++ b/test/gtest-param-test_test.h
@@ -43,12 +43,14 @@
 
 // Test fixture for testing definition and instantiation of a test
 // in separate translation units.
-class ExternalInstantiationTest : public ::testing::TestWithParam<int> {};
+class ExternalInstantiationTest : public ::testing::TestWithParam<int> {
+};
 
 // Test fixture for testing instantiation of a test in multiple
 // translation units.
 class InstantiationInMultipleTranslaionUnitsTest
-    : public ::testing::TestWithParam<int> {};
+    : public ::testing::TestWithParam<int> {
+};
 
 #endif  // GTEST_HAS_PARAM_TEST
 
diff --git a/test/gtest-port_test.cc b/test/gtest-port_test.cc
index b0177cf..75471c3 100644
--- a/test/gtest-port_test.cc
+++ b/test/gtest-port_test.cc
@@ -92,7 +92,7 @@
 
 class Castable {
  public:
-  Castable(bool* converted) : converted_(converted) {}
+  explicit Castable(bool* converted) : converted_(converted) {}
   operator Base() {
     *converted_ = true;
     return Base();
@@ -111,7 +111,7 @@
 
 class ConstCastable {
  public:
-  ConstCastable(bool* converted) : converted_(converted) {}
+  explicit ConstCastable(bool* converted) : converted_(converted) {}
   operator Base() const {
     *converted_ = true;
     return Base();
@@ -224,7 +224,7 @@
       GTEST_CHECK_(true);
   }
 
-  switch(0)
+  switch (0)
     case 0:
       GTEST_CHECK_(true) << "Check failed in switch case";
 }
@@ -929,7 +929,7 @@
 
 TEST(CaptureDeathTest, CannotReenterStdoutCapture) {
   CaptureStdout();
-  EXPECT_DEATH_IF_SUPPORTED(CaptureStdout();,
+  EXPECT_DEATH_IF_SUPPORTED(CaptureStdout(),
                             "Only one stdout capturer can exist at a time");
   GetCapturedStdout();
 
diff --git a/test/gtest-printers_test.cc b/test/gtest-printers_test.cc
index 58044ab..58d9622 100644
--- a/test/gtest-printers_test.cc
+++ b/test/gtest-printers_test.cc
@@ -841,7 +841,7 @@
   std::vector<int> numbers;
   for (size_t i = 0; i != result.length(); i++) {
     if (expected_pattern[i] == 'd') {
-      ASSERT_TRUE(isdigit(static_cast<unsigned char>(result[i])) != 0);
+      ASSERT_NE(isdigit(static_cast<unsigned char>(result[i])), 0);
       numbers.push_back(result[i] - '0');
     } else {
       EXPECT_EQ(expected_pattern[i], result[i]) << " where result is "
diff --git a/test/gtest_environment_test.cc b/test/gtest_environment_test.cc
index ec9aa2c..3cff19e 100644
--- a/test/gtest_environment_test.cc
+++ b/test/gtest_environment_test.cc
@@ -96,6 +96,7 @@
 
   // Was TearDown() run?
   bool tear_down_was_run() const { return tear_down_was_run_; }
+
  private:
   FailureType failure_in_set_up_;
   bool set_up_was_run_;
diff --git a/test/gtest_no_test_unittest.cc b/test/gtest_no_test_unittest.cc
index e3a85f1..292599a 100644
--- a/test/gtest_no_test_unittest.cc
+++ b/test/gtest_no_test_unittest.cc
@@ -34,7 +34,6 @@
 
 #include "gtest/gtest.h"
 
-
 int main(int argc, char **argv) {
   testing::InitGoogleTest(&argc, argv);
 
diff --git a/test/gtest_output_test_.cc b/test/gtest_output_test_.cc
index 13dbec4..031ae83 100644
--- a/test/gtest_output_test_.cc
+++ b/test/gtest_output_test_.cc
@@ -378,6 +378,7 @@
                   << "We should never get here, as the test fixture c'tor "
                   << "had a fatal failure.";
   }
+
  private:
   void Init() {
     FAIL() << "Expected failure #1, in the test fixture c'tor.";
diff --git a/test/gtest_pred_impl_unittest.cc b/test/gtest_pred_impl_unittest.cc
index 35dc9bc..a84eff8 100644
--- a/test/gtest_pred_impl_unittest.cc
+++ b/test/gtest_pred_impl_unittest.cc
@@ -27,7 +27,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-// This file is AUTOMATICALLY GENERATED on 09/24/2010 by command
+// This file is AUTOMATICALLY GENERATED on 10/31/2011 by command
 // 'gen_gtest_pred_impl.py 5'.  DO NOT EDIT BY HAND!
 
 // Regression test for gtest_pred_impl.h
diff --git a/test/gtest_repeat_test.cc b/test/gtest_repeat_test.cc
index 5223dc0..481012a 100644
--- a/test/gtest_repeat_test.cc
+++ b/test/gtest_repeat_test.cc
@@ -71,7 +71,7 @@
                   << "Which is: " << expected_val << "\n";\
       ::testing::internal::posix::Abort();\
     }\
-  } while(::testing::internal::AlwaysFalse())
+  } while (::testing::internal::AlwaysFalse())
 
 
 // Used for verifying that global environment set-up and tear-down are
diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc
index 0d624fd..8cd58be 100644
--- a/test/gtest_unittest.cc
+++ b/test/gtest_unittest.cc
@@ -33,8 +33,6 @@
 // Google Test work.
 
 #include "gtest/gtest.h"
-#include <vector>
-#include <ostream>
 
 // Verifies that the command line flag variables can be accessed
 // in code once <gtest/gtest.h> has been #included.
@@ -58,6 +56,15 @@
   EXPECT_TRUE(dummy || !dummy);  // Suppresses warning that dummy is unused.
 }
 
+#include <limits.h>  // For INT_MAX.
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include <map>
+#include <vector>
+#include <ostream>
+
 #include "gtest/gtest-spi.h"
 
 // Indicates that this translation unit is part of Google Test's
@@ -69,13 +76,6 @@
 #include "src/gtest-internal-inl.h"
 #undef GTEST_IMPLEMENTATION_
 
-#include <limits.h>  // For INT_MAX.
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include <map>
-
 namespace testing {
 namespace internal {
 
@@ -1141,7 +1141,7 @@
   EXPECT_TRUE(foo == "foo");  // NOLINT
 
   const String bar("x\0y", 3);
-  EXPECT_FALSE(bar == "x");
+  EXPECT_NE(bar, "x");
 }
 
 // Tests String::operator!=().
@@ -1163,7 +1163,7 @@
   EXPECT_FALSE(foo != "foo");  // NOLINT
 
   const String bar("x\0y", 3);
-  EXPECT_TRUE(bar != "x");
+  EXPECT_NE(bar, "x");
 }
 
 // Tests String::length().
@@ -1902,6 +1902,7 @@
     GTEST_FLAG(stream_result_to) = "localhost:1234";
     GTEST_FLAG(throw_on_failure) = true;
   }
+
  private:
   // For saving Google Test flags during this test case.
   static GTestFlagSaver* saver_;
@@ -2797,7 +2798,6 @@
 template <typename RawType>
 class FloatingPointTest : public Test {
  protected:
-
   // Pre-calculated numbers to be used by the tests.
   struct TestValues {
     RawType close_to_positive_zero;
@@ -7278,6 +7278,7 @@
 }
 
 TEST(ArrayEqTest, WorksForOneDimensionalArrays) {
+  // Note that a and b are distinct but compatible types.
   const int a[] = { 0, 1 };
   long b[] = { 0, 1 };
   EXPECT_TRUE(ArrayEq(a, b));