Remove extra from getCppType.

The argument is used for array type originally. We
now use hidl_array instead of T[], so there is no
need to use extra.

Renamed the convenience getCppType to getCppStackType
to avoid casting to (Type *) before using this
method (which makes it inconvenient)

Also fixes:
* RefType::getCppType ignores specifyNamespaces
* ConstantExpression.cpp emits a C-style cast instead
  of static_cast

Bug: 32559427

Test: mma passes
Test: hidl_test

Change-Id: I7e2e31c34c1ca1aa83c4a5a4dbdf7fd6b9aff30c
diff --git a/ScalarType.cpp b/ScalarType.cpp
index b89001f..f537310 100644
--- a/ScalarType.cpp
+++ b/ScalarType.cpp
@@ -37,7 +37,7 @@
     // do nothing
 }
 
-std::string ScalarType::getCppType(StorageMode, std::string *extra, bool) const {
+std::string ScalarType::getCppType(StorageMode, bool) const {
     static const char *const kName[] = {
         "bool",
         "int8_t",
@@ -52,8 +52,6 @@
         "double"
     };
 
-    extra->clear();
-
     return kName[mKind];
 }
 
@@ -184,10 +182,8 @@
         << "(";
 
     if (needsCast) {
-        std::string extra;
-
         out << "("
-            << Type::getCppType(&extra)
+            << getCppStackType()
             << (isReader ? " *)" : ")");
     }