all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Miles Bader <miles.bader@necel.com>
To: emacs-devel@gnu.org
Subject: divide-by-zero during redisplay
Date: Mon, 26 May 2008 19:43:37 +0900	[thread overview]
Message-ID: <buotzgl4a7a.fsf@dhapc248.dev.necel.com> (raw)

In the function "xfont_open", there's this code (line 611):

	  int width = font->space_width, n = pcm != NULL;

	  for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++)
	    if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL)
	      width += pcm->width, n++;
	  font->average_width = width / n;

I'm getting divide-by-zeros during redisplay, because n == 0.

Maybe this represents some degenerate condition (I'm having a hard time
reproducing it currently; I saw it happen while displaying rcirc channel
buffers), but still, it seems the code should avoid dividing by zero in
such a case.

Thanks,

-Miles

-- 
Mayonnaise, n. One of the sauces that serve the French in place of a state
religion.




             reply	other threads:[~2008-05-26 10:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-26 10:43 Miles Bader [this message]
2008-05-26 10:58 ` divide-by-zero during redisplay Miles Bader
2008-05-27  1:44 ` Kenichi Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=buotzgl4a7a.fsf@dhapc248.dev.necel.com \
    --to=miles.bader@necel.com \
    --cc=emacs-devel@gnu.org \
    --cc=miles@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.