diff options
author | Eli Zaretskii <eliz@gnu.org> | 2015-01-13 19:16:51 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2015-01-13 19:16:51 +0200 |
commit | 5aa618b05807d560126dfd09b9c9cb6b957b98de (patch) | |
tree | b739bec3884c4ed03158b8be0edd0c831540d0d7 /src/w32menu.c | |
parent | 30c5f5cdef8db72c007efecfc8436479631b45d0 (diff) | |
download | emacs-5aa618b05807d560126dfd09b9c9cb6b957b98de.tar.gz |
Fix problems with 32-bit wide-int build exposed by MinGW
lisp.h (XPNTR): Move definition to after XTYPE, to avoid
compilation error in an unoptimized build when !USE_LSB_TAG.
src/w32heap.c (DUMPED_HEAP_SIZE): For 32-bit wide-int build, use the
same larger value as for the 64-bit build.
src/w32term.h (SCROLL_BAR_PACK): Cast the result to UINT_PTR to
avoid compiler warnings.
src/w32proc.c (Fw32_get_codepage_charset, Fw32_set_keyboard_layout):
Avoid compiler warnings about cast from integer to pointer of
different size.
src/w32menu.c (menubar_selection_callback, w32_menu_show): Cast to
UINT_PTR instead of EMACS_INT, to avoid compiler warnings about
casting from integer to pointer of different size.
(add_menu_item): Pass the help-echo string as a pointer to
Lisp_String, not as a Lisp_Object.
(w32_menu_display_help): Use make_lisp_ptr to reconstruct a Lisp
string object from its C pointer.
src/w32fns.c (w32_msg_pump) <WM_EMACS_UNREGISTER_HOT_KEY>: Use
make_lisp_ptr instead of XIL, to reconstruct a Lisp_Cons from its
C pointer.
<WM_EMACS_TOGGLE_LOCK_KEY>: msg.lparam is now a C integer.
(Fx_create_frame): Type-cast the result of XFASTINT to avoild
compiler warnings about size differences.
(Fw32_unregister_hot_key): Pass the tail of w32_grabbed_keys as a
pointer to a Lisp_Cons struct, not as a disguised EMACS_INT.
(Fw32_toggle_lock_key): Pass the new state of the key as a C
integer; use -1 for nil. Doc fix.
src/.gdbinit (xgetsym): New subroutine.
(xsymname, xsymbol): Use it.
(xprintsym): No need to call xgetptr.
Diffstat (limited to 'src/w32menu.c')
-rw-r--r-- | src/w32menu.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/w32menu.c b/src/w32menu.c index a65e399ba5b..2742276d3f6 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -217,9 +217,9 @@ menubar_selection_callback (struct frame *f, void * client_data) else { entry = AREF (vector, i + MENU_ITEMS_ITEM_VALUE); - /* The EMACS_INT cast avoids a warning. There's no problem + /* The UINT_PTR cast avoids a warning. There's no problem as long as pointers have enough bits to hold small integers. */ - if ((int) (EMACS_INT) client_data == i) + if ((int) (UINT_PTR) client_data == i) { int j; struct input_event buf; @@ -706,7 +706,7 @@ w32_menu_show (struct frame *f, int x, int y, int menuflags, wv->key = SSDATA (descrip); /* Use the contents index as call_data, since we are restricted to 16-bits. */ - wv->call_data = !NILP (def) ? (void *) (EMACS_INT) i : 0; + wv->call_data = !NILP (def) ? (void *) (UINT_PTR) i : 0; if (NILP (type)) wv->button_type = BUTTON_TYPE_NONE; @@ -1401,17 +1401,21 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item) info.cbSize = sizeof (info); info.fMask = MIIM_DATA; - /* Set help string for menu item. Leave it as a Lisp_Object - until it is ready to be displayed, since GC can happen while - menus are active. */ + /* Set help string for menu item. Leave it as a pointer to + a Lisp_String until it is ready to be displayed, since GC + can happen while menus are active. */ if (!NILP (wv->help)) { + /* We use XUNTAG below because in a 32-bit build + --with-wide-int we cannot pass a Lisp_Object + via a DWORD member of MENUITEMINFO. */ /* As of Jul-2012, w32api headers say that dwItemData has DWORD type, but that's a bug: it should actually be ULONG_PTR, which is correct for 32-bit and 64-bit Windows alike. MSVC headers get it right; hopefully, MinGW headers will, too. */ - info.dwItemData = (ULONG_PTR) XLI (wv->help); + eassert (STRINGP (wv->help)); + info.dwItemData = (ULONG_PTR) XUNTAG (wv->help, Lisp_String); } if (wv->button_type == BUTTON_TYPE_RADIO) { @@ -1487,7 +1491,10 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags) info.fMask = MIIM_DATA; get_menu_item_info (menu, item, FALSE, &info); - help = info.dwItemData ? XIL (info.dwItemData) : Qnil; + help = + info.dwItemData + ? make_lisp_ptr ((void *) info.dwItemData, Lisp_String) + : Qnil; } /* Store the help echo in the keyboard buffer as the X toolkit |