>>>> "JM" == Jeff Miller
<jmiller(a)smart.net> writes:
>>>> "JM" == Jeff Miller
<jmiller(a)smart.net> writes:
JM> I working on porting some lisp code from Emacs to XEmacs. One area
JM> I'm having a problem in is with a certain popup menu. It works ok on
JM> Emacs but crashes XEmacs. I think it has to do with the length of the
JM> strings being put into the popup menu.
JM> I'm been able to come up with a simple snippet of lisp code that can
JM> recreate it. It would appear the magic number to make it crash is 64
JM> characters.
I experimented with this at work. A xemacs-19.15 worked fine (menus
longer than 64) on both linux & solaris. I then tried both xemacs-20.3 &
xemacs-20.4. They don't crash, but only display a popup menu that is 64
chars long.
I believe I have found the culprit. If you look at xlwmenu.c, function
"string_width_u", you'll see that it has a 64 long char array called
newchars. I don't follow all that's going on in here, but this function
appear to clean up the text string and null-terminate it.
The 64 char arry obviously limits the length of the popup menu, so I'm
jacking it up to 256.
Seocond, there is an off-by-one count on the null termination of
newchars. So I fixed that too.
These fix the problem I was having.
--- lwlib/xlwmenu.c.orig Thu Jun 4 19:22:09 1998
+++ lwlib/xlwmenu.c Thu Jun 4 20:16:05 1998
@@ -417,7 +417,7 @@
int drop;
# endif
#endif
- char newchars[64];
+ char newchars[256];
char *chars;
int i, j;
@@ -430,7 +430,7 @@
chars = string;
#endif
- for (i = j = 0; chars[i] && (j < (int) sizeof (newchars)); i++)
+ for (i = j = 0; chars[i] && (j < (int) (sizeof (newchars) - 1)); i++)
if (chars[i]=='%'&&chars[i+1]=='_')
i++;
else