cmSystemTools: simplify boolean expressions

This commit is contained in:
Daniel Pfeifer 2016-09-08 23:41:31 +02:00 committed by Brad King
parent 5d3b5bef11
commit 8f324c7cef
1 changed files with 5 additions and 15 deletions

View File

@ -1766,9 +1766,7 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile)
if (!GetFileTime(hFrom, &timeCreation, &timeLastAccess, &timeLastWrite)) { if (!GetFileTime(hFrom, &timeCreation, &timeLastAccess, &timeLastWrite)) {
return false; return false;
} }
if (!SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite)) { return SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite) != 0;
return false;
}
#else #else
struct stat fromStat; struct stat fromStat;
if (stat(fromFile, &fromStat) < 0) { if (stat(fromFile, &fromStat) < 0) {
@ -1778,11 +1776,8 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile)
struct utimbuf buf; struct utimbuf buf;
buf.actime = fromStat.st_atime; buf.actime = fromStat.st_atime;
buf.modtime = fromStat.st_mtime; buf.modtime = fromStat.st_mtime;
if (utime(toFile, &buf) < 0) { return utime(toFile, &buf) >= 0;
return false;
}
#endif #endif
return true;
} }
cmSystemToolsFileTime* cmSystemTools::FileTimeNew() cmSystemToolsFileTime* cmSystemTools::FileTimeNew()
@ -1828,16 +1823,11 @@ bool cmSystemTools::FileTimeSet(const char* fname, cmSystemToolsFileTime* t)
if (!h) { if (!h) {
return false; return false;
} }
if (!SetFileTime(h, &t->timeCreation, &t->timeLastAccess, return SetFileTime(h, &t->timeCreation, &t->timeLastAccess,
&t->timeLastWrite)) { &t->timeLastWrite) != 0;
return false;
}
#else #else
if (utime(fname, &t->timeBuf) < 0) { return utime(fname, &t->timeBuf) >= 0;
return false;
}
#endif #endif
return true;
} }
#ifdef _WIN32 #ifdef _WIN32