(int)(void*)(int) 64 vs 32

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Neels Hofmeyr nhofmeyr at sysmocom.de
Wed Feb 24 19:07:21 UTC 2016


On my 64bit system, I get warnings about casting int to pointer of
different size and vice versa. However, below patch only shifts the
warnings to 32bit systems, right?

Should we encapsulate in some #ifdef __i386__ or is there an always-native
int type?

Thanks
~Neels


From f25f8cebb58ad1f5241a33d9bac76654cd2a68a2 Mon Sep 17 00:00:00 2001
From: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Date: Wed, 24 Feb 2016 19:31:33 +0100
Subject: [PATCH] remove warning on 64bit, add warning on i386?

---
 openbsc/src/osmo-bsc/osmo_bsc_vty.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/openbsc/src/osmo-bsc/osmo_bsc_vty.c b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
index d871f01..1e4e6ee 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_vty.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_vty.c
@@ -43,7 +43,7 @@ static struct osmo_bsc_data *osmo_bsc_data(struct vty *vty)
 
 static struct osmo_msc_data *osmo_msc_data(struct vty *vty)
 {
-	return osmo_msc_data_find(bsc_gsmnet, (int) vty->index);
+	return osmo_msc_data_find(bsc_gsmnet, (int)(long int) vty->index);
 }
 
 static struct cmd_node bsc_node = {
@@ -70,7 +70,7 @@ DEFUN(cfg_net_msc, cfg_net_msc_cmd,
 		return CMD_WARNING;
 	}
 
-	vty->index = (void *) index;
+	vty->index = (void *)(long int) index;
 	vty->node = MSC_NODE;
 	return CMD_SUCCESS;
 }
-- 
2.1.4


-- 
- Neels Hofmeyr <nhofmeyr at sysmocom.de>          http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Alt-Moabit 93
* 10559 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschäftsführer / Managing Directors: Holger Freyther, Harald Welte
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.osmocom.org/pipermail/openbsc/attachments/20160224/bc46326c/attachment.bin>


More information about the OpenBSC mailing list