From c040efed532f736ef6271b672b744dd87273b2cb Mon Sep 17 00:00:00 2001 From: Patryk Obara Date: Wed, 15 Apr 2020 14:19:57 +0200 Subject: [PATCH] Add static_casts for few VGA modeinfo fields In all cases values are stored in Bitu, but the allowed range fits into a single byte. --- src/ints/int10_vesa.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ints/int10_vesa.cpp b/src/ints/int10_vesa.cpp index 152a5dad..b71e3025 100644 --- a/src/ints/int10_vesa.cpp +++ b/src/ints/int10_vesa.cpp @@ -240,7 +240,8 @@ foundit: } else if (pageSize) { pages = (vga.vmemsize / pageSize)-1; } - minfo.NumberOfImagePages = pages; + assert(pages <= 255); + minfo.NumberOfImagePages = static_cast(pages); minfo.ModeAttributes = host_to_le16(modeAttributes); minfo.WinAAttributes = 0x7; // Exists/readable/writable @@ -260,8 +261,8 @@ foundit: minfo.WinFuncPtr = host_to_le32(int10.rom.set_window); minfo.NumberOfBanks = 0x1; minfo.Reserved_page = 0x1; - minfo.XCharSize = mblock->cwidth; - minfo.YCharSize = mblock->cheight; + minfo.XCharSize = static_cast(mblock->cwidth); + minfo.YCharSize = static_cast(mblock->cheight); if (!int10.vesa_nolfb) minfo.PhysBasePtr = host_to_le32(S3_LFB_BASE); @@ -269,7 +270,6 @@ foundit: return VESA_SUCCESS; } - Bit8u VESA_SetSVGAMode(Bit16u mode) { if (INT10_SetVideoMode(mode)) { int10.vesa_setmode=mode&0x7fff;