mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 00:11:07 -06:00
find_package: Fix sign-cast warning
Tweak a helper function to avoid an implicit cast from unsigned to signed. This is hardly the only -Wsign-conversion we are tripping, but cmFindPackage is now free of such.
This commit is contained in:
@@ -424,11 +424,12 @@ bool TryGeneratedPaths(CallbackFn&& filesCollector,
|
||||
|
||||
// Parse the version number and store the results that were
|
||||
// successfully parsed.
|
||||
int parseVersion(const std::string& version, unsigned int& major,
|
||||
unsigned int& minor, unsigned int& patch, unsigned int& tweak)
|
||||
unsigned int parseVersion(std::string const& version, unsigned int& major,
|
||||
unsigned int& minor, unsigned int& patch,
|
||||
unsigned int& tweak)
|
||||
{
|
||||
return std::sscanf(version.c_str(), "%u.%u.%u.%u", &major, &minor, &patch,
|
||||
&tweak);
|
||||
return static_cast<unsigned int>(std::sscanf(
|
||||
version.c_str(), "%u.%u.%u.%u", &major, &minor, &patch, &tweak));
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
Reference in New Issue
Block a user