Closed Bug 1555436 Opened 1 year ago Closed 1 year ago

Fix `readability-braces-around-statements` static analysis warnings for nsTextFrameUtils.* and nsTextRunTransformations.*

Categories

(Core :: Layout: Text and Fonts, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: dholbert, Assigned: cmarlow)

Details

Attachments

(1 file)

Below are the warnings we get for this command:

./mach static-analysis check --checks "readability-braces-around-statements"  layout/generic/nsTextFrameUtils.* layout/generic/nsTextRunTransformations.*
 0:12.59  /scratch/work/builds/mozilla-central/mozilla/layout/generic/nsTextFrameUtils.cpp
 0:12.59 Warning: readability-braces-around-statements in /scratch/work/builds/mozilla-central/mozilla/layout/generic/nsTextFrameUtils.cpp: statement should be inside braces
 0:12.59 /scratch/work/builds/mozilla-central/mozilla/layout/generic/nsTextFrameUtils.cpp:391:27: warning: statement should be inside braces [readability-braces-around-statements]
 0:12.59     if (!mRemainingLength) return false;
 0:12.59                           ^
 0:12.59                            {
 0:12.59 Warning: readability-braces-around-statements in /scratch/work/builds/mozilla-central/mozilla/layout/generic/nsTextFrameUtils.h: statement should be inside braces
 0:12.59 /scratch/work/builds/mozilla-central/mozilla/layout/generic/nsTextFrameUtils.h:136:76: warning: statement should be inside braces [readability-braces-around-statements]
 0:12.59     if (aArray->Length() > 0 && (*aArray)[aArray->Length() - 1] == aOffset)
 0:12.59                                                                            ^
 0:12.59                                                                             {
 0:12.59 Warning: readability-braces-around-statements in /scratch/work/builds/mozilla-central/mozilla/layout/generic/nsTextRunTransformations.cpp: statement should be inside braces
 0:12.59 /scratch/work/builds/mozilla-central/mozilla/layout/generic/nsTextRunTransformations.cpp:62:50: warning: statement should be inside braces [readability-braces-around-statements]
 0:12.59     if (!mCapitalize.AppendElements(GetLength())) return;
 0:12.59                                                  ^
 0:12.59                                                   {
 0:12.59 Warning: readability-braces-around-statements in /scratch/work/builds/mozilla-central/mozilla/layout/generic/nsTextRunTransformations.cpp: statement should be inside braces
 0:12.59 /scratch/work/builds/mozilla-central/mozilla/layout/generic/nsTextRunTransformations.cpp:135:23: warning: statement should be inside braces [readability-braces-around-statements]
 0:12.59     if (NS_FAILED(rv)) return;
 0:12.59                       ^
 0:12.59                        {
 0:12.59 Warning: readability-braces-around-statements in /scratch/work/builds/mozilla-central/mozilla/layout/generic/nsTextRunTransformations.cpp: statement should be inside braces
 0:12.59 /scratch/work/builds/mozilla-central/mozilla/layout/generic/nsTextRunTransformations.cpp:828:14: warning: statement should be inside braces [readability-braces-around-statements]
 0:12.59   if (!child) return;
 0:12.59              ^
 0:12.59               {
 0:12.59 

You can use me as code-reviewer here if you like.

Commit message could be something like:
Bug 1555436: Add braces to address static analysis warnings in some text layout code. r?dholbert

Keywords: checkin-needed

Pushed by cbrindusan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/619e50e40760
Add braces to address static analysis warnings in some text layout code. r=dholbert

Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
You need to log in before you can comment on or make changes to this bug.