From 5a3bb76cd384fa3760fe8481ce008791258595ad Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 12 Jan 2018 20:17:51 +0100 Subject: More loplugin:cstylecast: sal auto-rewrite with "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I7d89b011464ba5d2dd12e04d5fc9f65cb4daebde --- sal/qa/osl/process/osl_Thread.cxx | 84 +++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'sal/qa/osl') diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx index ae23a9ef41a0..396aa86efdb4 100644 --- a/sal/qa/osl/process/osl_Thread.cxx +++ b/sal/qa/osl/process/osl_Thread.cxx @@ -96,7 +96,7 @@ void StopWatch::start() m_bIsValid = false; m_bIsRunning = true; osl_getSystemTime( &t1 ); - t_print("# %u %u nsecs\n", (unsigned)t1.Seconds, (unsigned)t1.Nanosec); + t_print("# %u %u nsecs\n", static_cast(t1.Seconds), static_cast(t1.Nanosec)); // gettimeofday(&t1, 0); } @@ -107,7 +107,7 @@ void StopWatch::stop() // gettimeofday(&t2, 0); // Ask timer osl_getSystemTime( &t2 ); - t_print("# %u %u nsecs\n", (unsigned) t2.Seconds, (unsigned) t2.Nanosec); + t_print("# %u %u nsecs\n", static_cast(t2.Seconds), static_cast(t2.Nanosec)); if (m_bIsRunning) { // check if started. @@ -119,7 +119,7 @@ void StopWatch::stop() m_nNanoSec = 1000000000 + static_cast(t2.Nanosec) - static_cast(t1.Nanosec); m_nSeconds -= 1; } - t_print("# %u %u nsecs\n", (unsigned) m_nSeconds, (unsigned) m_nNanoSec ); + t_print("# %u %u nsecs\n", static_cast(m_nSeconds), static_cast(m_nNanoSec) ); //if (m_nNanoSec < 0) //{ //m_nNanoSec += 1000000000; @@ -271,7 +271,7 @@ public: OCountThread() { m_nWaitSec = 0; - t_print("new OCountThread thread %u!\n", (unsigned) getIdentifier()); + t_print("new OCountThread thread %u!\n", static_cast(getIdentifier())); } sal_Int32 getValue() { return m_aFlag.getValue(); } @@ -312,7 +312,7 @@ protected: } void SAL_CALL onTerminated() override { - t_print("normally terminate this thread %u!\n", (unsigned) getIdentifier()); + t_print("normally terminate this thread %u!\n", static_cast(getIdentifier())); } public: @@ -351,12 +351,12 @@ protected: } void SAL_CALL onTerminated() override { - t_print("normally terminate this thread %u!\n", (unsigned) getIdentifier()); + t_print("normally terminate this thread %u!\n", static_cast(getIdentifier())); } public: ONoScheduleThread() { - t_print("new thread id %u!\n", (unsigned) getIdentifier()); + t_print("new thread id %u!\n", static_cast(getIdentifier())); } virtual ~ONoScheduleThread() override { @@ -467,7 +467,7 @@ namespace osl_Thread termAndJoinThread(newthread); delete newthread; - t_print(" nValue = %d\n", (int) nValue); + t_print(" nValue = %d\n", static_cast(nValue)); t_print("isRunning = %s\n", isRunning ? "true" : "false"); CPPUNIT_ASSERT_MESSAGE( @@ -671,9 +671,9 @@ namespace osl_Thread termAndJoinThread(pCountThread); delete pCountThread; - t_print("SuspendValue: %d\n", (int) nSuspendValue); - t_print("ResumeValue: %d\n", (int) nResumeValue); - t_print("LaterValue: %d\n", (int) nLaterValue); + t_print("SuspendValue: %d\n", static_cast(nSuspendValue)); + t_print("ResumeValue: %d\n", static_cast(nResumeValue)); + t_print("LaterValue: %d\n", static_cast(nLaterValue)); /* LLA: this assumption is no longer relevant: nResumeValue == nSuspendValue && */ CPPUNIT_ASSERT_MESSAGE( @@ -706,7 +706,7 @@ namespace osl_Thread termAndJoinThread(newthread); delete newthread; - t_print(" nValue = %d\n", (int) nValue); + t_print(" nValue = %d\n", static_cast(nValue)); CPPUNIT_ASSERT_MESSAGE( "Creates a suspended thread, then resume", @@ -747,8 +747,8 @@ namespace osl_Thread aCountThread->join(); delete aCountThread; - t_print(" nValue = %d\n", (int) nValue); - t_print("nLaterValue = %d\n", (int) nLaterValue); + t_print(" nValue = %d\n", static_cast(nValue)); + t_print("nLaterValue = %d\n", static_cast(nLaterValue)); CPPUNIT_ASSERT_MESSAGE( "Terminate the thread", @@ -780,8 +780,8 @@ namespace osl_Thread sal_Int32 nLaterValue = aCountThread->getValue(); delete aCountThread; - t_print(" nValue = %d\n", (int) nValue); - t_print("nLaterValue = %d\n", (int) nLaterValue); + t_print(" nValue = %d\n", static_cast(nValue)); + t_print("nLaterValue = %d\n", static_cast(nLaterValue)); CPPUNIT_ASSERT_MESSAGE( "Suspend then resume the thread", @@ -1013,8 +1013,8 @@ namespace osl_Thread rtl::OString sPrio = getPrioName(_aPriority); t_print("After 10 tenth seconds\n"); - t_print("nValue in %s Prio Thread is %d\n",sPrio.getStr(), (int) nValueNormal); - t_print("nValue in %s Prio Thread is %d\n", sPrio.getStr(), (int) nValueNormal2); + t_print("nValue in %s Prio Thread is %d\n",sPrio.getStr(), static_cast(nValueNormal)); + t_print("nValue in %s Prio Thread is %d\n", sPrio.getStr(), static_cast(nValueNormal2)); // ThreadHelper::thread_sleep_tenth_sec(1); pThread->join(); @@ -1031,7 +1031,7 @@ namespace osl_Thread ); double nDeltaPercent = nDelta / nQuotient * 100; - t_print("Delta value %d, percent %f\n", (int) nDelta, nDeltaPercent); + t_print("Delta value %d, percent %f\n", static_cast(nDelta), nDeltaPercent); // LLA: it's not a bug if the current OS is not able to handle thread scheduling right and good. // like Windows XP @@ -1113,9 +1113,9 @@ namespace osl_Thread nValueNormal = aNormalThread.getValue(); t_print("After 10 tenth seconds\n"); - t_print("nValue in Highest Prio Thread is %d\n", (int) nValueHighest); - t_print("nValue in AboveNormal Prio Thread is %d\n", (int) nValueAboveNormal); - t_print("nValue in Normal Prio Thread is %d\n", (int) nValueNormal); + t_print("nValue in Highest Prio Thread is %d\n", static_cast(nValueHighest)); + t_print("nValue in AboveNormal Prio Thread is %d\n", static_cast(nValueAboveNormal)); + t_print("nValue in Normal Prio Thread is %d\n", static_cast(nValueNormal)); #ifndef _WIN32 CPPUNIT_ASSERT_MESSAGE( @@ -1194,11 +1194,11 @@ namespace osl_Thread nValueLowest = pLowestThread.getValue(); t_print("After 10 tenth seconds\n"); - t_print("nValue in Highest Prio Thread is %d\n", (int) nValueHighest); - t_print("nValue in AboveNormal Prio Thread is %d\n", (int) nValueAboveNormal); - t_print("nValue in Normal Prio Thread is %d\n", (int) nValueNormal); - t_print("nValue in BelowNormal Prio Thread is %d\n", (int) nValueBelowNormal); - t_print("nValue in Lowest Prio Thread is %d\n", (int) nValueLowest); + t_print("nValue in Highest Prio Thread is %d\n", static_cast(nValueHighest)); + t_print("nValue in AboveNormal Prio Thread is %d\n", static_cast(nValueAboveNormal)); + t_print("nValue in Normal Prio Thread is %d\n", static_cast(nValueNormal)); + t_print("nValue in BelowNormal Prio Thread is %d\n", static_cast(nValueBelowNormal)); + t_print("nValue in Lowest Prio Thread is %d\n", static_cast(nValueLowest)); #ifndef _WIN32 CPPUNIT_ASSERT_MESSAGE( @@ -1279,10 +1279,10 @@ namespace osl_Thread nValueLowest = pLowestThread.getValue(); t_print("After 5 tenth seconds\n"); - t_print("nValue in AboveNormal Prio Thread is %d\n", (int) nValueAboveNormal); - t_print("nValue in Normal Prio Thread is %d\n", (int) nValueNormal); - t_print("nValue in BelowNormal Prio Thread is %d\n", (int) nValueBelowNormal); - t_print("nValue in Lowest Prio Thread is %d\n", (int) nValueLowest); + t_print("nValue in AboveNormal Prio Thread is %d\n", static_cast(nValueAboveNormal)); + t_print("nValue in Normal Prio Thread is %d\n", static_cast(nValueNormal)); + t_print("nValue in BelowNormal Prio Thread is %d\n", static_cast(nValueBelowNormal)); + t_print("nValue in Lowest Prio Thread is %d\n", static_cast(nValueLowest)); // delete pHighestThread; @@ -1364,9 +1364,9 @@ namespace osl_Thread nValueLowest = pLowestThread.getValue(); t_print("After 5 tenth seconds\n"); - t_print("nValue in Normal Prio Thread is %d\n", (int) nValueNormal); - t_print("nValue in BelowNormal Prio Thread is %d\n", (int) nValueBelowNormal); - t_print("nValue in Lowest Prio Thread is %d\n", (int) nValueLowest); + t_print("nValue in Normal Prio Thread is %d\n", static_cast(nValueNormal)); + t_print("nValue in BelowNormal Prio Thread is %d\n", static_cast(nValueBelowNormal)); + t_print("nValue in Lowest Prio Thread is %d\n", static_cast(nValueLowest)); #ifndef _WIN32 CPPUNIT_ASSERT_MESSAGE( @@ -1526,7 +1526,7 @@ namespace osl_Thread delete aCountThread; t_print("nTenthSec = %f \n", nTenthSec); t_print("nSec = %f \n", nSec); - t_print("nValue = %d \n", (int) nValue); + t_print("nValue = %d \n", static_cast(nValue)); CPPUNIT_ASSERT_MESSAGE( "Wait: Blocks the calling thread for the given number of time.", @@ -1586,8 +1586,8 @@ namespace osl_Thread ThreadHelper::thread_sleep_tenth_sec(3); sal_Int32 nLaterValue = aThread->getValue(); // resumeAndWaitThread(aThread); - t_print(" value = %d\n", (int) nValue); - t_print("later value = %d\n", (int) nLaterValue); + t_print(" value = %d\n", static_cast(nValue)); + t_print("later value = %d\n", static_cast(nLaterValue)); // if value and latervalue not equal, than the thread would not suspended CPPUNIT_ASSERT_EQUAL_MESSAGE( @@ -1604,8 +1604,8 @@ namespace osl_Thread aThread->join(); sal_Int32 nValue_join = aThread->getValue(); - t_print("value after term = %d\n", (int) nValue_term); - t_print("value after join = %d\n", (int) nValue_join); + t_print("value after term = %d\n", static_cast(nValue_term)); + t_print("value after join = %d\n", static_cast(nValue_join)); // nValue_term and nValue_join should be the same // but should be differ from nValue @@ -1641,8 +1641,8 @@ namespace osl_Thread resumeAndWaitThread(&aThread); - t_print(" value = %d\n", (int) nValue); - t_print("later value = %d\n", (int) nLaterValue); + t_print(" value = %d\n", static_cast(nValue)); + t_print("later value = %d\n", static_cast(nLaterValue)); //On windows, suspend works, so the values are same #ifdef _WIN32 @@ -1665,7 +1665,7 @@ namespace osl_Thread termAndJoinThread(&aThread); sal_Int32 nValue_term = aThread.getValue(); - t_print(" value term = %d\n", (int) nValue_term); + t_print(" value term = %d\n", static_cast(nValue_term)); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Schedule: don't schedule in thread run method, terminate failed.", -- cgit