Commit 880c631a3a395cefbc372817bd8cdc8deb3cefe8

Authored by Perry Werneck
1 parent 99d3b0ed
Exists in master and in 1 other branch develop

Fixing windows builds and compiler warnings.

@@ -39,8 +39,8 @@ TEST_SOURCES= \ @@ -39,8 +39,8 @@ TEST_SOURCES= \
39 39
40 #---[ Tools ]---------------------------------------------------------------------------- 40 #---[ Tools ]----------------------------------------------------------------------------
41 41
42 -CC=@CC@  
43 -LD=@CC@ 42 +CC=@CXX@
  43 +LD=@CXX@
44 LN_S=@LN_S@ 44 LN_S=@LN_S@
45 MKDIR=@MKDIR_P@ 45 MKDIR=@MKDIR_P@
46 INSTALL=@INSTALL@ 46 INSTALL=@INSTALL@
@@ -50,6 +50,7 @@ AM_ICONV @@ -50,6 +50,7 @@ AM_ICONV
50 50
51 dnl Checks for programs. 51 dnl Checks for programs.
52 AC_PROG_CC 52 AC_PROG_CC
  53 +AC_PROG_CXX
53 AC_PROG_SED 54 AC_PROG_SED
54 AC_PROG_LN_S 55 AC_PROG_LN_S
55 56
@@ -77,8 +78,10 @@ DLLPREFIX="lib" @@ -77,8 +78,10 @@ DLLPREFIX="lib"
77 case "$host" in 78 case "$host" in
78 *-mingw32|*-pc-msys) 79 *-mingw32|*-pc-msys)
79 app_cv_osname="windows" 80 app_cv_osname="windows"
  81 +
80 CFLAGS="$CFLAGS -pthread -D_WIN32_WINNT=0x0600" 82 CFLAGS="$CFLAGS -pthread -D_WIN32_WINNT=0x0600"
81 LIBS="$LIBS -lws2_32 -lwtsapi32 -lcomdlg32" 83 LIBS="$LIBS -lws2_32 -lwtsapi32 -lcomdlg32"
  84 +
