diff options
author | Brad King <brad.king@kitware.com> | 2010-06-29 13:52:12 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-06-29 13:52:12 (GMT) |
commit | ff1f8d0b53c37336645d4d53fc30134540d17ddd (patch) | |
tree | 140deb30db33b7dfdae6d22ecf43897640526d42 /Source/CursesDialog | |
parent | 6fc4cd86806b349c804cf9dacb2dd04c289a684f (diff) | |
download | CMake-ff1f8d0b53c37336645d4d53fc30134540d17ddd.zip CMake-ff1f8d0b53c37336645d4d53fc30134540d17ddd.tar.gz CMake-ff1f8d0b53c37336645d4d53fc30134540d17ddd.tar.bz2 |
Fix or cast more integer conversions in cmake
These were revealed by GCC's -Wconversion option. Fix types where it is
easy to do so. Cast in cases we know the integer will not be truncated.
Diffstat (limited to 'Source/CursesDialog')
-rw-r--r-- | Source/CursesDialog/cmCursesLongMessageForm.cxx | 8 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 12 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.h | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index c66147b..1c48d8c 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -53,13 +53,13 @@ void cmCursesLongMessageForm::UpdateStatusBar() getmaxyx(stdscr, y, x); char bar[cmCursesMainForm::MAX_WIDTH]; - int size = strlen(this->Title.c_str()); + size_t size = strlen(this->Title.c_str()); if ( size >= cmCursesMainForm::MAX_WIDTH ) { size = cmCursesMainForm::MAX_WIDTH-1; } strncpy(bar, this->Title.c_str(), size); - for(int i=size-1; i<cmCursesMainForm::MAX_WIDTH; i++) bar[i] = ' '; + for(size_t i=size-1; i<cmCursesMainForm::MAX_WIDTH; i++) bar[i] = ' '; int width; if (x < cmCursesMainForm::MAX_WIDTH ) @@ -76,8 +76,8 @@ void cmCursesLongMessageForm::UpdateStatusBar() char version[cmCursesMainForm::MAX_WIDTH]; char vertmp[128]; sprintf(vertmp,"CMake Version %s", cmVersion::GetCMakeVersion()); - int sideSpace = (width-strlen(vertmp)); - for(int i=0; i<sideSpace; i++) { version[i] = ' '; } + size_t sideSpace = (width-strlen(vertmp)); + for(size_t i=0; i<sideSpace; i++) { version[i] = ' '; } sprintf(version+sideSpace, "%s", vertmp); version[width] = '\0'; diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index cd231ad..805d5ec 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -454,7 +454,7 @@ void cmCursesMainForm::PrintKeys(int process /* = 0 */) if (cw) { sprintf(firstLine, "Page %d of %d", cw->GetPage(), this->NumberOfPages); - curses_move(0,65-strlen(firstLine)-1); + curses_move(0,65-static_cast<unsigned int>(strlen(firstLine))-1); printw(firstLine); } // } @@ -526,8 +526,8 @@ void cmCursesMainForm::UpdateStatusBar(const char* message) // Join the key, help string and pad with spaces // (or truncate) as necessary char bar[cmCursesMainForm::MAX_WIDTH]; - int i, curFieldLen = strlen(curField); - int helpLen = strlen(help); + size_t i, curFieldLen = strlen(curField); + size_t helpLen = strlen(help); int width; if (x < cmCursesMainForm::MAX_WIDTH ) @@ -592,7 +592,7 @@ void cmCursesMainForm::UpdateStatusBar(const char* message) char version[cmCursesMainForm::MAX_WIDTH]; char vertmp[128]; sprintf(vertmp,"CMake Version %s", cmVersion::GetCMakeVersion()); - int sideSpace = (width-strlen(vertmp)); + size_t sideSpace = (width-strlen(vertmp)); for(i=0; i<sideSpace; i++) { version[i] = ' '; } sprintf(version+sideSpace, "%s", vertmp); version[width] = '\0'; @@ -795,7 +795,7 @@ void cmCursesMainForm::RemoveEntry(const char* value) // copy from the list box to the cache manager void cmCursesMainForm::FillCacheManagerFromUI() { - int size = this->Entries->size(); + size_t size = this->Entries->size(); for(int i=0; i < size; i++) { cmCacheManager::CacheIterator it = @@ -866,7 +866,7 @@ void cmCursesMainForm::HandleInput() std::string searchstr = "Search: " + this->SearchString; this->UpdateStatusBar( searchstr.c_str() ); this->PrintKeys(1); - curses_move(y-5,searchstr.size()); + curses_move(y-5,static_cast<unsigned int>(searchstr.size())); //curses_move(1,1); touchwin(stdscr); refresh(); diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 9751999..4084415 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -147,7 +147,7 @@ protected: // Where is cmake executable std::string WhereCMake; // Number of entries shown (depends on mode -normal or advanced-) - int NumberOfVisibleEntries; + size_t NumberOfVisibleEntries; bool AdvancedMode; // Did the iteration converge (no new entries) ? bool OkToGenerate; |