Use cpplint.py from repohooks

The cpplint.py in external/google-styleguide is out of date and doesn't
support python 3.  Switch to the one in tools/repohooks/tools to match
the preupload configuration.  Also fix some lint issues caught by the
new version.

Test: m cpplint-art
Change-Id: Ie8c307388362c03c6f33cda6d4ec95c244481adf
diff --git a/build/Android.cpplint.mk b/build/Android.cpplint.mk
index ce68214..ab70e97 100644
--- a/build/Android.cpplint.mk
+++ b/build/Android.cpplint.mk
@@ -20,7 +20,7 @@
 LOCAL_PATH := $(art_path)
 
 # Use upstream cpplint (toolpath from .repo/manifests/GLOBAL-PREUPLOAD.cfg).
-ART_CPPLINT := external/google-styleguide/cpplint/cpplint.py
+ART_CPPLINT := tools/repohooks/tools/cpplint.py
 
 # This file previously configured many cpplint settings.
 # Everything that could be moved to CPPLINT.cfg has moved there.
diff --git a/dex2oat/common_compiler_driver_test.cc b/dex2oat/common_compiler_driver_test.cc
index 2007c5a..7e71976 100644
--- a/dex2oat/common_compiler_driver_test.cc
+++ b/dex2oat/common_compiler_driver_test.cc
@@ -67,7 +67,7 @@
   MemMap::Init();
   image_reservation_ = MemMap::MapAnonymous("image reservation",
                                             reinterpret_cast<uint8_t*>(ART_BASE_ADDRESS),
-                                            (size_t)120 * 1024 * 1024,  // 120MB
+                                            static_cast<size_t>(120 * 1024 * 1024),  // 120MB
                                             PROT_NONE,
                                             false /* no need for 4gb flag with fixed mmap */,
                                             /*reuse=*/ false,
diff --git a/dexdump/dexdump.cc b/dexdump/dexdump.cc
index 1d1eab8..d10ed26 100644
--- a/dexdump/dexdump.cc
+++ b/dexdump/dexdump.cc
@@ -1367,7 +1367,7 @@
     }
   }
 
- bail:
+bail:
   free(typeDescriptor);
   free(accessStr);
 }
diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc
index 75afc78..86973f6 100644
--- a/dexlayout/dexlayout.cc
+++ b/dexlayout/dexlayout.cc
@@ -1272,7 +1272,7 @@
     }
   }
 
- bail:
+bail:
   free(type_descriptor);
   free(access_str);
 }
diff --git a/runtime/native/sun_misc_Unsafe.cc b/runtime/native/sun_misc_Unsafe.cc
index 5014f34..e9c5af0 100644
--- a/runtime/native/sun_misc_Unsafe.cc
+++ b/runtime/native/sun_misc_Unsafe.cc
@@ -230,7 +230,7 @@
 static jlong Unsafe_allocateMemory(JNIEnv* env, jobject, jlong bytes) {
   ScopedFastNativeObjectAccess soa(env);
   // bytes is nonnegative and fits into size_t
-  if (bytes < 0 || bytes != (jlong)(size_t) bytes) {
+  if (bytes < 0 || bytes != static_cast<jlong>(static_cast<size_t>(bytes))) {
     ThrowIllegalAccessException("wrong number of bytes");
     return 0;
   }
@@ -311,11 +311,11 @@
     return;
   }
   // size is nonnegative and fits into size_t
-  if (size < 0 || size != (jlong)(size_t) size) {
+  if (size < 0 || size != static_cast<jlong>(static_cast<size_t>(size))) {
     ScopedFastNativeObjectAccess soa(env);
     ThrowIllegalAccessException("wrong number of bytes");
   }
-  size_t sz = (size_t)size;
+  size_t sz = static_cast<size_t>(size);
   memcpy(reinterpret_cast<void *>(dst), reinterpret_cast<void *>(src), sz);
 }
 
@@ -358,11 +358,11 @@
     return;
   }
   // size is nonnegative and fits into size_t
-  if (size < 0 || size != (jlong)(size_t) size) {
+  if (size < 0 || size != static_cast<jlong>(static_cast<size_t>(size))) {
     ThrowIllegalAccessException("wrong number of bytes");
   }
-  size_t sz = (size_t)size;
-  size_t dst_offset = (size_t)dstOffset;
+  size_t sz = static_cast<size_t>(size);
+  size_t dst_offset = static_cast<size_t>(dstOffset);
   ObjPtr<mirror::Object> dst = soa.Decode<mirror::Object>(dstObj);
   ObjPtr<mirror::Class> component_type = dst->GetClass()->GetComponentType();
   if (component_type->IsPrimitiveByte() || component_type->IsPrimitiveBoolean()) {
@@ -393,11 +393,11 @@
     return;
   }
   // size is nonnegative and fits into size_t
-  if (size < 0 || size != (jlong)(size_t) size) {
+  if (size < 0 || size != static_cast<jlong>(static_cast<size_t>(size))) {
     ThrowIllegalAccessException("wrong number of bytes");
   }
-  size_t sz = (size_t)size;
-  size_t src_offset = (size_t)srcOffset;
+  size_t sz = static_cast<size_t>(size);
+  size_t src_offset = static_cast<size_t>(srcOffset);
   ObjPtr<mirror::Object> src = soa.Decode<mirror::Object>(srcObj);
   ObjPtr<mirror::Class> component_type = src->GetClass()->GetComponentType();
   if (component_type->IsPrimitiveByte() || component_type->IsPrimitiveBoolean()) {
diff --git a/tools/dmtracedump/tracedump.cc b/tools/dmtracedump/tracedump.cc
index 42527c5..3cb7374 100644
--- a/tools/dmtracedump/tracedump.cc
+++ b/tools/dmtracedump/tracedump.cc
@@ -849,7 +849,7 @@
     return nullptr;
   }
 
-  if (fread(pKeys->fileData, 1, pKeys->fileLen, fp) != (size_t)pKeys->fileLen) {
+  if (fread(pKeys->fileData, 1, pKeys->fileLen, fp) != static_cast<size_t>(pKeys->fileLen)) {
     fprintf(stderr, "ERROR: unable to read %" PRIu64 " bytes from trace file\n", pKeys->fileLen);
     freeDataKeys(pKeys);
     return nullptr;