Fix some MSVC warnings (type conversions).
Ready for merging (TM) :)
svn path=/branches/ros-csrss/; revision=58758
sizeof(LuidEnabled),
NULL);
ASSERT(NT_SUCCESS(Status));
- BaseStaticServerData->LUIDDeviceMapsEnabled = LuidEnabled;
+ BaseStaticServerData->LUIDDeviceMapsEnabled = (BOOLEAN)LuidEnabled;
if (!BaseStaticServerData->LUIDDeviceMapsEnabled)
{
/* Make Global point back to BNO */
if (Console->LineBuffer == NULL)
{
/* Starting a new line */
- Console->LineMaxSize = max(256, nNumberOfCharsToRead);
+ Console->LineMaxSize = (WORD)max(256, nNumberOfCharsToRead);
Console->LineBuffer = RtlAllocateHeap(ConSrvHeap, 0, Console->LineMaxSize * sizeof(WCHAR));
if (Console->LineBuffer == NULL)
{
ClearLineBuffer(PCONSOLE_SCREEN_BUFFER Buff)
{
PBYTE Ptr = ConioCoordToPointer(Buff, 0, Buff->CursorPosition.Y);
- UINT Pos;
+ SHORT Pos;
for (Pos = 0; Pos < Buff->ScreenBufferSize.X; Pos++)
{
/* Fill the cell */
*Ptr++ = ' ';
- *Ptr++ = Buff->ScreenDefaultAttrib;
+ *Ptr++ = (BYTE)Buff->ScreenDefaultAttrib;
}
}
UINT i;
PBYTE Ptr;
SMALL_RECT UpdateRect;
- LONG CursorStartX, CursorStartY;
+ SHORT CursorStartX, CursorStartY;
UINT ScrolledLines;
CursorStartX = Buff->CursorPosition.X;
if (Buffer[i] == '\r')
{
Buff->CursorPosition.X = 0;
- UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CursorPosition.X);
- UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CursorPosition.X);
+ UpdateRect.Left = min(UpdateRect.Left, Buff->CursorPosition.X);
+ UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X);
continue;
}
/* --- LF --- */
/* slide virtual position up */
Buff->CursorPosition.X = Buff->ScreenBufferSize.X - 1;
Buff->CursorPosition.Y--;
- UpdateRect.Top = min(UpdateRect.Top, (LONG)Buff->CursorPosition.Y);
+ UpdateRect.Top = min(UpdateRect.Top, Buff->CursorPosition.Y);
}
else
{
}
Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y);
Ptr[0] = ' ';
- Ptr[1] = Buff->ScreenDefaultAttrib;
- UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CursorPosition.X);
- UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CursorPosition.X);
+ Ptr[1] = (BYTE)Buff->ScreenDefaultAttrib;
+ UpdateRect.Left = min(UpdateRect.Left, Buff->CursorPosition.X);
+ UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X);
}
continue;
}
{
UINT EndX;
- UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CursorPosition.X);
+ UpdateRect.Left = min(UpdateRect.Left, Buff->CursorPosition.X);
EndX = (Buff->CursorPosition.X + TAB_WIDTH) & ~(TAB_WIDTH - 1);
- EndX = min(EndX, Buff->ScreenBufferSize.X);
+ EndX = min(EndX, (UINT)Buff->ScreenBufferSize.X);
Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y);
while (Buff->CursorPosition.X < EndX)
{
*Ptr++ = ' ';
- *Ptr++ = Buff->ScreenDefaultAttrib;
+ *Ptr++ = (BYTE)Buff->ScreenDefaultAttrib;
Buff->CursorPosition.X++;
}
- UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CursorPosition.X - 1);
+ UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X - 1);
if (Buff->CursorPosition.X == Buff->ScreenBufferSize.X)
{
if (Buff->Mode & ENABLE_WRAP_AT_EOL_OUTPUT)
// continue;
// }
}
- UpdateRect.Left = min(UpdateRect.Left, (LONG)Buff->CursorPosition.X);
- UpdateRect.Right = max(UpdateRect.Right, (LONG)Buff->CursorPosition.X);
+ UpdateRect.Left = min(UpdateRect.Left, Buff->CursorPosition.X);
+ UpdateRect.Right = max(UpdateRect.Right, Buff->CursorPosition.X);
Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y);
Ptr[0] = Buffer[i];
if (Attrib)
{
- Ptr[1] = Buff->ScreenDefaultAttrib;
+ Ptr[1] = (BYTE)Buff->ScreenDefaultAttrib;
}
Buff->CursorPosition.X++;
if (Buff->CursorPosition.X == Buff->ScreenBufferSize.X)
if (!ConioIsRectEmpty(&UpdateRect) && Buff == Console->ActiveBuffer)
{
- ConioWriteStream(Console, &UpdateRect, CursorStartX, CursorStartY, ScrolledLines,
- Buffer, Length);
+ ConioWriteStream(Console, &UpdateRect, CursorStartX, CursorStartY,
+ ScrolledLines, Buffer, Length);
}
return STATUS_SUCCESS;
for (i = 0; i < diff; i++)
{
Buffer[Offset++] = ' ';
- Buffer[Offset++] = ScreenBuffer->ScreenDefaultAttrib;
+ Buffer[Offset++] = (BYTE)ScreenBuffer->ScreenDefaultAttrib;
}
#endif
}
for (i = 0; i < diff; i++)
{
Buffer[Offset++] = ' ';
- Buffer[Offset++] = ScreenBuffer->ScreenDefaultAttrib;
+ Buffer[Offset++] = (BYTE)ScreenBuffer->ScreenDefaultAttrib;
}
#endif
}
PCHAR_INFO CharInfo;
PCHAR_INFO CurCharInfo;
PCONSOLE_SCREEN_BUFFER Buff;
- DWORD SizeX, SizeY;
+ SHORT SizeX, SizeY;
NTSTATUS Status;
COORD BufferSize;
COORD BufferCoord;
AsciiChar = CurCharInfo->Char.AsciiChar;
}
*Ptr++ = AsciiChar;
- *Ptr++ = CurCharInfo->Attributes;
+ *Ptr++ = (BYTE)CurCharInfo->Attributes;
CurCharInfo++;
}
}
PCONSOLE Console;
PCONSOLE_SCREEN_BUFFER Buff;
USHORT CodeType;
- DWORD Xpos, Ypos;
+ SHORT Xpos, Ypos;
PVOID ReadBuffer;
DWORD i;
ULONG CodeSize;
PCONSOLE_SETCURSORPOSITION SetCursorPositionRequest = &((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetCursorPositionRequest;
PCONSOLE Console;
PCONSOLE_SCREEN_BUFFER Buff;
- LONG OldCursorX, OldCursorY;
- LONG NewCursorX, NewCursorY;
+ SHORT OldCursorX, OldCursorY;
+ SHORT NewCursorX, NewCursorY;
DPRINT("SrvSetConsoleCursorPosition\n");
*/
if (ConsoleStartInfo->dwStartupFlags & STARTF_USEFILLATTRIBUTE)
{
- ConsoleInfo.ScreenAttrib = ConsoleStartInfo->FillAttribute;
+ ConsoleInfo.ScreenAttrib = (USHORT)ConsoleStartInfo->FillAttribute;
}
if (ConsoleStartInfo->dwStartupFlags & STARTF_USECOUNTCHARS)
{
}
MultiByteToWideChar(Console->OutputCodePage,
- 0,
- (PCHAR)From,
- 1,
- To,
- 1);
+ 0, (PCHAR)From, 1, To, 1);
To++;
From += 2;
}
RightChar - Start + 1);
}
- if (Buff->CursorInfo.bVisible && Buff->CursorBlinkOn &&
- !Buff->ForceCursorOff)
+ if (Buff->CursorInfo.bVisible &&
+ Buff->CursorBlinkOn &&
+ !Buff->ForceCursorOff)
{
CursorX = Buff->CursorPosition.X;
CursorY = Buff->CursorPosition.Y;
if (LeftChar <= CursorX && CursorX <= RightChar &&
- TopLine <= CursorY && CursorY <= BottomLine)
+ TopLine <= CursorY && CursorY <= BottomLine)
{
CursorHeight = ConioEffectiveCursorSize(Console, GuiData->CharHeight);
From = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y) + 1;
}
static VOID
-GuiInvalidateCell(PCONSOLE Console, UINT x, UINT y)
+GuiInvalidateCell(PCONSOLE Console, SHORT x, SHORT y)
{
SMALL_RECT CellRect = { x, y, x, y };
GuiDrawRegion(Console, &CellRect);
PCONSOLE_SCREEN_BUFFER Buffer = Console->ActiveBuffer;
COORD Coord;
- Coord.X = Buffer->ShowX + ((short)LOWORD(lParam) / (int)GuiData->CharWidth);
- Coord.Y = Buffer->ShowY + ((short)HIWORD(lParam) / (int)GuiData->CharHeight);
+ Coord.X = Buffer->ShowX + ((SHORT)LOWORD(lParam) / (int)GuiData->CharWidth);
+ Coord.Y = Buffer->ShowY + ((SHORT)HIWORD(lParam) / (int)GuiData->CharHeight);
/* Clip coordinate to ensure it's inside buffer */
if (Coord.X < 0)
}
static VOID WINAPI
-GuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, LONG CursorStartX, LONG CursorStartY,
+GuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, SHORT CursorStartX, SHORT CursorStartY,
UINT ScrolledLines, CHAR *Buffer, UINT Length)
{
PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data;
PCONSOLE_SCREEN_BUFFER Buff = Console->ActiveBuffer;
- LONG CursorEndX, CursorEndY;
+ SHORT CursorEndX, CursorEndY;
RECT ScrollRect;
if (NULL == GuiData || NULL == GuiData->hWindow)
}
static BOOL WINAPI
-GuiSetScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, UINT OldCursorX, UINT OldCursorY)
+GuiSetScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, SHORT OldCursorX, SHORT OldCursorY)
{
if (Console->ActiveBuffer == Buff)
{
}
static VOID WINAPI
-TuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, LONG CursorStartX, LONG CursorStartY,
+TuiWriteStream(PCONSOLE Console, SMALL_RECT* Region, SHORT CursorStartX, SHORT CursorStartY,
UINT ScrolledLines, CHAR *Buffer, UINT Length)
{
DWORD BytesWritten;
}
static BOOL WINAPI
-TuiSetScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, UINT OldCursorX, UINT OldCursorY)
+TuiSetScreenInfo(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff, SHORT OldCursorX, SHORT OldCursorY)
{
CONSOLE_SCREEN_BUFFER_INFO Info;
DWORD BytesReturned;
VOID (WINAPI *CleanupConsole)(struct _CONSOLE* Console);
VOID (WINAPI *WriteStream)(struct _CONSOLE* Console,
SMALL_RECT* Block,
- LONG CursorStartX,
- LONG CursorStartY,
+ SHORT CursorStartX,
+ SHORT CursorStartY,
UINT ScrolledLines,
CHAR *Buffer,
UINT Length);
PCONSOLE_SCREEN_BUFFER ScreenBuffer);
BOOL (WINAPI *SetScreenInfo)(struct _CONSOLE* Console,
PCONSOLE_SCREEN_BUFFER ScreenBuffer,
- UINT OldCursorX,
- UINT OldCursorY);
+ SHORT OldCursorX,
+ SHORT OldCursorY);
BOOL (WINAPI *UpdateScreenInfo)(struct _CONSOLE* Console,
PCONSOLE_SCREEN_BUFFER ScreenBuffer);
BOOL (WINAPI *IsBufferResizeSupported)(struct _CONSOLE* Console);
HistoryAddEntry(PCONSOLE Console)
{
UNICODE_STRING NewEntry;
- PHISTORY_BUFFER Hist;
+ PHISTORY_BUFFER Hist = HistoryCurrentBuffer(Console);
INT i;
+ if (!Hist) return;
+
NewEntry.Length = NewEntry.MaximumLength = Console->LineSize * sizeof(WCHAR);
NewEntry.Buffer = Console->LineBuffer;
- if (!(Hist = HistoryCurrentBuffer(Console)))
- return;
-
/* Don't add blank or duplicate entries */
if (NewEntry.Length == 0 || Hist->MaxEntries == 0 ||
(Hist->NumEntries > 0 &&
static VOID
HistoryGetCurrentEntry(PCONSOLE Console, PUNICODE_STRING Entry)
{
- PHISTORY_BUFFER Hist;
- if (!(Hist = HistoryCurrentBuffer(Console)) || Hist->NumEntries == 0)
+ PHISTORY_BUFFER Hist = HistoryCurrentBuffer(Console);
+
+ if (!Hist || Hist->NumEntries == 0)
Entry->Length = 0;
else
*Entry = Hist->Entries[Hist->Position];
if (Pos != Console->LinePos && Console->InputBuffer.Mode & ENABLE_ECHO_INPUT)
{
PCONSOLE_SCREEN_BUFFER Buffer = Console->ActiveBuffer;
- UINT OldCursorX = Buffer->CursorPosition.X;
- UINT OldCursorY = Buffer->CursorPosition.Y;
+ SHORT OldCursorX = Buffer->CursorPosition.X;
+ SHORT OldCursorY = Buffer->CursorPosition.Y;
INT XY = OldCursorY * Buffer->ScreenBufferSize.X + OldCursorX;
XY += (Pos - Console->LinePos);
{
UINT Pos = Console->LinePos;
UINT NewSize = Console->LineSize - NumToDelete + NumToInsert;
- INT i;
+ UINT i;
/* Make sure there's always enough room for ending \r\n */
if (NewSize + 2 > Console->LineMaxSize)
static VOID
LineInputRecallHistory(PCONSOLE Console, INT Offset)
{
- PHISTORY_BUFFER Hist;
+ PHISTORY_BUFFER Hist = HistoryCurrentBuffer(Console);
+ UINT Position = 0;
- if (!(Hist = HistoryCurrentBuffer(Console)) || Hist->NumEntries == 0)
- return;
+ if (!Hist || Hist->NumEntries == 0) return;
- Offset += Hist->Position;
- Offset = max(Offset, 0);
- Offset = min(Offset, Hist->NumEntries - 1);
- Hist->Position = Offset;
+ Position = Hist->Position + Offset;
+ Position = min(max(Position, 0), Hist->NumEntries - 1);
+ Hist->Position = Position;
LineInputSetPos(Console, 0);
LineInputEdit(Console, Console->LineSize,
- Hist->Entries[Offset].Length / sizeof(WCHAR),
- Hist->Entries[Offset].Buffer);
+ Hist->Entries[Hist->Position].Length / sizeof(WCHAR),
+ Hist->Entries[Hist->Position].Buffer);
}
VOID FASTCALL
return;
case VK_F8:
/* Search for history entries starting with input. */
- if (!(Hist = HistoryCurrentBuffer(Console)) || Hist->NumEntries == 0)
- return;
+ Hist = HistoryCurrentBuffer(Console);
+ if (!Hist || Hist->NumEntries == 0) return;
/* Like Up/F5, on first time start from current (usually last) entry,
* but on subsequent times start at previous entry. */
PHISTORY_BUFFER Hist;
PBYTE Buffer = (PBYTE)GetCommandHistoryRequest->History;
ULONG BufferSize = GetCommandHistoryRequest->Length;
- INT i;
+ UINT i;
if ( !CsrValidateMessageBuffer(ApiMessage,
(PVOID*)&GetCommandHistoryRequest->History,
NTSTATUS Status;
PHISTORY_BUFFER Hist;
ULONG Length = 0;
- INT i;
+ UINT i;
if (!CsrValidateMessageBuffer(ApiMessage,
(PVOID*)&GetCommandHistoryLengthRequest->ExeName.Buffer,
}
else if (!wcscmp(szValueName, L"HistoryNoDup"))
{
- ConsoleInfo->HistoryNoDup = Value;
+ ConsoleInfo->HistoryNoDup = (BOOLEAN)Value;
RetVal = TRUE;
}
else if (!wcscmp(szValueName, L"FullScreen"))
}
else if (!wcscmp(szValueName, L"QuickEdit"))
{
- ConsoleInfo->QuickEdit = Value;
+ ConsoleInfo->QuickEdit = (BOOLEAN)Value;
RetVal = TRUE;
}
else if (!wcscmp(szValueName, L"InsertMode"))
{
- ConsoleInfo->InsertMode = Value;
+ ConsoleInfo->InsertMode = (BOOLEAN)Value;
RetVal = TRUE;
}
else if (!wcscmp(szValueName, L"ScreenBufferSize"))
}
else if (!wcscmp(szValueName, L"ScreenColors"))
{
- ConsoleInfo->ScreenAttrib = Value;
+ ConsoleInfo->ScreenAttrib = (USHORT)Value;
RetVal = TRUE;
}
else if (!wcscmp(szValueName, L"PopupColors"))
{
- ConsoleInfo->PopupAttrib = Value;
+ ConsoleInfo->PopupAttrib = (USHORT)Value;
RetVal = TRUE;
}
}