From 87baa4d3d224939698926dc119b46e6d87a8b9e8 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Wed, 12 Dec 2012 21:09:42 -0800 Subject: [PATCH] Eliminate usage of __mb_cur_max, try to fix Linux build --- common.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common.cpp b/common.cpp index 0fb8b774b..41318995f 100644 --- a/common.cpp +++ b/common.cpp @@ -302,8 +302,7 @@ std::string wcs2string(const wcstring &input) mbstate_t state; memset(&state, 0, sizeof(state)); - size_t converted_max_len = (size_t)(1 + __mb_cur_max); - char *converted = new char[converted_max_len]; + char converted[MB_LEN_MAX + 1]; for (size_t i=0; i < input.size(); i++) { @@ -318,7 +317,7 @@ std::string wcs2string(const wcstring &input) } else { - bzero(converted, converted_max_len); + bzero(converted, sizeof converted); size_t len = wcrtomb(converted, wc, &state); if (len == (size_t)(-1)) { @@ -332,7 +331,6 @@ std::string wcs2string(const wcstring &input) } } - delete [] converted; return result; }