unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chetan Pandya <pandyacus@sbcglobal.net>
To: emacs-devel@gnu.org, Dan Nicolaescu <dann@ics.uci.edu>
Cc: Kenichi Handa <handa@m17n.org>
Subject: Re: signed vs unsigned char in coding.h
Date: Fri, 20 Feb 2009 13:29:25 -0800 (PST)	[thread overview]
Message-ID: <911486.24447.qm@web83203.mail.mud.yahoo.com> (raw)
In-Reply-To: <200902201619.n1KGJBtJ006483@rodan.ics.uci.edu>

--- On Fri, 2/20/09, Dan Nicolaescu <dann@ics.uci.edu> wrote:
> struct coding_system in coding.h contains this:
> 
>       char *safe_charsets;
> 
> 
> and coding.c has this:
> 
> #define SAFE_CHARSET_P(coding, id)      \
>   ((id) <= (coding)->max_charset_id     \
>    && (coding)->safe_charsets[id] >= 0)
> 
> on some platforms "char" is unsigned by default,
> so the above >=0
> comparison is always true.
> 
> What is the intention here, should safe_charsets be defined
> as "signed char" ?

It looks like there are more things needed here. Since the safe_charsets is part of a string, it makes sense to declare it as unsigned char and compare it to 255.

However, when in coding.c:9298 this is initialized with 
  safe_charsets = Fmake_string (make_number (max_charset_id + 1),
				make_number (255));
This also has problems since it tries to create a string with a character that is not ASCII_CHAR_P. Wouldn't it make sense to create with ascii char and then replace all with 255 instead?

Chetan





      reply	other threads:[~2009-02-20 21:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 16:19 signed vs unsigned char in coding.h Dan Nicolaescu
2009-02-20 21:29 ` Chetan Pandya [this message]

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=911486.24447.qm@web83203.mail.mud.yahoo.com \
    --to=pandyacus@sbcglobal.net \
    --cc=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    --cc=handa@m17n.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).