Commit b83e57474ccb701574f1cfaf2cbadf748da0060e
1 parent
0216d04d
Exists in
master
and in
1 other branch
Removendo warnings "cast to integer of diferent size" quando compilando em win64
Showing
1 changed file
with
19 additions
and
21 deletions
Show diff stats
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 | ... | ... |