82 LDFLAGS="$LDFLAGS -pthread" 85 LDFLAGS="$LDFLAGS -pthread"
83 DLLEXT=".dll" 86 DLLEXT=".dll"
84 DLLPREFIX="" 87 DLLPREFIX=""
src/hllapi/server.h
@@ -1,53 +0,0 @@ @@ -1,53 +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., 59 Temple  
19 - * Place, Suite 330, Boston, MA, 02111-1307, USA  
20 - *  
21 - * Este programa está nomeado como server.h 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 <config.h>  
31 - #define ENABLE_NLS  
32 - #define GETTEXT_PACKAGE PACKAGE_NAME  
33 -  
34 - #include <libintl.h>  
35 - #include <glib/gi18n.h>  
36 - #include <gtk/gtk.h>  
37 -  
38 - #include <lib3270.h>  
39 - #include <lib3270/log.h>  
40 - #include <pw3270.h>  
41 - #include <pw3270/hllapi.h>  
42 -  
43 -#ifdef _WIN32  
44 - #include <windows.h>  
45 -  
46 - #define PIPE_BUFFER_LENGTH HLLAPI_MAXLENGTH+30  
47 -  
48 - G_GNUC_INTERNAL void popup_lasterror(const gchar *fmt, ...);  
49 - G_GNUC_INTERNAL void set_active(gboolean on);  
50 -  
51 -#endif // _WIN32  
52 -  
53 -  
src/plugin/linux/gobject.c
@@ -76,7 +76,7 @@ static void pw3270_dbus_init(PW3270Dbus *object) @@ -76,7 +76,7 @@ static void pw3270_dbus_init(PW3270Dbus *object)
76 76
77 PW3270Dbus * pw3270_dbus_new(void) 77 PW3270Dbus * pw3270_dbus_new(void)
78 { 78 {
79 - return g_object_new(PW3270_TYPE_DBUS, NULL); 79 + return (PW3270Dbus *) g_object_new(PW3270_TYPE_DBUS, NULL);
80 } 80 }
81 81
82 void pw3270_dbus_get_revision(PW3270Dbus *object, DBusGMethodInvocation *context) 82 void pw3270_dbus_get_revision(PW3270Dbus *object, DBusGMethodInvocation *context)
@@ -406,7 +406,7 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, char @@ -406,7 +406,7 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, char
406 void pw3270_dbus_set_toggle(PW3270Dbus *object, int id, int value, DBusGMethodInvocation *context) 406 void pw3270_dbus_set_toggle(PW3270Dbus *object, int id, int value, DBusGMethodInvocation *context)
407 { 407 {
408 trace("%s object=%p context=%p",__FUNCTION__,object,context); 408 trace("%s object=%p context=%p",__FUNCTION__,object,context);
409 - dbus_g_method_return(context,lib3270_set_toggle(pw3270_dbus_get_session_handle(object),id,value)); 409 + dbus_g_method_return(context,lib3270_set_toggle(pw3270_dbus_get_session_handle(object),(LIB3270_TOGGLE) id,value));
410 } 410 }
411 411
412 void pw3270_dbus_cmp_text_at(PW3270Dbus *object, int row, int col, const gchar *utftext, char lf, DBusGMethodInvocation *context) 412 void pw3270_dbus_cmp_text_at(PW3270Dbus *object, int row, int col, const gchar *utftext, char lf, DBusGMethodInvocation *context)
src/plugin/linux/main.c
@@ -67,7 +67,7 @@ @@ -67,7 +67,7 @@
67 { 67 {
68 GtkWidget *dialog = gtk_message_dialog_new( 68 GtkWidget *dialog = gtk_message_dialog_new(
69 GTK_WINDOW(window), 69 GTK_WINDOW(window),
70 - GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, 70 + (GtkDialogFlags) (GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT),
71 GTK_MESSAGE_ERROR, 71 GTK_MESSAGE_ERROR,
72 GTK_BUTTONS_OK, 72 GTK_BUTTONS_OK,
73 _( "Can't connect to DBUS server" )); 73 _( "Can't connect to DBUS server" ));
@@ -112,7 +112,7 @@ @@ -112,7 +112,7 @@
112 { 112 {
113 GtkWidget *dialog = gtk_message_dialog_new( 113 GtkWidget *dialog = gtk_message_dialog_new(
114 GTK_WINDOW(window), 114 GTK_WINDOW(window),
115 - GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, 115 + (GtkDialogFlags) (GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT),
116 GTK_MESSAGE_ERROR, 116 GTK_MESSAGE_ERROR,
117 GTK_BUTTONS_OK, 117 GTK_BUTTONS_OK,
118 _( "Can't get DBUS object name" )); 118 _( "Can't get DBUS object name" ));
src/plugin/linux/misc.c
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 39
40 gpointer pw3270_dbus_register_object(DBusGConnection *connection,DBusGProxy G_GNUC_UNUSED(*proxy),GType object_type,const DBusGObjectInfo *info,const gchar *path) 40 gpointer pw3270_dbus_register_object(DBusGConnection *connection,DBusGProxy G_GNUC_UNUSED(*proxy),GType object_type,const DBusGObjectInfo *info,const gchar *path)
41 { 41 {
42 - GObject *object = g_object_new (object_type, NULL); 42 + GObject *object = G_OBJECT(g_object_new(object_type, NULL));
43 dbus_g_object_type_install_info (object_type, info); 43 dbus_g_object_type_install_info (object_type, info);
44 dbus_g_connection_register_g_object (connection, path, object); 44 dbus_g_connection_register_g_object (connection, path, object);
45 return object; 45 return object;
src/plugin/windows/main.c
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 * 31 *
32 */ 32 */
33 33
34 - #include "server.h" 34 + #include "private.h"
35 35
36 #ifdef _WIN32 36 #ifdef _WIN32
37 #include <windows.h> 37 #include <windows.h>
@@ -99,8 +99,8 @@ @@ -99,8 +99,8 @@
99 case ERROR_PIPE_CONNECTED: 99 case ERROR_PIPE_CONNECTED:
100 trace("%s: ERROR_PIPE_CONNECTED",__FUNCTION__); 100 trace("%s: ERROR_PIPE_CONNECTED",__FUNCTION__);
101 set_active(TRUE); 101 set_active(TRUE);
102 - if(SetEvent(source->overlap.hEvent))  
103 - break; 102 + SetEvent(source->overlap.hEvent);
  103 + break;
104 104
105 // If an error occurs during the connect operation... 105 // If an error occurs during the connect operation...
106 default: 106 default:
@@ -208,7 +208,7 @@ @@ -208,7 +208,7 @@
208 send_text(source,strdup(lib3270_get_url(lib3270_get_default_session_handle()))); 208 send_text(source,strdup(lib3270_get_url(lib3270_get_default_session_handle())));
209 } 209 }
210 210
211 - static void process_input(pipe_source *source, DWORD cbRead) 211 + static void process_input(pipe_source *source, DWORD G_GNUC_UNUSED(cbRead))
212 { 212 {
213 const struct hllapi_packet_query * query = ((struct hllapi_packet_query *) source->buffer); 213 const struct hllapi_packet_query * query = ((struct hllapi_packet_query *) source->buffer);
214 214
@@ -490,7 +490,7 @@ @@ -490,7 +490,7 @@
490 490
491 } 491 }
492 492
493 - static gboolean IO_dispatch(GSource *source, GSourceFunc callback, gpointer data) 493 + static gboolean IO_dispatch(GSource *source, GSourceFunc G_GNUC_UNUSED(callback), gpointer G_GNUC_UNUSED(data))
494 { 494 {
495 /* 495 /*
496 * Called to dispatch the event source, 496 * Called to dispatch the event source,
@@ -559,9 +559,8 @@ @@ -559,9 +559,8 @@
559 559
560 } 560 }
561 561
562 - static gboolean IO_closure(gpointer data) 562 + static gboolean IO_closure(gpointer G_GNUC_UNUSED(data))
563 { 563 {
564 -// trace("%s: data=%p",__FUNCTION__,data);  
565 return 0; 564 return 0;
566 } 565 }
567 566
src/plugin/windows/private.h 0 → 100644
@@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
  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., 59 Temple
  19 + * Place, Suite 330, Boston, MA, 02111-1307, 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 <config.h>
  31 + #define ENABLE_NLS
  32 + #define GETTEXT_PACKAGE PACKAGE_NAME
  33 +
  34 + #include <libintl.h>
  35 + #include <glib/gi18n.h>
  36 + #include <gtk/gtk.h>
  37 +
  38 + #include <lib3270.h>
  39 + #include <lib3270/log.h>
  40 + #include <pw3270.h>
  41 + #include <pw3270/hllapi.h>
  42 +
  43 + #include <windows.h>
  44 +
  45 + #define PIPE_BUFFER_LENGTH HLLAPI_MAXLENGTH+30
  46 +
  47 + G_GNUC_INTERNAL void popup_lasterror(const gchar *fmt, ...);
  48 + G_GNUC_INTERNAL void set_active(gboolean on);
  49 +
  50 +
src/testprogram/testprogram.c
@@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
55 g_message("Closing module %p",module); 55 g_message("Closing module %p",module);
56 56
57 static void (*stop)(GtkWidget *window, GtkWidget *terminal) = NULL; 57 static void (*stop)(GtkWidget *window, GtkWidget *terminal) = NULL;
58 - if(!g_module_symbol(module,"pw3270_plugin_stop",(gpointer) &stop)) 58 + if(!g_module_symbol(module,"pw3270_plugin_stop",(void **) &stop))
59 { 59 {
60 g_message("Can't get stop method from plugin: %s",g_module_error()); 60 g_message("Can't get stop method from plugin: %s",g_module_error());
61 } 61 }
@@ -93,12 +93,12 @@ @@ -93,12 +93,12 @@
93 if(!module) 93 if(!module)
94 return; 94 return;
95 95
96 - GtkWidget * terminal = g_object_get_data(G_OBJECT(button),"terminal"); 96 + GtkWidget * terminal = GTK_WIDGET(g_object_get_data(G_OBJECT(button),"terminal"));
97 97
98 const gchar * method_name = (gtk_toggle_tool_button_get_active(button) ? "pw3270_plugin_start" : "pw3270_plugin_stop"); 98 const gchar * method_name = (gtk_toggle_tool_button_get_active(button) ? "pw3270_plugin_start" : "pw3270_plugin_stop");
99 99
100 static void (*call)(GtkWidget *window, GtkWidget *terminal) = NULL; 100 static void (*call)(GtkWidget *window, GtkWidget *terminal) = NULL;
101 - if(!g_module_symbol(module,method_name,(gpointer) &call)) 101 + if(!g_module_symbol(module,method_name,(void **) &call))
102 { 102 {
103 g_message("Can't get method \"%s\": %s",method_name,g_module_error()); 103 g_message("Can't get method \"%s\": %s",method_name,g_module_error());
104 return; 104 return;