Closed Bug 1378683 Opened 3 years ago Closed 3 years ago
Fix incorrectly-written retry loop in ns
Continue; in https://dxr.mozilla.org/mozilla-central/source/intl/unicharutil/nsUnicodeNormalizer_ICU.cpp?q=nsUnicodeNormalizer_ICU.cpp&redirect_type=direct#44 is misleading as we are already at the end of the loop
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 firstname.lastname@example.org: https://hg.mozilla.org/integration/mozilla-inbound/rev/23ab5a681338 Fix incorrectly-written retry loop in nsUnicodeNormalizer. r=sylvestre
Attachment #8883864 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.