From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10378 invoked by alias); 5 Jun 2014 15:01:00 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32716 Received: (qmail 10936 invoked from network); 5 Jun 2014 15:00:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140605080027.ZM23992@torch.brasslantern.com> Date: Thu, 05 Jun 2014 08:00:27 -0700 In-reply-to: <2F660578-9CA7-40B9-B3E2-AB318266F1D2@kba.biglobe.ne.jp> Comments: In reply to "Jun T." "Re: Unicode, Korean, normalization form, Mac OS X and tab completion" (Jun 5, 11:34pm) References: <20140531201617.4ca60ab8@pws-pc.ntlworld.com> <140531142926.ZM556@torch.brasslantern.com> <20140601022527.GD1820@tarsus.local2> <140601005624.ZM3283@torch.brasslantern.com> <140601125323.ZM9969@torch.brasslantern.com> <89931C75-9470-40CA-B278-EE6A5746582D@kba.biglobe.ne.jp> <2F660578-9CA7-40B9-B3E2-AB318266F1D2@kba.biglobe.ne.jp> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Unicode, Korean, normalization form, Mac OS X and tab completion MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jun 5, 11:34pm, Jun T. wrote: } } It seems we need to cast the return value of iconv() to a "signed" integer } for correctly detecting the error. Hmm. That may explain something else. I suggest this instead: diff --git a/Src/utils.c b/Src/utils.c index 8b512bb..59b9435 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -4287,7 +4287,7 @@ zreaddir(DIR *dir, int ignoredots) #if defined(HAVE_ICONV) && defined(__APPLE__) if (!conv_ds) conv_ds = iconv_open("UTF-8", "UTF-8-MAC"); - if (conv_ds) { + if (conv_ds != (iconv_t)(-1)) { /* Force initial state in case re-using conv_ds */ (void) iconv(conv_ds, 0, &orig_name_len, 0, &conv_name_len); @@ -4298,12 +4298,11 @@ zreaddir(DIR *dir, int ignoredots) conv_name_len = orig_name_len; if (iconv(conv_ds, &orig_name_ptr, &orig_name_len, - &conv_name_ptr, &conv_name_len) >= 0) { - if (orig_name_len == 0) { + &conv_name_ptr, &conv_name_len) != (size_t)(-1) && + orig_name_len == 0) { /* Completely converted, metafy and return */ *conv_name_ptr = '\0'; return metafy(conv_name, -1, META_STATIC); - } } /* Error, or conversion incomplete, keep the original name */ }