Commit 2e3024e131be1e582b06888802bf097dd28318f5
1 parent
e8ce1045
Exists in
master
and in
5 other branches
Retirando warnings ao compilar para win64
Showing
5 changed files
with
83 additions
and
30 deletions
Show diff stats
src/include/lib3270.h
@@ -566,10 +566,18 @@ | @@ -566,10 +566,18 @@ | ||
566 | void * (*AddTimeOut)(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); | 566 | void * (*AddTimeOut)(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); |
567 | void (*RemoveTimeOut)(void *timer); | 567 | void (*RemoveTimeOut)(void *timer); |
568 | 568 | ||
569 | +#ifdef WIN32 | ||
570 | + void * (*AddInput)(HANDLE source, H3270 *session, void (*fn)(H3270 *session)); | ||
571 | +#else | ||
569 | void * (*AddInput)(int source, H3270 *session, void (*fn)(H3270 *session)); | 572 | void * (*AddInput)(int source, H3270 *session, void (*fn)(H3270 *session)); |
573 | +#endif // WIN32 | ||
570 | void (*RemoveInput)(void *id); | 574 | void (*RemoveInput)(void *id); |
571 | 575 | ||
576 | +#ifdef WIN32 | ||
577 | + void * (*AddExcept)(HANDLE source, H3270 *session, void (*fn)(H3270 *session)); | ||
578 | +#else | ||
572 | void * (*AddExcept)(int source, H3270 *session, void (*fn)(H3270 *session)); | 579 | void * (*AddExcept)(int source, H3270 *session, void (*fn)(H3270 *session)); |
580 | +#endif | ||
573 | 581 | ||
574 | int (*callthread)(int(*callback)(H3270 *, void *), H3270 *session, void *parm); | 582 | int (*callthread)(int(*callback)(H3270 *, void *), H3270 *session, void *parm); |
575 | 583 |
src/lib3270/host.c
@@ -570,8 +570,8 @@ static int do_connect(H3270 *hSession, const char *n) | @@ -570,8 +570,8 @@ static int do_connect(H3270 *hSession, const char *n) | ||
570 | /* Setup socket I/O. */ | 570 | /* Setup socket I/O. */ |
571 | // add_input_calls(hSession,net_input,net_exception); | 571 | // add_input_calls(hSession,net_input,net_exception); |
572 | #ifdef _WIN32 | 572 | #ifdef _WIN32 |
573 | - hSession->ns_exception_id = AddExcept((int) hSession->sockEvent, hSession, net_exception); | ||
574 | - hSession->ns_read_id = AddInput((int) hSession->sockEvent, hSession, net_input); | 573 | + hSession->ns_exception_id = AddExcept(hSession->sockEvent, hSession, net_exception); |
574 | + hSession->ns_read_id = AddInput(hSession->sockEvent, hSession, net_input); | ||
575 | #else | 575 | #else |
576 | hSession->ns_exception_id = AddExcept(hSession->sock, hSession, net_exception); | 576 | hSession->ns_exception_id = AddExcept(hSession->sock, hSession, net_exception); |
577 | hSession->ns_read_id = AddInput(hSession->sock, hSession, net_input); | 577 | hSession->ns_read_id = AddInput(hSession->sock, hSession, net_input); |
src/lib3270/iocalls.c
@@ -50,8 +50,13 @@ | @@ -50,8 +50,13 @@ | ||
50 | static void internal_remove_timeout(void *timer); | 50 | static void internal_remove_timeout(void *timer); |
51 | static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); | 51 | static void * internal_add_timeout(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); |
52 | 52 | ||
53 | -static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *session)); | ||
54 | -static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session)); | 53 | +#ifdef WIN32 |
54 | + static void * internal_add_input(HANDLE source, H3270 *session, void (*fn)(H3270 *session)); | ||
55 | + static void * internal_add_except(HANDLE source, H3270 *session, void (*fn)(H3270 *session)); | ||
56 | +#else | ||
57 | + static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *session)); | ||
58 | + static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session)); | ||
59 | +#endif // WIN32 | ||
55 | 60 | ||
56 | static void internal_remove_input(void *id); | 61 | static void internal_remove_input(void *id); |
57 | 62 | ||
@@ -71,14 +76,22 @@ static void internal_ring_bell(H3270 *); | @@ -71,14 +76,22 @@ static void internal_ring_bell(H3270 *); | ||
71 | static void (*remove_timeout)(void *timer) | 76 | static void (*remove_timeout)(void *timer) |
72 | = internal_remove_timeout; | 77 | = internal_remove_timeout; |
73 | 78 | ||
74 | - static void * (*add_input)(int source, H3270 *session, void (*fn)(H3270 *session)) | ||
75 | - = internal_add_input; | ||
76 | - | ||
77 | static void (*remove_input)(void *id) | 79 | static void (*remove_input)(void *id) |
78 | = internal_remove_input; | 80 | = internal_remove_input; |
79 | 81 | ||
82 | +#ifdef WIN32 | ||
83 | + static void * (*add_input)(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) | ||
84 | + = internal_add_input; | ||
85 | + | ||
86 | + static void * (*add_except)(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) | ||
87 | + = internal_add_except; | ||
88 | +#else | ||
89 | + static void * (*add_input)(int source, H3270 *session, void (*fn)(H3270 *session)) | ||
90 | + = internal_add_input; | ||
91 | + | ||
80 | static void * (*add_except)(int source, H3270 *session, void (*fn)(H3270 *session)) | 92 | static void * (*add_except)(int source, H3270 *session, void (*fn)(H3270 *session)) |
81 | = internal_add_except; | 93 | = internal_add_except; |
94 | +#endif // WIN32 | ||
82 | 95 | ||
83 | static int (*callthread)(int(*callback)(H3270 *, void *), H3270 *session, void *parm) | 96 | static int (*callthread)(int(*callback)(H3270 *, void *), H3270 *session, void *parm) |
84 | = internal_callthread; | 97 | = internal_callthread; |
@@ -113,7 +126,11 @@ static void internal_ring_bell(H3270 *); | @@ -113,7 +126,11 @@ static void internal_ring_bell(H3270 *); | ||
113 | typedef struct input | 126 | typedef struct input |
114 | { | 127 | { |
115 | struct input *next; | 128 | struct input *next; |
129 | +#if defined(_WIN32) | ||
130 | + HANDLE source; | ||
131 | +#else | ||
116 | int source; | 132 | int source; |
133 | +#endif // WIN32 | ||
117 | int condition; | 134 | int condition; |
118 | void (*proc)(H3270 *session); | 135 | void (*proc)(H3270 *session); |
119 | H3270 *session; | 136 | H3270 *session; |
@@ -239,7 +256,11 @@ static void internal_remove_timeout(void * timer) | @@ -239,7 +256,11 @@ static void internal_remove_timeout(void * timer) | ||
239 | 256 | ||
240 | /* Input events. */ | 257 | /* Input events. */ |
241 | 258 | ||
259 | +#ifdef WIN32 | ||
260 | +static void * internal_add_input(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) | ||
261 | +#else | ||
242 | static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *session)) | 262 | static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *session)) |
263 | +#endif // WIN32 | ||
243 | { | 264 | { |
244 | input_t *ip = (input_t *) lib3270_malloc(sizeof(input_t)); | 265 | input_t *ip = (input_t *) lib3270_malloc(sizeof(input_t)); |
245 | 266 | ||
@@ -253,16 +274,19 @@ static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *s | @@ -253,16 +274,19 @@ static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *s | ||
253 | inputs = ip; | 274 | inputs = ip; |
254 | inputs_changed = True; | 275 | inputs_changed = True; |
255 | 276 | ||
256 | - trace("%s: fd=%d callback=%p handle=%p",__FUNCTION__,source,fn,ip); | 277 | +// trace("%s: fd=%d callback=%p handle=%p",__FUNCTION__,source,fn,ip); |
257 | 278 | ||
258 | return ip; | 279 | return ip; |
259 | } | 280 | } |
260 | 281 | ||
261 | -static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session)) | ||
262 | -{ | ||
263 | #if defined(_WIN32) | 282 | #if defined(_WIN32) |
283 | +static void * internal_add_except(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) | ||
284 | +{ | ||
264 | return 0; | 285 | return 0; |
286 | +} | ||
265 | #else | 287 | #else |
288 | +static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session)) | ||
289 | +{ | ||
266 | input_t *ip = (input_t *) lib3270_malloc(sizeof(input_t)); | 290 | input_t *ip = (input_t *) lib3270_malloc(sizeof(input_t)); |
267 | 291 | ||
268 | trace("%s session=%p proc=%p",__FUNCTION__,session,fn); | 292 | trace("%s session=%p proc=%p",__FUNCTION__,session,fn); |
@@ -278,8 +302,8 @@ static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 * | @@ -278,8 +302,8 @@ static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 * | ||
278 | trace("%s: fd=%d callback=%p handle=%p",__FUNCTION__,source,fn,ip); | 302 | trace("%s: fd=%d callback=%p handle=%p",__FUNCTION__,source,fn,ip); |
279 | 303 | ||
280 | return ip; | 304 | return ip; |
281 | -#endif | ||
282 | } | 305 | } |
306 | +#endif // WIN32 | ||
283 | 307 | ||
284 | static void internal_remove_input(void *id) | 308 | static void internal_remove_input(void *id) |
285 | { | 309 | { |
@@ -348,7 +372,7 @@ static int internal_event_dispatcher(int block) | @@ -348,7 +372,7 @@ static int internal_event_dispatcher(int block) | ||
348 | if ((unsigned long)ip->condition & InputReadMask) | 372 | if ((unsigned long)ip->condition & InputReadMask) |
349 | { | 373 | { |
350 | #if defined(_WIN32) | 374 | #if defined(_WIN32) |
351 | - ha[nha++] = (HANDLE) ip->source; | 375 | + ha[nha++] = ip->source; |
352 | #else | 376 | #else |
353 | FD_SET(ip->source, &rfds); | 377 | FD_SET(ip->source, &rfds); |
354 | #endif | 378 | #endif |
@@ -546,13 +570,13 @@ void RemoveTimeOut(void * timer) | @@ -546,13 +570,13 @@ void RemoveTimeOut(void * timer) | ||
546 | return remove_timeout(timer); | 570 | return remove_timeout(timer); |
547 | } | 571 | } |
548 | 572 | ||
549 | -void * AddInput(int source, H3270 *session, void (*fn)(H3270 *session)) | 573 | +void * AddInput(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) |
550 | { | 574 | { |
551 | CHECK_SESSION_HANDLE(session); | 575 | CHECK_SESSION_HANDLE(session); |
552 | return add_input(source,session,fn); | 576 | return add_input(source,session,fn); |
553 | } | 577 | } |
554 | 578 | ||
555 | -void * AddExcept(int source, H3270 *session, void (*fn)(H3270 *session)) | 579 | +void * AddExcept(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) |
556 | { | 580 | { |
557 | CHECK_SESSION_HANDLE(session); | 581 | CHECK_SESSION_HANDLE(session); |
558 | return add_except(source,session,fn); | 582 | return add_except(source,session,fn); |
@@ -572,11 +596,11 @@ void x_except_on(H3270 *h) | @@ -572,11 +596,11 @@ void x_except_on(H3270 *h) | ||
572 | RemoveInput(h->ns_read_id); | 596 | RemoveInput(h->ns_read_id); |
573 | 597 | ||
574 | #ifdef WIN32 | 598 | #ifdef WIN32 |
575 | - h->ns_exception_id = AddExcept((int) h->sockEvent, h, net_exception); | 599 | + h->ns_exception_id = AddExcept(h->sockEvent, h, net_exception); |
576 | h->excepting = 1; | 600 | h->excepting = 1; |
577 | 601 | ||
578 | if(h->reading) | 602 | if(h->reading) |
579 | - h->ns_read_id = AddInput( (int) h->sockEvent, h, net_input); | 603 | + h->ns_read_id = AddInput(h->sockEvent, h, net_input); |
580 | #else | 604 | #else |
581 | h->ns_exception_id = AddExcept(h->sock, h, net_exception); | 605 | h->ns_exception_id = AddExcept(h->sock, h, net_exception); |
582 | h->excepting = 1; | 606 | h->excepting = 1; |
src/lib3270/utilc.h
@@ -36,10 +36,14 @@ LIB3270_INTERNAL char *xs_buffer(const char *fmt, ...) printflike(1, 2); | @@ -36,10 +36,14 @@ LIB3270_INTERNAL char *xs_buffer(const char *fmt, ...) printflike(1, 2); | ||
36 | LIB3270_INTERNAL void xs_error(const char *fmt, ...) printflike(1, 2); | 36 | LIB3270_INTERNAL void xs_error(const char *fmt, ...) printflike(1, 2); |
37 | LIB3270_INTERNAL void xs_warning(const char *fmt, ...) printflike(1, 2); | 37 | LIB3270_INTERNAL void xs_warning(const char *fmt, ...) printflike(1, 2); |
38 | 38 | ||
39 | -LIB3270_INTERNAL void * AddInput(int, H3270 *session, void (*fn)(H3270 *session)); | ||
40 | -LIB3270_INTERNAL void * AddExcept(int, H3270 *session, void (*fn)(H3270 *session)); | ||
41 | -// LIB3270_INTERNAL void * AddOutput(int, H3270 *session, void (*fn)(H3270 *session)); | ||
42 | -LIB3270_INTERNAL void RemoveInput(void *); | 39 | +#ifdef WIN32 |
40 | + LIB3270_INTERNAL void * AddInput(HANDLE, H3270 *session, void (*fn)(H3270 *session)); | ||
41 | + LIB3270_INTERNAL void * AddExcept(HANDLE, H3270 *session, void (*fn)(H3270 *session)); | ||
42 | +#else | ||
43 | + LIB3270_INTERNAL void * AddInput(int, H3270 *session, void (*fn)(H3270 *session)); | ||
44 | + LIB3270_INTERNAL void * AddExcept(int, H3270 *session, void (*fn)(H3270 *session)); | ||
45 | +#endif // WIN32 | ||
46 | +LIB3270_INTERNAL void RemoveInput(void *); | ||
43 | LIB3270_INTERNAL void * AddTimeOut(unsigned long msec, H3270 *session, void (*fn)(H3270 *session)); | 47 | LIB3270_INTERNAL void * AddTimeOut(unsigned long msec, H3270 *session, void (*fn)(H3270 *session)); |
44 | LIB3270_INTERNAL void RemoveTimeOut(void *cookie); | 48 | LIB3270_INTERNAL void RemoveTimeOut(void *cookie); |
45 | 49 |
src/pw3270/v3270/iocallback.c
@@ -44,14 +44,16 @@ | @@ -44,14 +44,16 @@ | ||
44 | #include "../globals.h" | 44 | #include "../globals.h" |
45 | 45 | ||
46 | static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm); | 46 | static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm); |
47 | -static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)); | ||
48 | static void static_RemoveSource(void *id); | 47 | static void static_RemoveSource(void *id); |
49 | 48 | ||
50 | -//#if !defined(_WIN32) | ||
51 | -// static void * static_AddOutput(int source, H3270 *session, void (*fn)(H3270 *session)); | ||
52 | -//#endif | ||
53 | - | 49 | +#ifdef WIN32 |
50 | +static void * static_AddInput(HANDLE source, H3270 *session, void (*fn)(H3270 *session)); | ||
51 | +static void * static_AddExcept(HANDLE source, H3270 *session, void (*fn)(H3270 *session)); | ||
52 | +#else | ||
53 | +static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)); | ||
54 | static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session)); | 54 | static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session)); |
55 | +#endif // WIN32 | ||
56 | + | ||
55 | static void * static_AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); | 57 | static void * static_AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session)); |
56 | static void static_RemoveTimeOut(void * timer); | 58 | static void static_RemoveTimeOut(void * timer); |
57 | static int static_Sleep(int seconds); | 59 | static int static_Sleep(int seconds); |
@@ -69,7 +71,11 @@ static gboolean IO_closure(gpointer data); | @@ -69,7 +71,11 @@ static gboolean IO_closure(gpointer data); | ||
69 | { | 71 | { |
70 | GSource gsrc; | 72 | GSource gsrc; |
71 | GPollFD poll; | 73 | GPollFD poll; |
74 | +#if defined(_WIN32) | ||
75 | + HANDLE source; | ||
76 | +#else | ||
72 | int source; | 77 | int source; |
78 | +#endif // WIN32 | ||
73 | void (*fn)(H3270 *session); | 79 | void (*fn)(H3270 *session); |
74 | H3270 *session; | 80 | H3270 *session; |
75 | } IO_Source; | 81 | } IO_Source; |
@@ -93,13 +99,17 @@ static gboolean IO_closure(gpointer data); | @@ -93,13 +99,17 @@ static gboolean IO_closure(gpointer data); | ||
93 | 99 | ||
94 | /*---[ Implement ]-----------------------------------------------------------------------------------------*/ | 100 | /*---[ Implement ]-----------------------------------------------------------------------------------------*/ |
95 | 101 | ||
102 | +#ifdef WIN32 | ||
103 | +static void * AddSource(HANDLE source, H3270 *session, gushort events, void (*fn)(H3270 *session)) | ||
104 | +#else | ||
96 | static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H3270 *session)) | 105 | static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H3270 *session)) |
106 | +#endif // WIN32 | ||
97 | { | 107 | { |
98 | IO_Source *src = (IO_Source *) g_source_new(&IOSources,sizeof(IO_Source)); | 108 | IO_Source *src = (IO_Source *) g_source_new(&IOSources,sizeof(IO_Source)); |
99 | 109 | ||
100 | src->source = source; | 110 | src->source = source; |
101 | src->fn = fn; | 111 | src->fn = fn; |
102 | - src->poll.fd = source; | 112 | + src->poll.fd = (int) source; |
103 | src->poll.events = events; | 113 | src->poll.events = events; |
104 | 114 | ||
105 | g_source_attach((GSource *) src,NULL); | 115 | g_source_attach((GSource *) src,NULL); |
@@ -108,7 +118,11 @@ static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H | @@ -108,7 +118,11 @@ static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H | ||
108 | return src; | 118 | return src; |
109 | } | 119 | } |
110 | 120 | ||
121 | +#ifdef WIN32 | ||
122 | +static void * static_AddInput(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) | ||
123 | +#else | ||
111 | static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)) | 124 | static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)) |
125 | +#endif // WIN32 | ||
112 | { | 126 | { |
113 | return AddSource(source,session,G_IO_IN|G_IO_HUP|G_IO_ERR,fn); | 127 | return AddSource(source,session,G_IO_IN|G_IO_HUP|G_IO_ERR,fn); |
114 | } | 128 | } |
@@ -119,14 +133,17 @@ static void static_RemoveSource(void *id) | @@ -119,14 +133,17 @@ static void static_RemoveSource(void *id) | ||
119 | g_source_destroy((GSource *) id); | 133 | g_source_destroy((GSource *) id); |
120 | } | 134 | } |
121 | 135 | ||
122 | -static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session)) | 136 | +#if defined(WIN32) |
137 | +static void * static_AddExcept(HANDLE source, H3270 *session, void (*fn)(H3270 *session)) | ||
123 | { | 138 | { |
124 | -#if defined(_WIN32) /*[*/ | ||
125 | return 0; | 139 | return 0; |
140 | +} | ||
126 | #else | 141 | #else |
142 | +static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session)) | ||
143 | +{ | ||
127 | return AddSource(source,session,G_IO_HUP|G_IO_ERR,fn); | 144 | return AddSource(source,session,G_IO_HUP|G_IO_ERR,fn); |
128 | -#endif | ||
129 | } | 145 | } |
146 | +#endif // WIN32 | ||
130 | 147 | ||
131 | static gboolean do_timer(TIMER *t) | 148 | static gboolean do_timer(TIMER *t) |
132 | { | 149 | { |
@@ -182,7 +199,7 @@ static gboolean IO_check(GSource *source) | @@ -182,7 +199,7 @@ static gboolean IO_check(GSource *source) | ||
182 | */ | 199 | */ |
183 | #if defined(_WIN32) /*[*/ | 200 | #if defined(_WIN32) /*[*/ |
184 | 201 | ||
185 | - if(WaitForSingleObject((HANDLE) ((IO_Source *) source)->source,0) == WAIT_OBJECT_0) | 202 | + if(WaitForSingleObject(((IO_Source *) source)->source,0) == WAIT_OBJECT_0) |
186 | return TRUE; | 203 | return TRUE; |
187 | 204 | ||
188 | #else /*][*/ | 205 | #else /*][*/ |