Hi Thomas,
Wow, that are many changes to the source! That must have been a lot of time that you invested in such a "small" feature and everything for free and open source! Thank you!
Here are a few remarks after compiling Free42 under Arch Linux:
- Arch Linux requires the X11 library as well (LIBS += -lX11). Probably all Linux distributions require it.
- At least under Arch Linux -Wno-narrowing is necessary. As you've added it to the FreeBSD and SunOS builds, can you please add it to the normal Linux build as well? I think there are no downsides.
- Speaking of compile options: Adding -Wno-missing-braces -Wno-unused-but-set-variable -Wno-unused-variable removes hundreds of warnings.
- The buffer for the path generation in gtk/shell_main.cc is too small:
Code:
shell_main.cc:384:57: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 0 and 255 [-Wformat-truncation=]
384 | snprintf(core_state_file_name, FILENAMELEN, "%s/%s.f42", free42dirname, state.coreName);
| ^~ ~~~~~~~~~~~~~~
shell_main.cc:384:17: note: 'snprintf' output between 6 and 516 bytes into a destination of size 256
384 | snprintf(core_state_file_name, FILENAMELEN, "%s/%s.f42", free42dirname, state.coreName);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You are trying to put two strings with a length of up to 255 characters in a buffer of only 255 characters. There are several places with this issue.
- There are some misleading-indentation warnings like
Code:
core_keydown.cc: In function 'void keydown_normal_mode(int, int)':
core_keydown.cc:1821:18: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
1821 | else if (prgms[current_prgm].text[pc] != CMD_END)
| ^~
core_keydown.cc:1823:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
1823 | prgm_highlight_row = 1;
| ^~~~~~~~~~~~~~~~~~