summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2023-09-13 22:08:53 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-09-13 22:08:53 +0000
commitd001ea5b7242f110530e339d479b28b29dadc242 (patch)
tree461583516b23b03f09774f48e416790fed432551
parent20bb26382d5244b979baa8a6d9a42cc92f208d5b (diff)
parent41363ba9fceec76e0233db8889d75e986b91f39a (diff)
Merge "Don't depend on String8 cast to C string" into main am: 41363ba9fc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2748044 Change-Id: I0ad1370690eb3763c4d2a7a361bc91f22fd15919 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--cmds/bootanimation/BootAnimation.cpp2
-rw-r--r--cmds/idmap2/idmap2/Lookup.cpp2
-rw-r--r--cmds/incidentd/src/IncidentService.cpp2
-rw-r--r--libs/androidfw/AssetManager.cpp12
-rw-r--r--libs/androidfw/AssetManager2.cpp2
-rw-r--r--libs/androidfw/ResourceTypes.cpp6
-rw-r--r--libs/protoutil/include/android/util/ProtoOutputStream.h2
-rw-r--r--libs/protoutil/src/ProtoOutputStream.cpp4
-rw-r--r--media/jni/android_media_MediaCodec.cpp12
-rw-r--r--media/jni/android_media_MediaDescrambler.cpp2
-rw-r--r--media/jni/android_media_MediaPlayer.cpp2
-rw-r--r--native/android/obb.cpp2
-rw-r--r--tools/aapt/AaptAssets.cpp32
-rw-r--r--tools/aapt/Command.cpp6
-rw-r--r--tools/aapt/Resource.cpp10
-rw-r--r--tools/aapt/StringPool.cpp6
-rw-r--r--tools/aapt/XMLNode.cpp2
-rw-r--r--tools/aapt/tests/AaptGroupEntry_test.cpp2
-rw-r--r--tools/aapt2/DominatorTree_test.cpp4
-rw-r--r--tools/validatekeymaps/Main.cpp2
20 files changed, 57 insertions, 57 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 302af7642e14..681f8e9f44a0 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -1788,7 +1788,7 @@ BootAnimation::Animation* BootAnimation::loadAnimation(const String8& fn) {
fn.c_str());
return nullptr;
}
- ZipFileRO *zip = ZipFileRO::open(fn);
+ ZipFileRO *zip = ZipFileRO::open(fn.c_str());
if (zip == nullptr) {
SLOGE("Failed to open animation zip \"%s\": %s",
fn.c_str(), strerror(errno));
diff --git a/cmds/idmap2/idmap2/Lookup.cpp b/cmds/idmap2/idmap2/Lookup.cpp
index f41e57cc66d6..0862fbe78936 100644
--- a/cmds/idmap2/idmap2/Lookup.cpp
+++ b/cmds/idmap2/idmap2/Lookup.cpp
@@ -94,7 +94,7 @@ void PrintValue(AssetManager2* const am, const AssetManager2::SelectedValue& val
const ResStringPool* pool = am->GetStringPoolForCookie(value.cookie);
out->append("\"");
if (auto str = pool->string8ObjectAt(value.data); str.ok()) {
- out->append(*str);
+ out->append(str->c_str());
}
} break;
default:
diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp
index 53c7b744ee0f..82c87071bfff 100644
--- a/cmds/incidentd/src/IncidentService.cpp
+++ b/cmds/incidentd/src/IncidentService.cpp
@@ -563,7 +563,7 @@ status_t IncidentService::command(FILE* in, FILE* out, FILE* err, Vector<String8
fprintf(out, "Not enough arguments for section\n");
return NO_ERROR;
}
- int id = atoi(args[1]);
+ int id = atoi(args[1].c_str());
int idx = 0;
while (SECTION_LIST[idx] != NULL) {
const Section* section = SECTION_LIST[idx];
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index fd6e18ee364a..68befffecf2f 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -812,10 +812,10 @@ Asset* AssetManager::openNonAssetInPathLocked(const char* fileName, AccessMode m
/* check the appropriate Zip file */
ZipFileRO* pZip = getZipFileLocked(ap);
if (pZip != NULL) {
- ALOGV("GOT zip, checking NA '%s'", (const char*) path);
+ ALOGV("GOT zip, checking NA '%s'", path.c_str());
ZipEntryRO entry = pZip->findEntryByName(path.c_str());
if (entry != NULL) {
- ALOGV("FOUND NA in Zip file for %s", (const char*) path);
+ ALOGV("FOUND NA in Zip file for %s", path.c_str());
pAsset = openAssetFromZipLocked(pZip, entry, mode, path);
pZip->releaseEntry(entry);
}
@@ -1425,7 +1425,7 @@ AssetManager::SharedZip::SharedZip(const String8& path, time_t modWhen)
mResourceTableAsset(NULL), mResourceTable(NULL)
{
if (kIsDebug) {
- ALOGI("Creating SharedZip %p %s\n", this, (const char*)mPath);
+ ALOGI("Creating SharedZip %p %s\n", this, mPath.c_str());
}
ALOGV("+++ opening zip '%s'\n", mPath.c_str());
mZipFile = ZipFileRO::open(mPath.c_str());
@@ -1439,7 +1439,7 @@ AssetManager::SharedZip::SharedZip(int fd, const String8& path)
mResourceTableAsset(NULL), mResourceTable(NULL)
{
if (kIsDebug) {
- ALOGI("Creating SharedZip %p fd=%d %s\n", this, fd, (const char*)mPath);
+ ALOGI("Creating SharedZip %p fd=%d %s\n", this, fd, mPath.c_str());
}
ALOGV("+++ opening zip fd=%d '%s'\n", fd, mPath.c_str());
mZipFile = ZipFileRO::openFd(fd, mPath.c_str());
@@ -1453,7 +1453,7 @@ sp<AssetManager::SharedZip> AssetManager::SharedZip::get(const String8& path,
bool createIfNotPresent)
{
AutoMutex _l(gLock);
- time_t modWhen = getFileModDate(path);
+ time_t modWhen = getFileModDate(path.c_str());
sp<SharedZip> zip = gOpen.valueFor(path).promote();
if (zip != NULL && zip->mModWhen == modWhen) {
return zip;
@@ -1541,7 +1541,7 @@ bool AssetManager::SharedZip::getOverlay(size_t idx, asset_path* out) const
AssetManager::SharedZip::~SharedZip()
{
if (kIsDebug) {
- ALOGI("Destroying SharedZip %p %s\n", this, (const char*)mPath);
+ ALOGI("Destroying SharedZip %p %s\n", this, mPath.c_str());
}
if (mResourceTable != NULL) {
delete mResourceTable;
diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp
index 12be1e0d1bd4..c712d01fe1c2 100644
--- a/libs/androidfw/AssetManager2.cpp
+++ b/libs/androidfw/AssetManager2.cpp
@@ -913,7 +913,7 @@ std::string AssetManager2::GetLastResourceResolution() const {
log_stream << "\nBest matching is from "
<< (last_resolution_.best_config_name.empty() ? "default"
- : last_resolution_.best_config_name)
+ : last_resolution_.best_config_name.c_str())
<< " configuration of " << last_resolution_.best_package_name;
return log_stream.str();
}
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 620f31b9ed80..c13827fe29c3 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -5253,19 +5253,19 @@ bool ResTable::expandResourceRef(const char16_t* refStr, size_t refLen,
*outType = *defType;
}
*outName = String16(p, end-p);
- if(**outPackage == 0) {
+ if(outPackage->empty()) {
if(outErrorMsg) {
*outErrorMsg = "Resource package cannot be an empty string";
}
return false;
}
- if(**outType == 0) {
+ if(outType->empty()) {
if(outErrorMsg) {
*outErrorMsg = "Resource type cannot be an empty string";
}
return false;
}
- if(**outName == 0) {
+ if(outName->empty()) {
if(outErrorMsg) {
*outErrorMsg = "Resource id cannot be an empty string";
}
diff --git a/libs/protoutil/include/android/util/ProtoOutputStream.h b/libs/protoutil/include/android/util/ProtoOutputStream.h
index f4a358de1c41..1bfb874729d7 100644
--- a/libs/protoutil/include/android/util/ProtoOutputStream.h
+++ b/libs/protoutil/include/android/util/ProtoOutputStream.h
@@ -102,7 +102,7 @@ public:
bool write(uint64_t fieldId, long val);
bool write(uint64_t fieldId, long long val);
bool write(uint64_t fieldId, bool val);
- bool write(uint64_t fieldId, std::string val);
+ bool write(uint64_t fieldId, std::string_view val);
bool write(uint64_t fieldId, const char* val, size_t size);
/**
diff --git a/libs/protoutil/src/ProtoOutputStream.cpp b/libs/protoutil/src/ProtoOutputStream.cpp
index fcf82eed4eb1..a44a1b210924 100644
--- a/libs/protoutil/src/ProtoOutputStream.cpp
+++ b/libs/protoutil/src/ProtoOutputStream.cpp
@@ -170,13 +170,13 @@ ProtoOutputStream::write(uint64_t fieldId, bool val)
}
bool
-ProtoOutputStream::write(uint64_t fieldId, std::string val)
+ProtoOutputStream::write(uint64_t fieldId, std::string_view val)
{
if (mCompact) return false;
const uint32_t id = (uint32_t)fieldId;
switch (fieldId & FIELD_TYPE_MASK) {
case FIELD_TYPE_STRING:
- writeUtf8StringImpl(id, val.c_str(), val.size());
+ writeUtf8StringImpl(id, val.data(), val.size());
return true;
default:
ALOGW("Field type %" PRIu64 " is not supported when writing string val.",
diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp
index b03a039d74b8..ef90bf993437 100644
--- a/media/jni/android_media_MediaCodec.cpp
+++ b/media/jni/android_media_MediaCodec.cpp
@@ -1043,7 +1043,7 @@ static jthrowable createCodecException(
CHECK(ctor != NULL);
ScopedLocalRef<jstring> msgObj(
- env, env->NewStringUTF(msg != NULL ? msg : String8::format("Error %#x", err)));
+ env, env->NewStringUTF(msg != NULL ? msg : String8::format("Error %#x", err).c_str()));
// translate action code to Java equivalent
switch (actionCode) {
@@ -3036,7 +3036,7 @@ static void android_media_MediaCodec_setVideoScalingMode(
if (mode != NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW
&& mode != NATIVE_WINDOW_SCALING_MODE_SCALE_CROP) {
jniThrowException(env, "java/lang/IllegalArgumentException",
- String8::format("Unrecognized mode: %d", mode));
+ String8::format("Unrecognized mode: %d", mode).c_str());
return;
}
@@ -3467,27 +3467,27 @@ static void android_media_MediaCodec_native_setup(
if (err == NAME_NOT_FOUND) {
// fail and do not try again.
jniThrowException(env, "java/lang/IllegalArgumentException",
- String8::format("Failed to initialize %s, error %#x (NAME_NOT_FOUND)", tmp, err));
+ String8::format("Failed to initialize %s, error %#x (NAME_NOT_FOUND)", tmp, err).c_str());
env->ReleaseStringUTFChars(name, tmp);
return;
}
if (err == NO_MEMORY) {
throwCodecException(env, err, ACTION_CODE_TRANSIENT,
- String8::format("Failed to initialize %s, error %#x (NO_MEMORY)", tmp, err));
+ String8::format("Failed to initialize %s, error %#x (NO_MEMORY)", tmp, err).c_str());
env->ReleaseStringUTFChars(name, tmp);
return;
}
if (err == PERMISSION_DENIED) {
jniThrowException(env, "java/lang/SecurityException",
String8::format("Failed to initialize %s, error %#x (PERMISSION_DENIED)", tmp,
- err));
+ err).c_str());
env->ReleaseStringUTFChars(name, tmp);
return;
}
if (err != OK) {
// believed possible to try again
jniThrowException(env, "java/io/IOException",
- String8::format("Failed to find matching codec %s, error %#x (?)", tmp, err));
+ String8::format("Failed to find matching codec %s, error %#x (?)", tmp, err).c_str());
env->ReleaseStringUTFChars(name, tmp);
return;
}
diff --git a/media/jni/android_media_MediaDescrambler.cpp b/media/jni/android_media_MediaDescrambler.cpp
index c61365a448d3..37111c28c242 100644
--- a/media/jni/android_media_MediaDescrambler.cpp
+++ b/media/jni/android_media_MediaDescrambler.cpp
@@ -368,7 +368,7 @@ static jthrowable createServiceSpecificException(
ScopedLocalRef<jstring> msgObj(
env, env->NewStringUTF(msg != NULL ?
- msg : String8::format("Error %#x", serviceSpecificError)));
+ msg : String8::format("Error %#x", serviceSpecificError).c_str()));
return (jthrowable)env->NewObject(
clazz.get(), ctor, serviceSpecificError, msgObj.get());
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 3551ea422310..d05ee551c172 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -260,7 +260,7 @@ android_media_MediaPlayer_setDataSourceAndHeaders(
status_t opStatus =
mp->setDataSource(
httpService,
- pathStr,
+ pathStr.c_str(),
headersVector.size() > 0? &headersVector : NULL);
process_media_player_call(
diff --git a/native/android/obb.cpp b/native/android/obb.cpp
index e9900249b289..a14fa7e58fa8 100644
--- a/native/android/obb.cpp
+++ b/native/android/obb.cpp
@@ -42,7 +42,7 @@ void AObbInfo_delete(AObbInfo* obbInfo) {
}
const char* AObbInfo_getPackageName(AObbInfo* obbInfo) {
- return obbInfo->getPackageName();
+ return obbInfo->getPackageName().c_str();
}
int32_t AObbInfo_getVersion(AObbInfo* obbInfo) {
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 0fa13b81c4ea..70d875e394ff 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 parsing input device configuration file: %s.\n\n",
propertyMap.error().message().c_str());