unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: LGLYPH_SET_CODE
Date: Fri, 29 Aug 2008 20:17:50 +0900	[thread overview]
Message-ID: <E1KZ1zC-0005Dc-Kz@etlken.m17n.org> (raw)
In-Reply-To: <u1w081a7p.fsf@gnu.org> (message from Eli Zaretskii on Fri, 29 Aug 2008 11:44:58 +0300)

In article <u1w081a7p.fsf@gnu.org>, Eli Zaretskii <eliz@gnu.org> writes:

> Can the second argument to this macro be negative?  If so,
> the current definition:

>    #define LGLYPH_SET_CODE(g, val)					\
>      do {								\
>	if (val == FONT_INVALID_CODE)					\
>	  ASET ((g), LGLYPH_IX_CODE, Qnil);				\
>	else if ((EMACS_INT)val > MOST_POSITIVE_FIXNUM)			\
>	  ASET ((g), LGLYPH_IX_CODE, Fcons (make_number ((val) >> 16),	\
>					    make_number ((val) & 0xFFFF)));\
>	else								\
>	  ASET ((g), LGLYPH_IX_CODE, make_number (val));		\
>      } while (0)

> does not handle such values correctly, because their
> absolute value could be large enough to overflow an
> EMACS_INT.  If negative values are possible, we should use
> FIXNUM_OVERFLOW_P instead of a comparison with
> MOST_POSITIVE_FIXNUM.

It is intended that VAL is not negative.  That macro is
called at four places, and except for one place, it is
assured that VAL is never negative.  The exception is in
uniscribe_shape of w32uniscribe.c:

		  LGLYPH_SET_CODE (lglyph, glyphs[j]);

The type of glyphs[j] is "WORD" and I don't know if it's
unsigned or not, I don't know if ScriptShape set a negative
value in it or not.  Anyway, if it's possible that glyphs[j]
becomes negative, that function should be modified not to
call LGLYPH_SET_CODE with negative VAL.

---
Kenichi Handa
handa@ni.aist.go.jp




  reply	other threads:[~2008-08-29 11:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-29  8:44 LGLYPH_SET_CODE Eli Zaretskii
2008-08-29 11:17 ` Kenichi Handa [this message]
2008-08-29 11:26   ` LGLYPH_SET_CODE Jason Rumney
2008-08-29 23:48   ` LGLYPH_SET_CODE Richard M. Stallman
2008-09-01  5:17     ` LGLYPH_SET_CODE 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=E1KZ1zC-0005Dc-Kz@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).