[En-Nut-Discussion] [RESENT] Nutdisc: cast from DISCOVERY_TELE* to int loses precision

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Wed May 30 14:44:11 CEST 2012


>>>>> "Ole" == Ole Reinhardt <ole.reinhardt at embedded-it.de> writes:

...
    Ole> This will only suppress the warning, right?

    Ole> So I think the code must be reworked to pass a correct pointer
    Ole> instead of a 32 bit integer.

Appended rewrite at least compiled without the need to suppress the
warning. But I don't know if it is correct...

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: mainframe.cpp
===================================================================
--- mainframe.cpp	(Revision 4183)
+++ mainframe.cpp	(Arbeitskopie)
@@ -283,7 +283,7 @@
 
 void CMainFrame::OnUdpEvent(wxCommandEvent& event)
 {
-    DISCOVERY_TELE *dist = (DISCOVERY_TELE *)event.GetInt();
+    DISCOVERY_TELE *dist = (DISCOVERY_TELE *)event.GetExtraLong();
     if(!IsActive()) {
         RequestUserAttention();
     }
Index: udpthread.cpp
===================================================================
--- udpthread.cpp	(Revision 4183)
+++ udpthread.cpp	(Arbeitskopie)
@@ -152,7 +152,7 @@
             memcpy(dist, buf, got);
             if(dist->dist_type == DIST_ANNOUNCE) {
                 wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, UDP_EVENT);
-                event.SetInt((int)dist);
+                event.SetExtraLong((long)dist);
                 wxPostEvent(m_frame, event);
             }
             else {



More information about the En-Nut-Discussion mailing list