| 3577 | } |
| 3578 | |
| 3579 | std::string cmGlobalXCodeGenerator::GetObjectId(cmXCodeObject::PBXType ptype, |
| 3580 | cm::string_view key) |
| 3581 | { |
| 3582 | std::string objectId; |
| 3583 | if (!key.empty()) { |
| 3584 | cmCryptoHash hash(cmCryptoHash::AlgoSHA256); |
| 3585 | hash.Initialize(); |
| 3586 | hash.Append(&ptype, sizeof(ptype)); |
| 3587 | hash.Append(key); |
| 3588 | objectId = cmSystemTools::UpperCase(hash.FinalizeHex().substr(0, 24)); |
| 3589 | } else { |
| 3590 | char cUuid[40] = { 0 }; |
| 3591 | CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); |
| 3592 | CFStringRef s = CFUUIDCreateString(kCFAllocatorDefault, uuid); |
| 3593 | CFStringGetCString(s, cUuid, sizeof(cUuid), kCFStringEncodingUTF8); |
| 3594 | objectId = cUuid; |
| 3595 | CFRelease(s); |
| 3596 | CFRelease(uuid); |
| 3597 | cmSystemTools::ReplaceString(objectId, "-", ""); |
| 3598 | if (objectId.size() > 24) { |
| 3599 | objectId = objectId.substr(0, 24); |
| 3600 | } |
| 3601 | } |
| 3602 | return objectId; |
| 3603 | } |
| 3604 | |
| 3605 | std::string cmGlobalXCodeGenerator::GetOrCreateId(std::string const& name, |
| 3606 | std::string const& id) |
no test coverage detected