From 950ddc2a935d21c10d2b0a39e7840e5f825eec0a Mon Sep 17 00:00:00 2001 From: ashmew2 Date: Sat, 13 May 2017 18:28:22 +0000 Subject: [PATCH] iconv: fix case for target and source encoding being same git-svn-id: svn://kolibrios.org@6894 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/libraries/iconv/iconv.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/programs/develop/libraries/iconv/iconv.c b/programs/develop/libraries/iconv/iconv.c index 0781f32551..572c3b7a82 100644 --- a/programs/develop/libraries/iconv/iconv.c +++ b/programs/develop/libraries/iconv/iconv.c @@ -109,6 +109,20 @@ size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, case UTF_8: wctomb=utf8_wctomb; break; default: return -3; } + + if(from == to) { + int oc=0,ic=0; + + while(*inbytesleft > 0 && *outbytesleft > 0) { + str[oc]=(*inbuf)[ic]; + ++ic; + ++oc; + (*inbytesleft)--; + (*outbytesleft)--; + } + + return 0; + } count1=0; count2=0;