mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-07 04:02:23 +03: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:
1 parent
14ed8464c8
commit
3f450d2680
1 file changed
+5
-4
@@ -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