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: Andreas Schwab <schwab at linux-m68k dot org>
- To: Tim Shen <timshen91 at gmail dot com>
- 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 21:31:34 +0100
- 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>
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.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."