Re: [PATCH] fixes a compiler warning in smsboxc_run(void *arg)
Alexander Malysh <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
or IMO better attached patch?
Thanks,
Alex
Vincent CHAVANIS schrieb:
> This patch fixes a compiler warning in function static void smsboxc_run(void *arg) when using 64bit system
>
> Explanation;
> void *arg return a 64bit so we cannot cast it to an int which is natively 32bits (defined by "int port;")
> so we have to cast it first with a long then "downgrade" to a 32bit int.
>
> regards
>
> Vincent
>
>
> -----
>
> diff -ru /gateway/gw/bb_boxc.c /gateway2/gw/bb_boxc.c
> --- /gateway/gw/bb_boxc.c 2005-02-11 16:35:48.000000000 +0100
> +++ /gateway2/gw/bb_boxc.c 2006-03-22 11:46:03.000000000 +0100
> @@ -921,10 +921,10 @@
>
> gwlist_add_producer(flow_threads);
> gwthread_wakeup(MAIN_THREAD_ID);
> - port = (int)arg;
> + port = (int) (long) arg;
>
> fd = make_server_socket(port, NULL);
> /* XXX add interface_name if required */
>
> if (fd < 0) {
> panic(0, "Could not open smsbox port %d", port);
> @@ -977,10 +977,10 @@
>
> gwlist_add_producer(flow_threads);
> gwthread_wakeup(MAIN_THREAD_ID);
> - port = (int)arg;
> + port = (int) (long) arg;
>
> fd = make_server_socket(port, NULL);
> /* XXX add interface_name if required */
>
>
> --
> Telemaque - NICE - (FR)
> Service Technique - Developpement
> http://www.telemaque.fr/
> [email protected]
> Tel : +33 4 93 97 71 64 (fax 68)
>
>
> ------------------------------------------------------------------------
>
> diff -ru /gateway/gw/bb_boxc.c /gateway2/gw/bb_boxc.c
> --- /gateway/gw/bb_boxc.c 2005-02-11 16:35:48.000000000 +0100
> +++ /gateway2/gw/bb_boxc.c 2006-03-22 11:46:03.000000000 +0100
> @@ -921,10 +921,10 @@
>
> gwlist_add_producer(flow_threads);
> gwthread_wakeup(MAIN_THREAD_ID);
> - port = (int)arg;
> + port = (int) (long) arg;
>
> fd = make_server_socket(port, NULL);
> /* XXX add interface_name if required */
>
> if (fd < 0) {
> panic(0, "Could not open smsbox port %d", port);
> @@ -977,10 +977,10 @@
>
> gwlist_add_producer(flow_threads);
> gwthread_wakeup(MAIN_THREAD_ID);
> - port = (int)arg;
> + port = (int) (long) arg;
>
> fd = make_server_socket(port, NULL);
> /* XXX add interface_name if required */
bb-boxc-64bit-warning.patch
(text/plain, 1.6 KB)
Index: gw/bb_boxc.c
===================================================================
RCS file: /home/cvs/gateway/gw/bb_boxc.c,v
retrieving revision 1.84
diff -a -u -p -r1.84 bb_boxc.c
--- gw/bb_boxc.c 11 Feb 2005 15:35:48 -0000 1.84
+++ gw/bb_boxc.c 23 Mar 2006 13:07:19 -0000
@@ -921,7 +921,7 @@ static void smsboxc_run(void *arg)
gwlist_add_producer(flow_threads);
gwthread_wakeup(MAIN_THREAD_ID);
- port = (int)arg;
+ port = (int) *((long *)arg);
fd = make_server_socket(port, NULL);
/* XXX add interface_name if required */
@@ -977,7 +977,7 @@ static void wapboxc_run(void *arg)
gwlist_add_producer(flow_threads);
gwthread_wakeup(MAIN_THREAD_ID);
- port = (int)arg;
+ port = (int) *((long*)arg);
fd = make_server_socket(port, NULL);
/* XXX add interface_name if required */
@@ -1137,7 +1137,7 @@ int smsbox_start(Cfg *cfg)
if ((sms_dequeue_thread = gwthread_create(sms_to_smsboxes, NULL)) == -1)
panic(0, "Failed to start a new thread for smsbox routing");
- if (gwthread_create(smsboxc_run, (void *)smsbox_port) == -1)
+ if (gwthread_create(smsboxc_run, &smsbox_port) == -1)
panic(0, "Failed to start a new thread for smsbox connections");
return 0;
@@ -1192,7 +1192,7 @@ int wapbox_start(Cfg *cfg)
if (gwthread_create(wdp_to_wapboxes, NULL) == -1)
panic(0, "Failed to start a new thread for wapbox routing");
- if (gwthread_create(wapboxc_run, (void *)wapbox_port) == -1)
+ if (gwthread_create(wapboxc_run, &wapbox_port) == -1)
panic(0, "Failed to start a new thread for wapbox connections");
wapbox_running = 1;