Removed old style casts
AbandonedPublic

Authored by carlos_hdc on Sep 22 2018, 3:03 PM.

Details

Reviewers
tcanabrava
pino
Summary

Removed old style casts, casts in some cases and some lines that would never be executed.

Diff Detail

Repository
R326 Kalzium
Branch
removed_old_style
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 3119
Build 3137: arc lint + arc unit
carlos_hdc created this revision.Sep 22 2018, 3:03 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptSep 22 2018, 3:03 PM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
carlos_hdc requested review of this revision.Sep 22 2018, 3:03 PM
tcanabrava added inline comments.Sep 23 2018, 5:37 AM
src/calculator/concCalculator.cpp
626

This break seems meeded

src/spectrumwidget.cpp
219

Not everything that had old style casts should have a cast at all

362

He careful not to make things yet more complex with the casts.

pino requested changes to this revision.Sep 23 2018, 6:14 AM
pino added a subscriber: pino.

This patch does more things that "remove old style casts". Some of the other changes are OK, but please do split them in own changes, properly documenting them.

src/exportdialog.cpp
183

you use dynamic_cast when you expect that the cast can fail; since in this case it is assumed it will work, then use static_cast directly instead

187

ditto

also, property is casted more than once within this foreach loop, so factorize it

190–191

ditto

203

ditto

207

ditto (dynamic_cast + factorize)

210–211

ditto

224

ditto

230

ditto (dynamic_cast + factorize)

235–236

ditto

src/kdeeduglossary.cpp
236–237

or, simpler, turn both num and i to int, since the only usage of i is with QDomNodeList::item(int)

241

QDomNode::toElement() already returns a QDomElement, so this cast can go away altogether

247

ditto

src/molcalcwidget.cpp
101

i is already int, so this cast can go altogether

137

ditto

src/spectrumviewimpl.cpp
75

as mentioned this goes to another patch... hoever you do not need to cast nullptr to anything...

This revision now requires changes to proceed.Sep 23 2018, 6:14 AM
carlos_hdc updated this revision to Diff 42190.Sep 23 2018, 4:14 PM
  • Removed unnecessary casts
  • Altered dynamic to static cast
  • Changed variables from uint to int type
  • Removed casts
pino added a comment.Sep 23 2018, 4:41 PM
  • again, please do not mix unrelated changes, just submit separate and documented review for them
  • please follow a bit more the existing coding style
libscience/isotope.cpp
97

unrelated change

src/calculator/calculator.cpp
89

unrelated change

src/calculator/concCalculator.cpp
291

unrelated change

299

unrelated change

331

unrelated change

341

unrelated change

371–373

unrelated changes

626

good, but unrelated change

src/calculator/gasCalculator.cpp
337–338

unrelated change

src/exportdialog.cpp
182

coding style, extra space between angle bracket and round bracket

186

coding style, extra space between angle bracket and round bracket

190–191

coding style, i.e missing space after comma

202

coding style, extra space between angle bracket and round bracket

206

coding style, extra space between angle bracket and round bracket

210–211

coding style, i.e missing space after comma

223

coding style, extra space between angle bracket and round bracket

229

coding style, extra space between angle bracket and round bracket

233

coding style, extra space between angle bracket and round bracket

235–236

coding style, i.e missing space after comma

src/isotopetable/isotopeguideview.cpp
27

unrelated change

src/spectrumviewimpl.cpp
75

unrelated change

src/spectrumwidget.cpp
155

coding style, extra space between angle bracket and round bracket

206

coding style, extra space between angle bracket and round bracket

219

coding style, extra space between angle bracket and round bracket

230

coding style, extra space between angle bracket and round bracket

318

coding style, extra space between angle bracket and round bracket

324

unrelated change

361–363

coding style, extra space between angle bracket and round bracket

src/tablesdialog.cpp
270

coding style, extra space between angle bracket and round bracket

src/tools/moleculeview.cpp
174

unrelated change

src/tools/obconverter.cpp
64

unrelated change

pino requested changes to this revision.Sep 23 2018, 4:41 PM
This revision now requires changes to proceed.Sep 23 2018, 4:41 PM
carlos_hdc abandoned this revision.Sep 25 2018, 3:58 PM

Hi,

I'm a student at UFF (Universidade Federal Fluminense), Brazil and i'm starting to learn how the commit system works, sorry for the multiple troubles while doing it. I spoke with Tomaz and i'm going to close the review and open a new one with smaller alterations, so i can better modularize the changes. Thanks for the help and i would like to ask if i could place you as reviewer in my next one, if possible.

Thanks again for the help,
Carlos Henrique

pino added a comment.Sep 25 2018, 9:42 PM

Hi Carlos,

there is no need to drop this change -- just make it contain only the changes related to the casts.

Hi,
I'm in the middle of my exams and things are a little complicated,. I'll reactivate and fix this review next Friday (or as soon as i'm able).