Closed Bug 1378683 Opened 7 years ago Closed 7 years ago

Fix incorrectly-written retry loop in nsUnicodeNormalizer

Categories

(Core :: Internationalization, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: Sylvestre, Assigned: jfkthame)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: [CID 1402705])

Attachments

(1 file, 1 obsolete file)

Assignee: nobody → sledru
Comment on attachment 8883864 [details]
Bug 1378683 - Remove a useless continue; declaration

https://reviewboard.mozilla.org/r/154832/#review159844

No, `continue` is needed here to cause the loop to repeat; otherwise it will terminate. (It's normally a single-iteration "loop", using do...while(false); the exceptional case is when we need to re-do the conversion after enlarging the target buffer, in which case we explicitly use `continue` to repeat the block.)
Attachment #8883864 - Flags: review-
Looks like coverity disagrees with you:

"continue_in_do_while_false: A continue statement within a do-while loop only continues execution of the loop body if the loop continuation condition is still true. Since the condition will never be true in a "do ... while (false);" loop the continue statement has the same effect as a break statement. Did you intend execution to continue at the top of the loop?"
Huh, interesting... I guess that's a gotcha I hadn't noticed! OK, in that case this code doesn't work as intended (although it was meant to be handling a rare case, so the real-world impact is probably small-to-nonexistent), and we should fix it accordingly.
Something like this should make more sense.
Attachment #8883879 - Flags: review?(sledru)
Good thing with CS: every day, we can still learn something new ;)
Assignee: sledru → jfkthame
Comment on attachment 8883879 [details] [diff] [review]
Fix incorrectly-written retry loop in nsUnicodeNormalizer

Seems to be better but I am no expert in that code ;)
Attachment #8883879 - Flags: review?(sledru) → review+
Summary: Remove a useless continue; declaration → Fix incorrectly-written retry loop in nsUnicodeNormalizer
https://hg.mozilla.org/integration/mozilla-inbound/rev/23ab5a681338e2b4e516ad1f37a184018dce18e7
Bug 1378683 - Fix incorrectly-written retry loop in nsUnicodeNormalizer. r=sylvestre
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/23ab5a681338
Fix incorrectly-written retry loop in nsUnicodeNormalizer. r=sylvestre
https://hg.mozilla.org/mozilla-central/rev/23ab5a681338
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Attachment #8883864 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: