From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: Re: scm_to_locale_stringbuf Date: Tue, 03 Feb 2009 22:48:18 +0000 Message-ID: <874ozbjfwt.fsf@arudy.ossau.uklinux.net> References: <493834.3827.qm@web37902.mail.mud.yahoo.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1233701396 1982 80.91.229.12 (3 Feb 2009 22:49:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 3 Feb 2009 22:49:56 +0000 (UTC) Cc: guile-devel To: Mike Gran Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Feb 03 23:51:10 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LUU6f-0003wF-D2 for guile-devel@m.gmane.org; Tue, 03 Feb 2009 23:51:01 +0100 Original-Received: from localhost ([127.0.0.1]:45477 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUU5M-0007BB-Em for guile-devel@m.gmane.org; Tue, 03 Feb 2009 17:49:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUU4F-0006ng-00 for guile-devel@gnu.org; Tue, 03 Feb 2009 17:48:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUU4C-0006m7-22 for guile-devel@gnu.org; Tue, 03 Feb 2009 17:48:30 -0500 Original-Received: from [199.232.76.173] (port=39556 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUU4B-0006m2-SU for guile-devel@gnu.org; Tue, 03 Feb 2009 17:48:27 -0500 Original-Received: from mail3.uklinux.net ([80.84.72.33]:53128) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LUU4B-0006yC-FL for guile-devel@gnu.org; Tue, 03 Feb 2009 17:48:27 -0500 Original-Received: from arudy (host86-157-180-39.range86-157.btcentralplus.com [86.157.180.39]) by mail3.uklinux.net (Postfix) with ESMTP id DFB451F698F; Tue, 3 Feb 2009 22:48:23 +0000 (GMT) Original-Received: from arudy.ossau.uklinux.net (arudy [127.0.0.1]) by arudy (Postfix) with ESMTP id 4C45838012; Tue, 3 Feb 2009 22:48:18 +0000 (GMT) In-Reply-To: <493834.3827.qm@web37902.mail.mud.yahoo.com> (Mike Gran's message of "Tue\, 3 Feb 2009 08\:25\:48 -0800 \(PST\)") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8124 Archived-At: Mike Gran writes: > Hi, > > The description for scm_to_locale_stringbuf doesn't specify > what happens when the final multibyte character doesn't fit > in the provided string buffer. > > size_t scm_to_locale_stringbuf (SCM str, char *buf, size_t max_len) > > Say the locale is UTF-8, and the last position in BUF would be > the first byte of a two-byte character. The right thing is not > to copy that first byte of the character into the last position > of BUF, but, instead copy a '\0'. But there is no way to indicate > to the caller that the final '\0' is padding and not a true '\0'. I'm afraid I don't understand the problem, on two counts. 1. The doc (in the manual) says that scm_to_locale_stringbuf doesn't add a terminating \0. So presumably any \0s present must be padding. 2. The doc also says that if scm_to_locale_stringbuf's return value is > max_len (as it would be in your case), the caller should call it again with a larger buffer. What is the caller scenario that you have in mind? Regards, Neil