Apply tab to spaces filter to src folder

This commit is contained in:
XinyuHou
2016-12-28 11:50:32 +00:00
committed by Andrew Nelless
parent 4902b8674c
commit deea23f866
545 changed files with 41758 additions and 41758 deletions

View File

@@ -38,35 +38,35 @@ int
main(int argc, char **argv)
{
#if SYSAPI_WIN32
// record window instance for tray icon, etc
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
// record window instance for tray icon, etc
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));
#endif
Arch arch;
arch.init();
Log log;
log.setFilter(kDEBUG2);
Arch arch;
arch.init();
Log log;
log.setFilter(kDEBUG2);
string lockFile;
for (int i = 0; i < argc; i++) {
if (string(argv[i]).compare("--lock-file") == 0) {
lockFile = argv[i + 1];
}
}
string lockFile;
for (int i = 0; i < argc; i++) {
if (string(argv[i]).compare("--lock-file") == 0) {
lockFile = argv[i + 1];
}
}
if (!lockFile.empty()) {
lock(lockFile);
}
if (!lockFile.empty()) {
lock(lockFile);
}
testing::InitGoogleTest(&argc, argv);
testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
int result = RUN_ALL_TESTS();
if (!lockFile.empty()) {
unlock(lockFile);
}
if (!lockFile.empty()) {
unlock(lockFile);
}
// gtest seems to randomly finish with error codes (e.g. -1, -1073741819)
// even when no tests have failed. not sure what causes this, but it
@@ -79,30 +79,30 @@ main(int argc, char **argv)
void
lock(string lockFile)
{
double start = ARCH->time();
// keep checking until timeout is reached.
while ((ARCH->time() - start) < LOCK_TIMEOUT) {
double start = ARCH->time();
// keep checking until timeout is reached.
while ((ARCH->time() - start) < LOCK_TIMEOUT) {
ifstream is(lockFile.c_str());
bool noLock = !is;
is.close();
ifstream is(lockFile.c_str());
bool noLock = !is;
is.close();
if (noLock) {
break;
}
if (noLock) {
break;
}
// check every second if file has gone.
ARCH->sleep(1);
}
// check every second if file has gone.
ARCH->sleep(1);
}
// write empty lock file.
ofstream os(lockFile.c_str());
os.close();
// write empty lock file.
ofstream os(lockFile.c_str());
os.close();
}
void
unlock(string lockFile)
{
remove(lockFile.c_str());
remove(lockFile.c_str());
}