Commit 9c46c02c0823fa2709d411ef6026a84214d3c0d5

Authored by Perry Werneck
1 parent 7819b67d
Exists in develop

Fixing codeql alerts.

src/dialogs/print/private.h
... ... @@ -27,6 +27,8 @@
27 27 *
28 28 */
29 29  
  30 + #pragma once
  31 +
30 32 #include <v3270.h>
31 33 #include <v3270/print.h>
32 34 #include <lib3270/log.h>
... ...
src/dialogs/save/private.h
... ... @@ -27,6 +27,8 @@
27 27 *
28 28 */
29 29  
  30 + #pragma once
  31 +
30 32 #include <internals.h>
31 33  
32 34 #include <libintl.h>
... ...
src/dialogs/settings/private.h
... ... @@ -27,60 +27,59 @@
27 27 *
28 28 */
29 29  
30   -#ifndef PRIVATE_H_INCLUDED
  30 + #pragma once
31 31  
32   - #include <internals.h>
33   - #include <lib3270/log.h>
34   - #include <lib3270/toggle.h>
35   - #include <v3270/settings.h>
  32 + #include <internals.h>
  33 + #include <lib3270/log.h>
  34 + #include <lib3270/toggle.h>
  35 + #include <v3270/settings.h>
36 36  
37   - /// @brief Toggle button factory.
38   - struct ToggleButtonDefinition {
39   - gint left;
40   - gint top;
41   - gint width;
42   - unsigned short grid;
43   - LIB3270_TOGGLE_ID id;
44   - };
  37 + /// @brief Toggle button factory.
  38 + struct ToggleButtonDefinition {
  39 + gint left;
  40 + gint top;
  41 + gint width;
  42 + unsigned short grid;
  43 + LIB3270_TOGGLE_ID id;
  44 + };
45 45  
46   - G_GNUC_INTERNAL void v3270_settings_create_toggle_buttons(const struct ToggleButtonDefinition * definitions, size_t length, GtkWidget **grids, GtkToggleButton **toggles);
47   - G_GNUC_INTERNAL void v3270_settings_load_toggle_buttons(const struct ToggleButtonDefinition * definitions, size_t length, GtkWidget *terminal, GtkToggleButton **toggles);
48   - G_GNUC_INTERNAL void v3270_settings_apply_toggle_buttons(const struct ToggleButtonDefinition * definitions, size_t length, GtkWidget *terminal, GtkToggleButton **toggles);
  46 + G_GNUC_INTERNAL void v3270_settings_create_toggle_buttons(const struct ToggleButtonDefinition * definitions, size_t length, GtkWidget **grids, GtkToggleButton **toggles);
  47 + G_GNUC_INTERNAL void v3270_settings_load_toggle_buttons(const struct ToggleButtonDefinition * definitions, size_t length, GtkWidget *terminal, GtkToggleButton **toggles);
  48 + G_GNUC_INTERNAL void v3270_settings_apply_toggle_buttons(const struct ToggleButtonDefinition * definitions, size_t length, GtkWidget *terminal, GtkToggleButton **toggles);
49 49  
50   - /// @brief Entry field factory.
51   - struct EntryFieldDefinition {
  50 + /// @brief Entry field factory.
  51 + struct EntryFieldDefinition {
52 52  
53   - ENTRY_FIELD_HEAD
  53 + ENTRY_FIELD_HEAD
54 54  
55   - unsigned short grid;
56   - gint max_length;
57   - gint width_chars;
  55 + unsigned short grid;
  56 + gint max_length;
  57 + gint width_chars;
58 58  
59   - };
  59 + };
60 60  
61   - G_GNUC_INTERNAL void v3270_settings_create_entry_fields(const struct EntryFieldDefinition * definitions, size_t length, GtkWidget **grids, GtkEntry **entries);
  61 + G_GNUC_INTERNAL void v3270_settings_create_entry_fields(const struct EntryFieldDefinition * definitions, size_t length, GtkWidget **grids, GtkEntry **entries);
62 62  
63   - /// @brief Combo Box factory
64   - struct ComboBoxDefinition {
  63 + /// @brief Combo Box factory
  64 + struct ComboBoxDefinition {
65 65  
66   - ENTRY_FIELD_HEAD
  66 + ENTRY_FIELD_HEAD
67 67  
68   - unsigned short grid;
  68 + unsigned short grid;
69 69  
70   - gint n_columns;
71   - const GType *types;
  70 + gint n_columns;
  71 + const GType *types;
72 72  
73   - };
  73 + };
