mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-29 02:20:17 -06:00
CMake: fix sizeof string literal violations
This commit is contained in:
@@ -451,7 +451,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
|
|||||||
mountpoint_regex.find(attach_output.c_str());
|
mountpoint_regex.find(attach_output.c_str());
|
||||||
std::string const temp_mount = mountpoint_regex.match(1);
|
std::string const temp_mount = mountpoint_regex.match(1);
|
||||||
std::string const temp_mount_name =
|
std::string const temp_mount_name =
|
||||||
temp_mount.substr(sizeof("/Volumes/") - 1);
|
temp_mount.substr(cmStrLen("/Volumes/"));
|
||||||
|
|
||||||
// Remove dummy padding file so we have enough space on RW image ...
|
// Remove dummy padding file so we have enough space on RW image ...
|
||||||
std::ostringstream dummy_padding;
|
std::ostringstream dummy_padding;
|
||||||
|
|||||||
@@ -669,8 +669,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
|
|||||||
|
|
||||||
while ((pos = input.find("$<TARGET_PROPERTY:", lastPos)) !=
|
while ((pos = input.find("$<TARGET_PROPERTY:", lastPos)) !=
|
||||||
std::string::npos) {
|
std::string::npos) {
|
||||||
std::string::size_type nameStartPos =
|
std::string::size_type nameStartPos = pos + cmStrLen("$<TARGET_PROPERTY:");
|
||||||
pos + sizeof("$<TARGET_PROPERTY:") - 1;
|
|
||||||
std::string::size_type closePos = input.find('>', nameStartPos);
|
std::string::size_type closePos = input.find('>', nameStartPos);
|
||||||
std::string::size_type commaPos = input.find(',', nameStartPos);
|
std::string::size_type commaPos = input.find(',', nameStartPos);
|
||||||
std::string::size_type nextOpenPos = input.find("$<", nameStartPos);
|
std::string::size_type nextOpenPos = input.find("$<", nameStartPos);
|
||||||
@@ -696,7 +695,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
|
|||||||
pos = 0;
|
pos = 0;
|
||||||
lastPos = pos;
|
lastPos = pos;
|
||||||
while ((pos = input.find("$<TARGET_NAME:", lastPos)) != std::string::npos) {
|
while ((pos = input.find("$<TARGET_NAME:", lastPos)) != std::string::npos) {
|
||||||
std::string::size_type nameStartPos = pos + sizeof("$<TARGET_NAME:") - 1;
|
std::string::size_type nameStartPos = pos + cmStrLen("$<TARGET_NAME:");
|
||||||
std::string::size_type endPos = input.find('>', nameStartPos);
|
std::string::size_type endPos = input.find('>', nameStartPos);
|
||||||
if (endPos == std::string::npos) {
|
if (endPos == std::string::npos) {
|
||||||
errorString = "$<TARGET_NAME:...> expression incomplete";
|
errorString = "$<TARGET_NAME:...> expression incomplete";
|
||||||
@@ -721,7 +720,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
|
|||||||
lastPos = pos;
|
lastPos = pos;
|
||||||
while (errorString.empty() &&
|
while (errorString.empty() &&
|
||||||
(pos = input.find("$<LINK_ONLY:", lastPos)) != std::string::npos) {
|
(pos = input.find("$<LINK_ONLY:", lastPos)) != std::string::npos) {
|
||||||
std::string::size_type nameStartPos = pos + sizeof("$<LINK_ONLY:") - 1;
|
std::string::size_type nameStartPos = pos + cmStrLen("$<LINK_ONLY:");
|
||||||
std::string::size_type endPos = input.find('>', nameStartPos);
|
std::string::size_type endPos = input.find('>', nameStartPos);
|
||||||
if (endPos == std::string::npos) {
|
if (endPos == std::string::npos) {
|
||||||
errorString = "$<LINK_ONLY:...> expression incomplete";
|
errorString = "$<LINK_ONLY:...> expression incomplete";
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ void cmGeneratorExpression::ReplaceInstallPrefix(
|
|||||||
|
|
||||||
while ((pos = input.find("$<INSTALL_PREFIX>", lastPos)) !=
|
while ((pos = input.find("$<INSTALL_PREFIX>", lastPos)) !=
|
||||||
std::string::npos) {
|
std::string::npos) {
|
||||||
std::string::size_type endPos = pos + sizeof("$<INSTALL_PREFIX>") - 1;
|
std::string::size_type endPos = pos + cmStrLen("$<INSTALL_PREFIX>");
|
||||||
input.replace(pos, endPos - pos, replacement);
|
input.replace(pos, endPos - pos, replacement);
|
||||||
lastPos = endPos;
|
lastPos = endPos;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6718,7 +6718,7 @@ bool cmGeneratorTarget::IsLinkLookupScope(std::string const& n,
|
|||||||
cmLocalGenerator const*& lg) const
|
cmLocalGenerator const*& lg) const
|
||||||
{
|
{
|
||||||
if (cmHasLiteralPrefix(n, CMAKE_DIRECTORY_ID_SEP)) {
|
if (cmHasLiteralPrefix(n, CMAKE_DIRECTORY_ID_SEP)) {
|
||||||
cmDirectoryId const dirId = n.substr(sizeof(CMAKE_DIRECTORY_ID_SEP) - 1);
|
cmDirectoryId const dirId = n.substr(cmStrLen(CMAKE_DIRECTORY_ID_SEP));
|
||||||
if (dirId.String.empty()) {
|
if (dirId.String.empty()) {
|
||||||
lg = this->LocalGenerator;
|
lg = this->LocalGenerator;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user