Use String8/16 c_str [media]
Bug: 295394788
Test: make checkbuild
Change-Id: I4ba5400f39c769bec59508525844f1daefe1d15c
diff --git a/drm/common/DrmSupportInfo.cpp b/drm/common/DrmSupportInfo.cpp
index 584c6a6..6294f50 100644
--- a/drm/common/DrmSupportInfo.cpp
+++ b/drm/common/DrmSupportInfo.cpp
@@ -50,7 +50,7 @@
for (size_t i = 0; i < mMimeTypeVector.size(); i++) {
const String8 item = mMimeTypeVector.itemAt(i);
- if (!strcasecmp(item.string(), mimeType.string())) {
+ if (!strcasecmp(item.c_str(), mimeType.c_str())) {
return true;
}
}
@@ -61,7 +61,7 @@
for (size_t i = 0; i < mFileSuffixVector.size(); i++) {
const String8 item = mFileSuffixVector.itemAt(i);
- if (!strcasecmp(item.string(), fileType.string())) {
+ if (!strcasecmp(item.c_str(), fileType.c_str())) {
return true;
}
}
diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp
index a6d33b0..1b49be1 100644
--- a/drm/common/IDrmManagerService.cpp
+++ b/drm/common/IDrmManagerService.cpp
@@ -303,8 +303,8 @@
const String8 value = drmInforequest->get(key);
if (key == String8("FileDescriptorKey")) {
int fd = -1;
- if (sscanf(value.string(), "FileDescriptor[%d]", &fd) != 1) {
- sscanf(value.string(), "%d", &fd);
+ if (sscanf(value.c_str(), "FileDescriptor[%d]", &fd) != 1) {
+ sscanf(value.c_str(), "%d", &fd);
}
data.writeFileDescriptor(fd);
} else {
@@ -1330,7 +1330,7 @@
const String8 mime = data.readString8();
sp<DecryptHandle> handle
- = openDecryptSession(uniqueId, fd, offset, length, mime.string());
+ = openDecryptSession(uniqueId, fd, offset, length, mime.c_str());
if (NULL != handle.get()) {
writeDecryptHandleToParcelData(handle.get(), reply);
@@ -1349,7 +1349,7 @@
const String8 uri = data.readString8();
const String8 mime = data.readString8();
- sp<DecryptHandle> handle = openDecryptSession(uniqueId, uri.string(), mime.string());
+ sp<DecryptHandle> handle = openDecryptSession(uniqueId, uri.c_str(), mime.c_str());
if (NULL != handle.get()) {
writeDecryptHandleToParcelData(handle.get(), reply);
diff --git a/drm/common/ReadWriteUtils.cpp b/drm/common/ReadWriteUtils.cpp
index 16b5b34..97c3716 100644
--- a/drm/common/ReadWriteUtils.cpp
+++ b/drm/common/ReadWriteUtils.cpp
@@ -34,7 +34,7 @@
String8 ReadWriteUtils::readBytes(const String8& filePath) {
FILE* file = NULL;
- file = fopen(filePath.string(), "r");
+ file = fopen(filePath.c_str(), "r");
String8 string("");
if (NULL != file) {
@@ -56,7 +56,7 @@
int ReadWriteUtils::readBytes(const String8& filePath, char** buffer) {
FILE* file = NULL;
- file = fopen(filePath.string(), "r");
+ file = fopen(filePath.c_str(), "r");
off64_t length = 0;
if (NULL != file) {
@@ -77,15 +77,15 @@
void ReadWriteUtils::writeToFile(const String8& filePath, const String8& data) {
FILE* file = NULL;
- file = fopen(filePath.string(), "w+");
+ file = fopen(filePath.c_str(), "w+");
if (NULL != file) {
int fd = fileno(file);
int size = data.size();
if (FAILURE != ftruncate(fd, size)) {
- if (size != write(fd, data.string(), size)) {
- ALOGE("Failed to write the data to: %s", filePath.string());
+ if (size != write(fd, data.c_str(), size)) {
+ ALOGE("Failed to write the data to: %s", filePath.c_str());
}
}
fclose(file);
@@ -94,14 +94,14 @@
void ReadWriteUtils::appendToFile(const String8& filePath, const String8& data) {
FILE* file = NULL;
- file = fopen(filePath.string(), "a+");
+ file = fopen(filePath.c_str(), "a+");
if (NULL != file) {
int fd = fileno(file);
int size = data.size();
- if (size != write(fd, data.string(), size)) {
- ALOGE("Failed to write the data to: %s", filePath.string());
+ if (size != write(fd, data.c_str(), size)) {
+ ALOGE("Failed to write the data to: %s", filePath.c_str());
}
fclose(file);
}