Commit 4d1647fab913e7c65c2377b54eb3473af6fa3b87

Authored by perry.werneck@gmail.com
1 parent 38131a60

Removendo warnings "cast to integer of diferent size" quando compilando em win64

src/include/lib3270.h
... ... @@ -554,16 +554,16 @@
554 554 {
555 555 unsigned short sz;
556 556  
557   - unsigned long (*AddTimeOut)(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session));
558   - void (*RemoveTimeOut)(unsigned long timer);
  557 + void * (*AddTimeOut)(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session));
  558 + void (*RemoveTimeOut)(void *timer);
559 559  
560   - unsigned long (*AddInput)(int source, H3270 *session, void (*fn)(H3270 *session));
561   - void (*RemoveInput)(unsigned long id);
  560 + void * (*AddInput)(int source, H3270 *session, void (*fn)(H3270 *session));
  561 + void (*RemoveInput)(void *id);
562 562  
563   - unsigned long (*AddExcept)(int source, H3270 *session, void (*fn)(H3270 *session));
  563 + void * (*AddExcept)(int source, H3270 *session, void (*fn)(H3270 *session));
564 564  
565 565 #if !defined(_WIN32) /*[*/
566   - unsigned long (*AddOutput)(int source, H3270 *session, void (*fn)(H3270 *session));
  566 + void * (*AddOutput)(int source, H3270 *session, void (*fn)(H3270 *session));
567 567 #endif /*]*/
568 568  
569 569 int (*callthread)(int(*callback)(H3270 *, void *), H3270 *session, void *parm);
... ...
src/include/lib3270/session.h
... ... @@ -172,8 +172,8 @@
172 172 } select;
173 173  
174 174 // xio
175   - unsigned long ns_read_id;
176   - unsigned long ns_exception_id;
  175 + void * ns_read_id;
  176 + void * ns_exception_id;
177 177 char reading;
178 178 char excepting;
179 179  
... ...
src/lib3270/XtGlue.c
... ... @@ -91,17 +91,17 @@
91 91  
92 92 /*---[ Callbacks ]------------------------------------------------------------------------------------------*/
93 93  
94   -static void DefaultRemoveTimeOut(unsigned long timer);
95   -static unsigned long DefaultAddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session));
  94 +static void DefaultRemoveTimeOut(void *timer);
  95 +static void * DefaultAddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session));
96 96  
97   -static unsigned long DefaultAddInput(int source, H3270 *session, void (*fn)(H3270 *session));
98   -static unsigned long DefaultAddExcept(int source, H3270 *session, void (*fn)(H3270 *session));
  97 +static void * DefaultAddInput(int source, H3270 *session, void (*fn)(H3270 *session));
  98 +static void * DefaultAddExcept(int source, H3270 *session, void (*fn)(H3270 *session));
99 99  
100 100 #if !defined(_WIN32) /*[*/
101   -static unsigned long DefaultAddOutput(int source, H3270 *session, void (*fn)(H3270 *session));
  101 +static void * DefaultAddOutput(int source, H3270 *session, void (*fn)(H3270 *session));
102 102 #endif
103 103  
104   -static void DefaultRemoveInput(unsigned long id);
  104 +static void DefaultRemoveInput(void *id);
105 105  
106 106 static int DefaultProcessEvents(int block);
107 107  
... ... @@ -171,7 +171,7 @@ typedef struct timeout
171 171 #define TN (timeout_t *)NULL
172 172 static timeout_t *timeouts = TN;
173 173  
174   -static unsigned long DefaultAddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session))
  174 +static void * DefaultAddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session))
