4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-17 20:09:21 +08:00
Corinna Vinschen e185421106 strxfrm/wcsxfrm: Always return length of the transformed string
Cygwin's strxfrm/wcsfrm treated a too short output buffer as an error
condition and always returned the size value provided as third parameter.
This is not as it's documented in POSIX.1-2008.  Rather, the only error
condition is an invalid input string(*).

Other than that, the functions are supposed to return the length of the
resulting sort key, even if the output buffer is too small.  In the latter
case the content of the output array is unspecified, but it's the job
of the application to check that the return value is greater or equal to
the provided buffer size.

(*) We have to make an exception in Cygwin:  strxfrm has to call the
    UNICODE function LCMapStringW for reasons outlined in a source comment.
    If the incoming multibyte string is so large that we fail to malloc
    the space required to convert it to a wchar_t string, we have to
    ser errno as well since we have nothing to call LCMapStringW with.

	* nlsfuncs.cc (wcsxfrm): Fix expression computing offset of
	trailing wchar_t NUL.  Compute correct return value even if
	output buffer is too small.
	(strxfrm): Handle failing malloc.  Compute correct return value
	even if	output buffer is too small.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-04-12 15:06:05 +02:00
..
2013-04-30 23:43:08 +00:00
2013-04-23 09:44:36 +00:00
2012-11-23 13:22:47 +00:00
2013-04-23 09:44:36 +00:00
2016-03-29 17:39:17 +02:00
2013-04-23 09:44:36 +00:00
2015-04-23 21:57:12 +02:00
2015-04-23 21:57:12 +02:00
2014-04-26 17:38:22 +00:00
2015-07-29 13:45:46 +02:00
2013-04-23 09:44:36 +00:00
2015-11-05 18:31:36 +01:00
2016-03-20 21:59:43 +01:00
2016-03-20 21:59:43 +01:00
2015-03-03 12:58:34 +00:00
2013-04-23 09:44:36 +00:00
2013-04-23 09:44:36 +00:00
2013-04-23 09:44:36 +00:00
2015-11-18 19:09:47 +01:00
2015-02-24 20:52:57 +00:00
2014-08-14 17:36:24 +00:00
2016-03-18 14:46:20 +01:00
2016-03-18 14:46:20 +01:00
2015-08-17 11:05:43 +02:00
2013-04-23 09:44:36 +00:00
2013-04-23 09:44:36 +00:00
2016-01-27 15:39:11 +01:00
2013-04-23 09:44:36 +00:00
2016-03-29 13:41:11 +02:00
2013-04-23 09:44:36 +00:00
2015-07-29 13:45:46 +02:00
2013-04-23 09:44:36 +00:00
2016-03-08 13:56:40 +01:00
2016-03-29 12:14:18 +02:00
2015-07-29 13:45:46 +02:00
2013-04-23 09:44:36 +00:00
2015-07-29 13:45:46 +02:00
2013-04-23 09:44:36 +00:00
2013-04-23 09:44:36 +00:00
2013-04-23 09:44:36 +00:00
2013-04-23 09:44:36 +00:00
2013-04-23 09:44:36 +00:00
2016-03-20 12:19:35 +01:00
2016-02-13 16:03:15 +01:00
2015-04-23 21:57:07 +02:00
2015-04-23 22:04:24 +02:00
2015-02-24 20:52:57 +00:00
2013-04-23 09:44:36 +00:00