From 5550a1f54e158675f84f09f4a1d7a292ccd9a04d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 14 Sep 2013 10:20:11 +0000 Subject: [PATCH] [KERNEL32] Fix MSVC warnings. svn path=/trunk/; revision=60095 --- .../dll/win32/kernel32/client/console/init.c | 10 ++--- .../win32/kernel32/client/console/readwrite.c | 2 +- reactos/dll/win32/kernel32/client/environ.c | 26 ++++++------ .../dll/win32/kernel32/client/file/create.c | 8 ++-- reactos/dll/win32/kernel32/client/loader.c | 2 +- reactos/dll/win32/kernel32/client/path.c | 24 +++++------ reactos/dll/win32/kernel32/client/power.c | 2 +- reactos/dll/win32/kernel32/client/proc.c | 9 ++-- reactos/dll/win32/kernel32/client/thread.c | 2 +- reactos/dll/win32/kernel32/client/time.c | 2 +- reactos/dll/win32/kernel32/client/vdm.c | 4 +- .../win32/kernel32/winnls/string/format_msg.c | 10 ++--- .../dll/win32/kernel32/winnls/string/nls.c | 41 ++++++++++--------- 13 files changed, 72 insertions(+), 70 deletions(-) diff --git a/reactos/dll/win32/kernel32/client/console/init.c b/reactos/dll/win32/kernel32/client/console/init.c index 80a7dffb79b..5c90ddf9c61 100644 --- a/reactos/dll/win32/kernel32/client/console/init.c +++ b/reactos/dll/win32/kernel32/client/console/init.c @@ -121,7 +121,7 @@ InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo, ConsoleStartInfo->dwStartupFlags = si.dwFlags; if (si.dwFlags & STARTF_USEFILLATTRIBUTE) { - ConsoleStartInfo->wFillAttribute = si.dwFillAttribute; + ConsoleStartInfo->wFillAttribute = (WORD)si.dwFillAttribute; } if (si.dwFlags & STARTF_USECOUNTCHARS) { @@ -134,13 +134,13 @@ InitConsoleInfo(IN OUT PCONSOLE_START_INFO ConsoleStartInfo, } if (si.dwFlags & STARTF_USEPOSITION) { - ConsoleStartInfo->dwWindowOrigin.X = (LONG)(si.dwX); - ConsoleStartInfo->dwWindowOrigin.Y = (LONG)(si.dwY); + ConsoleStartInfo->dwWindowOrigin.X = (SHORT)(si.dwX); + ConsoleStartInfo->dwWindowOrigin.Y = (SHORT)(si.dwY); } if (si.dwFlags & STARTF_USESIZE) { - ConsoleStartInfo->dwWindowSize.X = (LONG)(si.dwXSize); - ConsoleStartInfo->dwWindowSize.Y = (LONG) (si.dwYSize); + ConsoleStartInfo->dwWindowSize.X = (SHORT)(si.dwXSize); + ConsoleStartInfo->dwWindowSize.Y = (SHORT)(si.dwYSize); } /* Set up the title for the console */ diff --git a/reactos/dll/win32/kernel32/client/console/readwrite.c b/reactos/dll/win32/kernel32/client/console/readwrite.c index 942c534389e..a2c8b9c1561 100644 --- a/reactos/dll/win32/kernel32/client/console/readwrite.c +++ b/reactos/dll/win32/kernel32/client/console/readwrite.c @@ -660,7 +660,7 @@ IntWriteConsoleOutputCode(HANDLE hConsoleOutput, WriteOutputCodeRequest->CodeType = CodeType; WriteOutputCodeRequest->Coord = dwWriteCoord; - WriteOutputCodeRequest->Length = nLength; + WriteOutputCodeRequest->Length = (USHORT)nLength; /* Call the server */ Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, diff --git a/reactos/dll/win32/kernel32/client/environ.c b/reactos/dll/win32/kernel32/client/environ.c index 8948980633a..e1c191d8dd8 100644 --- a/reactos/dll/win32/kernel32/client/environ.c +++ b/reactos/dll/win32/kernel32/client/environ.c @@ -50,7 +50,7 @@ GetEnvironmentVariableA(IN LPCSTR lpName, if (nSize) { /* Keep the given size, minus a NULL-char */ - UniSize = nSize - 1; + UniSize = (USHORT)(nSize - 1); } else { @@ -114,7 +114,7 @@ GetEnvironmentVariableA(IN LPCSTR lpName, { /* Check if the size is too big to fit */ UniSize = UNICODE_STRING_MAX_BYTES - 1; - if (nSize <= UniSize) UniSize = nSize; + if (nSize <= UniSize) UniSize = (USHORT)nSize; /* Check the size */ Result = RtlUnicodeStringToAnsiSize(&VarValueU); @@ -169,7 +169,7 @@ GetEnvironmentVariableW(IN LPCWSTR lpName, { if (nSize) { - UniSize = nSize * sizeof(WCHAR) - sizeof(UNICODE_NULL); + UniSize = (USHORT)nSize * sizeof(WCHAR) - sizeof(UNICODE_NULL); } else { @@ -180,7 +180,7 @@ GetEnvironmentVariableW(IN LPCWSTR lpName, { UniSize = UNICODE_STRING_MAX_BYTES - sizeof(UNICODE_NULL); } - + Status = RtlInitUnicodeStringEx(&VarName, lpName); if (!NT_SUCCESS(Status)) { @@ -404,11 +404,11 @@ ExpandEnvironmentStringsA(IN LPCSTR lpSrc, /* Check if the size is too big to fit */ UniSize = UNICODE_STRING_MAX_CHARS - 2; - if (nSize <= UniSize) UniSize = nSize; - + if (nSize <= UniSize) UniSize = (USHORT)nSize; + /* Clear the input buffer */ if (lpDst) *lpDst = ANSI_NULL; - + /* Initialize all the strings */ RtlInitAnsiString(&Source, lpSrc); RtlInitUnicodeString(&SourceU, NULL); @@ -446,7 +446,7 @@ ExpandEnvironmentStringsA(IN LPCSTR lpSrc, if (!(NT_SUCCESS(Status)) && (Status == STATUS_BUFFER_TOO_SMALL)) { /* Fixup the length that the API returned */ - DestU.MaximumLength = Length; + DestU.MaximumLength = (SHORT)Length; /* Free old Unicode buffer */ RtlFreeHeap(RtlGetProcessHeap(), 0, DestU.Buffer); @@ -474,7 +474,7 @@ ExpandEnvironmentStringsA(IN LPCSTR lpSrc, { /* Check if the size is too big to fit */ UniSize = UNICODE_STRING_MAX_BYTES - 1; - if (nSize <= UniSize) UniSize = nSize; + if (nSize <= UniSize) UniSize = (USHORT)nSize; /* Check the size */ Result = RtlUnicodeStringToAnsiSize(&DestU); @@ -483,7 +483,7 @@ ExpandEnvironmentStringsA(IN LPCSTR lpSrc, /* Convert the string */ RtlInitEmptyAnsiString(&Dest, lpDst, UniSize); Status = RtlUnicodeStringToAnsiString(&Dest, &DestU, FALSE); - + /* Write a NULL-char in case of failure only */ if (!NT_SUCCESS(Status)) *lpDst = ANSI_NULL; } @@ -517,13 +517,13 @@ ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, UNICODE_STRING Source, Destination; NTSTATUS Status; USHORT UniSize; - + UniSize = UNICODE_STRING_MAX_CHARS - 2; - if (nSize <= UniSize) UniSize = nSize; + if (nSize <= UniSize) UniSize = (USHORT)nSize; RtlInitUnicodeString(&Source, (LPWSTR)lpSrc); RtlInitEmptyUnicodeString(&Destination, lpDst, UniSize * sizeof(WCHAR)); - + Status = RtlExpandEnvironmentStrings_U(NULL, &Source, &Destination, diff --git a/reactos/dll/win32/kernel32/client/file/create.c b/reactos/dll/win32/kernel32/client/file/create.c index c1923d0d755..a9d2bbcb716 100644 --- a/reactos/dll/win32/kernel32/client/file/create.c +++ b/reactos/dll/win32/kernel32/client/file/create.c @@ -418,7 +418,7 @@ OpenFile(LPCSTR lpFileName, lpReOpenBuff->szPathName, NULL)) { - lpReOpenBuff->nErrCode = GetLastError(); + lpReOpenBuff->nErrCode = (WORD)GetLastError(); return HFILE_ERROR; } @@ -492,7 +492,7 @@ OpenFile(LPCSTR lpFileName, if (Len == 0 || Len > OFS_MAXPATHNAME) { - lpReOpenBuff->nErrCode = GetLastError(); + lpReOpenBuff->nErrCode = (WORD)GetLastError(); return (HFILE)INVALID_HANDLE_VALUE; } @@ -500,7 +500,7 @@ OpenFile(LPCSTR lpFileName, { if (!DeleteFileW(PathNameW)) { - lpReOpenBuff->nErrCode = GetLastError(); + lpReOpenBuff->nErrCode = (WORD)GetLastError(); return HFILE_ERROR; } TRACE("(%s): OF_DELETE return = OK\n", lpFileName); @@ -546,7 +546,7 @@ OpenFile(LPCSTR lpFileName, RtlFreeHeap(RtlGetProcessHeap(), 0, FileNameString.Buffer); - lpReOpenBuff->nErrCode = RtlNtStatusToDosError(errCode); + lpReOpenBuff->nErrCode = (WORD)RtlNtStatusToDosError(errCode); if (!NT_SUCCESS(errCode)) { diff --git a/reactos/dll/win32/kernel32/client/loader.c b/reactos/dll/win32/kernel32/client/loader.c index 82011e22e52..d2dfce9a623 100644 --- a/reactos/dll/win32/kernel32/client/loader.c +++ b/reactos/dll/win32/kernel32/client/loader.c @@ -552,7 +552,7 @@ GetModuleFileNameA(HINSTANCE hModule, } /* Call unicode API */ - FilenameW.Length = GetModuleFileNameW(hModule, FilenameW.Buffer, nSize) * sizeof(WCHAR); + FilenameW.Length = (USHORT)GetModuleFileNameW(hModule, FilenameW.Buffer, nSize) * sizeof(WCHAR); FilenameW.MaximumLength = FilenameW.Length + sizeof(WCHAR); if (FilenameW.Length) diff --git a/reactos/dll/win32/kernel32/client/path.c b/reactos/dll/win32/kernel32/client/path.c index b2d0d795c32..dd0c4f65b92 100644 --- a/reactos/dll/win32/kernel32/client/path.c +++ b/reactos/dll/win32/kernel32/client/path.c @@ -557,7 +557,7 @@ IsShortName_U(IN PWCHAR Name, IN ULONG Length) { BOOLEAN HasExtension; - WCHAR c; + UCHAR c; NTSTATUS Status; UNICODE_STRING UnicodeName; ANSI_STRING AnsiName; @@ -587,7 +587,7 @@ IsShortName_U(IN PWCHAR Name, /* Initialize our two strings */ RtlInitEmptyAnsiString(&AnsiName, AnsiBuffer, MAX_PATH); - RtlInitEmptyUnicodeString(&UnicodeName, Name, Length * sizeof(WCHAR)); + RtlInitEmptyUnicodeString(&UnicodeName, Name, (USHORT)Length * sizeof(WCHAR)); UnicodeName.Length = UnicodeName.MaximumLength; /* Now do the conversion */ @@ -914,7 +914,7 @@ GetDllDirectoryA(IN DWORD nBufferLength, ANSI_STRING AnsiDllDirectory; ULONG Length; - RtlInitEmptyAnsiString(&AnsiDllDirectory, lpBuffer, nBufferLength); + RtlInitEmptyAnsiString(&AnsiDllDirectory, lpBuffer, (USHORT)nBufferLength); RtlEnterCriticalSection(&BaseDllDirectoryLock); @@ -1363,7 +1363,7 @@ SearchPathW(IN LPCWSTR lpPath, } /* Set the path size now that we have it */ - PathString.MaximumLength = PathString.Length = LengthNeeded * sizeof(WCHAR); + PathString.MaximumLength = PathString.Length = (USHORT)LengthNeeded * sizeof(WCHAR); /* Request SxS isolation from RtlDosSearchPath_Ustr */ Flags |= 1; @@ -1377,7 +1377,7 @@ SearchPathW(IN LPCWSTR lpPath, if (nBufferLength <= UNICODE_STRING_MAX_CHARS) { /* Add it into the string */ - CallerBuffer.MaximumLength = nBufferLength * sizeof(WCHAR); + CallerBuffer.MaximumLength = (USHORT)nBufferLength * sizeof(WCHAR); } else { @@ -1707,9 +1707,9 @@ GetLongPathNameA(IN LPCSTR lpszShortPath, if (!PathLength) goto Quickie; - ShortPathUni.MaximumLength = PathLength * sizeof(WCHAR) + sizeof(UNICODE_NULL); + ShortPathUni.MaximumLength = (USHORT)PathLength * sizeof(WCHAR) + sizeof(UNICODE_NULL); LongPathUni.Buffer = LongPath; - LongPathUni.Length = PathLength * sizeof(WCHAR); + LongPathUni.Length = (USHORT)PathLength * sizeof(WCHAR); Status = BasepUnicodeStringTo8BitString(&LongPathAnsi, &LongPathUni, TRUE); if (!NT_SUCCESS(Status)) @@ -1788,9 +1788,9 @@ GetShortPathNameA(IN LPCSTR lpszLongPath, if (!PathLength) goto Quickie; - LongPathUni.MaximumLength = PathLength * sizeof(WCHAR) + sizeof(UNICODE_NULL); + LongPathUni.MaximumLength = (USHORT)PathLength * sizeof(WCHAR) + sizeof(UNICODE_NULL); ShortPathUni.Buffer = ShortPath; - ShortPathUni.Length = PathLength * sizeof(WCHAR); + ShortPathUni.Length = (USHORT)PathLength * sizeof(WCHAR); Status = BasepUnicodeStringTo8BitString(&ShortPathAnsi, &ShortPathUni, TRUE); if (!NT_SUCCESS(Status)) @@ -2150,8 +2150,8 @@ GetCurrentDirectoryA(IN DWORD nBufferLength, MaxLength = UNICODE_STRING_MAX_BYTES - 1; } - StaticString->Length = RtlGetCurrentDirectory_U(StaticString->MaximumLength, - StaticString->Buffer); + StaticString->Length = (USHORT)RtlGetCurrentDirectory_U(StaticString->MaximumLength, + StaticString->Buffer); Status = RtlUnicodeToMultiByteSize(&nBufferLength, StaticString->Buffer, StaticString->Length); @@ -2167,7 +2167,7 @@ GetCurrentDirectoryA(IN DWORD nBufferLength, } AnsiString.Buffer = lpBuffer; - AnsiString.MaximumLength = MaxLength; + AnsiString.MaximumLength = (USHORT)MaxLength; Status = BasepUnicodeStringTo8BitString(&AnsiString, StaticString, FALSE); if (!NT_SUCCESS(Status)) { diff --git a/reactos/dll/win32/kernel32/client/power.c b/reactos/dll/win32/kernel32/client/power.c index 795217809d4..411d209571d 100644 --- a/reactos/dll/win32/kernel32/client/power.c +++ b/reactos/dll/win32/kernel32/client/power.c @@ -53,7 +53,7 @@ GetSystemPowerStatus(IN LPSYSTEM_POWER_STATUS PowerStatus) { if (Current <= Max) { - PowerStatus->BatteryLifePercent = (100 * Current + Max / 2) / Max; + PowerStatus->BatteryLifePercent = (UCHAR)((100 * Current + Max / 2) / Max); } else { diff --git a/reactos/dll/win32/kernel32/client/proc.c b/reactos/dll/win32/kernel32/client/proc.c index 6a1f7a7f704..9e548e881b8 100644 --- a/reactos/dll/win32/kernel32/client/proc.c +++ b/reactos/dll/win32/kernel32/client/proc.c @@ -102,7 +102,7 @@ BuildSubSysCommandLine(IN LPCWSTR SubsystemName, /* Allocate buffer for the output string */ Length = CommandLineString.MaximumLength + ApplicationNameString.MaximumLength + 32; Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length); - RtlInitEmptyUnicodeString(SubsysCommandLine, Buffer, Length); + RtlInitEmptyUnicodeString(SubsysCommandLine, Buffer, (USHORT)Length); if (!Buffer) { /* Fail, no memory */ @@ -2295,7 +2295,8 @@ CreateProcessInternalW(IN HANDLE hUserToken, SECTION_IMAGE_INFORMATION ImageInformation; IO_STATUS_BLOCK IoStatusBlock; CLIENT_ID ClientId; - ULONG NoWindow, RegionSize, StackSize, ImageMachine, ErrorCode, Flags; + ULONG NoWindow, RegionSize, StackSize, ErrorCode, Flags; + USHORT ImageMachine; ULONG ParameterFlags, PrivilegeValue, HardErrorMode, ErrorResponse; ULONG_PTR ErrorParameters[2]; BOOLEAN InJob, SaferNeeded, UseLargePages, HavePrivilege; @@ -2576,7 +2577,7 @@ CreateProcessInternalW(IN HANDLE hUserToken, } /* Use the allocated size and convert */ - UnicodeEnv.MaximumLength = RegionSize; + UnicodeEnv.MaximumLength = (USHORT)RegionSize; Status = RtlAnsiStringToUnicodeString(&UnicodeEnv, &AnsiEnv, FALSE); if (!NT_SUCCESS(Status)) { @@ -3784,7 +3785,7 @@ StartScan: /* Set the length */ RtlInitEmptyUnicodeString(&DebuggerString, DebuggerString.Buffer, - n); + (USHORT)n); /* Now perform the command line creation */ ImageDbgStatus = RtlAppendUnicodeToString(&DebuggerString, diff --git a/reactos/dll/win32/kernel32/client/thread.c b/reactos/dll/win32/kernel32/client/thread.c index 457b7a025ac..e89eefd753c 100644 --- a/reactos/dll/win32/kernel32/client/thread.c +++ b/reactos/dll/win32/kernel32/client/thread.c @@ -920,7 +920,7 @@ WINAPI SetThreadUILanguage(IN LANGID LangId) { UNIMPLEMENTED; - return NtCurrentTeb()->CurrentLocale; + return (LANGID)NtCurrentTeb()->CurrentLocale; } /* diff --git a/reactos/dll/win32/kernel32/client/time.c b/reactos/dll/win32/kernel32/client/time.c index 8a6835cb8d5..aee6d8ab169 100644 --- a/reactos/dll/win32/kernel32/client/time.c +++ b/reactos/dll/win32/kernel32/client/time.c @@ -531,7 +531,7 @@ GetSystemTimes(OUT LPFILETIME lpIdleTime OPTIONAL, PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION ProcPerfInfo; LARGE_INTEGER TotalUserTime, TotalKernTime, TotalIdleTime; SIZE_T BufferSize, ReturnLength; - ULONG i; + CCHAR i; NTSTATUS Status; TotalUserTime.QuadPart = TotalKernTime.QuadPart = TotalIdleTime.QuadPart = 0; diff --git a/reactos/dll/win32/kernel32/client/vdm.c b/reactos/dll/win32/kernel32/client/vdm.c index e53ae265b78..00793177980 100644 --- a/reactos/dll/win32/kernel32/client/vdm.c +++ b/reactos/dll/win32/kernel32/client/vdm.c @@ -382,8 +382,8 @@ BaseCreateVDMEnvironment(IN PWCHAR lpEnvironment, /* Initialize the unicode string to hold it */ EnvironmentSize = (p - NewEnvironment) * sizeof(WCHAR); - RtlInitEmptyUnicodeString(UnicodeEnv, NewEnvironment, EnvironmentSize); - UnicodeEnv->Length = EnvironmentSize; + RtlInitEmptyUnicodeString(UnicodeEnv, NewEnvironment, (USHORT)EnvironmentSize); + UnicodeEnv->Length = (USHORT)EnvironmentSize; /* Create the ASCII version of it */ Status = RtlUnicodeStringToAnsiString(AnsiEnv, UnicodeEnv, TRUE); diff --git a/reactos/dll/win32/kernel32/winnls/string/format_msg.c b/reactos/dll/win32/kernel32/winnls/string/format_msg.c index 99a8b158188..89307ff415a 100644 --- a/reactos/dll/win32/kernel32/winnls/string/format_msg.c +++ b/reactos/dll/win32/kernel32/winnls/string/format_msg.c @@ -212,7 +212,7 @@ static LPCWSTR format_insert( BOOL unicode_caller, int insert, LPCWSTR format, (unicode_caller && format[0] == 'C') || (!unicode_caller && format[0] == 'c')) { - char ch = arg; + char ch = (char)arg; wstring = HeapAlloc( GetProcessHeap(), 0, 2 * sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, &ch, 1, wstring, 1 ); wstring[1] = 0; @@ -446,9 +446,9 @@ DWORD WINAPI FormatMessageA( else if (dwFlags & (FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_FROM_SYSTEM)) { if (dwFlags & FORMAT_MESSAGE_FROM_HMODULE) - from = load_message( (HMODULE)lpSource, dwMessageId, dwLanguageId ); + from = load_message( (HMODULE)lpSource, dwMessageId, (WORD)dwLanguageId ); if (!from && (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM)) - from = load_message( kernel32_handle, dwMessageId, dwLanguageId ); + from = load_message( kernel32_handle, dwMessageId, (WORD)dwLanguageId ); if (!from) return 0; } else @@ -549,9 +549,9 @@ DWORD WINAPI FormatMessageW( else if (dwFlags & (FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_FROM_SYSTEM)) { if (dwFlags & FORMAT_MESSAGE_FROM_HMODULE) - from = load_message( (HMODULE)lpSource, dwMessageId, dwLanguageId ); + from = load_message( (HMODULE)lpSource, dwMessageId, (WORD)dwLanguageId ); if (!from && (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM)) - from = load_message( kernel32_handle, dwMessageId, dwLanguageId ); + from = load_message( kernel32_handle, dwMessageId, (WORD)dwLanguageId ); if (!from) return 0; } else diff --git a/reactos/dll/win32/kernel32/winnls/string/nls.c b/reactos/dll/win32/kernel32/winnls/string/nls.c index 252e22e6bfe..b64544e6a42 100644 --- a/reactos/dll/win32/kernel32/winnls/string/nls.c +++ b/reactos/dll/win32/kernel32/winnls/string/nls.c @@ -551,10 +551,10 @@ IntMultiByteToWideCharCP(UINT CodePage, static INT -WINAPI -IntMultiByteToWideCharSYMBOL(DWORD Flags, +WINAPI +IntMultiByteToWideCharSYMBOL(DWORD Flags, LPCSTR MultiByteString, - INT MultiByteCount, + INT MultiByteCount, LPWSTR WideCharString, INT WideCharCount) { @@ -569,7 +569,7 @@ IntMultiByteToWideCharSYMBOL(DWORD Flags, return 0; } - if (WideCharCount == 0) + if (WideCharCount == 0) { return MultiByteCount; } @@ -588,7 +588,7 @@ IntMultiByteToWideCharSYMBOL(DWORD Flags, WideCharString[Count] = Char + 0xf000; } } - if (MultiByteCount > WideCharMaxLen) + if (MultiByteCount > WideCharMaxLen) { SetLastError(ERROR_INSUFFICIENT_BUFFER); return 0; @@ -624,7 +624,7 @@ IntWideCharToMultiByteSYMBOL(DWORD Flags, } - if (MultiByteCount == 0) + if (MultiByteCount == 0) { return WideCharCount; } @@ -635,11 +635,11 @@ IntWideCharToMultiByteSYMBOL(DWORD Flags, Char = WideCharString[Count]; if (Char < 0x20) { - MultiByteString[Count] = Char; + MultiByteString[Count] = (CHAR)Char; } - else + else { - if ((Char>=0xf020)&&(Char<0xf100)) + if ((Char >= 0xf020) && (Char < 0xf100)) { MultiByteString[Count] = Char - 0xf000; } @@ -650,7 +650,8 @@ IntWideCharToMultiByteSYMBOL(DWORD Flags, } } } - if (WideCharCount > MaxLen) + + if (WideCharCount > MaxLen) { SetLastError(ERROR_INSUFFICIENT_BUFFER); return 0; @@ -1013,7 +1014,7 @@ IntWideCharToMultiByteCP(UINT CodePage, if (DefaultChar) DefChar = *DefaultChar; else - DefChar = CodePageTable->TransDefaultChar; + DefChar = (CHAR)CodePageTable->TransDefaultChar; /* Convert the WideCharString to the MultiByteString and verify if the mapping is valid */ for (TempLength = MultiByteCount; @@ -1259,16 +1260,16 @@ IsValidCodePage(UINT CodePage) return GetCPFileNameFromRegistry(CodePage, NULL, 0); } -static const signed char -base64inv[] = +static const signed char +base64inv[] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, - -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 }; @@ -1334,7 +1335,7 @@ static INT Utf7ToWideCharSize(LPCSTR pszUtf7, INT cchUtf7) } cchUtf7--; pch = pszUtf7; - while(cchUtf7 > 0 && (BYTE) *pszUtf7 < 0x80 && + while(cchUtf7 > 0 && (BYTE) *pszUtf7 < 0x80 && base64inv[*pszUtf7] >= 0) { cchUtf7--; @@ -1390,7 +1391,7 @@ static INT Utf7ToWideChar(LPCSTR pszUtf7, INT cchUtf7, LPWSTR pszWide, INT cchWi } cchUtf7--; pch = pszUtf7; - while(cchUtf7 > 0 && (BYTE) *pszUtf7 < 0x80 && + while(cchUtf7 > 0 && (BYTE) *pszUtf7 < 0x80 && base64inv[*pszUtf7] >= 0) { cchUtf7--; @@ -2166,5 +2167,5 @@ GetNLSVersion(IN NLS_FUNCTION Function, STUB; return TRUE; } - + /* EOF */