From 60271a581998865a0b64b1c8867a8fbc83ea362e Mon Sep 17 00:00:00 2001 From: PKEuS Date: Fri, 19 Oct 2012 11:08:50 +0200 Subject: [PATCH] Simplified some switch statements and removed redundant code (VS warning) in GUI. --- gui/checkstatistics.cpp | 22 +++++++--------------- gui/showtypes.cpp | 12 +----------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/gui/checkstatistics.cpp b/gui/checkstatistics.cpp index ea6dab9e0..4d5258346 100644 --- a/gui/checkstatistics.cpp +++ b/gui/checkstatistics.cpp @@ -65,30 +65,22 @@ void CheckStatistics::Clear() unsigned CheckStatistics::GetCount(ShowTypes::ShowType type) const { - unsigned count = 0; switch (type) { case ShowTypes::ShowStyle: - count = mStyle; - break; + return mStyle; case ShowTypes::ShowWarnings: - count = mWarning; - break; + return mWarning; case ShowTypes::ShowPerformance: - count = mPerformance; - break; + return mPerformance; case ShowTypes::ShowPortability: - count = mPortability; - break; + return mPortability; case ShowTypes::ShowErrors: - count = mError; - break; + return mError; case ShowTypes::ShowInformation: - count = mInformation; - break; + return mInformation; case ShowTypes::ShowNone: default: qDebug() << "Unknown error type - returning zero statistics."; - break; + return 0; } - return count; } diff --git a/gui/showtypes.cpp b/gui/showtypes.cpp index 5b0c07fbf..71b4e05c0 100644 --- a/gui/showtypes.cpp +++ b/gui/showtypes.cpp @@ -51,8 +51,6 @@ ShowTypes::ShowType ShowTypes::SeverityToShowType(Severity::SeverityType severit default: return ShowTypes::ShowNone; } - - return ShowTypes::ShowNone; } Severity::SeverityType ShowTypes::ShowTypeToSeverity(ShowTypes::ShowType type) @@ -60,34 +58,26 @@ Severity::SeverityType ShowTypes::ShowTypeToSeverity(ShowTypes::ShowType type) switch (type) { case ShowTypes::ShowStyle: return Severity::style; - break; case ShowTypes::ShowErrors: return Severity::error; - break; case ShowTypes::ShowWarnings: return Severity::warning; - break; case ShowTypes::ShowPerformance: return Severity::performance; - break; case ShowTypes::ShowPortability: return Severity::portability; - break; case ShowTypes::ShowInformation: return Severity::information; - break; case ShowTypes::ShowNone: + default: return Severity::none; - break; } - - return Severity::none; } ShowTypes::ShowType ShowTypes::VariantToShowType(const QVariant &data)