Closed Bug 624410 Opened 14 years ago Closed 13 years ago

nsReadableUtils.cpp:577:38: warning: suggest parentheses around ‘&&’ within ‘||’

Categories

(Core :: XPCOM, defect)

All
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

(Whiteboard: [build_warning])

Attachments

(1 file)

Filing bug on this warning-spam:
> xpcom/string/src/nsReadableUtils.cpp: In function ‘PRBool IsUTF8(const nsACString_internal&)’:
> xpcom/string/src/nsReadableUtils.cpp:577:38: warning: suggest parentheses around ‘&&’ within ‘||’
> xpcom/string/src/nsReadableUtils.cpp:578:50: warning: suggest parentheses around ‘&&’ within ‘||’
> xpcom/string/src/nsReadableUtils.cpp:581:62: warning: suggest parentheses around ‘&&’ within ‘||’
> xpcom/string/src/nsReadableUtils.cpp:582:42: warning: suggest parentheses around ‘&&’ within ‘||’
> xpcom/string/src/nsReadableUtils.cpp:582:59: warning: suggest parentheses around ‘&&’ within ‘||’

The chunk of code flagged is:
> 575 // non-character : EF BF [BE-BF] or F[0-7] [89AB]F BF [BE-BF]
> 576 if ( nonchar &&  ( !state &&  c < 0xBE ||
> 577       state == 1 && c != 0xBF  ||
> 578       state == 2 && 0x0F != (0x0F & c) ))
> 579     nonchar = PR_FALSE;
> 580 
> 581 if ( !UTF8traits::isInSeq(c) || overlong && c <= olupper || 
> 582       surrogate && slower <= c || nonchar && !state )
> 583   return PR_FALSE; // Not UTF-8 string
> 584 overlong = surrogate = PR_FALSE;
http://mxr.mozilla.org/mozilla-central/source/xpcom/string/src/nsReadableUtils.cpp
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #502522 - Flags: review?(dwitte)
Attachment #502522 - Attachment description: fix → fix: add parens around && (and some newlines)
Comment on attachment 502522 [details] [diff] [review]
fix: add parens around && (and some newlines)

r=dwitte
Attachment #502522 - Flags: review?(dwitte) → review+
(not requesting approval -- deferring this patch to post-Gecko-2.0)
Whiteboard: [build_warning] → [build_warning][needs landing post-2.0]
Hardware: x86_64 → All
Whiteboard: [build_warning][needs landing post-2.0] → [build_warning][needs landing post-gecko2.0]
Landed: http://hg.mozilla.org/mozilla-central/rev/8fdd8b2b6b69
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [build_warning][needs landing post-gecko2.0] → [build_warning]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: