[PATCH 21.5] Fix g++ build of lwlib-Xaw.c
Jerry James <[email protected]> Wed, 7 Jan 2015 09:21:16 -0700
| Newsgroups | gmane.emacs.xemacs.beta,gmane.emacs.xemacs.patches |
|---|---|
| Message-ID | <CAHCOHQkezBaCaoLr1Ra4Rnb7b2-GN2J+Qd60XaKvgTyzB1eXOA@mail.gmail.com> |
PATCH 21.5 On Tue, Jan 6, 2015 at 9:19 AM, Marcus <[email protected]> wrote: > Jerry James <[email protected]> writes: > >> Does the compile succeed if you cast to long first, then to int? > > Indeed, it does. The secrets of "why" are part of the C++ standard, I > reckon. I am not even getting a warning despite the fact that casting > long to int is lossy. Stephen already explained the whys and wherefores, so I'll just paste the patch in here for public consideration. diff -r 9e5f3a0d4e66 lwlib/ChangeLog --- a/lwlib/ChangeLog Sat Jan 03 16:24:56 2015 +0100 +++ b/lwlib/ChangeLog Wed Jan 07 09:14:09 2015 -0700 @@ -1,3 +1,8 @@ +2015-01-07 Jerry James <[email protected]> + + * lwlib-Xaw.c (xaw_scrollbar_scroll): Add typecast to fix g++ build, + problem reported by Marcus Harnisch. + 2013-06-23 Stephen J. Turnbull <[email protected]> * XEmacs 21.5.34 "kale" is released. diff -r 9e5f3a0d4e66 lwlib/lwlib-Xaw.c --- a/lwlib/lwlib-Xaw.c Sat Jan 03 16:24:56 2015 +0100 +++ b/lwlib/lwlib-Xaw.c Wed Jan 07 09:14:09 2015 -0700 @@ -613,10 +613,10 @@ return; id = instance->info->id; - event_data.slider_value = (int) call_data; + event_data.slider_value = (int) (long) call_data; event_data.time = 0; - if ((int) call_data > 0) + if ((int) (long) call_data > 0) /* event_data.action = SCROLLBAR_PAGE_DOWN;*/ event_data.action = SCROLLBAR_LINE_DOWN; else -- Jerry James http://www.jamezone.org/