Merge "Fix clang-tidy performance-faster-string-find warnings" am: 57fb318ca3 am: 7c0f0d3cec am: 40ef6319ca
Change-Id: Id9d31a0c5cf41a0bb4a58326faa79511a1d8cc4a
diff --git a/startop/view_compiler/dex_layout_compiler.cc b/startop/view_compiler/dex_layout_compiler.cc
index cb820f8..bddb8aa 100644
--- a/startop/view_compiler/dex_layout_compiler.cc
+++ b/startop/view_compiler/dex_layout_compiler.cc
@@ -118,7 +118,7 @@
std::string ResolveName(const std::string& name) {
if (name == "View") return "android.view.View";
if (name == "ViewGroup") return "android.view.ViewGroup";
- if (name.find(".") == std::string::npos) {
+ if (name.find('.') == std::string::npos) {
return StringPrintf("android.widget.%s", name.c_str());
}
return name;
@@ -205,4 +205,4 @@
view_stack_.pop_back();
}
-} // namespace startop
\ No newline at end of file
+} // namespace startop
diff --git a/startop/view_compiler/util.cc b/startop/view_compiler/util.cc
index a0637e6..c34d7b0 100644
--- a/startop/view_compiler/util.cc
+++ b/startop/view_compiler/util.cc
@@ -23,13 +23,13 @@
// TODO: see if we can borrow this from somewhere else, like aapt2.
string FindLayoutNameFromFilename(const string& filename) {
- size_t start = filename.rfind("/");
+ size_t start = filename.rfind('/');
if (start == string::npos) {
start = 0;
} else {
start++; // advance past '/' character
}
- size_t end = filename.find(".", start);
+ size_t end = filename.find('.', start);
return filename.substr(start, end - start);
}
diff --git a/tools/aapt2/dump/DumpManifest.cpp b/tools/aapt2/dump/DumpManifest.cpp
index 31aa249..e7a8203 100644
--- a/tools/aapt2/dump/DumpManifest.cpp
+++ b/tools/aapt2/dump/DumpManifest.cpp
@@ -1188,7 +1188,7 @@
}
// Fully qualify the activity name
- ssize_t idx = name.find(".");
+ ssize_t idx = name.find('.');
if (idx == 0) {
name = package + name;
} else if (idx < 0) {
@@ -2138,7 +2138,7 @@
size_t pos = file_path.find("lib/");
if (pos != std::string::npos) {
file_path = file_path.substr(pos + 4);
- pos = file_path.find("/");
+ pos = file_path.find('/');
if (pos != std::string::npos) {
file_path = file_path.substr(0, pos);
}
diff --git a/tools/aapt2/java/ManifestClassGenerator.cpp b/tools/aapt2/java/ManifestClassGenerator.cpp
index 10e504e..09ea03b 100644
--- a/tools/aapt2/java/ManifestClassGenerator.cpp
+++ b/tools/aapt2/java/ManifestClassGenerator.cpp
@@ -39,7 +39,7 @@
}
// Normalize only the java identifier, leave the original value unchanged.
- if (result.find("-") != std::string::npos) {
+ if (result.find('-') != std::string::npos) {
result = JavaClassGenerator::TransformToFieldName(result);
}