Author: cfinck Date: Tue Aug 14 20:25:58 2012 New Revision: 57076
URL: http://svn.reactos.org/svn/reactos?rev=57076&view=rev Log: [ROSAUTOTEST] Use "advanced C++ features" like default parameters to reduce the complexity of StringOut calls and fix a warning in the MSVC build :-)
Modified: trunk/rostests/rosautotest/CJournaledTestList.cpp trunk/rostests/rosautotest/CWebService.cpp trunk/rostests/rosautotest/CWineTest.cpp trunk/rostests/rosautotest/main.cpp trunk/rostests/rosautotest/precomp.h trunk/rostests/rosautotest/shutdown.cpp trunk/rostests/rosautotest/tools.cpp
Modified: trunk/rostests/rosautotest/CJournaledTestList.cpp URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/CJournaledTest... ============================================================================== --- trunk/rostests/rosautotest/CJournaledTestList.cpp [iso-8859-1] (original) +++ trunk/rostests/rosautotest/CJournaledTestList.cpp [iso-8859-1] Tue Aug 14 20:25:58 2012 @@ -146,7 +146,7 @@ CTestInfo* TestInfo; DWORD BytesWritten;
- StringOut("Writing initial journal file...\n\n", TRUE); + StringOut("Writing initial journal file...\n\n");
m_ListIterator = 0;
@@ -192,7 +192,7 @@ DWORD BytesRead; DWORD RemainingSize;
- StringOut("Loading journal file...\n\n", TRUE); + StringOut("Loading journal file...\n\n");
OpenJournal(GENERIC_READ); RemainingSize = GetFileSize(m_hJournal, NULL);
Modified: trunk/rostests/rosautotest/CWebService.cpp URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/CWebService.cp... ============================================================================== --- trunk/rostests/rosautotest/CWebService.cpp [iso-8859-1] (original) +++ trunk/rostests/rosautotest/CWebService.cpp [iso-8859-1] Tue Aug 14 20:25:58 2012 @@ -207,7 +207,7 @@ Response.reset(DoRequest(Data));
ss << "The server responded:" << endl << Response << endl; - StringOut(ss.str(), TRUE); + StringOut(ss.str());
if(strcmp(Response, "OK")) EXCEPTION("Aborted!\n");
Modified: trunk/rostests/rosautotest/CWineTest.cpp URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/CWineTest.cpp?... ============================================================================== --- trunk/rostests/rosautotest/CWineTest.cpp [iso-8859-1] (original) +++ trunk/rostests/rosautotest/CWineTest.cpp [iso-8859-1] Tue Aug 14 20:25:58 2012 @@ -269,7 +269,7 @@ string tailString;
ss << "Running Wine Test, Module: " << TestInfo->Module << ", Test: " << TestInfo->Test << endl; - StringOut(ss.str(), TRUE); + StringOut(ss.str());
StartTime = GetTickCount();
@@ -302,7 +302,7 @@
/* Output text through StringOut, even while the test is still running */ Buffer[BytesAvailable] = 0; - tailString = StringOut(tailString.append(string(Buffer)), FALSE); + tailString = StringOut(tailString.append(string(Buffer)), false);
if(Configuration.DoSubmit()) TestInfo->Log += Buffer; @@ -313,12 +313,12 @@
/* Print what's left */ if(!tailString.empty()) - StringOut(tailString, TRUE); + StringOut(tailString);
TotalTime = ((float)GetTickCount() - StartTime)/1000; ssFinish << "Test " << TestInfo->Test << " completed in "; ssFinish << setprecision(2) << fixed << TotalTime << " seconds." << endl; - StringOut(ssFinish.str(), TRUE); + StringOut(ssFinish.str()); }
/** @@ -375,6 +375,6 @@ if(Configuration.DoSubmit() && !TestInfo->Log.empty()) WebService->Submit("wine", TestInfo);
- StringOut("\n\n", TRUE); - } -} + StringOut("\n\n"); + } +}
Modified: trunk/rostests/rosautotest/main.cpp URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/main.cpp?rev=5... ============================================================================== --- trunk/rostests/rosautotest/main.cpp [iso-8859-1] (original) +++ trunk/rostests/rosautotest/main.cpp [iso-8859-1] Tue Aug 14 20:25:58 2012 @@ -60,7 +60,7 @@
ss << "\n\nSystem uptime " << setprecision(2) << fixed ; ss << ((float)GetTickCount()/1000) << " seconds\n"; - StringOut(ss.str(), TRUE); + StringOut(ss.str());
/* Run the tests */ WineTest.Run(); @@ -76,7 +76,7 @@ } catch(CSimpleException& e) { - StringOut(e.GetMessage(), TRUE); + StringOut(e.GetMessage()); } catch(CFatalException& e) { @@ -87,7 +87,7 @@ << "File: " << e.GetFile() << endl << "Line: " << e.GetLine() << endl << "Last Win32 Error: " << GetLastError() << endl; - StringOut(ss.str(), TRUE); + StringOut(ss.str()); }
/* For sysreg2 to notice if rosautotest itself failed */
Modified: trunk/rostests/rosautotest/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/precomp.h?rev=... ============================================================================== --- trunk/rostests/rosautotest/precomp.h [iso-8859-1] (original) +++ trunk/rostests/rosautotest/precomp.h [iso-8859-1] Tue Aug 14 20:25:58 2012 @@ -51,7 +51,7 @@ string EscapeString(const string& Input); string GetINIValue(PCWCH AppName, PCWCH KeyName, PCWCH FileName); bool IsNumber(const char* Input); -string StringOut(const string& String, const BOOL forcePrint); +string StringOut(const string& String, bool forcePrint = true); string UnicodeToAscii(PCWSTR UnicodeString); string UnicodeToAscii(const wstring& UnicodeString);
Modified: trunk/rostests/rosautotest/shutdown.cpp URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/shutdown.cpp?r... ============================================================================== --- trunk/rostests/rosautotest/shutdown.cpp [iso-8859-1] (original) +++ trunk/rostests/rosautotest/shutdown.cpp [iso-8859-1] Tue Aug 14 20:25:58 2012 @@ -20,14 +20,14 @@
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) { - StringOut("OpenProcessToken failed\n", TRUE); + StringOut("OpenProcessToken failed\n"); return false; }
/* Get the LUID for the Shutdown privilege */ if (!LookupPrivilegeValueW(NULL, SE_SHUTDOWN_NAME, &Privileges.Privileges[0].Luid)) { - StringOut("LookupPrivilegeValue failed\n", TRUE); + StringOut("LookupPrivilegeValue failed\n"); return false; }
@@ -37,14 +37,14 @@
if (!AdjustTokenPrivileges(hToken, FALSE, &Privileges, 0, NULL, NULL)) { - StringOut("AdjustTokenPrivileges failed\n", TRUE); + StringOut("AdjustTokenPrivileges failed\n"); return false; }
/* Finally shut down the system */ if(!ExitWindowsEx(EWX_POWEROFF, SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED)) { - StringOut("ExitWindowsEx failed\n", TRUE); + StringOut("ExitWindowsEx failed\n"); return false; }
Modified: trunk/rostests/rosautotest/tools.cpp URL: http://svn.reactos.org/svn/reactos/trunk/rostests/rosautotest/tools.cpp?rev=... ============================================================================== --- trunk/rostests/rosautotest/tools.cpp [iso-8859-1] (original) +++ trunk/rostests/rosautotest/tools.cpp [iso-8859-1] Tue Aug 14 20:25:58 2012 @@ -93,7 +93,7 @@ * The std::string to output */ string -StringOut(const string& String, const BOOL forcePrint) +StringOut(const string& String, bool forcePrint) { char DbgString[DBGPRINT_BUFSIZE + 1]; size_t i, start = 0, last_newline = 0, size = 0, curr_pos = 0;