This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [libstdc++] Transforming a string to a primary sort key
- From: Tim Shen <timshen91 at gmail dot com>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, libc-alpha at sourceware dot org, Paolo Carlini <paolo dot carlini at oracle dot com>, roland at gnu dot org
- Date: Fri, 28 Mar 2014 16:40:37 -0400
- Subject: Re: [libstdc++] Transforming a string to a primary sort key
- Authentication-results: sourceware.org; auth=none
- References: <CAPrifDmGAR=wVP7++dDC--V9R0jfO2r7ohvD_Bnnd3YM3VNASQ at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1403281639120 dot 6067 at digraph dot polyomino dot org dot uk> <CAPrifD=eUWEeHZzUUtdDHj_kO+YyHfuGkMY8erQxxGi5hZPquw at mail dot gmail dot com> <87a9cadpzt dot fsf at igel dot home>
On Fri, Mar 28, 2014 at 4:31 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Tim Shen <timshen91@gmail.com> writes:
>
>> int n1 = wcsxfrm(buff1, st1, wcslen(st1));
>
> This is not the length of the string, but the max size of the output.
> Since the output is truncated you are getting unspecified contents.
Oh, thanks, that's a quite stupid mistake. So I use "sizeof(buff1)"
and "sizeof(buff2)" respectively and get the result 1 from wcscmp and
7 from wcscoll, which is correct.
That does give an example that wcsxfrm is not what transform_primary
wants, which expect a 0 as a return.
--
Regards,
Tim Shen