From fc44cffac50e6096528f2bde456d91a4e40ea7c9 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Tue, 3 May 2016 16:23:30 -0700 Subject: restyle switch blocks to match project style I missed restyling a few "switch" blocks to make them consistent with the rest of the code base. This fixes that oversight. This should be the final step in restyling the C++ code to have a consistent style. This also includes a few trivial cleanups elsewhere. I also missed restyling the "complete" module when working my way from a to z so this final change includes restyling that module. Total lint errors decreased 36%. Cppcheck errors went from 47 to 24. Oclint P2 errors went from 819 to 778. Oclint P3 errors went from 3252 to 1842. Resolves #2902. --- src/wildcard.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/wildcard.cpp') diff --git a/src/wildcard.cpp b/src/wildcard.cpp index 1a09d63e..93242570 100644 --- a/src/wildcard.cpp +++ b/src/wildcard.cpp @@ -94,7 +94,7 @@ static enum fuzzy_match_type_t wildcard_match_internal(const wchar_t *str, const bool leading_dots_fail_to_match, bool is_first) { if (*str == 0 && *wc == 0) { - return fuzzy_match_exact; // we're done + return fuzzy_match_exact; // we're done } // Hackish fix for issue #270. Prevent wildcards from matching . or .., but we must still allow @@ -261,7 +261,6 @@ static bool wildcard_complete_internal(const wchar_t *str, const wchar_t *wc, } break; } - case ANY_STRING: { // Hackish. If this is the last character of the wildcard, then just complete with // the empty string. This fixes cases like "f*" -> "f*o". @@ -289,14 +288,14 @@ static bool wildcard_complete_internal(const wchar_t *str, const wchar_t *wc, } return has_match; } - - case ANY_STRING_RECURSIVE: + case ANY_STRING_RECURSIVE: { // We don't even try with this one. return false; - - default: + } + default: { assert(0 && "Unreachable code reached"); return false; + } } } assert(0 && "Unreachable code reached"); @@ -535,9 +534,9 @@ class wildcard_expander_t { wcstring child_entry; while (wreaddir_resolving(dir, abs_unique_hierarchy, child_entry, &child_is_dir)) { if (child_entry.empty() || child_entry.at(0) == L'.') { - continue; // either hidden, or . and .. entries -- skip them + continue; // either hidden, or . and .. entries -- skip them } else if (child_is_dir && unique_entry.empty()) { - unique_entry = child_entry; // first candidate + unique_entry = child_entry; // first candidate } else { // We either have two or more candidates, or the child is not a directory. We're // done. -- cgit v1.2.3