components/ksh93/patches/CR7065478.patch
changeset 789 5f074ca23733
equal deleted inserted replaced
788:ab1a623335b6 789:5f074ca23733
       
     1 --- a/src/lib/libast/comp/setlocale.c	Mon Dec 27 04:23:49 2010
       
     2 +++ b/src/lib/libast/comp/setlocale.c	Fri Jul 22 00:30:31 2011
       
     3 @@ -19,6 +19,9 @@
       
     4  *                   Phong Vo <[email protected]>                    *
       
     5  *                                                                      *
       
     6  ***********************************************************************/
       
     7 +/*
       
     8 + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
       
     9 + */
       
    10  #pragma prototyped
       
    11  
       
    12  /*
       
    13 @@ -2236,6 +2239,24 @@
       
    14  
       
    15  typedef int (*Isw_f)(wchar_t);
       
    16  
       
    17 +static int
       
    18 +wide_wctomb(char* u, wchar_t w) 
       
    19 +{
       
    20 +	int size = 0;
       
    21 +
       
    22 +	if (u)
       
    23 +	{
       
    24 +		size = wctomb(u, w);
       
    25 +		if (size < 0)
       
    26 +		{
       
    27 +			*u = (char)(w & 0xff);
       
    28 +			size = 1;
       
    29 +		}
       
    30 +	}
       
    31 +
       
    32 +	return size;
       
    33 +}
       
    34 +
       
    35  /*
       
    36   * called when LC_CTYPE initialized or changes
       
    37   */
       
    38 @@ -2280,7 +2301,7 @@
       
    39  	{
       
    40  		if (!(ast.mb_width = wcwidth))
       
    41  			ast.mb_width = default_wcwidth;
       
    42 -		ast.mb_conv = wctomb;
       
    43 +		ast.mb_conv = wide_wctomb;
       
    44  #ifdef mb_state
       
    45  		{
       
    46  			/*