Commit b06fef94850391d4848c1125142b58256220d9bf

Authored by Perry Werneck
1 parent 22aebd01
Exists in master and in 1 other branch develop

Fixing some CodeQL alerts.

src/objects/application/application.c
... ... @@ -23,6 +23,9 @@
23 23 #include <pw3270/actions.h>
24 24 #include <pw3270/keypad.h>
25 25 #include <stdlib.h>
  26 +#include <sys/types.h>
  27 +#include <sys/stat.h>
  28 +#include <fcntl.h>
26 29  
27 30 enum {
28 31 PROP_ZERO,
... ... @@ -611,7 +614,12 @@ static int loghandler(const H3270 G_GNUC_UNUSED(*hSession), pw3270Application *a
611 614 return -1;
612 615 }
613 616  
614   - FILE *f = fopen(app->logfile,"a");
  617 + int fd = open(app->logfile,O_WRONLY|O_APPEND|O_CREAT,S_IWUSR|S_IRUSR);
  618 + if(fd < 0) {
  619 + return -1;
  620 + }
  621 +
  622 + FILE *f = fdopen(fd,"a");
615 623  
616 624 if(f) {
617 625 time_t ltime = time(0);
... ...
src/objects/toolbar/models.c
... ... @@ -210,7 +210,6 @@ static void set_property(GObject *menuitem, GObject *widget) {
210 210 const struct _contents *model = (const struct _contents *) g_object_get_data(menuitem, I_("pw3270_model_data"));
211 211 const char *name = (const char *) g_object_get_data(menuitem, I_("pw3270_property_name"));
212 212  
213   -// debug("%s(%s,%d)",__FUNCTION__,name,model->value);
214 213 g_object_set(widget,name,model->value,NULL);
215 214  
216 215 }
... ...
src/objects/toolbar/settings.c
... ... @@ -79,7 +79,6 @@ static const struct _comboboxes {
79 79  
80 80 struct _PW3270SettingsPage {
81 81 GtkWidget * views[2];
82   -// GtkTreeModel * models[G_N_ELEMENTS(comboboxes)];
83 82 GtkWidget * combos[G_N_ELEMENTS(comboboxes)];
84 83 };
85 84  
... ...
src/objects/window/actions/close.c
... ... @@ -33,15 +33,6 @@
33 33 #include <lib3270.h>
34 34 #include <lib3270/log.h>
35 35  
36   -/*
37   -void pw3270_window_close_activated(GSimpleAction G_GNUC_UNUSED(* action), GVariant G_GNUC_UNUSED(*parameter), gpointer window) {
38   -
39   -debug("%s(%p)",__FUNCTION__,window);
40   -gtk_window_close(GTK_WINDOW(window));
41   -
42   -}
43   -*/
44   -
45 36 static void activate(GAction G_GNUC_UNUSED(*action), GVariant G_GNUC_UNUSED(*parameter), GtkWidget *terminal) {
46 37  
47 38 debug("%s","Window close action was activated");
... ...
src/objects/window/actions/hostproperties.c
... ... @@ -1,73 +0,0 @@
1   -/*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
11   - *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
16   - *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como - e possui - linhas de código.
22   - *
23   - * Contatos:
24   - *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27   - *
28   - */
29   -
30   -#include "../private.h"
31   -#include <pw3270/window.h>
32   -#include <pw3270/actions.h>
33   -#include <v3270/settings.h>
34   -#include <v3270/dialogs.h>
35   -
36   -/*
37   -static GtkWidget * factory(V3270SimpleAction *action, GtkWidget *terminal);
38   -
39   -GAction * pw3270_action_host_properties_new(void) {
40   -
41   - V3270SimpleAction * action = v3270_dialog_action_new(factory);
42   -
43   - action->name = "host.properties";
44   - action->group.id = LIB3270_ACTION_GROUP_OFFLINE;
45   - action->icon_name = "network-server";
46   - action->label = N_("Host properties");
47   -
48   - return G_ACTION(action);
49   -}
50   -
51   -GtkWidget * factory(V3270SimpleAction G_GNUC_UNUSED(*action), GtkWidget *terminal) {
52   -
53   - GtkWidget * dialog = v3270_settings_dialog_new();
54   - V3270Settings * settings = GTK_V3270_SETTINGS(v3270_host_settings_new());
55   -
56   - if(settings->title)
57   - gtk_window_set_title(GTK_WINDOW(dialog), settings->title);
58   -
59   - gtk_container_add(GTK_CONTAINER(dialog), GTK_WIDGET(settings));
60   -
61   - gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(terminal)));
62   - gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
63   -
64   - v3270_settings_dialog_set_terminal_widget(dialog, terminal);
65   -
66   - g_signal_connect(dialog,"response",G_CALLBACK(v3270_setttings_dialog_response),settings);
67   -
68   - gtk_widget_show_all(dialog);
69   - return dialog;
70   -
71   -}
72   -*/
73   -
src/objects/window/actions/sessionproperties.c
... ... @@ -44,7 +44,6 @@ GtkWidget * factory(V3270SimpleAction *action, GtkWidget *terminal) {
44 44 size_t ix;
45 45  
46 46 GApplication *application = g_application_get_default();
47   -// GSettings *settings = pw3270_application_get_settings(g_application_get_default());
48 47  
49 48 GtkWidget * dialog = v3270_settings_dialog_new();
50 49 gtk_window_set_title(GTK_WINDOW(dialog), action->label);
... ...
src/objects/window/actions/setcolors.c
... ... @@ -1,60 +0,0 @@
1   -/*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
11   - *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
16   - *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como - e possui - linhas de código.
22   - *
23   - * Contatos:
24   - *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27   - *
28   - */
29   -
30   -/*
31   -#include "../private.h"
32   -#include <pw3270/window.h>
33   -#include <pw3270/actions.h>
34   -#include <v3270/settings.h>
35   -#include <v3270/dialogs.h>
36   -#include <v3270/colorscheme.h>
37   -
38   -static GtkWidget * factory(V3270SimpleAction *action, GtkWidget *terminal);
39   -
40   -GAction * pw3270_set_color_action_new(void) {
41   -
42   - V3270SimpleAction * action = v3270_dialog_action_new(factory);
43   -
44   - action->name = "set.colors";
45   - action->icon_name = "gtk-select-color";
46   - action->label = _("Colors");
47   - action->tooltip = _("Change terminal colors");
48   -
49   - return G_ACTION(action);
50   -
51   -}
52   -
53   -GtkWidget * factory(V3270SimpleAction G_GNUC_UNUSED(*action), GtkWidget *terminal) {
54   -
55   - GtkWidget *dialog = v3270_settings_get_edit_dialog(v3270_color_settings_new(),terminal,FALSE);
56   - gtk_widget_show_all(dialog);
57   - return dialog;
58   -}
59   -*/
60   -
src/objects/window/header-settings.c
... ... @@ -41,40 +41,8 @@ static void apply(GtkWidget *widget, GSettings *settings, PW3270SettingsPage *pa
41 41  
42 42 struct _PW3270SettingsPage {
43 43 GtkWidget * editor;
44   - /*
45   - GtkWidget * views[3];
46   - GtkTreeModel * model;
47   - */
48 44 };
49 45  
50   -/*
51   -static const struct _views {
52   -const char * label;
53   -gint left;
54   -gint top;
55   -gint height;
56   -} views[] = {
57   -{
58   - .label = N_("Left"),
59   - .left = 0,
60   - .top = 0,
61   - .height = 4
62   -},
63   -{
64   - .label = N_("Right"),
65   - .left = 0,
66   - .top = 6,
67   - .height = 4
68   -},
69   -{
70   - .label = N_("Available"),
71   - .left = 2,
72   - .top = 0,
73   - .height = 10
74   -}
75   -};
76   -*/
77   -
78 46 /*--[ Implement ]------------------------------------------------------------------------------------*/
79 47  
80 48 GtkWidget * pw3270_header_settings_new() {
... ...