summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2013-05-21 21:33:54 (GMT)
committerRolf Eike Beer <eike@sf-mail.de>2013-05-21 21:33:54 (GMT)
commitf1d27bf667a8548121ed849cbb211eccf386f1bd (patch)
treef531c343231008e51e55e11794e4fe3034b8b57d
parent4825d70e830395ebff09a7fba73eb6ff5661048b (diff)
downloadCMake-f1d27bf667a8548121ed849cbb211eccf386f1bd.zip
CMake-f1d27bf667a8548121ed849cbb211eccf386f1bd.tar.gz
CMake-f1d27bf667a8548121ed849cbb211eccf386f1bd.tar.bz2
wizard: fix warnings
.../Source/cmakewizard.cxx: In member function ‘virtual void cmakewizard::AskUser(const char*, cmCacheManager::CacheIterator&)’: .../Source/cmakewizard.cxx:31:35: warning: conversion to ‘int’ from ‘long unsigned int’ may alter its value [-Wconversion] if(!fgets(buffer, sizeof(buffer)-1, stdin)) ^ .../Source/cmakewizard.cxx: In member function ‘virtual bool cmakewizard::AskAdvanced()’: .../Source/cmakewizard.cxx:70:35: warning: conversion to ‘int’ from ‘long unsigned int’ may alter its value [-Wconversion] if(!fgets(buffer, sizeof(buffer)-1, stdin)) The compiler is (partly) right here: sizeof() returns a size_t, which often is bigger as as int as it is unsigned long or something similar. Add an explicit cast to get rid of that warning here, the buffer has a size of 4KiB, so the value will fit into an int on all sane platforms.
-rw-r--r--Source/cmakewizard.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/cmakewizard.cxx b/Source/cmakewizard.cxx
index 749f669..8ac55d9 100644
--- a/Source/cmakewizard.cxx
+++ b/Source/cmakewizard.cxx
@@ -28,7 +28,7 @@ void cmakewizard::AskUser(const char* key,
printf("Current Value: %s\n", iter.GetValue());
printf("New Value (Enter to keep current value): ");
char buffer[4096];
- if(!fgets(buffer, sizeof(buffer)-1, stdin))
+ if(!fgets(buffer, static_cast<int>(sizeof(buffer) - 1), stdin))
{
buffer[0] = 0;
}
@@ -67,7 +67,7 @@ bool cmakewizard::AskAdvanced()
{
printf("Would you like to see advanced options? [No]:");
char buffer[4096];
- if(!fgets(buffer, sizeof(buffer)-1, stdin))
+ if(!fgets(buffer, static_cast<int>(sizeof(buffer) - 1), stdin))
{
buffer[0] = 0;
}