From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4708 invoked by alias); 5 Jun 2014 14:34:49 -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: 32714 Received: (qmail 11401 invoked from network); 5 Jun 2014 14:34:46 -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 X-Biglobe-Sender: Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) Subject: Re: Unicode, Korean, normalization form, Mac OS X and tab completion From: "Jun T." In-Reply-To: Date: Thu, 5 Jun 2014 23:34:41 +0900 Content-Transfer-Encoding: 7bit Message-Id: <2F660578-9CA7-40B9-B3E2-AB318266F1D2@kba.biglobe.ne.jp> 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> To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.1878.2) X-Biglobe-Spnum: 53004 It seems we need to cast the return value of iconv() to a "signed" integer for correctly detecting the error. diff --git a/Src/utils.c b/Src/utils.c index 8b512bb..2693ecd 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -4296,14 +4296,13 @@ zreaddir(DIR *dir, int ignoredots) conv_name = zrealloc(conv_name, orig_name_len+1); conv_name_ptr = conv_name; conv_name_len = orig_name_len; - if (iconv(conv_ds, + if ((long)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) >= 0 && + 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 */ }