175 175 {
176 176 timeout_t *t_new;
177 177 timeout_t *t;
... ... @@ -225,10 +225,10 @@ static unsigned long DefaultAddTimeOut(unsigned long interval_ms, H3270 *session
225 225  
226 226 trace("Timeout added: %p",t_new);
227 227  
228   - return (unsigned long) t_new;
  228 + return t_new;
229 229 }
230 230  
231   -static void DefaultRemoveTimeOut(unsigned long timer)
  231 +static void DefaultRemoveTimeOut(void * timer)
232 232 {
233 233 timeout_t *st = (timeout_t *)timer;
234 234 timeout_t *t;
... ... @@ -262,7 +262,7 @@ typedef struct input {
262 262 static input_t *inputs = (input_t *)NULL;
263 263 static Boolean inputs_changed = False;
264 264  
265   -static unsigned long DefaultAddInput(int source, H3270 *session, void (*fn)(H3270 *session))
  265 +static void * DefaultAddInput(int source, H3270 *session, void (*fn)(H3270 *session))
266 266 {
267 267 input_t *ip;
268 268  
... ... @@ -281,10 +281,10 @@ static unsigned long DefaultAddInput(int source, H3270 *session, void (*fn)(H327
281 281  
282 282 Trace("%s: fd=%d callback=%p handle=%p",__FUNCTION__,source,fn,ip);
283 283  
284   - return (unsigned long) ip;
  284 + return ip;
285 285 }
286 286  
287   -static unsigned long DefaultAddExcept(int source, H3270 *session, void (*fn)(H3270 *session))
  287 +static void * DefaultAddExcept(int source, H3270 *session, void (*fn)(H3270 *session))
288 288 {
289 289 #if defined(_WIN32) /*[*/
290 290 return 0;
... ... @@ -306,12 +306,12 @@ static unsigned long DefaultAddExcept(int source, H3270 *session, void (*fn)(H32
306 306  
307 307 Trace("%s: fd=%d callback=%p handle=%p",__FUNCTION__,source,fn,ip);
308 308  
309   - return (unsigned long)ip;
  309 + return ip;
310 310 #endif /*]*/
311 311 }
312 312  
313 313 #if !defined(_WIN32) /*[*/
314   -static unsigned long DefaultAddOutput(int source, H3270 *session, void (*fn)(H3270 *session))
  314 +static void * DefaultAddOutput(int source, H3270 *session, void (*fn)(H3270 *session))
315 315 {
316 316 input_t *ip;
317 317  
... ... @@ -330,11 +330,11 @@ static unsigned long DefaultAddOutput(int source, H3270 *session, void (*fn)(H32
330 330  
331 331 Trace("%s: fd=%d callback=%p handle=%p",__FUNCTION__,source,fn,ip);
332 332  
333   - return (unsigned long)ip;
  333 + return ip;
334 334 }
335 335 #endif /*]*/
336 336  
337   -static void DefaultRemoveInput(unsigned long id)
  337 +static void DefaultRemoveInput(void *id)
338 338 {
339 339 input_t *ip;
340 340 input_t *prev = (input_t *)NULL;
... ... @@ -404,7 +404,7 @@ static int DefaultProcessEvents(int block)
404 404 if ((unsigned long)ip->condition & InputReadMask)
405 405 {
406 406 #if defined(_WIN32)
407   - ha[nha++] = (HANDLE)ip->source;
  407 + ha[nha++] = (HANDLE) ip->source;
408 408 #else
409 409 FD_SET(ip->source, &rfds);
410 410 #endif
... ... @@ -801,7 +801,7 @@ const char * KeysymToString(KeySym k)
801 801  
802 802 /* Timeouts. */
803 803  
804   -unsigned long AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session))
  804 +void * AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session))
805 805 {
806 806 CHECK_SESSION_HANDLE(session);
807 807 if(callbacks->AddTimeOut)
... ... @@ -809,13 +809,13 @@ unsigned long AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)
809 809 return 0;
810 810 }
811 811  
812   -void RemoveTimeOut(unsigned long timer)
  812 +void RemoveTimeOut(void * timer)
813 813 {
814 814 if(callbacks->RemoveTimeOut)
815 815 return callbacks->RemoveTimeOut(timer);
816 816 }
817 817  
818   -unsigned long AddInput(int source, H3270 *session, void (*fn)(H3270 *session))
  818 +void * AddInput(int source, H3270 *session, void (*fn)(H3270 *session))
819 819 {
820 820 CHECK_SESSION_HANDLE(session);
821 821  
... ... @@ -826,7 +826,7 @@ unsigned long AddInput(int source, H3270 *session, void (*fn)(H3270 *session))
826 826 return 0;
827 827 }
828 828  
829   -unsigned long AddExcept(int source, H3270 *session, void (*fn)(H3270 *session))
  829 +void * AddExcept(int source, H3270 *session, void (*fn)(H3270 *session))
830 830 {
831 831 CHECK_SESSION_HANDLE(session);
832 832 if(callbacks->AddExcept)
... ... @@ -835,7 +835,7 @@ unsigned long AddExcept(int source, H3270 *session, void (*fn)(H3270 *session))
835 835 }
836 836  
837 837 #if !defined(_WIN32) /*[*/
838   -unsigned long AddOutput(int source, H3270 *session, void (*fn)(H3270 *session))
  838 +void * AddOutput(int source, H3270 *session, void (*fn)(H3270 *session))
839 839 {
840 840 CHECK_SESSION_HANDLE(session);
841 841 if(callbacks->AddOutput)
... ... @@ -844,7 +844,7 @@ unsigned long AddOutput(int source, H3270 *session, void (*fn)(H3270 *session))
844 844 }
845 845 #endif /*]*/
846 846  
847   -void RemoveInput(unsigned long id)
  847 +void RemoveInput(void * id)
848 848 {
849 849 if(callbacks->RemoveInput)
850 850 callbacks->RemoveInput(id);
... ...
src/lib3270/ctlr.c
... ... @@ -2706,7 +2706,7 @@ ctlr_dbcs_state(int baddr)
2706 2706 static struct timeval t_start;
2707 2707 static Boolean ticking = False;
2708 2708 static Boolean mticking = False;
2709   -static unsigned long tick_id;
  2709 +static void * tick_id;
2710 2710 static struct timeval t_want;
2711 2711  
2712 2712 /* Return the difference in milliseconds between two timevals. */
... ...
src/lib3270/kybd.c
... ... @@ -104,7 +104,7 @@ static unsigned char pa_xlate[] = {
104 104 };
105 105 #define PF_SZ (sizeof(pf_xlate)/sizeof(pf_xlate[0]))
106 106 #define PA_SZ (sizeof(pa_xlate)/sizeof(pa_xlate[0]))
107   -static unsigned long unlock_id;
  107 +static void * unlock_id;
108 108 static time_t unlock_delay_time;
109 109 #define UNLOCK_MS 350 /* 0.35s after last unlock */
110 110 static Boolean key_Character(int code, Boolean with_ge, Boolean pasting,Boolean *skipped);
... ...
src/lib3270/utilc.h
... ... @@ -38,12 +38,12 @@ LIB3270_INTERNAL void xs_warning(const char *fmt, ...) printflike(1, 2);
38 38 LIB3270_INTERNAL char * xs_vsprintf(const char *fmt, va_list args);
39 39  
40 40  
41   -LIB3270_INTERNAL unsigned long AddInput(int, H3270 *session, void (*fn)(H3270 *session));
42   -LIB3270_INTERNAL unsigned long AddExcept(int, H3270 *session, void (*fn)(H3270 *session));
43   -LIB3270_INTERNAL unsigned long AddOutput(int, H3270 *session, void (*fn)(H3270 *session));
44   -LIB3270_INTERNAL void RemoveInput(unsigned long);
45   -LIB3270_INTERNAL unsigned long AddTimeOut(unsigned long msec, H3270 *session, void (*fn)(H3270 *session));
46   -LIB3270_INTERNAL void RemoveTimeOut(unsigned long cookie);
  41 +LIB3270_INTERNAL void * AddInput(int, H3270 *session, void (*fn)(H3270 *session));
  42 +LIB3270_INTERNAL void * AddExcept(int, H3270 *session, void (*fn)(H3270 *session));
  43 +LIB3270_INTERNAL void * AddOutput(int, H3270 *session, void (*fn)(H3270 *session));
  44 +LIB3270_INTERNAL void RemoveInput(void *);
  45 +LIB3270_INTERNAL void * AddTimeOut(unsigned long msec, H3270 *session, void (*fn)(H3270 *session));
  46 +LIB3270_INTERNAL void RemoveTimeOut(void *cookie);
47 47  
48 48 LIB3270_INTERNAL const char * KeysymToString(KeySym k);
49 49 LIB3270_INTERNAL KeySym StringToKeysym(char *s);
... ...
src/pw3270/v3270/iocallback.c
... ... @@ -47,19 +47,19 @@
47 47 #include <malloc.h>
48 48 #endif
49 49  
50   -static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm);
51   -static unsigned long static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session));
52   -static void static_RemoveSource(unsigned long id);
  50 +static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm);
  51 +static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session));
  52 +static void static_RemoveSource(void *id);
53 53  
54 54 #if !defined(_WIN32) /*[*/
55   -static unsigned long static_AddOutput(int source, H3270 *session, void (*fn)(H3270 *session));
  55 +static void * static_AddOutput(int source, H3270 *session, void (*fn)(H3270 *session));
56 56 #endif
57 57  
58   -static unsigned long static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session));
59   -static unsigned long static_AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session));
60   -static void static_RemoveTimeOut(unsigned long timer);
61   -static int static_Sleep(int seconds);
62   -static int static_RunPendingEvents(int wait);
  58 +static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session));
  59 +static void * static_AddTimeOut(unsigned long interval_ms, H3270 *session, void (*proc)(H3270 *session));
  60 +static void static_RemoveTimeOut(void * timer);
  61 +static int static_Sleep(int seconds);
  62 +static int static_RunPendingEvents(int wait);
