mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 08:53:02 +00:00
support CP_SYMBOL in MultiByteToWideChar and WideCharToMultiByte ported from Wine. patch by Daniel Zimmermann <netzimme at aim dot com>
See issue #2870 for more details. svn path=/trunk/; revision=31322
This commit is contained in:
parent
073599e2de
commit
ef9000bca7
1 changed files with 121 additions and 5 deletions
|
@ -497,6 +497,116 @@ IntMultiByteToWideCharCP(UINT CodePage, DWORD Flags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name IntMultiByteToWideCharSYMBOL
|
||||||
|
*
|
||||||
|
* Internal version of MultiByteToWideChar for SYMBOL.
|
||||||
|
*
|
||||||
|
* @see MultiByteToWideChar
|
||||||
|
*/
|
||||||
|
|
||||||
|
static INT STDCALL
|
||||||
|
IntMultiByteToWideCharSYMBOL(DWORD Flags,
|
||||||
|
LPCSTR MultiByteString, INT MultiByteCount,
|
||||||
|
LPWSTR WideCharString, INT WideCharCount)
|
||||||
|
{
|
||||||
|
LONG Count;
|
||||||
|
UCHAR Char;
|
||||||
|
INT WideCharMaxLen;
|
||||||
|
|
||||||
|
|
||||||
|
if (Flags != 0)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_FLAGS);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WideCharCount == 0)
|
||||||
|
{
|
||||||
|
return MultiByteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
WideCharMaxLen = WideCharCount > MultiByteCount ? MultiByteCount : WideCharCount;
|
||||||
|
|
||||||
|
for (Count = 0; Count < WideCharMaxLen; Count++)
|
||||||
|
{
|
||||||
|
Char = MultiByteString[Count];
|
||||||
|
if ( Char < 0x20 )
|
||||||
|
{
|
||||||
|
WideCharString[Count] = Char;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WideCharString[Count] = Char + 0xf000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MultiByteCount > WideCharMaxLen)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return WideCharMaxLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name IntWideCharToMultiByteSYMBOL
|
||||||
|
*
|
||||||
|
* Internal version of WideCharToMultiByte for SYMBOL.
|
||||||
|
*
|
||||||
|
* @see WideCharToMultiByte
|
||||||
|
*/
|
||||||
|
|
||||||
|
static INT STDCALL
|
||||||
|
IntWideCharToMultiByteSYMBOL(DWORD Flags,
|
||||||
|
LPCWSTR WideCharString, INT WideCharCount,
|
||||||
|
LPSTR MultiByteString, INT MultiByteCount)
|
||||||
|
{
|
||||||
|
LONG Count;
|
||||||
|
INT MaxLen;
|
||||||
|
WCHAR Char;
|
||||||
|
|
||||||
|
if (Flags!=0)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( MultiByteCount == 0)
|
||||||
|
{
|
||||||
|
return WideCharCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
MaxLen = MultiByteCount>WideCharCount?WideCharCount:MultiByteCount;
|
||||||
|
for (Count = 0;Count<MaxLen;Count++)
|
||||||
|
{
|
||||||
|
Char = WideCharString[Count];
|
||||||
|
if (Char<0x20)
|
||||||
|
{
|
||||||
|
MultiByteString[Count] = Char;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((Char>=0xf020)&&(Char<0xf100))
|
||||||
|
{
|
||||||
|
MultiByteString[Count] = Char - 0xf000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_NO_UNICODE_TRANSLATION);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( WideCharCount > MaxLen)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return MaxLen;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name IntWideCharToMultiByteUTF8
|
* @name IntWideCharToMultiByteUTF8
|
||||||
*
|
*
|
||||||
|
@ -951,9 +1061,9 @@ MultiByteToWideChar(UINT CodePage, DWORD Flags,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case CP_SYMBOL:
|
case CP_SYMBOL:
|
||||||
DPRINT1("MultiByteToWideChar for CP_SYMBOL is not implemented!\n");
|
return IntMultiByteToWideCharSYMBOL(
|
||||||
return 0;
|
Flags, MultiByteString, MultiByteCount,
|
||||||
|
WideCharString, WideCharCount);
|
||||||
default:
|
default:
|
||||||
return IntMultiByteToWideCharCP(
|
return IntMultiByteToWideCharCP(
|
||||||
CodePage, Flags, MultiByteString, MultiByteCount,
|
CodePage, Flags, MultiByteString, MultiByteCount,
|
||||||
|
@ -1034,8 +1144,14 @@ WideCharToMultiByte(UINT CodePage, DWORD Flags,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case CP_SYMBOL:
|
case CP_SYMBOL:
|
||||||
DPRINT1("WideCharToMultiByte for CP_SYMBOL is not implemented!\n");
|
if ((DefaultChar!=NULL) || (UsedDefaultChar!=NULL))
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
return IntWideCharToMultiByteSYMBOL(
|
||||||
|
Flags,WideCharString,WideCharCount,MultiByteString,
|
||||||
|
MultiByteCount);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return IntWideCharToMultiByteCP(
|
return IntWideCharToMultiByteCP(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue