mirror of
https://github.com/openharmony/distributed_screen.git
synced 2026-07-20 01:13:32 -04:00
@@ -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
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user