From 183092d048a06424128b53180e18ba5955680924 Mon Sep 17 00:00:00 2001 From: Jehan Date: Wed, 21 Sep 2016 02:32:01 +0200 Subject: [PATCH] src: fix non-guarded 'if' warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not sure if this is useful to have the 'if (mDetectedCharset)' outside the if block, but it won't hurt for sure in this specific case, so I leave the current code logics as is. The exact warning was: nsUniversalDetector.cpp: In member function ‘virtual nsresult nsUniversalDetector::HandleData(const char*, PRUint32)’: nsUniversalDetector.cpp:115:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (aLen > 2) ^~ nsUniversalDetector.cpp:157:7: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ if (mDetectedCharset) ^~ --- src/nsUniversalDetector.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/nsUniversalDetector.cpp b/src/nsUniversalDetector.cpp index ff06b9d..9711618 100644 --- a/src/nsUniversalDetector.cpp +++ b/src/nsUniversalDetector.cpp @@ -113,6 +113,7 @@ nsresult nsUniversalDetector::HandleData(const char* aBuf, PRUint32 aLen) { mStart = PR_FALSE; if (aLen > 2) + { switch (aBuf[0]) { case '\xEF': @@ -153,12 +154,13 @@ nsresult nsUniversalDetector::HandleData(const char* aBuf, PRUint32 aLen) } break; } + } - if (mDetectedCharset) - { + if (mDetectedCharset) + { mDone = PR_TRUE; return NS_OK; - } + } } PRUint32 i;