| 4118 | |
| 4119 | namespace { |
| 4120 | bool cmLocalGeneratorShortenObjectName(std::string& objName, |
| 4121 | std::string::size_type max_len) |
| 4122 | { |
| 4123 | // Check if the path can be shortened using an md5 sum replacement for |
| 4124 | // a portion of the path. |
| 4125 | std::string::size_type md5Len = 32; |
| 4126 | std::string::size_type numExtraChars = objName.size() - max_len + md5Len; |
| 4127 | std::string::size_type pos = objName.find('/', numExtraChars); |
| 4128 | if (pos == std::string::npos) { |
| 4129 | pos = objName.rfind('/', numExtraChars); |
| 4130 | if (pos == std::string::npos || pos <= md5Len) { |
| 4131 | return false; |
| 4132 | } |
| 4133 | } |
| 4134 | |
| 4135 | // Replace the beginning of the path portion of the object name with |
| 4136 | // its own md5 sum. |
| 4137 | cmCryptoHash md5(cmCryptoHash::AlgoMD5); |
| 4138 | std::string md5name = cmStrCat(md5.HashString(objName.substr(0, pos)), |
| 4139 | cm::string_view(objName).substr(pos)); |
| 4140 | objName = md5name; |
| 4141 | |
| 4142 | // The object name is now shorter, check if it is short enough. |
| 4143 | return pos >= numExtraChars; |
| 4144 | } |
| 4145 | |
| 4146 | bool cmLocalGeneratorCheckObjectName(std::string& objName, |
| 4147 | std::string::size_type dir_len, |
no test coverage detected
searching dependent graphs…