cpp check告警问题修复

Signed-off-by: liuxiyao223 <liuxiyao223@huawei.com>
This commit is contained in:
liuxiyao223 2023-12-27 11:51:48 +08:00
parent 67ca8fa93a
commit bac6bde82f
2 changed files with 3 additions and 3 deletions

View File

@ -642,7 +642,7 @@ bool SimFileManager::IsCTSimCard()
bool isCTCardType = IsCTCardType(cardType);
std::string iccId = simFile_->ObtainIccId();
if (!iccId.empty() && iccId.length() >= ICCID_LEN_MINIMUM) {
iccId = iccId.substr(0, ICCID_LEN_MINIMUM);
iccId.resize(ICCID_LEN_MINIMUM);
}
if (isCTCardType && IsCTIccId(iccId)) {
TELEPHONY_LOGI("[slot%{public}d] result = 1", slotId_);
@ -692,7 +692,7 @@ bool SimFileManager::IsCTIccId(std::string iccId)
bool isCTIccId = false;
if (!iccId.empty() && iccId.length() >= ICCID_LEN_MINIMUM) {
if (iccId.compare(0, PREFIX_LOCAL_ICCID_LEN, PREFIX_LOCAL_ICCID) == 0) {
iccId = iccId.substr(0, ICCID_LEN_SIX);
iccId.resize(ICCID_LEN_SIX);
}
auto iccIdRet = find(CT_ICCID_ARRAY.begin(), CT_ICCID_ARRAY.end(), iccId);
isCTIccId = iccIdRet != CT_ICCID_ARRAY.end();

View File

@ -430,7 +430,7 @@ HWTEST_F(BranchTest, Telephony_SimFileManager_003, Function | MediumTest | Level
EXPECT_FALSE(simFileManager.IsCTCardType(CardType::UNKNOWN_CARD));
std::string iccId = "";
EXPECT_FALSE(simFileManager.IsCTIccId(iccId));
iccId = "8986030";
iccId = "8986060";
EXPECT_TRUE(simFileManager.IsCTIccId(iccId));
iccId = "8985302";
EXPECT_TRUE(simFileManager.IsCTIccId(iccId));