Merge branch 'fix-cmake-conversion-warnings'

This commit is contained in:
Brad King 2010-07-06 10:20:50 -04:00 committed by CMake Topic Stage
commit 54b1dc4161
11 changed files with 37 additions and 36 deletions

View File

@ -371,7 +371,7 @@ static const char * ar_rname(const char *path)
typedef struct ar_hdr HDR;
static char ar_hb[sizeof(HDR) + 1]; /* real header */
static int ar_already_written;
static size_t ar_already_written;
/* copy_ar --
* Copy size bytes from one file to another - taking care to handle the

View File

@ -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';

View File

@ -242,7 +242,7 @@ void cmCursesMainForm::RePost()
// Assign the fields: 3 for each entry: label, new entry marker
// ('*' or ' ') and entry widget
this->Fields = new FIELD*[3*this->NumberOfVisibleEntries+1];
int cc;
size_t cc;
for ( cc = 0; cc < 3 * this->NumberOfVisibleEntries+1; cc ++ )
{
this->Fields[cc] = 0;
@ -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,10 +526,10 @@ 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;
size_t width;
if (x < cmCursesMainForm::MAX_WIDTH )
{
width = x;
@ -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,8 +795,8 @@ void cmCursesMainForm::RemoveEntry(const char* value)
// copy from the list box to the cache manager
void cmCursesMainForm::FillCacheManagerFromUI()
{
int size = this->Entries->size();
for(int i=0; i < size; i++)
size_t size = this->Entries->size();
for(size_t i=0; i < size; i++)
{
cmCacheManager::CacheIterator it =
this->CMakeInstance->GetCacheManager()->GetCacheIterator(
@ -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();
@ -961,7 +961,7 @@ void cmCursesMainForm::HandleInput()
else if ( key == KEY_DOWN || key == ctrl('n') )
{
FIELD* cur = current_field(this->Form);
int findex = field_index(cur);
size_t findex = field_index(cur);
if ( findex == 3*this->NumberOfVisibleEntries-1 )
{
continue;
@ -1108,7 +1108,7 @@ void cmCursesMainForm::HandleInput()
{
this->OkToGenerate = false;
FIELD* cur = current_field(this->Form);
int findex = field_index(cur);
size_t findex = field_index(cur);
// make the next or prev. current field after deletion
// each entry consists of fields: label, isnew, value
@ -1199,7 +1199,7 @@ void cmCursesMainForm::JumpToCacheEntry(int idx, const char* astr)
str = cmSystemTools::LowerCase(astr);
}
if ( idx > this->NumberOfVisibleEntries )
if ( size_t(idx) > this->NumberOfVisibleEntries )
{
return;
}
@ -1232,7 +1232,7 @@ void cmCursesMainForm::JumpToCacheEntry(int idx, const char* astr)
}
}
}
if ( findex >= 3* this->NumberOfVisibleEntries-1 )
if ( size_t(findex) >= 3* this->NumberOfVisibleEntries-1 )
{
set_current_field(this->Form, this->Fields[2]);
}

View File

@ -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;

View File

@ -1169,7 +1169,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output,
if ( tick % tick_line_len == 0 && tick > 0 )
{
cmCTestLog(this, HANDLER_OUTPUT, " Size: "
<< int((output->size() / 1024.0) + 1) << "K" << std::endl
<< int((double(output->size()) / 1024.0) + 1) << "K" << std::endl
<< " " << std::flush);
}
}
@ -1181,7 +1181,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string* output,
}
}
cmCTestLog(this, OUTPUT, " Size of output: "
<< int(output->size() / 1024.0) << "K" << std::endl);
<< int(double(output->size()) / 1024.0) << "K" << std::endl);
cmsysProcess_WaitForExit(cp, 0);

View File

@ -576,7 +576,7 @@ unsigned int cmELFInternalImpl<Types>::GetDynamicEntryCount()
return i;
}
}
return this->DynamicSectionEntries.size();
return static_cast<unsigned int>(this->DynamicSectionEntries.size());
}
//----------------------------------------------------------------------------

View File

@ -750,8 +750,9 @@ cmGlobalUnixMakefileGenerator3
cmLocalGenerator::FULL,
cmLocalGenerator::SHELL);
progCmd << " ";
std::vector<int> &progFiles = this->ProgressMap[&t->second].Marks;
for (std::vector<int>::iterator i = progFiles.begin();
std::vector<unsigned long>& progFiles =
this->ProgressMap[&t->second].Marks;
for (std::vector<unsigned long>::iterator i = progFiles.begin();
i != progFiles.end(); ++i)
{
progCmd << " " << *i;

View File

@ -177,7 +177,7 @@ protected:
TargetProgress(): NumberOfActions(0) {}
unsigned long NumberOfActions;
std::string VariableFile;
std::vector<int> Marks;
std::vector<unsigned long> Marks;
void WriteProgressVariables(unsigned long total, unsigned long& current);
};
struct ProgressMapCompare { bool operator()(cmTarget*,cmTarget*) const; };

View File

@ -739,7 +739,7 @@ bool cmStringCommand
alphabet = cmStringCommandDefaultAlphabet;
}
double sizeofAlphabet = alphabet.size();
double sizeofAlphabet = static_cast<double>(alphabet.size());
if ( sizeofAlphabet < 1 )
{
this->SetError("sub-command RANDOM invoked with bad alphabet.");

View File

@ -1204,6 +1204,7 @@ bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out)
// Should be efficient enough on most system:
const int bufferSize = 4096;
char buffer[bufferSize];
unsigned char const* buffer_uc = reinterpret_cast<unsigned char const*>(buffer);
// This copy loop is very sensitive on certain platforms with
// slightly broken stream libraries (like HPUX). Normally, it is
// incorrect to not check the error condition on the fin.read()
@ -1212,10 +1213,9 @@ bool cmSystemTools::ComputeFileMD5(const char* source, char* md5out)
while(fin)
{
fin.read(buffer, bufferSize);
if(fin.gcount())
if(int gcount = static_cast<int>(fin.gcount()))
{
cmsysMD5_Append(md5, reinterpret_cast<unsigned char const*>(buffer),
fin.gcount());
cmsysMD5_Append(md5, buffer_uc, gcount);
}
}
cmsysMD5_FinalizeHex(md5, md5out);
@ -1989,9 +1989,9 @@ namespace{
# pragma warn -8066 /* unreachable code */
#endif
int copy_data(struct archive *ar, struct archive *aw)
long copy_data(struct archive *ar, struct archive *aw)
{
int r;
long r;
const void *buff;
size_t size;
off_t offset;
@ -2136,7 +2136,7 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
}
else if(*outiter == '\n' || *outiter == '\0')
{
int length = outiter-out.begin();
std::vector<char>::size_type length = outiter-out.begin();
if(length > 1 && *(outiter-1) == '\r')
{
--length;
@ -2159,7 +2159,7 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
}
else if(*erriter == '\n' || *erriter == '\0')
{
int length = erriter-err.begin();
std::vector<char>::size_type length = erriter-err.begin();
if(length > 1 && *(erriter-1) == '\r')
{
--length;

View File

@ -50,7 +50,7 @@ const char* cm_utf8_decode_character(const char* first, const char* last,
unsigned int* pc)
{
/* Count leading ones in the first byte. */
unsigned char c = *first++;
unsigned char c = (unsigned char)*first++;
unsigned char const ones = cm_utf8_ones[c];
switch(ones)
{
@ -62,10 +62,10 @@ const char* cm_utf8_decode_character(const char* first, const char* last,
/* Extract bits from this multi-byte character. */
{
unsigned int uc = c & cm_utf8_mask[ones];
unsigned char left;
int left;
for(left = ones-1; left && first != last; --left)
{
c = *first++;
c = (unsigned char)*first++;
if(cm_utf8_ones[c] != 1)
{
return 0;