codex告警清理

Signed-off-by: qinlong0101 <qinlong15@huawei.com>
This commit is contained in:
qinlong0101
2022-06-08 15:43:18 +08:00
parent 58bd9232f6
commit 619ff2bb8a
2 changed files with 4 additions and 2 deletions
+1
View File
@@ -23,6 +23,7 @@ namespace DistributedHardware {
int32_t GetLocalDeviceNetworkId(std::string &networkId);
std::string GetRandomID();
std::string GetAnonyString(const std::string &value);
std::string GetInterruptString(const std::string &value);
} // namespace DistributedHardware
} // namespace OHOS
#endif
+3 -2
View File
@@ -98,12 +98,13 @@ std::string GetAnonyString(const std::string &value)
std::string GetInterruptString(const std::string &value)
{
constexpr size_t INT32_MIN_ID_LENGTH = 3;
constexpr size_t STRING_HALF_LENGTH = 2;
std::string res;
size_t strlen = value.length();
if(strlen <= INT32_MIN_ID_LENGTH) {
if (strlen <= INT32_MIN_ID_LENGTH) {
res = value;
} else {
res = value.substr(0, strlen / 2);
res = value.substr(0, strlen / STRING_HALF_LENGTH);
}
return res;