Static analyzer-found cleanup opportunities#155
Static analyzer-found cleanup opportunities#155ryandrake08 wants to merge 4 commits intorougier:masterfrom
Conversation
|
Thanks! I've never used the clang static analyzer. I'll look into proposed modification and merge them. |
| else if( (set_fg == 0) && (code == 5) ) | ||
| { | ||
| set_fg = 1; | ||
| code = 0; |
There was a problem hiding this comment.
This line prevents from ever entering the test just after. Do you know how the analyzer decides this can be safely removed ?
There was a problem hiding this comment.
Observe line 177, code gets assigned 0 outside the if-else statement anyway, directly after line 128 is executed. So line 128 is redundant it seems.
| float glyph_height = glyph->height * width/(float)glyph->width; | ||
| float glyph_width = glyph->width * height/(float)glyph->height; | ||
| int x = -glyph_width/2 + width/2.; | ||
| int y = -glyph_height/2 + height/2.; |
There was a problem hiding this comment.
Even if not used, this is relevant information. Maybe commenting those line would be better, no ?
There was a problem hiding this comment.
Sure, I'll push a change with them added back, but commented out!
|
Thanks for the feedback. Adjustments made. This library is very useful by the way! |
|
@ryandrake08 Thanks for the fix. Just tell me you're ready for a merge. |
|
Feel free to merge whenever. This PR is turning into a grab bag of warnings fixes and cleanups. The only change that may actually change the functionality of the library is 3df29ce. Please have a look at what this one is doing. You may prefer I leave this out. I found I needed it in my application to improve the look of my rendered text. Without this padding I was seeing undesired graphic artifacts around the edges of each glyph. |
A couple of issues found using clang's static analyzer. Most are pretty trivial (removal of unnecessary / unused code). Two moderately concerning ones:
Feel free to merge if you think it's helpful.