830N/A--- a/src/lib/libast/comp/setlocale.c Mon Dec 27 04:23:49 2010
830N/A+++ b/src/lib/libast/comp/setlocale.c Fri Jul 22 00:30:31 2011
830N/A@@ -19,6 +19,9 @@
830N/A * Phong Vo <kpv@research.att.com> *
830N/A * *
830N/A ***********************************************************************/
830N/A+/*
830N/A+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
830N/A+ */
830N/A #pragma prototyped
830N/A
830N/A /*
830N/A@@ -2236,6 +2239,24 @@
830N/A
830N/A typedef int (*Isw_f)(wchar_t);
830N/A
830N/A+static int
830N/A+wide_wctomb(char* u, wchar_t w)
830N/A+{
830N/A+ int size = 0;
830N/A+
830N/A+ if (u)
830N/A+ {
830N/A+ size = wctomb(u, w);
830N/A+ if (size < 0)
830N/A+ {
830N/A+ *u = (char)(w & 0xff);
830N/A+ size = 1;
830N/A+ }
830N/A+ }
830N/A+
830N/A+ return size;
830N/A+}
830N/A+
830N/A /*
830N/A * called when LC_CTYPE initialized or changes
830N/A */
830N/A@@ -2280,7 +2301,7 @@
830N/A {
830N/A if (!(ast.mb_width = wcwidth))
830N/A ast.mb_width = default_wcwidth;
830N/A- ast.mb_conv = wctomb;
830N/A+ ast.mb_conv = wide_wctomb;
830N/A #ifdef mb_state
830N/A {
830N/A /*