From: Neil Jerram <neil@ossau.uklinux.net>
To: Mike Gran <spk121@yahoo.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: scm_to_locale_stringbuf
Date: Tue, 03 Feb 2009 22:48:18 +0000 [thread overview]
Message-ID: <874ozbjfwt.fsf@arudy.ossau.uklinux.net> (raw)
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\)")
Mike Gran <spk121@yahoo.com> 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
next prev parent reply other threads:[~2009-02-03 22:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-03 16:25 scm_to_locale_stringbuf Mike Gran
2009-02-03 22:48 ` Neil Jerram [this message]
2009-02-03 23:46 ` scm_to_locale_stringbuf Mike Gran
2009-02-04 0:23 ` scm_to_locale_stringbuf Neil Jerram
2009-02-05 22:26 ` scm_to_locale_stringbuf Ludovic Courtès
2009-02-08 21:41 ` scm_to_locale_stringbuf Neil Jerram
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874ozbjfwt.fsf@arudy.ossau.uklinux.net \
--to=neil@ossau.uklinux.net \
--cc=guile-devel@gnu.org \
--cc=spk121@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).