From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: Re: Coding system conversion error Date: Tue, 08 Feb 2005 18:38:25 -0500 Message-ID: References: <20050205170221.ZTBD24781.mxfep02.bredband.com@coolsville.localdomain> <738f9db09f1986269b8f5719d45d2dd5@swipnet.se> <4207DAF0.6000204@swipnet.se> <4209342E.5010701@swipnet.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1107906059 2522 80.91.229.2 (8 Feb 2005 23:40:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 8 Feb 2005 23:40:59 +0000 (UTC) Cc: emacs-pretest-bug@gnu.org, emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 09 00:40:58 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Cyey9-0004P7-1V for ged-emacs-devel@m.gmane.org; Wed, 09 Feb 2005 00:40:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CyfCZ-0007CA-0R for ged-emacs-devel@m.gmane.org; Tue, 08 Feb 2005 18:55:27 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CyfBB-0006f7-NE for emacs-devel@gnu.org; Tue, 08 Feb 2005 18:54:01 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CyfB4-0006bP-PL for emacs-devel@gnu.org; Tue, 08 Feb 2005 18:53:57 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CyfB4-0006ax-GT; Tue, 08 Feb 2005 18:53:54 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CyewA-0001YJ-PG; Tue, 08 Feb 2005 18:38:30 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 6EC278282A8; Tue, 8 Feb 2005 18:38:30 -0500 (EST) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id D59624AC16A; Tue, 8 Feb 2005 18:38:25 -0500 (EST) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id BA0DC4BCC5; Tue, 8 Feb 2005 18:38:25 -0500 (EST) Original-To: "Jan D." In-Reply-To: <4209342E.5010701@swipnet.se> (Jan D.'s message of "Tue, 08 Feb 2005 22:50:38 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.787, requis 5, autolearn=not spam, AWL 0.11, BAYES_00 -4.90) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:33103 gmane.emacs.pretest.bugs:5799 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:33103 > I think I found the reason for this, but I am not sure. Can anybody with > knowledge about multibyte and unibyte string representations comment on the > patch below (in function allocate_string_data in alloc.c)? > diff -c alloc.c.~1.363.~ alloc.c > Index: alloc.c > *** alloc.c.~1.363.~ 2005-01-20 21:20:32.000000000 +0100 > --- alloc.c 2005-02-08 22:46:02.000000000 +0100 > *************** > *** 1977,1983 **** > SDATA_NBYTES (data) = nbytes; > #endif s-> size = nchars; > ! s->size_byte = nbytes; s-> data[nbytes] = '\0'; > #ifdef GC_CHECK_STRING_OVERRUN > bcopy (string_overrun_cookie, (char *) data + needed, > --- 1977,1983 ---- > SDATA_NBYTES (data) = nbytes; > #endif s-> size = nchars; > ! s->size_byte = nchars != nbytes ? nbytes : -1; s-> data[nbytes] = '\0'; > #ifdef GC_CHECK_STRING_OVERRUN > bcopy (string_overrun_cookie, (char *) data + needed, This doesn't look like the right fix. Normally, the caller would instead use `STRING_SET_UNIBYTE' after the call (or rather calls one of make_foo_string which does it for him) if needed. Stefan