63 63  
64 64 static gboolean IO_prepare(GSource *source, gint *timeout);
65 65 static gboolean IO_check(GSource *source);
... ... @@ -97,7 +97,7 @@ static gboolean IO_closure(gpointer data);
97 97  
98 98 /*---[ Implement ]-----------------------------------------------------------------------------------------*/
99 99  
100   -static unsigned long AddSource(int source, H3270 *session, gushort events, void (*fn)(H3270 *session))
  100 +static void * AddSource(int source, H3270 *session, gushort events, void (*fn)(H3270 *session))
101 101 {
102 102 IO_Source *src = (IO_Source *) g_source_new(&IOSources,sizeof(IO_Source));
103 103  
... ... @@ -109,28 +109,28 @@ static unsigned long AddSource(int source, H3270 *session, gushort events, void
109 109 g_source_attach((GSource *) src,NULL);
110 110 g_source_add_poll((GSource *) src,&src->poll);
111 111  
112   - return (unsigned long) src;
  112 + return src;
113 113 }
114 114  
115   -static unsigned long static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session))
  115 +static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session))
116 116 {
117 117 return AddSource(source,session,G_IO_IN|G_IO_HUP|G_IO_ERR,fn);
118 118 }
119 119  
120   -static void static_RemoveSource(unsigned long id)
  120 +static void static_RemoveSource(void *id)
