本文整理汇总了C++中String8::toLower方法的典型用法代码示例。如果您正苦于以下问题:C++ String8::toLower方法的具体用法?C++ String8::toLower怎么用?C++ String8::toLower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String8
的用法示例。
在下文中一共展示了String8::toLower方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onOpenDecryptSession
status_t FwdLockEngine::onOpenDecryptSession(int uniqueId,
DecryptHandle* decryptHandle,
const char* uri) {
status_t result = DRM_ERROR_CANNOT_HANDLE;
const char fileTag [] = "file://";
if (NULL != decryptHandle && NULL != uri && strlen(uri) > sizeof(fileTag)) {
String8 uriTag = String8(uri);
uriTag.toLower();
if (0 == strncmp(uriTag.string(), fileTag, sizeof(fileTag) - 1)) {
const char *filePath = strchr(uri + sizeof(fileTag) - 1, '/');
if (NULL != filePath && onCanHandle(uniqueId, String8(filePath))) {
int fd = open(filePath, O_RDONLY);
if (-1 < fd) {
// offset is always 0 and length is not used. so any positive size.
result = onOpenDecryptSession(uniqueId, decryptHandle, fd, 0, 1);
// fd is duplicated already if success. closing the file
close(fd);
}
}
}
}
return result;
}
示例2: onGetOriginalMimeType
String8 FwdLockEngine::onGetOriginalMimeType(int /* uniqueId */,
const String8& /* path */,
int fd) {
LOG_VERBOSE("FwdLockEngine::onGetOriginalMimeType");
String8 mimeString = String8("");
int fileDesc = dup(fd);
if (-1 < fileDesc) {
if (FwdLockFile_attach(fileDesc) < 0) {
close(fileDesc);
return mimeString;
}
const char* pMimeType = FwdLockFile_GetContentType(fileDesc);
if (NULL != pMimeType) {
String8 contentType = String8(pMimeType);
contentType.toLower();
mimeString = MimeTypeUtil::convertMimeType(contentType);
}
FwdLockFile_close(fileDesc);
}
return mimeString;
}
示例3: onOpenDecryptSession
status_t FwdLockEngine::onOpenDecryptSession(int uniqueId,
DecryptHandle* decryptHandle,
int fd,
off64_t offset,
off64_t length) {
#else
status_t FwdLockEngine::onOpenDecryptSession(int uniqueId,
DecryptHandle* decryptHandle,
int fd,
int offset,
int length) {
#endif
status_t result = DRM_ERROR_CANNOT_HANDLE;
int fileDesc = -1;
LOG_VERBOSE("FwdLockEngine::onOpenDecryptSession");
if ((-1 < fd) &&
(NULL != decryptHandle) &&
(!decodeSessionMap.isCreated(decryptHandle->decryptId))) {
fileDesc = dup(fd);
} else {
ALOGE("FwdLockEngine::onOpenDecryptSession parameter error");
return result;
}
if (-1 < fileDesc &&
-1 < ::lseek(fileDesc, offset, SEEK_SET) &&
-1 < FwdLockFile_attach(fileDesc)) {
// check for file integrity. This must be done to protect the content mangling.
int retVal = FwdLockFile_CheckHeaderIntegrity(fileDesc);
DecodeSession* decodeSession = new DecodeSession(fileDesc);
if (retVal && NULL != decodeSession) {
decodeSessionMap.addValue(decryptHandle->decryptId, decodeSession);
const char *pmime= FwdLockFile_GetContentType(fileDesc);
String8 contentType = String8(pmime == NULL ? "" : pmime);
contentType.toLower();
decryptHandle->mimeType = MimeTypeUtil::convertMimeType(contentType);
decryptHandle->decryptApiType = DecryptApiType::CONTAINER_BASED;
decryptHandle->status = RightsStatus::RIGHTS_VALID;
decryptHandle->decryptInfo = NULL;
result = DRM_NO_ERROR;
} else {
LOG_VERBOSE("FwdLockEngine::onOpenDecryptSession Integrity Check failed for the fd");
FwdLockFile_detach(fileDesc);
delete decodeSession;
}
}
if (DRM_NO_ERROR != result && -1 < fileDesc) {
::close(fileDesc);
}
LOG_VERBOSE("FwdLockEngine::onOpenDecryptSession Exit. result = %d", result);
return result;
}
示例4: onGetOriginalMimeType
String8 FwdLockEngine::onGetOriginalMimeType(int uniqueId, const String8& path) {
LOG_VERBOSE("FwdLockEngine::onGetOriginalMimeType");
String8 mimeString = String8("");
int fileDesc = FwdLockFile_open(path.string());
if (-1 < fileDesc) {
const char* pMimeType = FwdLockFile_GetContentType(fileDesc);
if (NULL != pMimeType) {
String8 contentType = String8(pMimeType);
contentType.toLower();
mimeString = MimeTypeUtil::convertMimeType(contentType);
}
FwdLockFile_close(fileDesc);
}
return mimeString;
}
示例5: onCanHandle
bool DrmPassthruPlugIn::onCanHandle(int uniqueId, const String8& path) {
ALOGV("DrmPassthruPlugIn::canHandle: %s ", path.string());
String8 extension = path.getPathExtension();
extension.toLower();
return (String8(".passthru") == extension);
}