diff options
author | Bill Peckham <bpeckham@google.com> | 2018-10-09 17:33:34 -0700 |
---|---|---|
committer | Bill Peckham <bpeckham@google.com> | 2018-10-15 17:46:00 -0700 |
commit | ddcaa93e851eb5e57692799446f2ef3fe31436ae (patch) | |
tree | 41f5481541b8c4e26dd8fef5cbba7a24aa1003c7 /tools/aapt2/java/ManifestClassGenerator.cpp | |
parent | 760f366150e46580bfa808a897bc99c3e8907ded (diff) | |
parent | ef229d9195a2bdff34f94420687c0c05f4447a88 (diff) |
Merge QP1A.181008.001
Change-Id: Iff68e8d0501ac5c2998c96f9df4042a94a1ce9e1
Diffstat (limited to 'tools/aapt2/java/ManifestClassGenerator.cpp')
-rw-r--r-- | tools/aapt2/java/ManifestClassGenerator.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/aapt2/java/ManifestClassGenerator.cpp b/tools/aapt2/java/ManifestClassGenerator.cpp index be67c9c8c03c..10e504ec0752 100644 --- a/tools/aapt2/java/ManifestClassGenerator.cpp +++ b/tools/aapt2/java/ManifestClassGenerator.cpp @@ -26,21 +26,20 @@ #include "util/Maybe.h" #include "xml/XmlDom.h" -using ::android::StringPiece; using ::aapt::text::IsJavaIdentifier; namespace aapt { -static Maybe<StringPiece> ExtractJavaIdentifier(IDiagnostics* diag, const Source& source, +static Maybe<std::string> ExtractJavaIdentifier(IDiagnostics* diag, const Source& source, const std::string& value) { - StringPiece result = value; + std::string result = value; size_t pos = value.rfind('.'); if (pos != std::string::npos) { result = result.substr(pos + 1); } // Normalize only the java identifier, leave the original value unchanged. - if (result.contains("-")) { + if (result.find("-") != std::string::npos) { result = JavaClassGenerator::TransformToFieldName(result); } @@ -64,7 +63,7 @@ static bool WriteSymbol(const Source& source, IDiagnostics* diag, xml::Element* return false; } - Maybe<StringPiece> result = + Maybe<std::string> result = ExtractJavaIdentifier(diag, source.WithLine(el->line_number), attr->value); if (!result) { return false; |