From d662196ed099075bfe8d5337808281d5729e1313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 14 Nov 2008 09:58:18 +0000 Subject: [PATCH] * Removed a superfluous allocation (even without nothrow!), and a superfluous const_cast. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28645 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/textencoding/utf8_conversions.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/kits/textencoding/utf8_conversions.cpp b/src/kits/textencoding/utf8_conversions.cpp index daceee0368..a6137bc1be 100644 --- a/src/kits/textencoding/utf8_conversions.cpp +++ b/src/kits/textencoding/utf8_conversions.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007, Haiku, Inc. All Rights Reserved. + * Copyright 2003-2008, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -78,10 +78,9 @@ convert_encoding(const char* from, const char* to, const char* src, iconvctl(conversion, ICONV_SET_DISCARD_ILSEQ, (void*)&zero); // prepare to convert the substitute character to target encoding - char* original = new char[1]; - original[0] = substitute; + char original = substitute; size_t len = 1; - char* copy = original; + char* copy = &original; // Perform the conversion // We ignore any errors during this as part of robustness/best-effort @@ -91,11 +90,9 @@ convert_encoding(const char* from, const char* to, const char* src, iconv_t iso8859_1to = iconv_open(to,"ISO-8859-1"); if (iso8859_1to != (iconv_t)-1) { iconv(iso8859_1to, 0, 0, 0, 0); - iconv(iso8859_1to, const_cast(©), &len, &dst, - &outputLeft); + iconv(iso8859_1to, ©, &len, &dst, &outputLeft); iconv_close(iso8859_1to); } - delete[] original; break; }