Commit 163be35ef5f3995ec975549a1a43248ab9fcd8e1

Authored by Perry Werneck
1 parent 575e4f1a
Exists in master and in 1 other branch develop

Fixing RHEL_7 builds.

src/core/tools.c 0 → 100644
... ... @@ -0,0 +1,45 @@
  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 main.c 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 <lib3270.h>
  31 +#include <lib3270/ipc.h>
  32 +
  33 +/*--[ Implement ]------------------------------------------------------------------------------------*/
  34 +
  35 + #if ! GLIB_CHECK_VERSION(2,44,0)
  36 +
  37 + // Reference: https://github.com/ImageMagick/glib/blob/master/glib/glib-autocleanups.h
  38 + void ipc3270_autoptr_cleanup_generic_gfree(void *p)
  39 + {
  40 + void **pp = (void**)p;
  41 + g_free (*pp);
  42 + }
  43 +
  44 + #endif // ! GLIB(2,44,0)
  45 +
... ...
src/core/windows/pipesource.c
... ... @@ -28,6 +28,7 @@
28 28 */
29 29  
30 30 #include "gobject.h"
  31 +#include <lib3270/ipc.h>
31 32 #include <lib3270/trace.h>
32 33  
33 34 void ipc3270_wait_for_client(IPC3270_PIPE_SOURCE *source) {
... ...
src/include/lib3270/ipc.h
... ... @@ -31,6 +31,8 @@
31 31 /**
32 32 * @brief Common definitions for pw3270 IPC plugin.
33 33 *
  34 + * @author Perry Werneck <perry.werneck@gmail.com>
  35 + *
34 36 */
35 37  
36 38 #ifndef PW3270_IPC_H_INCLUDED
... ... @@ -53,7 +55,7 @@
53 55  
54 56 #endif // _WIN32
55 57  
56   -
  58 + #include <glib.h>
57 59 #include <gtk/gtk.h>
58 60 #include <lib3270.h>
59 61  
... ... @@ -69,25 +71,25 @@
69 71 typedef struct _ipc3270 ipc3270;
70 72 typedef struct _ipc3270Class ipc3270Class;
71 73  
72   - GObject * ipc3270_new();
73   - GType ipc3270_get_type(void);
74   - void ipc3270_set_session(GObject *object, H3270 *hSession);
75   - void ipc3270_export_object(GObject *object, const char *name, GError **error);
  74 + GObject * ipc3270_new();
  75 + GType ipc3270_get_type(void);
  76 + void ipc3270_set_session(GObject *object, H3270 *hSession);
  77 + void ipc3270_export_object(GObject *object, const char *name, GError **error);
76 78  
77   - gchar * ipc3270_convert_output_string(GObject *object, const gchar *string, GError **error);
78   - gchar * ipc3270_convert_input_string(GObject *object, const gchar *string, GError **error);
79   - GVariant * ipc3270_GVariant_from_input_string(GObject *object, char *string, GError **error);
  79 + gchar * ipc3270_convert_output_string(GObject *object, const gchar *string, GError **error);
  80 + gchar * ipc3270_convert_input_string(GObject *object, const gchar *string, GError **error);
  81 + GVariant * ipc3270_GVariant_from_input_string(GObject *object, char *string, GError **error);
80 82  
81   - void ipc3270_add_terminal_introspection(GString *string);
  83 + void ipc3270_add_terminal_introspection(GString *string);
82 84  
83   - const gchar * ipc3270_get_display_charset(GObject *object);
84   - H3270 * ipc3270_get_session(GObject *object);
  85 + const gchar * ipc3270_get_display_charset(GObject *object);
  86 + H3270 * ipc3270_get_session(GObject *object);
85 87  
86   - void ipc3270_set_error(GObject *object, int errcode, GError **error);
  88 + void ipc3270_set_error(GObject *object, int errcode, GError **error);
87 89  
88   - GVariant * ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *parameters, GError **error);
89   - gboolean ipc3270_set_property(GObject *object, const gchar *property_name, GVariant *value, GError **error);
90   - GVariant * ipc3270_get_property(GObject *object, const gchar *property_name, GError **error);
  90 + GVariant * ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *parameters, GError **error);
  91 + gboolean ipc3270_set_property(GObject *object, const gchar *property_name, GVariant *value, GError **error);
  92 + GVariant * ipc3270_get_property(GObject *object, const gchar *property_name, GError **error);
91 93  
92 94 #ifdef _WIN32
93 95 unsigned char * ipc3270_pack(const gchar *name, int id, GVariant *values, size_t * szPacket);
... ... @@ -98,6 +100,11 @@
98 100  
99 101 G_END_DECLS
100 102  
  103 + #if ! GLIB_CHECK_VERSION(2,44,0)
  104 + G_GNUC_INTERNAL void ipc3270_autoptr_cleanup_generic_gfree(void *p);
  105 + #define g_autofree __attribute__((cleanup(ipc3270_autoptr_cleanup_generic_gfree)))
  106 + #endif // ! GLIB(2,44,0)
  107 +
101 108 #ifdef DEBUG
102 109 #define debug( fmt, ... ) fprintf(stderr,"%s(%d) " fmt "\n", __FILE__, (int) __LINE__, __VA_ARGS__ ); fflush(stderr);
103 110 #else
... ...