mirror of
https://github.com/mpv-player/mpv
synced 2025-01-29 03:02:53 +00:00
Fix and simplify the WideCharToMultiByte and MultiByteToWideChar pseudo-implementations.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22431 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
8e2bc40df5
commit
2987b207ed
34
loader/ext.c
34
loader/ext.c
@ -559,39 +559,25 @@ INT WINAPI WideCharToMultiByte(UINT codepage, DWORD flags, LPCWSTR src,
|
|||||||
INT srclen,LPSTR dest, INT destlen, LPCSTR defch, WIN_BOOL* used_defch)
|
INT srclen,LPSTR dest, INT destlen, LPCSTR defch, WIN_BOOL* used_defch)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if(src==0)
|
|
||||||
return 0;
|
|
||||||
if ((srclen==-1)&&(dest==0)) return 0;
|
|
||||||
if(srclen==-1){srclen=0; while(src[srclen++]);}
|
if(srclen==-1){srclen=0; while(src[srclen++]);}
|
||||||
// for(i=0; i<srclen; i++)
|
if(destlen==0)
|
||||||
// printf("%c", src[i]);
|
return srclen;
|
||||||
// printf("\n");
|
|
||||||
if(dest==0)
|
|
||||||
{
|
|
||||||
for(i=0; i<srclen; i++)
|
|
||||||
{
|
|
||||||
src++;
|
|
||||||
if(*src==0)
|
|
||||||
return i+1;
|
|
||||||
}
|
|
||||||
return srclen+1;
|
|
||||||
}
|
|
||||||
if(used_defch)
|
if(used_defch)
|
||||||
*used_defch=0;
|
*used_defch=0;
|
||||||
for(i=0; i<min(srclen, destlen); i++)
|
for(i=0; i<min(srclen, destlen); i++)
|
||||||
{
|
*dest++=(char)*src++;
|
||||||
*dest=(char)*src;
|
|
||||||
dest++;
|
|
||||||
src++;
|
|
||||||
if(*src==0)
|
|
||||||
return i+1;
|
|
||||||
}
|
|
||||||
return min(srclen, destlen);
|
return min(srclen, destlen);
|
||||||
}
|
}
|
||||||
INT WINAPI MultiByteToWideChar(UINT codepage,DWORD flags, LPCSTR src, INT srclen,
|
INT WINAPI MultiByteToWideChar(UINT codepage,DWORD flags, LPCSTR src, INT srclen,
|
||||||
LPWSTR dest, INT destlen)
|
LPWSTR dest, INT destlen)
|
||||||
{
|
{
|
||||||
return 0;
|
int i;
|
||||||
|
if(srclen==-1){srclen=0; while(src[srclen++]);}
|
||||||
|
if(destlen==0)
|
||||||
|
return srclen;
|
||||||
|
for(i=0; i<min(srclen, destlen); i++)
|
||||||
|
*dest++=(WCHAR)*src++;
|
||||||
|
return min(srclen, destlen);
|
||||||
}
|
}
|
||||||
HANDLE WINAPI OpenFileMappingA(DWORD access, WIN_BOOL prot, LPCSTR name)
|
HANDLE WINAPI OpenFileMappingA(DWORD access, WIN_BOOL prot, LPCSTR name)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user