zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: Compiler warning after workers/39825
Date: Tue, 08 Nov 2016 10:01:49 +0000	[thread overview]
Message-ID: <20161108100149.6ad05be9@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <1478589863.1742905.780812753.58D372CF@webmail.messagingengine.com>

On Mon, 07 Nov 2016 23:24:23 -0800
Sebastian Gniazdowski <psprint@fastmail.com> wrote:
> Ah, the (mild) enlightenment is: char can be signed / unsigned. Wonder
> if this can have any actual implications as 7f is AFAIK still in
> unsigned range. For sure there are some techniques of solving such
> portability problems hm

Yes, that's it.  We have a macro to perform a safe cast to unsigned.
That's the right answer, since if the char is signed and is negative,
it's *not* in a range we want to deal with.  So the compiler was right...

Casting 0x74 is unnecessary, since the constant will conform with
unsigned char anyway, but I've made the point...

pws

diff --git a/Src/utils.c b/Src/utils.c
index 733f570..d73110a 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -5341,7 +5341,7 @@ mb_metastrlenend(char *ptr, int width, char *eptr)
 	    inchar = *ptr;
 	ptr++;
 
-	if (complete && (inchar >= 0 && inchar <= 0x7f)) {
+	if (complete && (inchar >= 0 && STOUC(inchar) <= STOUC(0x7f))) {
 	    /*
 	     * We rely on 7-bit US-ASCII as a subset, so skip
 	     * multibyte handling if we have such a character.


  reply	other threads:[~2016-11-08 10:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 23:50 Bart Schaefer
2016-11-08  7:08 ` Sebastian Gniazdowski
2016-11-08  7:24   ` Sebastian Gniazdowski
2016-11-08 10:01     ` Peter Stephenson [this message]
2016-11-08 10:07       ` Peter Stephenson
2016-11-08 15:38         ` Daniel Shahaf
2016-11-08 15:44           ` Peter Stephenson
2016-11-08  8:36 ` Sebastian Gniazdowski

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=20161108100149.6ad05be9@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.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.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).