From 34ac853507e9f8527250df9ff7598e6b54e43f8d Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sat, 15 Feb 2003 21:29:07 +0000 Subject: fix casting on big-endian, from galeon. 2003-02-15 Marco Pesenti Gritti * embed/mozilla/EventContext.cpp: fix casting on big-endian, from galeon. --- ChangeLog | 6 ++++++ embed/mozilla/EventContext.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9119cbef4..30182f727 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-02-15 Marco Pesenti Gritti + + * embed/mozilla/EventContext.cpp: + + fix casting on big-endian, from galeon. + 2003-02-15 Marco Pesenti Gritti * data/ui/epiphany-ui.xml.in: diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp index 78a01e451..7e07e757b 100644 --- a/embed/mozilla/EventContext.cpp +++ b/embed/mozilla/EventContext.cpp @@ -527,7 +527,12 @@ nsresult EventContext::GetMouseEventInfo (EphyEmbedEvent *info) nsresult result; nsIDOMMouseEvent *aMouseEvent = (nsIDOMMouseEvent*)mEvent; - aMouseEvent->GetButton ((PRUint16*)&info->mouse_button); + /* casting 32-bit guint* to PRUint16* below will break on big-endian */ + PRUint16 btn; + aMouseEvent->GetButton (&btn); + info->mouse_button = (guint)btn; + + /* OTOH, casting only between (un)signedness is safe */ aMouseEvent->GetScreenX ((PRInt32*)&info->mouse_x); aMouseEvent->GetScreenY ((PRInt32*)&info->mouse_y); -- cgit v1.2.3