ENH: FilesDiffer checks for 0 byte files

This commit is contained in:
Sebastien Barre 2002-04-15 08:48:39 -04:00
parent 36189ce2a8
commit a89dd1fbaf
1 changed files with 5 additions and 12 deletions

View File

@ -969,6 +969,11 @@ bool cmSystemTools::FilesDiffer(const char* source,
return true;
}
if(statSource.st_size == 0)
{
return false;
}
#if defined(_WIN32) || defined(__CYGWIN__)
std::ifstream finSource(source,
std::ios::binary | std::ios::in);
@ -984,19 +989,7 @@ bool cmSystemTools::FilesDiffer(const char* source,
}
char* source_buf = new char[statSource.st_size];
if (!source_buf)
{
cmSystemTools::Error("FilesDiffer failed to allocate memory for source!");
return false;
}
char* dest_buf = new char[statSource.st_size];
if (!dest_buf)
{
cmSystemTools::Error("FilesDiffer failed to allocate memory for dest!");
delete [] source_buf;
return false;
}
finSource.read(source_buf, statSource.st_size);
finDestination.read(dest_buf, statSource.st_size);