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

Thiago A. Corrêa thiago.correa at gmail.com
Fri Jun 1 16:52:47 CEST 2012


Hi,

    I'm not very familiar with wxWindows but from the documentation,
it looks like SetClientData and GetClientData would be better choices
because they are pointer types. They would be automatically at the
correct size. You would need the cast on the Get but not on the Set.

Kind Regards,
     Thiago A. Correa

On Wed, May 30, 2012 at 9:44 AM, Uwe Bonnes
<bon at elektron.ikp.physik.tu-darmstadt.de> wrote:
>  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);
>             }



More information about the En-Nut-Discussion mailing list