mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Use String8/16 c_str [camera]
Bug: 295394788 Test: make checkbuild Change-Id: I7ca371112e891f4f40673b5c34e3b8ccc41841bf
This commit is contained in:
@@ -258,7 +258,7 @@ status_t CameraMetadata::update(uint32_t tag, const String8& string) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
// string.size() doesn't count the null termination character.
|
// string.size() doesn't count the null termination character.
|
||||||
return updateImpl(tag, (const void*)string.string(), string.size() + 1);
|
return updateImpl(tag, (const void*)string.c_str(), string.size() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t CameraMetadata::update(const camera_metadata_ro_entry& entry) {
|
status_t CameraMetadata::update(const camera_metadata_ro_entry& entry) {
|
||||||
@@ -455,7 +455,7 @@ status_t CameraMetadata::getTagFromName(const char* name, const VendorTagDescrip
|
|||||||
for (size_t i = 0; i < totalSectionCount; ++i) {
|
for (size_t i = 0; i < totalSectionCount; ++i) {
|
||||||
const char* str = (i < ANDROID_SECTION_COUNT)
|
const char* str = (i < ANDROID_SECTION_COUNT)
|
||||||
? camera_metadata_section_names[i]
|
? camera_metadata_section_names[i]
|
||||||
: (*vendorSections)[i - ANDROID_SECTION_COUNT].string();
|
: (*vendorSections)[i - ANDROID_SECTION_COUNT].c_str();
|
||||||
|
|
||||||
ALOGV("%s: Trying to match against section '%s'", __FUNCTION__, str);
|
ALOGV("%s: Trying to match against section '%s'", __FUNCTION__, str);
|
||||||
|
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ String8 CameraParameters::flatten() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CameraParameters::unflatten(const String8& params) {
|
void CameraParameters::unflatten(const String8& params) {
|
||||||
const char* a = params.string();
|
const char* a = params.c_str();
|
||||||
const char* b;
|
const char* b;
|
||||||
|
|
||||||
mMap.clear();
|
mMap.clear();
|
||||||
@@ -263,7 +263,7 @@ void CameraParameters::setFloat(const char* key, float value) {
|
|||||||
const char* CameraParameters::get(const char* key) const {
|
const char* CameraParameters::get(const char* key) const {
|
||||||
String8 v = mMap.valueFor(String8(key));
|
String8 v = mMap.valueFor(String8(key));
|
||||||
if (v.length() == 0) return 0;
|
if (v.length() == 0) return 0;
|
||||||
return v.string();
|
return v.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CameraParameters::getInt(const char* key) const {
|
int CameraParameters::getInt(const char* key) const {
|
||||||
@@ -429,7 +429,7 @@ void CameraParameters::dump() const {
|
|||||||
String8 k, v;
|
String8 k, v;
|
||||||
k = mMap.keyAt(i);
|
k = mMap.keyAt(i);
|
||||||
v = mMap.valueAt(i);
|
v = mMap.valueAt(i);
|
||||||
ALOGD("%s: %s\n", k.string(), v.string());
|
ALOGD("%s: %s\n", k.c_str(), v.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,10 +443,10 @@ status_t CameraParameters::dump(int fd, const Vector<String16>& /*args*/) const
|
|||||||
String8 k, v;
|
String8 k, v;
|
||||||
k = mMap.keyAt(i);
|
k = mMap.keyAt(i);
|
||||||
v = mMap.valueAt(i);
|
v = mMap.valueAt(i);
|
||||||
snprintf(buffer, 255, "\t%s: %s\n", k.string(), v.string());
|
snprintf(buffer, 255, "\t%s: %s\n", k.c_str(), v.c_str());
|
||||||
result.append(buffer);
|
result.append(buffer);
|
||||||
}
|
}
|
||||||
write(fd, result.string(), result.size());
|
write(fd, result.c_str(), result.size());
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ const char* VendorTagDescriptor::getSectionName(uint32_t tag) const {
|
|||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return VENDOR_SECTION_NAME_ERR;
|
return VENDOR_SECTION_NAME_ERR;
|
||||||
}
|
}
|
||||||
return mSections[mTagToSectionMap.valueAt(index)].string();
|
return mSections[mTagToSectionMap.valueAt(index)].c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t VendorTagDescriptor::getSectionIndex(uint32_t tag) const {
|
ssize_t VendorTagDescriptor::getSectionIndex(uint32_t tag) const {
|
||||||
@@ -109,7 +109,7 @@ const char* VendorTagDescriptor::getTagName(uint32_t tag) const {
|
|||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
return VENDOR_TAG_NAME_ERR;
|
return VENDOR_TAG_NAME_ERR;
|
||||||
}
|
}
|
||||||
return mTagToNameMap.valueAt(index).string();
|
return mTagToNameMap.valueAt(index).c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
int VendorTagDescriptor::getTagType(uint32_t tag) const {
|
int VendorTagDescriptor::getTagType(uint32_t tag) const {
|
||||||
@@ -128,13 +128,13 @@ status_t VendorTagDescriptor::lookupTag(const String8& name, const String8& sect
|
|||||||
/*out*/ uint32_t* tag) const {
|
/*out*/ uint32_t* tag) const {
|
||||||
ssize_t index = mReverseMapping.indexOfKey(section);
|
ssize_t index = mReverseMapping.indexOfKey(section);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
ALOGE("%s: Section '%s' does not exist.", __FUNCTION__, section.string());
|
ALOGE("%s: Section '%s' does not exist.", __FUNCTION__, section.c_str());
|
||||||
return BAD_VALUE;
|
return BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t nameIndex = mReverseMapping[index]->indexOfKey(name);
|
ssize_t nameIndex = mReverseMapping[index]->indexOfKey(name);
|
||||||
if (nameIndex < 0) {
|
if (nameIndex < 0) {
|
||||||
ALOGE("%s: Tag name '%s' does not exist.", __FUNCTION__, name.string());
|
ALOGE("%s: Tag name '%s' does not exist.", __FUNCTION__, name.c_str());
|
||||||
return BAD_VALUE;
|
return BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ void VendorTagDescriptor::dump(int fd, int verbosity, int indentation) const {
|
|||||||
const char* typeName =
|
const char* typeName =
|
||||||
(type >= 0 && type < NUM_TYPES) ? camera_metadata_type_names[type] : "UNKNOWN";
|
(type >= 0 && type < NUM_TYPES) ? camera_metadata_type_names[type] : "UNKNOWN";
|
||||||
dprintf(fd, "%*s0x%x (%s) with type %d (%s) defined in section %s\n", indentation + 2, "",
|
dprintf(fd, "%*s0x%x (%s) with type %d (%s) defined in section %s\n", indentation + 2, "",
|
||||||
tag, name.string(), type, typeName, sectionName.string());
|
tag, name.c_str(), type, typeName, sectionName.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -439,7 +439,7 @@ bool LegacyCameraProviderImpl_2_4::setUpVendorTags() {
|
|||||||
}
|
}
|
||||||
mVendorTagSections.resize(numSections);
|
mVendorTagSections.resize(numSections);
|
||||||
for (size_t s = 0; s < numSections; s++) {
|
for (size_t s = 0; s < numSections; s++) {
|
||||||
mVendorTagSections[s].sectionName = (*sectionNames)[s].string();
|
mVendorTagSections[s].sectionName = (*sectionNames)[s].c_str();
|
||||||
mVendorTagSections[s].tags = tagsBySection[s];
|
mVendorTagSections[s].tags = tagsBySection[s];
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ namespace {
|
|||||||
std::string* deviceVersion, std::string* cameraId) {
|
std::string* deviceVersion, std::string* cameraId) {
|
||||||
::android::String8 pattern;
|
::android::String8 pattern;
|
||||||
pattern.appendFormat(kDeviceNameRE, providerType.c_str());
|
pattern.appendFormat(kDeviceNameRE, providerType.c_str());
|
||||||
std::regex e(pattern.string());
|
std::regex e(pattern.c_str());
|
||||||
std::string deviceNameStd(deviceName.c_str());
|
std::string deviceNameStd(deviceName.c_str());
|
||||||
std::smatch sm;
|
std::smatch sm;
|
||||||
if (std::regex_match(deviceNameStd, sm, e)) {
|
if (std::regex_match(deviceNameStd, sm, e)) {
|
||||||
@@ -8801,8 +8801,7 @@ void CameraHidlTest::getParameters(
|
|||||||
void CameraHidlTest::setParameters(
|
void CameraHidlTest::setParameters(
|
||||||
const sp<::android::hardware::camera::device::V1_0::ICameraDevice> &device,
|
const sp<::android::hardware::camera::device::V1_0::ICameraDevice> &device,
|
||||||
const CameraParameters &cameraParams) {
|
const CameraParameters &cameraParams) {
|
||||||
Return<Status> returnStatus = device->setParameters(
|
Return<Status> returnStatus = device->setParameters(cameraParams.flatten().c_str());
|
||||||
cameraParams.flatten().string());
|
|
||||||
ASSERT_TRUE(returnStatus.isOk());
|
ASSERT_TRUE(returnStatus.isOk());
|
||||||
ASSERT_EQ(Status::OK, returnStatus);
|
ASSERT_EQ(Status::OK, returnStatus);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user