diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/aapt/AaptAssets.cpp | 32 | ||||
-rw-r--r-- | tools/aapt/Command.cpp | 6 | ||||
-rw-r--r-- | tools/aapt/Resource.cpp | 10 | ||||
-rw-r--r-- | tools/aapt/StringPool.cpp | 6 | ||||
-rw-r--r-- | tools/aapt/XMLNode.cpp | 2 | ||||
-rw-r--r-- | tools/aapt/tests/AaptGroupEntry_test.cpp | 2 | ||||
-rw-r--r-- | tools/aapt2/DominatorTree_test.cpp | 4 | ||||
-rw-r--r-- | tools/validatekeymaps/Main.cpp | 2 |
8 files changed, 32 insertions, 32 deletions
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp index 0aaf3e8fd6c7..82bcfc2c1a8b 100644 --- a/tools/aapt/AaptAssets.cpp +++ b/tools/aapt/AaptAssets.cpp @@ -99,7 +99,7 @@ static bool isHidden(const char *root, const char *path) String8 fullPath(root); appendPath(fullPath, String8(path)); - FileType type = getFileType(fullPath); + FileType type = getFileType(fullPath.c_str()); int plen = strlen(path); @@ -287,19 +287,19 @@ int AaptLocaleValue::initFromDirName(const Vector<String8>& parts, const int sta Vector<String8> subtags = AaptUtil::splitAndLowerCase(part, '+'); subtags.removeItemsAt(0); if (subtags.size() == 1) { - setLanguage(subtags[0]); + setLanguage(subtags[0].c_str()); } else if (subtags.size() == 2) { - setLanguage(subtags[0]); + setLanguage(subtags[0].c_str()); // The second tag can either be a region, a variant or a script. switch (subtags[1].size()) { case 2: case 3: - setRegion(subtags[1]); + setRegion(subtags[1].c_str()); break; case 4: if (isAlpha(subtags[1])) { - setScript(subtags[1]); + setScript(subtags[1].c_str()); break; } // This is not alphabetical, so we fall through to variant @@ -308,7 +308,7 @@ int AaptLocaleValue::initFromDirName(const Vector<String8>& parts, const int sta case 6: case 7: case 8: - setVariant(subtags[1]); + setVariant(subtags[1].c_str()); break; default: fprintf(stderr, "ERROR: Invalid BCP 47 tag in directory name %s\n", @@ -317,14 +317,14 @@ int AaptLocaleValue::initFromDirName(const Vector<String8>& parts, const int sta } } else if (subtags.size() == 3) { // The language is always the first subtag. - setLanguage(subtags[0]); + setLanguage(subtags[0].c_str()); // The second subtag can either be a script or a region code. // If its size is 4, it's a script code, else it's a region code. if (subtags[1].size() == 4) { - setScript(subtags[1]); + setScript(subtags[1].c_str()); } else if (subtags[1].size() == 2 || subtags[1].size() == 3) { - setRegion(subtags[1]); + setRegion(subtags[1].c_str()); } else { fprintf(stderr, "ERROR: Invalid BCP 47 tag in directory name %s\n", part.c_str()); return -1; @@ -333,15 +333,15 @@ int AaptLocaleValue::initFromDirName(const Vector<String8>& parts, const int sta // The third tag can either be a region code (if the second tag was // a script), else a variant code. if (subtags[2].size() >= 4) { - setVariant(subtags[2]); + setVariant(subtags[2].c_str()); } else { - setRegion(subtags[2]); + setRegion(subtags[2].c_str()); } } else if (subtags.size() == 4) { - setLanguage(subtags[0]); - setScript(subtags[1]); - setRegion(subtags[2]); - setVariant(subtags[3]); + setLanguage(subtags[0].c_str()); + setScript(subtags[1].c_str()); + setRegion(subtags[2].c_str()); + setVariant(subtags[3].c_str()); } else { fprintf(stderr, "ERROR: Invalid BCP 47 tag in directory name: %s\n", part.c_str()); return -1; @@ -351,7 +351,7 @@ int AaptLocaleValue::initFromDirName(const Vector<String8>& parts, const int sta } else { if ((part.length() == 2 || part.length() == 3) && isAlpha(part) && strcmp("car", part.c_str())) { - setLanguage(part); + setLanguage(part.c_str()); if (++currentIndex == size) { return size; } diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index 800466aa587f..43a8b52f2766 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -401,7 +401,7 @@ static void printUsesImpliedPermission(const String8& name, const String8& reaso Vector<String8> getNfcAidCategories(AssetManager& assets, const String8& xmlPath, bool offHost, String8 *outError = NULL) { - Asset* aidAsset = assets.openNonAsset(xmlPath, Asset::ACCESS_BUFFER); + Asset* aidAsset = assets.openNonAsset(xmlPath.c_str(), Asset::ACCESS_BUFFER); if (aidAsset == NULL) { if (outError != NULL) *outError = "xml resource does not exist"; return Vector<String8>(); @@ -2760,7 +2760,7 @@ int doPackage(Bundle* bundle) appendPath(dependencyFile, "R.java.d"); } // Make sure we have a clean dependency file to start with - fp = fopen(dependencyFile, "w"); + fp = fopen(dependencyFile.c_str(), "w"); fclose(fp); } @@ -2849,7 +2849,7 @@ int doPackage(Bundle* bundle) if (bundle->getGenDependencies()) { // Now that writeResourceSymbols or writeAPK has taken care of writing // the targets to our dependency file, we'll write the prereqs - fp = fopen(dependencyFile, "a+"); + fp = fopen(dependencyFile.c_str(), "a+"); fprintf(fp, " : "); bool includeRaw = (outputAPKFile != NULL); err = writeDependencyPreReqs(bundle, assets, fp, includeRaw); diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index 3a198fd43d48..7e4e186ec320 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -924,7 +924,7 @@ status_t massageManifest(Bundle* bundle, ResourceTable* table, sp<XMLNode> root) if (bundle->getCompileSdkVersion() != 0) { if (!addTagAttribute(root, RESOURCES_ANDROID_NAMESPACE, "compileSdkVersion", - String8::format("%d", bundle->getCompileSdkVersion()), + String8::format("%d", bundle->getCompileSdkVersion()).c_str(), errorOnFailedInsert, true)) { return UNKNOWN_ERROR; } @@ -932,21 +932,21 @@ status_t massageManifest(Bundle* bundle, ResourceTable* table, sp<XMLNode> root) if (bundle->getCompileSdkVersionCodename() != "") { if (!addTagAttribute(root, RESOURCES_ANDROID_NAMESPACE, "compileSdkVersionCodename", - bundle->getCompileSdkVersionCodename(), errorOnFailedInsert, true)) { + bundle->getCompileSdkVersionCodename().c_str(), errorOnFailedInsert, true)) { return UNKNOWN_ERROR; } } if (bundle->getPlatformBuildVersionCode() != "") { if (!addTagAttribute(root, "", "platformBuildVersionCode", - bundle->getPlatformBuildVersionCode(), errorOnFailedInsert, true)) { + bundle->getPlatformBuildVersionCode().c_str(), errorOnFailedInsert, true)) { return UNKNOWN_ERROR; } } if (bundle->getPlatformBuildVersionName() != "") { if (!addTagAttribute(root, "", "platformBuildVersionName", - bundle->getPlatformBuildVersionName(), errorOnFailedInsert, true)) { + bundle->getPlatformBuildVersionName().c_str(), errorOnFailedInsert, true)) { return UNKNOWN_ERROR; } } @@ -1210,7 +1210,7 @@ status_t generateAndroidManifestForSplit(Bundle* bundle, const sp<AaptAssets>& a sp<XMLNode> manifest = XMLNode::newElement(filename, String16(), String16("manifest")); // Add the 'package' attribute which is set to the package name. - const char* packageName = assets->getPackage(); + const char* packageName = assets->getPackage().c_str(); const char* manifestPackageNameOverride = bundle->getManifestPackageNameOverride(); if (manifestPackageNameOverride != NULL) { packageName = manifestPackageNameOverride; diff --git a/tools/aapt/StringPool.cpp b/tools/aapt/StringPool.cpp index 8d0268393433..1af8d6f67bd3 100644 --- a/tools/aapt/StringPool.cpp +++ b/tools/aapt/StringPool.cpp @@ -472,13 +472,13 @@ status_t StringPool::writeStringBlock(const sp<AaptFile>& pool) ENCODE_LENGTH(strings, sizeof(uint8_t), encSize) - strncpy((char*)strings, encStr, encSize+1); + strncpy((char*)strings, encStr.c_str(), encSize + 1); } else { char16_t* strings = (char16_t*)dat; ENCODE_LENGTH(strings, sizeof(char16_t), strSize) - strcpy16_htod(strings, ent.value); + strcpy16_htod(strings, ent.value.c_str()); } strPos += totalSize; @@ -592,7 +592,7 @@ ssize_t StringPool::offsetForString(const String16& val) const ssize_t res = indices != NULL && indices->size() > 0 ? indices->itemAt(0) : -1; if (kIsDebug) { printf("Offset for string %s: %zd (%s)\n", String8(val).c_str(), res, - res >= 0 ? String8(mEntries[mEntryArray[res]].value).c_str() : String8()); + res >= 0 ? String8(mEntries[mEntryArray[res]].value).c_str() : ""); } return res; } diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp index a887ac947835..1a648c01f631 100644 --- a/tools/aapt/XMLNode.cpp +++ b/tools/aapt/XMLNode.cpp @@ -559,7 +559,7 @@ status_t parseXMLResource(const sp<AaptFile>& file, ResXMLTree* outTree, root->removeWhitespace(stripAll, cDataTags); if (kIsDebug) { - printf("Input XML from %s:\n", (const char*)file->getPrintableSource()); + printf("Input XML from %s:\n", file->getPrintableSource().c_str()); root->print(); } sp<AaptFile> rsc = new AaptFile(String8(), AaptGroupEntry(), String8()); diff --git a/tools/aapt/tests/AaptGroupEntry_test.cpp b/tools/aapt/tests/AaptGroupEntry_test.cpp index bf5ca59a81c8..8621e9be7010 100644 --- a/tools/aapt/tests/AaptGroupEntry_test.cpp +++ b/tools/aapt/tests/AaptGroupEntry_test.cpp @@ -24,7 +24,7 @@ using android::String8; static ::testing::AssertionResult TestParse(AaptGroupEntry& entry, const String8& dirName, String8* outType) { - if (entry.initFromDirName(dirName, outType)) { + if (entry.initFromDirName(dirName.c_str(), outType)) { return ::testing::AssertionSuccess() << dirName << " was successfully parsed"; } return ::testing::AssertionFailure() << dirName << " could not be parsed"; diff --git a/tools/aapt2/DominatorTree_test.cpp b/tools/aapt2/DominatorTree_test.cpp index a0679a65b9fd..087f456ec084 100644 --- a/tools/aapt2/DominatorTree_test.cpp +++ b/tools/aapt2/DominatorTree_test.cpp @@ -50,8 +50,8 @@ class PrettyPrinter : public DominatorTree::Visitor { private: void VisitConfig(const DominatorTree::Node* node, const int indent) { auto config_string = node->value()->config.toString(); - buffer_ << std::string(indent, ' ') << (config_string.empty() ? "<default>" : config_string) - << std::endl; + buffer_ << std::string(indent, ' ') + << (config_string.empty() ? "<default>" : config_string.c_str()) << std::endl; } void VisitNode(const DominatorTree::Node* node, const int indent) { diff --git a/tools/validatekeymaps/Main.cpp b/tools/validatekeymaps/Main.cpp index 0d7d5f949a08..6cae3ecc6e44 100644 --- a/tools/validatekeymaps/Main.cpp +++ b/tools/validatekeymaps/Main.cpp @@ -165,7 +165,7 @@ static bool validateFile(const char* filename) { case FileType::INPUT_DEVICE_CONFIGURATION: { android::base::Result<std::unique_ptr<PropertyMap>> propertyMap = - PropertyMap::load(String8(filename)); + PropertyMap::load(String8(filename).c_str()); if (!propertyMap.ok()) { error("Error %d parsing input device configuration file.\n\n", propertyMap.error().code()); |