iconv: fix case for target and source encoding being same

git-svn-id: svn://kolibrios.org@6894 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
ashmew2 2017-05-13 18:28:22 +00:00
parent a4a06a81a0
commit 950ddc2a93

View File

@ -109,6 +109,20 @@ size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft,
case UTF_8: wctomb=utf8_wctomb; break; case UTF_8: wctomb=utf8_wctomb; break;
default: return -3; 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; count1=0;
count2=0; count2=0;