From f7ae7a1dbe266df7a4e03ba9edad7da016c4f933 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Wed, 31 Jan 2018 10:21:41 +0000 Subject: [PATCH] Fix narrowing warnings (errors on clang/freebsd) and an unhandled value in switch. (Part of patch #275 from strageqargo) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4072 --- src/dos/dos_programs.cpp | 2 +- src/hardware/vga_other.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index e905783d..51bf01b1 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -75,7 +75,7 @@ public: for (int d = 0;d < DOS_DRIVES;d++) { if (!Drives[d]) continue; - char root[7] = {'A'+d,':','\\','*','.','*',0}; + char root[7] = {static_cast('A'+d),':','\\','*','.','*',0}; bool ret = DOS_FindFirst(root,DOS_ATTR_VOLUME); if (ret) { dta.GetResult(name,size,date,time,attr); diff --git a/src/hardware/vga_other.cpp b/src/hardware/vga_other.cpp index e8115eed..068a8f42 100644 --- a/src/hardware/vga_other.cpp +++ b/src/hardware/vga_other.cpp @@ -280,9 +280,9 @@ static void update_cga16_color(void) { } Bitu CGApal[4] = { overscan, - 2 + (color_sel||bw ? 1 : 0) + (background_i ? 8 : 0), - 4 + (color_sel&&!bw? 1 : 0) + (background_i ? 8 : 0), - 6 + (color_sel||bw ? 1 : 0) + (background_i ? 8 : 0) + static_cast(2 + (color_sel||bw ? 1 : 0) + (background_i ? 8 : 0)), + static_cast(4 + (color_sel&&!bw? 1 : 0) + (background_i ? 8 : 0)), + static_cast(6 + (color_sel||bw ? 1 : 0) + (background_i ? 8 : 0)) }; for (Bit8u x=0; x<4; x++) { // Position of pixel in question bool even = (x & 1) == 0; @@ -381,6 +381,8 @@ static void write_cga_color_select(Bitu val) { vga.tandy.border_color = val & 0xf; vga.attr.overscan_color = 0; break; + default: //Else unhandled values warning + break; } }