fix: iconv to/from unpacking order and calling convention (#126) (#127)
Build system / Check kernel codestyle (pull_request) Successful in 1m32s
Build system / Build (pull_request) Successful in 11m41s

swapped unpacking order of to and from and caller parameters
     removed null terminator adding at end
     changed call from stdcall to cdecl
This commit was merged in pull request #387.
This commit is contained in:
2026-03-22 23:27:14 -04:00
committed by Burer
parent f305d3425d
commit de6724017d
2 changed files with 5 additions and 6 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ dword ChangeCharset(dword from_chs, to_chs, conv_buf)
{
dword cd, in_len, out_len, new_buf;
iconv_open stdcall (from_chs*10+#charsets, to_chs*10+#charsets);
iconv_open cdecl (to_chs*10+#charsets, from_chs*10+#charsets);
if (EAX==-1) {
debugln("iconv: unsupported charset");
return 0;
@@ -37,7 +37,7 @@ dword ChangeCharset(dword from_chs, to_chs, conv_buf)
in_len = strlen(conv_buf)+1;
out_len = in_len * 2;
new_buf = mem_Alloc(out_len);
iconv stdcall (cd, #conv_buf, #in_len, #new_buf, #out_len);
iconv cdecl (cd, #conv_buf, #in_len, #new_buf, #out_len);
if (EAX!=0)
{
cd = EAX;
+3 -4
View File
@@ -64,8 +64,8 @@ size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf,
char *str;
str=*outbuf;
from=cd>>16;
to=cd&0xFFFF;
to=cd>>16;
from=cd&0xFFFF;
switch (from)
{
@@ -92,7 +92,7 @@ size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf,
count1=0;
count2=0;
while ( *inbytesleft>0 && *outbytesleft>1)
while (*inbytesleft>0 && *outbytesleft>1)
{
n=1;
@@ -116,7 +116,6 @@ size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf,
count1+=converted;
count2+=written;
}
*(str+count2)='\0';
if (*inbytesleft>0 && *outbytesleft==0) return -12;
return 0;