[REACTOS] Fix a number of MSVC warnings

This commit is contained in:
Timo Kreuzer 2021-06-29 18:50:15 +02:00
parent b1c6c91d1f
commit 5d8e834897
43 changed files with 175 additions and 86 deletions

View file

@ -320,7 +320,7 @@ CheckForValidPEAndVendor(
RtlStringCbCopyNW(VendorName->Buffer, VendorName->MaximumLength,
pvData, BufLen * sizeof(WCHAR));
VendorName->Length = wcslen(VendorName->Buffer) * sizeof(WCHAR);
VendorName->Length = (USHORT)wcslen(VendorName->Buffer) * sizeof(WCHAR);
Success = TRUE;
}

View file

@ -78,7 +78,7 @@ CreateNestedKey(PHANDLE KeyHandle,
break;
}
*Ptr = (WCHAR)0;
LocalKeyName.Length = wcslen(LocalKeyName.Buffer) * sizeof(WCHAR);
LocalKeyName.Length = (Ptr - LocalKeyName.Buffer) * sizeof(WCHAR);
Status = NtCreateKey(&LocalKeyHandle,
KEY_CREATE_SUB_KEY,
@ -110,7 +110,7 @@ CreateNestedKey(PHANDLE KeyHandle,
NtClose(LocalKeyHandle);
LocalKeyName.Buffer[LocalKeyName.Length / sizeof(WCHAR)] = L'\\';
LocalKeyName.Length = wcslen(LocalKeyName.Buffer) * sizeof(WCHAR);
LocalKeyName.Length = (USHORT)wcslen(LocalKeyName.Buffer) * sizeof(WCHAR);
Status = NtCreateKey(&LocalKeyHandle,
KEY_ALL_ACCESS,

View file

@ -1026,7 +1026,7 @@ ReadCommand(
{
/* If this character insertion will cause screen scrolling,
* adjust the saved origin of the command prompt. */
tempscreen = strlen(str + current) + curx;
tempscreen = (USHORT)strlen(str + current) + curx;
if ((tempscreen % State->maxx) == (State->maxx - 1) &&
(tempscreen / State->maxx) + cury == (State->maxy - 1))
{

View file

@ -140,7 +140,7 @@ MUIClearPage(
CONSOLE_ClearStyledText(entry[index].X,
entry[index].Y,
entry[index].Flags,
strlen(entry[index].Buffer));
(USHORT)strlen(entry[index].Buffer));
index++;
}
}
@ -347,7 +347,7 @@ MUIClearText(
CONSOLE_ClearTextXY(
entry[Index].X,
entry[Index].Y,
(ULONG)strlen(entry[Index].Buffer));
(USHORT)strlen(entry[Index].Buffer));
/* Increment the index and loop over next entires with the same ID */
Index++;
@ -404,7 +404,7 @@ MUIClearStyledText(
entry[Index].X,
entry[Index].Y,
Flags,
(ULONG)strlen(entry[Index].Buffer));
(USHORT)strlen(entry[Index].Buffer));
/* Increment the index and loop over next entires with the same ID */
Index++;

View file

@ -240,7 +240,7 @@ DrawProgressBar(
if (Bar->UpdateProgressProc &&
Bar->UpdateProgressProc(Bar, TRUE, TextBuffer, ARRAYSIZE(TextBuffer)))
{
coPos.X = Bar->Left + (Bar->Width - strlen(TextBuffer) + 1) / 2;
coPos.X = Bar->Left + (Bar->Width - (USHORT)strlen(TextBuffer) + 1) / 2;
coPos.Y = Bar->Top;
WriteConsoleOutputCharacterA(StdOutput,
TextBuffer,
@ -383,7 +383,7 @@ ProgressSetStep(
if (Bar->UpdateProgressProc &&
Bar->UpdateProgressProc(Bar, FALSE, TextBuffer, ARRAYSIZE(TextBuffer)))
{
coPos.X = Bar->Left + (Bar->Width - strlen(TextBuffer) + 1) / 2;
coPos.X = Bar->Left + (Bar->Width - (USHORT)strlen(TextBuffer) + 1) / 2;
coPos.Y = Bar->Top;
WriteConsoleOutputCharacterA(StdOutput,
TextBuffer,

View file

@ -981,6 +981,7 @@ CabinetExtractFile(
PCFFOLDER CurrentFolder;
LARGE_INTEGER MaxDestFileSize;
LONG InputLength, OutputLength;
SIZE_T StringLength;
char Chunk[512];
if (wcscmp(Search->Cabinet, CabinetContext->CabinetName) != 0)
@ -1039,8 +1040,9 @@ CabinetExtractFile(
{
RtlInitAnsiString(&AnsiString, Search->File->FileName);
wcscpy(DestName, CabinetContext->DestPath);
UnicodeString.MaximumLength = sizeof(DestName) - wcslen(DestName) * sizeof(WCHAR);
UnicodeString.Buffer = DestName + wcslen(DestName);
StringLength = wcslen(DestName);
UnicodeString.MaximumLength = sizeof(DestName) - (USHORT)StringLength * sizeof(WCHAR);
UnicodeString.Buffer = DestName + StringLength;
UnicodeString.Length = 0;
RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, FALSE);

View file

@ -1907,7 +1907,7 @@ ShowPartitionSizeInputBox(SHORT Left,
coPos.X = Left + 2;
coPos.Y = Top + 2;
strcpy(Buffer, MUIGetString(STRING_PARTITIONSIZE));
iLeft = coPos.X + strlen(Buffer) + 1;
iLeft = coPos.X + (USHORT)strlen(Buffer) + 1;
iTop = coPos.Y;
WriteConsoleOutputCharacterA(StdOutput,