From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12906 invoked from network); 28 Oct 2005 22:09:40 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 Oct 2005 22:09:40 -0000 Received: (qmail 76122 invoked from network); 28 Oct 2005 22:09:33 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Oct 2005 22:09:33 -0000 Received: (qmail 29667 invoked by alias); 28 Oct 2005 22:09:31 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21948 Received: (qmail 29586 invoked from network); 28 Oct 2005 22:09:30 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 28 Oct 2005 22:09:30 -0000 Received: (qmail 75899 invoked from network); 28 Oct 2005 22:09:30 -0000 Received: from dsl3-63-249-88-2.cruzio.com (HELO dot.blorf.net) (63.249.88.2) by a.mx.sunsite.dk with SMTP; 28 Oct 2005 22:09:29 -0000 Received: by dot.blorf.net (Postfix, from userid 1000) id A6C704EA; Fri, 28 Oct 2005 15:09:27 -0700 (PDT) Date: Fri, 28 Oct 2005 15:09:27 -0700 From: Wayne Davison To: Peter Stephenson Cc: Zsh hackers list Subject: Re: unpatch: rationalise multibyte output Message-ID: <20051028220927.GB27510@blorf.net> References: <200510281729.j9SHTSGm025792@news01.csr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200510281729.j9SHTSGm025792@news01.csr.com> User-Agent: Mutt/1.5.9i X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 On Fri, Oct 28, 2005 at 06:29:28PM +0100, Peter Stephenson wrote: > I was too lazy to patch this into my non-multibyte build, but when I > commit this and can get CVS to do it for me I'll do that and fix up > any fallout. I also compiled a non-multibyte build, and I finally got around to looking into some of the compiler warnings that crop up. Here's one that's been around for a while, which seems to be an easy fix: --- Src/Zle/zle_refresh.c 28 Oct 2005 17:34:33 -0000 1.36 +++ Src/Zle/zle_refresh.c 28 Oct 2005 21:57:49 -0000 @@ -1138,8 +1138,10 @@ refreshline(int ln) /* inserting & deleting chars: we can if there's no right-prompt */ if ((ln || !put_rpmpt || !oput_rpmpt) - && (nl[1] && ol[1] && nl[1] != ol[1]) - && *ol != WEOF && *nl != WEOF) { +#ifdef MULTIBYTE_SUPPORT + && *ol != WEOF && *nl != WEOF +#endif + && nl[1] && ol[1] && nl[1] != ol[1]) { /* deleting characters - see if we can find a match series that makes it cheaper to delete intermediate characters Those WEOF comparisons were being done w/o MULTIBYTE_SUPPORT being defined, which I assume is never needed (if it were, REFRESH_STRING would need to be something larger than an unsigned char, and WEOF would need to be ZLEEOF). Another signed/unsigned error concerns the return value of the WC_REDIR_TYPE() macro (which is unsigned) and the redir_type variables which are used in the code, which are "int"s. One simple fix is to just make the WC_REDIR_* macros return an int, which is what this patch does: --- Src/zsh.h 28 Oct 2005 17:34:33 -0000 1.80 +++ Src/zsh.h 28 Oct 2005 22:04:25 -0000 @@ -656,8 +656,8 @@ struct eccstr { #define WC_PIPE_LINENO(C) (wc_data(C) >> 1) #define WCB_PIPE(T,L) wc_bld(WC_PIPE, ((T) | ((L) << 1))) -#define WC_REDIR_TYPE(C) (wc_data(C) & REDIR_TYPE_MASK) -#define WC_REDIR_VARID(C) (wc_data(C) & REDIR_VARID_MASK) +#define WC_REDIR_TYPE(C) ((int)(wc_data(C) & REDIR_TYPE_MASK)) +#define WC_REDIR_VARID(C) ((int)(wc_data(C) & REDIR_VARID_MASK)) #define WCB_REDIR(T) wc_bld(WC_REDIR, (T)) /* Size of redir is 4 words if REDIR_VARID_MASK is set, else 3 */ #define WC_REDIR_WORDS(C) (WC_REDIR_VARID(C) ? 4 : 3) That looked better than changing various ints into unsigned ints. I have another set of potential changes, but those I'll reserve for another message. If anyone has any concerns/comments about the above changes, let me know. ..wayne..