Commit 4754a52822c2d6886e442dd2091dafced98c5d9d

Authored by perry.werneck@gmail.com
1 parent e297096d

Retirando warnings ao compilar para win64

Showing 3 changed files with 48 additions and 20 deletions   Show diff stats
host.c
... ... @@ -570,8 +570,8 @@ static int do_connect(H3270 *hSession, const char *n)
570 570 /* Setup socket I/O. */
571 571 // add_input_calls(hSession,net_input,net_exception);
572 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 575 #else
576 576 hSession->ns_exception_id = AddExcept(hSession->sock, hSession, net_exception);
577 577 hSession->ns_read_id = AddInput(hSession->sock, hSession, net_input);
... ...
iocalls.c
... ... @@ -50,8 +50,13 @@
50 50 static void internal_remove_timeout(void *timer);
51 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 61 static void internal_remove_input(void *id);
57 62  
... ... @@ -71,14 +76,22 @@ static void internal_ring_bell(H3270 *);
71 76 static void (*remove_timeout)(void *timer)
72 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 79 static void (*remove_input)(void *id)
78 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 92 static void * (*add_except)(int source, H3270 *session, void (*fn)(H3270 *session))
81 93 = internal_add_except;
  94 +#endif // WIN32
82 95  
83 96 static int (*callthread)(int(*callback)(H3270 *, void *), H3270 *session, void *parm)
84 97 = internal_callthread;
... ... @@ -113,7 +126,11 @@ static void internal_ring_bell(H3270 *);
113 126 typedef struct input
114 127 {
115 128 struct input *next;
  129 +#if defined(_WIN32)
  130 + HANDLE source;
  131 +#else
116 132 int source;
  133 +#endif // WIN32
117 134 int condition;
118 135 void (*proc)(H3270 *session);
119 136 H3270 *session;
... ... @@ -239,7 +256,11 @@ static void internal_remove_timeout(void * timer)
239 256  
240 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 262 static void * internal_add_input(int source, H3270 *session, void (*fn)(H3270 *session))
  263 +#endif // WIN32
243 264 {
244 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 274 inputs = ip;
254 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 279 return ip;
259 280 }
260 281  
261   -static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session))
262   -{
263 282 #if defined(_WIN32)
  283 +static void * internal_add_except(HANDLE source, H3270 *session, void (*fn)(H3270 *session))
  284 +{
264 285 return 0;
  286 +}
265 287 #else
  288 +static void * internal_add_except(int source, H3270 *session, void (*fn)(H3270 *session))
  289 +{
266 290 input_t *ip = (input_t *) lib3270_malloc(sizeof(input_t));
267 291  
268 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 302 trace("%s: fd=%d callback=%p handle=%p",__FUNCTION__,source,fn,ip);
279 303  
280 304 return ip;
281   -#endif
282 305 }
  306 +#endif // WIN32
283 307  
284 308 static void internal_remove_input(void *id)
285 309 {
... ... @@ -348,7 +372,7 @@ static int internal_event_dispatcher(int block)
348 372 if ((unsigned long)ip->condition & InputReadMask)
349 373 {
350 374 #if defined(_WIN32)
351   - ha[nha++] = (HANDLE) ip->source;
  375 + ha[nha++] = ip->source;
352 376 #else
353 377 FD_SET(ip->source, &rfds);
354 378 #endif
... ... @@ -546,13 +570,13 @@ void RemoveTimeOut(void * timer)
546 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 575 CHECK_SESSION_HANDLE(session);
552 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 581 CHECK_SESSION_HANDLE(session);
558 582 return add_except(source,session,fn);
... ... @@ -572,11 +596,11 @@ void x_except_on(H3270 *h)
572 596 RemoveInput(h->ns_read_id);
573 597  
574 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 600 h->excepting = 1;
577 601  
578 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 604 #else
581 605 h->ns_exception_id = AddExcept(h->sock, h, net_exception);
582 606 h->excepting = 1;
... ...
utilc.h
... ... @@ -36,10 +36,14 @@ LIB3270_INTERNAL char *xs_buffer(const char *fmt, ...) printflike(1, 2);
36 36 LIB3270_INTERNAL void xs_error(const char *fmt, ...) printflike(1, 2);
37 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 47 LIB3270_INTERNAL void * AddTimeOut(unsigned long msec, H3270 *session, void (*fn)(H3270 *session));
44 48 LIB3270_INTERNAL void RemoveTimeOut(void *cookie);
45 49  
... ...