74 74  
75   - G_GNUC_INTERNAL void v3270_settings_create_combos(const struct ComboBoxDefinition * definitions, size_t length, GtkWidget **grids, GtkComboBox **combos);
  75 + G_GNUC_INTERNAL void v3270_settings_create_combos(const struct ComboBoxDefinition * definitions, size_t length, GtkWidget **grids, GtkComboBox **combos);
76 76  
77   - /// @brief Checkbox factory
78   - struct CheckBoxDefinition {
79   - ENTRY_FIELD_HEAD
  77 + /// @brief Checkbox factory
  78 + struct CheckBoxDefinition {
  79 + ENTRY_FIELD_HEAD
80 80  
81   - unsigned short grid;
82   - };
  81 + unsigned short grid;
  82 + };
83 83  
84   - G_GNUC_INTERNAL void v3270_settings_create_checkboxes(const struct CheckBoxDefinition * definitions, size_t length, GtkWidget **grids, GtkToggleButton **buttons);
  84 + G_GNUC_INTERNAL void v3270_settings_create_checkboxes(const struct CheckBoxDefinition * definitions, size_t length, GtkWidget **grids, GtkToggleButton **buttons);
85 85  
86   -#endif // PRIVATE_H_INCLUDED
... ...
src/filetransfer/v3270ft.c
... ... @@ -103,16 +103,18 @@ static void transfer_type_changed(GtkComboBox *widget, v3270ft *dialog) {
103 103 // Tem opção seleciona
104 104  
105 105 struct v3270ft_entry *entry = v3270ft_get_selected(dialog);
106   - LIB3270_FT_OPTION opt = entry->options & ~(LIB3270_FT_OPTION_SEND|LIB3270_FT_OPTION_RECEIVE|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP);
  106 + if(entry) {
  107 + LIB3270_FT_OPTION opt = entry->options & ~(LIB3270_FT_OPTION_SEND|LIB3270_FT_OPTION_RECEIVE|LIB3270_FT_OPTION_ASCII|LIB3270_FT_OPTION_CRLF|LIB3270_FT_OPTION_REMAP);
107 108  
108   - opt |= ft_type[selected].opt;
  109 + opt |= ft_type[selected].opt;
109 110  
110   - entry->type = selected;
111   - debug("Transfer type=%d opt=%08x last=%08x",selected,opt,entry->options);
  111 + entry->type = selected;
  112 + debug("Transfer type=%d opt=%08x last=%08x",selected,opt,entry->options);
112 113  
113   - if(entry->options != opt) {
114   - debug("Transfer type=%d opt=%08x",selected,opt);
115   - v3270ft_set_options(GTK_WIDGET(dialog),opt);
  114 + if(entry->options != opt) {
  115 + debug("Transfer type=%d opt=%08x",selected,opt);
  116 + v3270ft_set_options(GTK_WIDGET(dialog),opt);
  117 + }
116 118 }
117 119  
118 120 }
... ... @@ -290,11 +292,7 @@ static gboolean spin_format(GtkSpinButton *spin, G_GNUC_UNUSED gpointer data) {
290 292 return TRUE;
291 293 }
292 294  
293   -//#ifdef WIN32
294   -//static void select_local_file(GtkButton G_GNUC_UNUSED(*button), v3270ft *dialog) {
295   -//#else
296 295 static void icon_press(G_GNUC_UNUSED GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_pos, G_GNUC_UNUSED GdkEvent *event, v3270ft *dialog) {
297   -//#endif // WIN32
298 296  
299 297 debug("%s: action=%d",__FUNCTION__, (int) GTK_FILE_CHOOSER_ACTION_OPEN);
300 298  
... ...
src/include/terminal.h
... ... @@ -17,6 +17,8 @@
17 17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 18 */
19 19  
  20 + #pragma once
  21 +
20 22 #include <config.h>
21 23 #include <internals.h>
22 24 #include <v3270/selection.h>
... ...
src/include/v3270/accessible.h
... ... @@ -27,47 +27,46 @@
27 27 *
28 28 */
29 29  
30   -#include <gtk/gtk.h>
  30 + #pragma once
31 31  
32   -G_BEGIN_DECLS
  32 + #include <gtk/gtk.h>
33 33  
34   -#define GTK_TYPE_V3270_ACCESSIBLE (v3270_accessible_get_type ())
35   -#define GTK_V3270_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270_ACCESSIBLE, v3270Accessible))
36   -#define GTK_V3270_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270_ACCESSIBLE, v3270AccessibleClass))
37   -#define GTK_IS_V3270_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_V3270_ACCESSIBLE))
38   -#define GTK_IS_V3270_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_V3270_ACCESSIBLE))
39   -#define GTK_V3270_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_V3270_ACCESSIBLE, v3270AccessibleClass))
  34 + G_BEGIN_DECLS
40 35  
41   -typedef struct _v3270Accessible v3270Accessible;
42   -typedef struct _v3270AccessibleClass v3270AccessibleClass;
  36 + #define GTK_TYPE_V3270_ACCESSIBLE (v3270_accessible_get_type ())
  37 + #define GTK_V3270_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270_ACCESSIBLE, v3270Accessible))
  38 + #define GTK_V3270_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270_ACCESSIBLE, v3270AccessibleClass))
  39 + #define GTK_IS_V3270_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_V3270_ACCESSIBLE))
  40 + #define GTK_IS_V3270_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_V3270_ACCESSIBLE))
  41 + #define GTK_V3270_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_V3270_ACCESSIBLE, v3270AccessibleClass))
43 42  
44   -typedef enum _v3270_state
45   -{
  43 + typedef struct _v3270Accessible v3270Accessible;
  44 + typedef struct _v3270AccessibleClass v3270AccessibleClass;
  45 +
  46 + typedef enum _v3270_state
  47 + {
46 48 V3270_STATE_NONE = 0x0000,
47 49 V3270_STATE_EDITABLE = 0x0001,
48 50 V3270_STATE_BUSY = 0x0002,
49 51 V3270_STATE_ENABLED = 0x0004,
50 52 V3270_STATE_INVALID_ENTRY = 0x0008,
51 53  
52   -} V3270_STATE;
  54 + } V3270_STATE;
53 55  
54   -struct _v3270Accessible
55   -{
  56 + struct _v3270Accessible
  57 + {
56 58 GtkAccessible parent;
57 59 V3270_STATE state;
58 60  
59   -// AtkLayer layer;
60   -};
  61 + };
61 62  
62   -struct _v3270AccessibleClass
63   -{
  63 + struct _v3270AccessibleClass
  64 + {
64 65 GtkAccessibleClass parent_class;
  66 + };
65 67  
  68 + GType v3270_accessible_get_type(void);
66 69  
67   -};
68   -
69   -GType v3270_accessible_get_type(void);
70   -
71   -void v3270_acessible_set_state(GtkAccessible *obj, LIB3270_MESSAGE id);
  70 + void v3270_acessible_set_state(GtkAccessible *obj, LIB3270_MESSAGE id);
72 71  
73   -G_END_DECLS
  72 + G_END_DECLS
... ...
src/include/v3270/colorscheme.h
... ... @@ -27,7 +27,7 @@
27 27 *
28 28 */
29 29  
30   -#ifndef V3270_COLOR_SCHEME_H_INCLUDED
  30 + #pragma once
31 31  
32 32 #include <gtk/gtk.h>
33 33  
... ... @@ -69,4 +69,3 @@
69 69  
70 70 G_END_DECLS
71 71  
72   -#endif // V3270_COLOR_SCHEME_H_INCLUDED
... ...
src/include/v3270/tools.h
... ... @@ -27,27 +27,25 @@
27 27 *
28 28 */
29 29  
30   -#ifndef V3270_TOOLS_H_INCLUDED
  30 + #pragma once
31 31  
32 32 #include <gtk/gtk.h>
33 33 #include <lib3270.h>
34 34  
35 35 G_BEGIN_DECLS
36 36  
37   - /// @brief Bind pointer to widget; release it when widget is destroyed.
38   - LIB3270_EXPORT void gtk_widget_bind_ptr(GtkWidget *widget, gpointer ptr);
  37 + /// @brief Bind pointer to widget; release it when widget is destroyed.
  38 + LIB3270_EXPORT void gtk_widget_bind_ptr(GtkWidget *widget, gpointer ptr);
39 39  
40   - /// @brief Add style to widget.
41   - LIB3270_EXPORT void gtk_widget_add_class(GtkWidget *widget, const char *className);
  40 + /// @brief Add style to widget.
  41 + LIB3270_EXPORT void gtk_widget_add_class(GtkWidget *widget, const char *className);
42 42  
43   - /// @brief Bind file chooser with entry field.
44   - LIB3270_EXPORT void gtk_entry_bind_to_filechooser(GtkWidget *widget, GtkFileChooserAction action, const gchar *title, const gchar *icon_name, const gchar *pattern, const gchar *name);
45   -
46   - /// @brief Bind dialog with toplevel
47   - LIB3270_EXPORT void gtk_dialog_set_toplevel(GtkWidget *dialog, GtkWidget *widget);
  43 + /// @brief Bind file chooser with entry field.
  44 + LIB3270_EXPORT void gtk_entry_bind_to_filechooser(GtkWidget *widget, GtkFileChooserAction action, const gchar *title, const gchar *icon_name, const gchar *pattern, const gchar *name);
48 45  
  46 + /// @brief Bind dialog with toplevel
  47 + LIB3270_EXPORT void gtk_dialog_set_toplevel(GtkWidget *dialog, GtkWidget *widget);
49 48  
50 49 G_END_DECLS
51 50  
52   -#endif // V3270_TOOLS_H_INCLUDED
53 51  
... ...
src/terminal/actions/private.h
... ... @@ -17,6 +17,8 @@
17 17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 18 */
19 19  
  20 + #pragma once
  21 +
20 22 #include <config.h>
21 23  
22 24 #include <glib.h>
... ...
src/terminal/properties/private.h
... ... @@ -17,11 +17,13 @@
17 17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 18 */
19 19  
20   -#ifdef WIN32
  20 + #pragma once
  21 +
  22 + #ifdef WIN32
21 23 #include <winsock2.h>
22 24 #include <windows.h>
23 25 #include <ws2tcpip.h>
24   -#endif // WIN32
  26 + #endif // WIN32
25 27  
26 28 #include <gtk/gtk.h>
27 29 #include <limits.h>
... ...
src/trace/private.h
... ... @@ -27,44 +27,38 @@
27 27 *
28 28 */
29 29  
30   -#ifndef PRIVATE_H_INCLUDED
  30 + #pragma once
31 31  
32   - #include <config.h>
  32 + #include <config.h>
33 33  
34   - #include <gtk/gtk.h>
  34 + #include <gtk/gtk.h>
35 35  
  36 + #ifndef ENABLE_NLS
36 37 #define ENABLE_NLS
  38 + #endif // ENABLE_NLS
37 39  
38   - #include <libintl.h>
39   - #include <glib/gi18n-lib.h>
  40 + #include <libintl.h>
  41 + #include <glib/gi18n-lib.h>
40 42  
41   - #include <v3270.h>
42   - #include <v3270/trace.h>
  43 + #include <v3270.h>
  44 + #include <v3270/trace.h>
43 45  
44   - #include <lib3270.h>
45   - #include <lib3270/log.h>
46   - #include <lib3270/trace.h>
  46 + #include <lib3270.h>
  47 + #include <lib3270/log.h>
  48 + #include <lib3270/trace.h>
47 49  
48   - /// @brief V3270 Trace Signal list
49   - enum V3270_TRACE_SIGNAL
50   - {
51   - V3270_TRACE_SIGNAL_COMMAND,
  50 + /// @brief V3270 Trace Signal list
  51 + enum V3270_TRACE_SIGNAL
  52 + {
  53 + V3270_TRACE_SIGNAL_COMMAND,
52 54  
53   - V3270_TRACE_SIGNAL_LAST
54   - };
  55 + V3270_TRACE_SIGNAL_LAST
  56 + };
55 57  
56   - G_GNUC_INTERNAL H3270 * v3270_trace_get_session(GtkWidget *widget);
57   - G_GNUC_INTERNAL GtkWidget * v3270_trace_get_terminal(GtkWidget *widget);
58   - G_GNUC_INTERNAL GtkTextBuffer * v3270_trace_get_text_buffer(GtkWidget *widget);
59   - G_GNUC_INTERNAL GtkScrolledWindow * v3270_trace_get_scrolled_window(GtkWidget *widget);
60   - G_GNUC_INTERNAL void v3270_trace_signal_emit(gpointer instance, enum V3270_TRACE_SIGNAL signal_id, ...);
  58 + G_GNUC_INTERNAL H3270 * v3270_trace_get_session(GtkWidget *widget);
  59 + G_GNUC_INTERNAL GtkWidget * v3270_trace_get_terminal(GtkWidget *widget);
  60 + G_GNUC_INTERNAL GtkTextBuffer * v3270_trace_get_text_buffer(GtkWidget *widget);
  61 + G_GNUC_INTERNAL GtkScrolledWindow * v3270_trace_get_scrolled_window(GtkWidget *widget);
  62 + G_GNUC_INTERNAL void v3270_trace_signal_emit(gpointer instance, enum V3270_TRACE_SIGNAL signal_id, ...);
61 63  
62   - G_BEGIN_DECLS
63   -
64   -
65   - G_END_DECLS
66   -
67   -
68   -
69   -#endif // PRIVATE_H_INCLUDED
70 64  
... ...