121 121 {
122 122 if(id)
123 123 g_source_destroy((GSource *) id);
124 124 }
125 125  
126 126 #if !defined(_WIN32) /*[*/
127   -static unsigned long static_AddOutput(int source, H3270 *session, void (*fn)(H3270 *session))
  127 +static void * static_AddOutput(int source, H3270 *session, void (*fn)(H3270 *session))
128 128 {
129 129 return AddSource(source,session,G_IO_OUT|G_IO_HUP|G_IO_ERR,fn);
130 130 }
131 131 #endif /*]*/
132 132  
133   -static unsigned long static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session))
  133 +static void * static_AddExcept(int source, H3270 *session, void (*fn)(H3270 *session))
134 134 {
135 135 #if defined(_WIN32) /*[*/
136 136 return 0;
... ... @@ -146,22 +146,20 @@ static gboolean do_timer(TIMER *t)
146 146 return FALSE;
147 147 }
148 148  
149   -static unsigned long static_AddTimeOut(unsigned long interval, H3270 *session, void (*proc)(H3270 *session))
  149 +static void * static_AddTimeOut(unsigned long interval, H3270 *session, void (*proc)(H3270 *session))
150 150 {
151   - TIMER *t = g_malloc(sizeof(TIMER));
  151 + TIMER *t = g_malloc0(sizeof(TIMER));
152 152  
153   - t->remove = 0;
154 153 t->fn = proc;
155 154 t->session = session;
156 155  
157 156 g_timeout_add_full(G_PRIORITY_DEFAULT, (guint) interval, (GSourceFunc) do_timer, t, g_free);
158 157  
159   - return (unsigned long) t;
  158 + return t;
160 159 }
161 160  
162   -static void static_RemoveTimeOut(unsigned long timer)
  161 +static void static_RemoveTimeOut(void * timer)
163 162 {
164   - // FIXME (perry#2#): It this really necessary? The timeout is removed as soon as it ticks.
165 163 ((TIMER *) timer)->remove++;
166 164 }
167 165  
... ...