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
@@ -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);
@@ -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;
@@ -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