*** pgsql/src/backend/utils/mb/mbutils.c 2009/01/22 10:09:48 1.78 --- pgsql/src/backend/utils/mb/mbutils.c 2009/03/02 15:10:09 1.79 *************** *** 4,10 **** * (currently mule internal code (mic) is used) * Tatsuo Ishii * ! * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.77 2009/01/19 15:34:23 mha Exp $ */ #include "postgres.h" --- 4,10 ---- * (currently mule internal code (mic) is used) * Tatsuo Ishii * ! * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.78 2009/01/22 10:09:48 mha Exp $ */ #include "postgres.h" *************** wchar2char(char *to, const wchar_t *from *** 601,607 **** --- 601,610 ---- } else #endif /* WIN32 */ + { + Assert( !lc_ctype_is_c() ); result = wcstombs(to, from, tolen); + } return result; } *************** char2wchar(wchar_t *to, size_t tolen, co *** 647,668 **** else #endif /* WIN32 */ { ! if (lc_ctype_is_c()) ! { ! /* ! * pg_mb2wchar_with_len always adds trailing '\0', so 'to' should be ! * allocated with sufficient space ! */ ! result = pg_mb2wchar_with_len(from, (pg_wchar *) to, fromlen); ! } ! else ! { ! /* mbstowcs requires ending '\0' */ ! char *str = pnstrdup(from, fromlen); ! result = mbstowcs(to, str, tolen); ! pfree(str); ! } } if (result == -1) --- 650,661 ---- else #endif /* WIN32 */ { ! /* mbstowcs requires ending '\0' */ ! char *str = pnstrdup(from, fromlen); ! Assert( !lc_ctype_is_c() ); ! result = mbstowcs(to, str, tolen); ! pfree(str); } if (result == -1)