Mercurial > mplayer.hg
changeset 22413:219d577285e1
Fix and simplify the WideCharToMultiByte and MultiByteToWideChar pseudo-implementations.
author | reimar |
---|---|
date | Sun, 04 Mar 2007 09:04:45 +0000 |
parents | 3fb1371e1697 |
children | 01f781618827 |
files | loader/ext.c |
diffstat | 1 files changed, 10 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/loader/ext.c Sun Mar 04 08:49:24 2007 +0000 +++ b/loader/ext.c Sun Mar 04 09:04:45 2007 +0000 @@ -559,39 +559,25 @@ INT srclen,LPSTR dest, INT destlen, LPCSTR defch, WIN_BOOL* used_defch) { int i; - if(src==0) - return 0; - if ((srclen==-1)&&(dest==0)) return 0; if(srclen==-1){srclen=0; while(src[srclen++]);} -// for(i=0; i<srclen; i++) -// printf("%c", src[i]); -// printf("\n"); - if(dest==0) - { - for(i=0; i<srclen; i++) - { - src++; - if(*src==0) - return i+1; - } - return srclen+1; - } + if(destlen==0) + return srclen; if(used_defch) *used_defch=0; for(i=0; i<min(srclen, destlen); i++) - { - *dest=(char)*src; - dest++; - src++; - if(*src==0) - return i+1; - } + *dest++=(char)*src++; return min(srclen, destlen); } INT WINAPI MultiByteToWideChar(UINT codepage,DWORD flags, LPCSTR src, INT srclen, 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) {