Cleaned up use of substr() to get interface's base name.
Bug: 31527442
Test: make at top-level. hidl_test passes.
Change-Id: Ia940a421599dc158e26fb7ea481abeab32620f65
diff --git a/generateCppImpl.cpp b/generateCppImpl.cpp
index bed1d1d..66a35d4 100644
--- a/generateCppImpl.cpp
+++ b/generateCppImpl.cpp
@@ -98,8 +98,7 @@
const Interface *iface = mRootScope->getInterface();
- // cut off the leading 'I'.
- const std::string baseName = ifaceName.substr(1);
+ const std::string baseName = iface->getBaseName();
std::string path = outputPath;
path.append(baseName);
@@ -222,8 +221,8 @@
return OK;
}
- // cut off the leading 'I'.
- const std::string baseName = ifaceName.substr(1);
+ const Interface *iface = mRootScope->getInterface();
+ const std::string baseName = iface->getBaseName();
std::string path = outputPath;
path.append(baseName);
@@ -251,7 +250,6 @@
MethodLocation::IMPL_SOURCE,
false /* specify namespaces */);
- const Interface *iface = mRootScope->getInterface();
out << ifaceName
<< "* ";