[CONSRV]: Fix MSVC warnings.

svn path=/trunk/; revision=67163
This commit is contained in:
Hermès Bélusca-Maïto 2015-04-11 13:49:32 +00:00
parent 89f99d7458
commit d3b9acd3f5
4 changed files with 15 additions and 21 deletions

View file

@ -162,20 +162,14 @@ ConioComputeUpdateRect(IN PTEXTMODE_SCREEN_BUFFER Buff,
IN PCOORD Start, IN PCOORD Start,
IN UINT Length) IN UINT Length)
{ {
if (Buff->ScreenBufferSize.X <= Start->X + Length) if ((UINT)Buff->ScreenBufferSize.X <= Start->X + Length)
{
UpdateRect->Left = 0;
}
else
{
UpdateRect->Left = Start->X;
}
if (Buff->ScreenBufferSize.X <= Start->X + Length)
{ {
UpdateRect->Left = 0;
UpdateRect->Right = Buff->ScreenBufferSize.X - 1; UpdateRect->Right = Buff->ScreenBufferSize.X - 1;
} }
else else
{ {
UpdateRect->Left = Start->X;
UpdateRect->Right = Start->X + Length - 1; UpdateRect->Right = Start->X + Length - 1;
} }
UpdateRect->Top = Start->Y; UpdateRect->Top = Start->Y;
@ -391,7 +385,7 @@ ConDrvChangeScreenBufferAttributes(IN PCONSOLE Console,
IN USHORT NewScreenAttrib, IN USHORT NewScreenAttrib,
IN USHORT NewPopupAttrib) IN USHORT NewPopupAttrib)
{ {
DWORD X, Y, Length; ULONG X, Y, Length;
PCHAR_INFO Ptr; PCHAR_INFO Ptr;
COORD TopLeft = {0}; COORD TopLeft = {0};
@ -796,7 +790,7 @@ ConDrvReadConsoleOutputString(IN PCONSOLE Console,
* if we are going to overflow... * if we are going to overflow...
*/ */
// Ptr = ConioCoordToPointer(Buffer, Xpos, Ypos); // Doesn't work // Ptr = ConioCoordToPointer(Buffer, Xpos, Ypos); // Doesn't work
for (i = 0; i < min(NumCodesToRead, Buffer->ScreenBufferSize.X * Buffer->ScreenBufferSize.Y); ++i) for (i = 0; i < min(NumCodesToRead, (ULONG)Buffer->ScreenBufferSize.X * Buffer->ScreenBufferSize.Y); ++i)
{ {
// Ptr = ConioCoordToPointer(Buffer, Xpos, Ypos); // Doesn't work either // Ptr = ConioCoordToPointer(Buffer, Xpos, Ypos); // Doesn't work either
Ptr = &Buffer->Buffer[Xpos + Ypos * Buffer->ScreenBufferSize.X]; Ptr = &Buffer->Buffer[Xpos + Ypos * Buffer->ScreenBufferSize.X];
@ -855,7 +849,7 @@ ConDrvWriteConsoleOutputString(IN PCONSOLE Console,
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
PVOID WriteBuffer = NULL; PVOID WriteBuffer = NULL;
PWCHAR tmpString = NULL; PWCHAR tmpString = NULL;
DWORD X, Y, Length; // , Written = 0; ULONG X, Y, Length; // , Written = 0;
ULONG CodeSize; ULONG CodeSize;
PCHAR_INFO Ptr; PCHAR_INFO Ptr;
@ -989,7 +983,7 @@ ConDrvFillConsoleOutput(IN PCONSOLE Console,
IN PCOORD WriteCoord, IN PCOORD WriteCoord,
OUT PULONG NumCodesWritten OPTIONAL) OUT PULONG NumCodesWritten OPTIONAL)
{ {
DWORD X, Y, Length; // , Written = 0; ULONG X, Y, Length; // , Written = 0;
PCHAR_INFO Ptr; PCHAR_INFO Ptr;
if (Console == NULL || Buffer == NULL || WriteCoord == NULL) if (Console == NULL || Buffer == NULL || WriteCoord == NULL)

View file

@ -1916,8 +1916,8 @@ OnSize(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam)
if ((windy % HeightUnit) >= (HeightUnit / 2)) ++chary; if ((windy % HeightUnit) >= (HeightUnit / 2)) ++chary;
// Compensate for added scroll bars in new window // Compensate for added scroll bars in new window
if (charx < Buff->ScreenBufferSize.X) windy -= GetSystemMetrics(SM_CYHSCROLL); // new window will have a horizontal scroll bar if (charx < (DWORD)Buff->ScreenBufferSize.X) windy -= GetSystemMetrics(SM_CYHSCROLL); // new window will have a horizontal scroll bar
if (chary < Buff->ScreenBufferSize.Y) windx -= GetSystemMetrics(SM_CXVSCROLL); // new window will have a vertical scroll bar if (chary < (DWORD)Buff->ScreenBufferSize.Y) windx -= GetSystemMetrics(SM_CXVSCROLL); // new window will have a vertical scroll bar
charx = windx / (int)WidthUnit ; charx = windx / (int)WidthUnit ;
chary = windy / (int)HeightUnit; chary = windy / (int)HeightUnit;
@ -1929,8 +1929,8 @@ OnSize(PGUI_CONSOLE_DATA GuiData, WPARAM wParam, LPARAM lParam)
// Resize window // Resize window
if ((charx != Buff->ViewSize.X) || (chary != Buff->ViewSize.Y)) if ((charx != Buff->ViewSize.X) || (chary != Buff->ViewSize.Y))
{ {
Buff->ViewSize.X = (charx <= Buff->ScreenBufferSize.X) ? charx : Buff->ScreenBufferSize.X; Buff->ViewSize.X = (charx <= (DWORD)Buff->ScreenBufferSize.X) ? charx : Buff->ScreenBufferSize.X;
Buff->ViewSize.Y = (chary <= Buff->ScreenBufferSize.Y) ? chary : Buff->ScreenBufferSize.Y; Buff->ViewSize.Y = (chary <= (DWORD)Buff->ScreenBufferSize.Y) ? chary : Buff->ScreenBufferSize.Y;
} }
ResizeConWnd(GuiData, WidthUnit, HeightUnit); ResizeConWnd(GuiData, WidthUnit, HeightUnit);

View file

@ -199,7 +199,7 @@ CopyLines(PTEXTMODE_SCREEN_BUFFER Buffer,
* array, because of the way things are stored inside it. The downside is * array, because of the way things are stored inside it. The downside is
* that it makes the code more complicated. * that it makes the code more complicated.
*/ */
for (yPos = Begin->Y; (yPos <= End->Y) && (NumChars > 0); yPos++) for (yPos = Begin->Y; (yPos <= (ULONG)End->Y) && (NumChars > 0); yPos++)
{ {
xBeg = (yPos == Begin->Y ? Begin->X : 0); xBeg = (yPos == Begin->Y ? Begin->X : 0);
xEnd = (yPos == End->Y ? End->X : Buffer->ScreenBufferSize.X - 1); xEnd = (yPos == End->Y ? End->X : Buffer->ScreenBufferSize.X - 1);
@ -366,8 +366,8 @@ GuiPaintTextModeBuffer(PTEXTMODE_SCREEN_BUFFER Buffer,
RightChar = rcFramebuffer->right / GuiData->CharWidth; RightChar = rcFramebuffer->right / GuiData->CharWidth;
BottomLine = rcFramebuffer->bottom / GuiData->CharHeight; BottomLine = rcFramebuffer->bottom / GuiData->CharHeight;
if (RightChar >= Buffer->ScreenBufferSize.X) RightChar = Buffer->ScreenBufferSize.X - 1; if (RightChar >= (ULONG)Buffer->ScreenBufferSize.X) RightChar = Buffer->ScreenBufferSize.X - 1;
if (BottomLine >= Buffer->ScreenBufferSize.Y) BottomLine = Buffer->ScreenBufferSize.Y - 1; if (BottomLine >= (ULONG)Buffer->ScreenBufferSize.Y) BottomLine = Buffer->ScreenBufferSize.Y - 1;
LastAttribute = ConioCoordToPointer(Buffer, LeftChar, TopLine)->Attributes; LastAttribute = ConioCoordToPointer(Buffer, LeftChar, TopLine)->Attributes;

View file

@ -561,7 +561,7 @@ ConioWriteConsole(PFRONTEND FrontEnd,
EndX = (Buff->CursorPosition.X + TAB_WIDTH) & ~(TAB_WIDTH - 1); EndX = (Buff->CursorPosition.X + TAB_WIDTH) & ~(TAB_WIDTH - 1);
EndX = min(EndX, (UINT)Buff->ScreenBufferSize.X); EndX = min(EndX, (UINT)Buff->ScreenBufferSize.X);
Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y); Ptr = ConioCoordToPointer(Buff, Buff->CursorPosition.X, Buff->CursorPosition.Y);
while (Buff->CursorPosition.X < EndX) while ((UINT)Buff->CursorPosition.X < EndX)
{ {
Ptr->Char.UnicodeChar = L' '; Ptr->Char.UnicodeChar = L' ';
Ptr->Attributes = Buff->ScreenDefaultAttrib; Ptr->Attributes = Buff->ScreenDefaultAttrib;