Commit cd11f29c authored by Uwe Bonnes's avatar Uwe Bonnes Committed by Alexandre Julliard

The API for WideCharToMultiByte says that the src-string has only to be

treated as NULL-terminated if srclen is -1.
parent 0fbe1de1
...@@ -178,6 +178,7 @@ INT32 WINAPI WideCharToMultiByte(UINT32 page, DWORD flags, LPCWSTR src, ...@@ -178,6 +178,7 @@ INT32 WINAPI WideCharToMultiByte(UINT32 page, DWORD flags, LPCWSTR src,
{ {
int count = 0; int count = 0;
int eos = 0; int eos = 0;
int care_for_eos=0;
int dont_copy= (dstlen==0); int dont_copy= (dstlen==0);
if ((!src) | ((!dst) && (!dont_copy)) ) if ((!src) | ((!dst) && (!dont_copy)) )
...@@ -194,7 +195,10 @@ INT32 WINAPI WideCharToMultiByte(UINT32 page, DWORD flags, LPCWSTR src, ...@@ -194,7 +195,10 @@ INT32 WINAPI WideCharToMultiByte(UINT32 page, DWORD flags, LPCWSTR src,
if(used) if(used)
*used=0; *used=0;
if (srclen == -1) if (srclen == -1)
{
srclen = lstrlen32W(src)+1; srclen = lstrlen32W(src)+1;
care_for_eos=1;
}
while(srclen && (dont_copy || dstlen)) while(srclen && (dont_copy || dstlen))
{ {
if(!dont_copy){ if(!dont_copy){
...@@ -215,7 +219,7 @@ INT32 WINAPI WideCharToMultiByte(UINT32 page, DWORD flags, LPCWSTR src, ...@@ -215,7 +219,7 @@ INT32 WINAPI WideCharToMultiByte(UINT32 page, DWORD flags, LPCWSTR src,
} }
count++; count++;
srclen--; srclen--;
if(!*src) { if((!*src) && care_for_eos) {
eos = 1; eos = 1;
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment