FVWM Bug Tracking notification

new message incoming/745

Message summary for PR#745
        From: [EMAIL PROTECTED]
        Subject: FvwmForm's "message" displays null chars
        Date: Mon, 23 Jul 2001 23:05:45 -0500
        0 replies       0 followups

====> ORIGINAL MESSAGE FOLLOWS <====

>From [EMAIL PROTECTED] Mon Jul 23 23:05:46 2001
Received: from karazm.math.uh.edu ([129.7.128.1])
        by malifon.math.uh.edu with esmtp (Exim 3.20 #1)
        id 15OtS6-0004wf-00
        for [EMAIL PROTECTED]; Mon, 23 Jul 2001 23:05:46 -0500
Received: from malifon.math.uh.edu (IDENT:[EMAIL PROTECTED] [129.7.128.13])
        by karazm.math.uh.edu (8.9.3/8.9.3) with ESMTP id XAA22019
        for <[EMAIL PROTECTED]>; Mon, 23 Jul 2001 23:05:45 -0500 (CDT)
From: [EMAIL PROTECTED]
Received: from localhost ([127.0.0.1] ident=65534)
        by malifon.math.uh.edu with esmtp (Exim 3.20 #1)
        id 15OtS5-0004wb-00
        for [EMAIL PROTECTED]; Mon, 23 Jul 2001 23:05:45 -0500
To: [EMAIL PROTECTED]
Subject: FvwmForm's "message" displays null chars
Message-Id: <[EMAIL PROTECTED]>
Date: Mon, 23 Jul 2001 23:05:45 -0500
X-RBL-Warning: (relays.orbs.org) 

Full_Name: Dmitry Bolkhovityanov
Version: 2.4
CVS_Date: 20010705
OS: Red Hat Linux 7.1
X_Server: XFree86 4.0.3
Submission from: (NULL) (140.221.9.192)


FvwmForm's "message" displays null chars after a message itself.  While it
was okay in older environments ('\0's were empty glyphs), in most modern
fonts null chars are either present or displayed because of present
DEFAULT_CHAR (usually a solid or dashed rectangle).

To reproduce: under XFree86 >=4.0.3, start FvwmTalk and issue some bad
command -- like "aaa".  The error message will be padded with rectangles.

A simple patch to fix it (hope FvwmBug wouldn't mangle the text ;-):

---- CUT ----
--- modules/FvwmForm/FvwmForm.c.orig    Sun Mar 25 04:44:12 2001
+++ modules/FvwmForm/FvwmForm.c Tue Jul 24 09:46:16 2001
@@ -1169,13 +1169,18 @@
 void RedrawText(Item *item)
 {
   int x, y;
+  int len;
+  char *p;
   CheckAlloc(item,item->header.dt_ptr); /* alloc colors and fonts needed
*/
   x = item->header.pos_x + TEXT_SPC;
   y = item->header.pos_y + ( CF.padVText / 2 ) +
     item->header.dt_ptr->dt_font_struct->ascent;
+  len = item->text.n;
+  if ((p = memchr(item->text.value, '\0', len)) != NULL)
+    len = p - item->text.value;
   XDrawString(dpy, CF.frame, item->header.dt_ptr->dt_GC,
                    x, y, item->text.value,
-                   item->text.n);
+                   len);
 }
 
 /* redraw an item */
---- CUT ----

BTW, this goof is fairly common (it became visible in many apps under
4.0.3), so other pieces of FVWM are worth checking.



--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [EMAIL PROTECTED]
To report problems, send mail to [EMAIL PROTECTED]

Reply via email to