| [ Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]
STR #3043
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 2 - Low, e.g. a documentation error or undocumented side-effect |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | Core Library |
Summary: | loop has empty body |
Version: | 1.3-current |
Created By: | AnyCPU |
Assigned To: | AlbrechtS |
Fix Version: | 1.3.3 (SVN: v10145) |
Update Notification: | |
Trouble Report Files:
No files
Trouble Report Comments:
|
#1 | AnyCPU 13:32 Jan 29, 2014 |
| src\Fl_File_Browser.cxx:379:45
"for loop has empty body"
if (columns) { // Try clipping inside this column... for (i = 0; i < column && columns[i]; i ++);
if (columns[i]) cW = columns[i]; }
This "for" loop used for purpose: rewind? If yes then why not? (for example):
if (columns) { // Try clipping inside this column... for (i = 0; i < column; i ++); if (columns[i]) cW = columns[i], break; }
I think "for" should be revisited. | |
|
#2 | AnyCPU 13:46 Jan 29, 2014 |
| Also if all columns[i] != FALSE then possible out of range in columns array because "i" after "for" loop will be equal to "column" (column widths), no? | |
|
#3 | AlbrechtS 05:54 Nov 27, 2014 |
| Thanks for the report.
The code has been changed a bit since your report though. It is now:
for (i = 0; i < column && columns[i]; i ++) { ; } if (columns[i]) cW = columns[i];
The "for loop has empty body" warning should hopefully be gone. Can you verify this? | |
|
#4 | AlbrechtS 06:04 Nov 27, 2014 |
| Regarding #2:
There is no out of range condition possible because the columns array must be zero terminated. The loop tries to find the column width of the requested column but terminates prematurely if one column width is zero, because this terminates the list of column widths.
If I'm not missing anything, this should be okay. | |
[ Return to Bugs & Features ]
|
| |