Use String8/16 c_str
Bug: 295394788
Test: make checkbuild
Change-Id: I538720d4de2dcc038b417048209782ff605b7e30
diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp
index 05a43ad..53c7b74 100644
--- a/cmds/incidentd/src/IncidentService.cpp
+++ b/cmds/incidentd/src/IncidentService.cpp
@@ -407,8 +407,8 @@
Status IncidentService::getIncidentReportList(const String16& pkg16, const String16& cls16,
vector<String16>* result) {
status_t err;
- const string pkg(String8(pkg16).string());
- const string cls(String8(cls16).string());
+ const string pkg(String8(pkg16).c_str());
+ const string cls(String8(cls16).c_str());
// List the reports
vector<sp<ReportFile>> all;
@@ -441,9 +441,9 @@
const String16& id16, IncidentManager::IncidentReport* result) {
status_t err;
- const string pkg(String8(pkg16).string());
- const string cls(String8(cls16).string());
- const string id(String8(id16).string());
+ const string pkg(String8(pkg16).c_str());
+ const string cls(String8(cls16).c_str());
+ const string id(String8(id16).c_str());
IncidentReportArgs args;
sp<ReportFile> file = mWorkDirectory->getReport(pkg, cls, id, &args);
@@ -470,9 +470,9 @@
Status IncidentService::deleteIncidentReports(const String16& pkg16, const String16& cls16,
const String16& id16) {
- const string pkg(String8(pkg16).string());
- const string cls(String8(cls16).string());
- const string id(String8(id16).string());
+ const string pkg(String8(pkg16).c_str());
+ const string cls(String8(cls16).c_str());
+ const string id(String8(id16).c_str());
sp<ReportFile> file = mWorkDirectory->getReport(pkg, cls, id, nullptr);
if (file != nullptr) {
@@ -484,7 +484,7 @@
}
Status IncidentService::deleteAllIncidentReports(const String16& pkg16) {
- const string pkg(String8(pkg16).string());
+ const string pkg(String8(pkg16).c_str());
mWorkDirectory->commitAll(pkg);
mBroadcaster->clearPackageBroadcasts(pkg);
@@ -568,7 +568,7 @@
while (SECTION_LIST[idx] != NULL) {
const Section* section = SECTION_LIST[idx];
if (section->id == id) {
- fprintf(out, "Section[%d] %s\n", id, section->name.string());
+ fprintf(out, "Section[%d] %s\n", id, section->name.c_str());
break;
}
idx++;
@@ -592,7 +592,7 @@
static void printPrivacy(const Privacy* p, FILE* out, String8 indent) {
if (p == NULL) return;
- fprintf(out, "%sid:%d, type:%d, dest:%d\n", indent.string(), p->field_id, p->type, p->policy);
+ fprintf(out, "%sid:%d, type:%d, dest:%d\n", indent.c_str(), p->field_id, p->type, p->policy);
if (p->children == NULL) return;
for (int i = 0; p->children[i] != NULL; i++) { // NULL-terminated.
printPrivacy(p->children[i], out, indent + " ");
@@ -605,7 +605,7 @@
const int argCount = args.size();
if (argCount >= 3) {
String8 opt = args[1];
- int sectionId = atoi(args[2].string());
+ int sectionId = atoi(args[2].c_str());
const Privacy* p = get_privacy_of_section(sectionId);
if (p == NULL) {