diff options
author | Kurtis Rader <krader@skepticism.us> | 2016-05-04 15:19:47 -0700 |
---|---|---|
committer | Kurtis Rader <krader@skepticism.us> | 2016-05-04 15:32:04 -0700 |
commit | 79f342b954a6f47ee3f1277a899066a654e7c330 (patch) | |
tree | a9386ce1e108a5c046276e4266e0129404fc4ea0 /src/utf8.cpp | |
parent | 527e5f52ba5a097a24490065fea23b4627032e4c (diff) |
lint cleanup: eliminate "redundant" errors
This removes some pointless parentheses but the primary focus is removing
redundancies like unnecessary "else" clauses.
Diffstat (limited to 'src/utf8.cpp')
-rw-r--r-- | src/utf8.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/utf8.cpp b/src/utf8.cpp index 9c8bcf6d..afd0c764 100644 --- a/src/utf8.cpp +++ b/src/utf8.cpp @@ -238,9 +238,8 @@ static size_t utf8_to_wchar_internal(const char *in, size_t insize, utf8_wstring if (__wchar_forbitten(out_val) != 0) { if ((flags & UTF8_IGNORE_ERROR) == 0) { return 0; // forbidden character - } else { - skip = true; } + skip = true; } else if (out_val == _BOM && (flags & UTF8_SKIP_BOM) != 0) { skip = true; } @@ -286,10 +285,8 @@ static size_t wchar_to_utf8_internal(const utf8_wchar_t *in, size_t insize, char total = 0; for (; w < wlim; w++) { if (__wchar_forbitten(*w) != 0) { - if ((flags & UTF8_IGNORE_ERROR) == 0) - return 0; - else - continue; + if ((flags & UTF8_IGNORE_ERROR) == 0) return 0; + continue; } if (*w == _BOM && (flags & UTF8_SKIP_BOM) != 0) continue; @@ -298,18 +295,13 @@ static size_t wchar_to_utf8_internal(const utf8_wchar_t *in, size_t insize, char if (w_wide < 0) { if ((flags & UTF8_IGNORE_ERROR) == 0) return 0; continue; - } else if (w_wide <= 0x0000007f) - n = 1; - else if (w_wide <= 0x000007ff) - n = 2; - else if (w_wide <= 0x0000ffff) - n = 3; - else if (w_wide <= 0x001fffff) - n = 4; - else if (w_wide <= 0x03ffffff) - n = 5; - else /// if (w_wide <= 0x7fffffff) - n = 6; + } + if (w_wide <= 0x0000007f) n = 1; + else if (w_wide <= 0x000007ff) n = 2; + else if (w_wide <= 0x0000ffff) n = 3; + else if (w_wide <= 0x001fffff) n = 4; + else if (w_wide <= 0x03ffffff) n = 5; + else n = 6; /// if (w_wide <= 0x7fffffff) total += n; |