Skip to content

Commit 6d95f43

Browse files
committed
FLTK: Fix compile warnings with updated gcc
1 parent aae73b3 commit 6d95f43

File tree

4 files changed

+11
-24
lines changed

4 files changed

+11
-24
lines changed

ChangeLog

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
2020-05-11 (0.12.19)
2+
FLTK: Fix compile warnings with updated gcc
3+
14
2020-05-10 (0.12.19)
2-
Fix ABSMIN/ABSMAX transposed #96
5+
COMMON: Fix ABSMIN/ABSMAX transposed #96
36

47
2020-05-09 (0.12.19)
58
COMMON: Fix crash when passing non-array to CHART
@@ -10,7 +13,7 @@
1013

1114
2020-05-04 (0.12.19)
1215
COMMON: INPUT crash #99
13-
COMMON: Fix compile warning with updated gcc
16+
COMMON: Fix compile warnings with updated gcc
1417

1518
2020-03-07 (0.12.19)
1619
COMMON: implement DEFINEKEY undo #92

src/platform/fltk/EditorWidget.cxx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -815,11 +815,7 @@ void EditorWidget::getInput(char *result, int size) {
815815
if (wnd->isBreakExec()) {
816816
brun_break();
817817
} else {
818-
const char *value = _commandText->value();
819-
int valueLen = strlen(value);
820-
int len = (valueLen < size) ? valueLen : size;
821-
strncpy(result, value, len);
822-
result[len] = 0;
818+
strlcpy(result, _commandText->value(), size);
823819
}
824820
setCommand(cmd_find);
825821
}

src/platform/fltk/MainWindow.cxx

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -544,18 +544,19 @@ void MainWindow::editor_plugin(Fl_Widget *w, void *eventData) {
544544
if (editWidget) {
545545
Fl_Text_Editor *editor = editWidget->getEditor();
546546
char filename[PATH_MAX];
547-
char path[PATH_MAX];
548-
strcpy(filename, editWidget->getFilename());
547+
strlcpy(filename, editWidget->getFilename(), PATH_MAX);
549548

550549
if (runMode == edit_state) {
551550
if (editWidget->checkSave(false) && filename[0]) {
551+
char path[PATH_MAX];
552552
int pos = editor->insert_position();
553553
int row, col, s1r, s1c, s2r, s2c;
554554
editWidget->getRowCol(&row, &col);
555555
editWidget->getSelStartRowCol(&s1r, &s1c);
556556
editWidget->getSelEndRowCol(&s2r, &s2c);
557-
snprintf(opt_command, sizeof(opt_command), "%s|%d|%d|%d|%d|%d|%d",
558-
filename, row - 1, col, s1r - 1, s1c, s2r - 1, s2c);
557+
strlcpy(opt_command, filename, PATH_MAX);
558+
snprintf(path, sizeof(path), "|%d|%d|%d|%d|%d|%d", row - 1, col, s1r - 1, s1c, s2r - 1, s2c);
559+
strlcat(opt_command, path, PATH_MAX);
559560
runMode = run_state;
560561
editWidget->runState(rs_run);
561562
snprintf(path, sizeof(path), "%s/%s", packageHome, (const char *)eventData);
@@ -626,17 +627,6 @@ void MainWindow::load_file(Fl_Widget *w, void *eventData) {
626627

627628
//--Startup functions-----------------------------------------------------------
628629

629-
/**
630-
*Adds a plug-in to the menu
631-
*/
632-
void MainWindow::addPlugin(Fl_Menu_Bar *menu, const char *label, const char *filename) {
633-
char path[PATH_MAX];
634-
snprintf(path, PATH_MAX, "%s/%s", pluginHome, filename);
635-
if (access(path, R_OK) == 0) {
636-
menu->add(label, 0, editor_plugin_cb, strdup(path));
637-
}
638-
}
639-
640630
/**
641631
* scan for recent files
642632
*/
@@ -952,7 +942,6 @@ MainWindow::MainWindow(int w, int h) :
952942
m->add("&File/_Close Others", 0, close_other_tabs_cb);
953943
m->add("&File/&Save File", FL_CTRL + 's', EditorWidget::save_file_cb);
954944
m->add("&File/_Save File &As", FL_CTRL + FL_SHIFT + 'S', save_file_as_cb);
955-
addPlugin(m, "&File/Publish Online", "publish.bas");
956945
m->add("&File/_Export", FL_CTRL + FL_F+9, export_file_cb);
957946
m->add("&File/E&xit", FL_CTRL + 'q', quit_cb);
958947
m->add("&Edit/_&Undo", FL_CTRL + 'z', EditorWidget::undo_cb);

src/platform/fltk/MainWindow.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ struct MainWindow : public BaseWindow {
7272
bool isIdeHidden(); // whether to run without the IDE displayed
7373
bool isInteractive(); // whether to run without an interface
7474
bool isModal(); // whether a modal gui loop is active
75-
void addPlugin(Fl_Menu_Bar *menu, const char *label, const char *filename);
7675
void busyMessage();
7776
int handle(int e);
7877
void loadHelp(const char *path);

0 commit comments

Comments
 (0)