Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opposite inner 'if' condition leads to a dead code block. #65

Open
dismine opened this issue Aug 6, 2022 · 2 comments
Open

Opposite inner 'if' condition leads to a dead code block. #65

dismine opened this issue Aug 6, 2022 · 2 comments
Assignees

Comments

@dismine
Copy link
Contributor

dismine commented Aug 6, 2022

Cppcheck warns that this code leads to a dead end.

if (ver == DRW::AC1009)

Looks like because of this line

if (ver > DRW::AC1009) {

@lordofbikes
Copy link
Member

Indeed, and there are some more

libdxfrw/src/drw_header.cpp

Lines 1108 to 1111 in a610710

if (ver > DRW::AC1009) { //begin post r12 PUCS vars
writer->writeString(9, "$PUCSORTHOREF");
if (getStr("$PUCSORTHOREF", &varStr))
if (ver == DRW::AC1009)

recognized by investigating LibreCAD/LibreCAD#636:

libdxfrw/src/drw_header.cpp

Lines 1354 to 1362 in a610710

if (ver > DRW::AC1009){//start port r12 vars
writer->writeString(9, "$TREEDEPTH");
if (getInt("$TREEDEPTH", &varInt))
writer->writeInt16(70, varInt);
else
writer->writeInt16(70, 3020);
writer->writeString(9, "$CMLSTYLE");
if (getStr("$CMLSTYLE", &varStr))
if (ver == DRW::AC1009)

and possibly others.

Needs to check DXF version references, what is intended and if there are possible issues.

@lordofbikes lordofbikes self-assigned this Sep 4, 2022
@lordofbikes
Copy link
Member

After fixing LibreCAD/LibreCAD#636 I started to fix this one too, but it turned out to become a bottomless pit.
I haven't checked commit history yet, to see if this happened with some code refactoring or if it is since beginning.
Also have to check if there are any different DXF references, which led to this current status.
From the spreadsheet I have, showing the various variables added and removed in DXF versions, I found several places where variables don't match with version conditions.
And that not only applies to the mentioned condition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants