[comp.windows.x] Small bug in UWM GetButton.c, V10R4

jmsellens@watmath.waterloo.edu.UUCP (02/15/87)

icon_str is not always dealt with properly in UWM, GetButton.c.  The
RCS header defines this file as version 10.5 dated 86/11/19.  This
bug also appears in the X V10R3 distribution.  Context diff follows.
Fixes are due to Ian! Allen (idallen@watmath).

John Sellens -- Logic Programming and Artificial Intelligence Group

{decvax|utzoo|ihnp4|allegra|clyde}!watmath!watdragon!jmsellens
jmsellens@dragon.waterloo.{edu,CDN} jsellens@watmta.BITNET
jmsellens%dragon@waterloo.csnet


*** GetButton.c.orig	Sun Feb 15 15:01:24 1987
--- GetButton.c.new	Sun Feb 15 15:05:22 1987
***************
*** 191,197 ****
--- 191,201 ----
               */
              if (icon_str_len > 0) {
  		icon_str_len = 0;
+ #ifdef waterloo
+ 		icon_str[0] = '\0';
+ #else
  		icon_str = '\0';
+ #endif
  	    }
          }
          else if (key_char < IFontInfo.firstchar ||
***************
*** 228,240 ****
--- 232,256 ----
      /*
       * Set the window name to the new string.
       */
+ #ifdef waterloo
+     /* note that icon_str can be NULL at this point.  A quick fix to
+        stop mem faults ... */
+ #define ICONSTR	(icon_str ? icon_str : "")
+ 
+     XStoreName(icon_info.assoc_wind, ICONSTR);
+ #else
      XStoreName(icon_info.assoc_wind, icon_str);
+ #endif
  
      /*
       * Determine the new icon window configuration.
       */
      icon_h = IFontInfo.height + (VIconPad << 1);
+ #ifdef waterloo
+     icon_w = XQueryWidth(ICONSTR, IFont);
+ #else
      icon_w = XQueryWidth(icon_str, IFont);
+ #endif
      if (icon_w == 0) {
          icon_w = icon_h;
      }