File 0002-reduce-warnings.patch of Package wangemu
From 5d3ffb0becb318a3a6bdee6fb48f3b5a2f46a09b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@gmail.com>
Date: Fri, 3 Oct 2025 10:30:06 +0200
Subject: [PATCH 02/11] reduce warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
---
src/Cpu2200vp.cpp | 1 +
src/IoCardDisk.cpp | 4 ++--
src/UiCrt.cpp | 2 +-
src/UiCrt_Render.cpp | 2 +-
src/UiPrinterFrame.cpp | 1 +
src/UiSystemConfigDlg.cpp | 6 +++---
src/Wvd.cpp | 2 +-
src/system2200.cpp | 1 +
8 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/Cpu2200vp.cpp b/src/Cpu2200vp.cpp
index 59de843..4b02b13 100644
--- a/src/Cpu2200vp.cpp
+++ b/src/Cpu2200vp.cpp
@@ -338,6 +338,7 @@ Cpu2200vp::writeUcode(uint16 addr, uint32 uop, bool force) noexcept
if (((uop >> 14) & 3) >= 2) {
m_ucode[addr].ucode |= FETCH_CY; // clear or set
}
+ /*FALLTHRU*/
case 0x07: // M: multiply
illegal = (uop & 0x010000) != 0x000000;
x_field = (uop >> 17) & 1;
diff --git a/src/IoCardDisk.cpp b/src/IoCardDisk.cpp
index 6cc51fa..cafefbd 100644
--- a/src/IoCardDisk.cpp
+++ b/src/IoCardDisk.cpp
@@ -1262,7 +1262,7 @@ bool
platterHasValidCatalog(Wvd *wvd, int p)
{
assert(wvd != nullptr);
- uint8 sector_buff[257]; // 256B of data plus an LRC byte
+ uint8 sector_buff[257] = { 0 }; // 256B of data plus an LRC byte
// get sector 0 of the platter;
// the first 16 bytes contains info about the index/catalog structure
@@ -1350,7 +1350,7 @@ bool
IoCardDisk::platterHasBit15Problem(Wvd *wvd, int p, bool fix_it)
{
assert(wvd != nullptr);
- uint8 sector_buff[257]; // 256B of data plus an LRC byte
+ uint8 sector_buff[257] = { 0 }; // 256B of data plus an LRC byte
// get sector 0 of the platter;
// the first 16 bytes contains info about the index/catalog structure
diff --git a/src/UiCrt.cpp b/src/UiCrt.cpp
index 37ab74a..9f33caa 100644
--- a/src/UiCrt.cpp
+++ b/src/UiCrt.cpp
@@ -407,7 +407,7 @@ Crt::recalcBorders()
// only a font change requires a new wxBitmap.
if (!m_scrbits.IsOk() || (m_scrbits.GetWidth() != width) ||
(m_scrbits.GetHeight() != height)) {
-#if !(__WXMAC__) && DRAW_WITH_RAWBMP
+#if !defined(__WXMAC__) && DRAW_WITH_RAWBMP
m_scrbits = wxBitmap(width, height, 24);
#else
m_scrbits = wxBitmap(width, height, wxBITMAP_SCREEN_DEPTH);
diff --git a/src/UiCrt_Render.cpp b/src/UiCrt_Render.cpp
index f38bfb1..176a2e0 100644
--- a/src/UiCrt_Render.cpp
+++ b/src/UiCrt_Render.cpp
@@ -252,7 +252,7 @@ Crt::generateFontmap()
// 5 : alt no normal
// 6 : alt yes high
// 7 : alt yes high
-#if !(__WXMAC__) && DRAW_WITH_RAWBMP
+#if !defined(__WXMAC__) && DRAW_WITH_RAWBMP
m_font_map = wxBitmap(256*m_charcell_w, 8*m_charcell_h, 24); // use DIB
#else
m_font_map = wxBitmap(256*m_charcell_w, 8*m_charcell_h, wxBITMAP_SCREEN_DEPTH);
diff --git a/src/UiPrinterFrame.cpp b/src/UiPrinterFrame.cpp
index 7d2461b..5f8d3c3 100644
--- a/src/UiPrinterFrame.cpp
+++ b/src/UiPrinterFrame.cpp
@@ -147,6 +147,7 @@ PrinterFrame::PrinterFrame(const wxString& title, const int io_addr) :
m_printer_addr(io_addr) // used later during configuration
{
#ifndef __WXMAC__
+ #include "wang.xpm"
// set the frame icon
SetIcon(wxICON(wang));
#endif
diff --git a/src/UiSystemConfigDlg.cpp b/src/UiSystemConfigDlg.cpp
index cb87e32..941b106 100644
--- a/src/UiSystemConfigDlg.cpp
+++ b/src/UiSystemConfigDlg.cpp
@@ -224,11 +224,11 @@ SystemConfigDlg::setMemsizeStrings()
assert(cpu_cfg != nullptr);
for (const int kb : cpu_cfg->ram_size_options) {
- char label[10];
+ char label[16];
if (kb < 1024) {
- sprintf(&label[0], "%3d KB", kb);
+ snprintf(&label[0], 16, "%3d KB", kb);
} else {
- sprintf(&label[0], "%3d MB", kb/1024);
+ snprintf(&label[0], 16, "%3d MB", kb/1024);
}
m_mem_size->Append(&label[0], new myClientData(kb));
}
diff --git a/src/Wvd.cpp b/src/Wvd.cpp
index a10d795..6a0be60 100644
--- a/src/Wvd.cpp
+++ b/src/Wvd.cpp
@@ -515,7 +515,7 @@ Wvd::readHeader()
m_num_platters = 1;
m_num_platter_sectors = 1;
- uint8 data[256];
+ uint8 data[256] = { 0 };
const bool ok = rawReadSector(0, &data[0]);
if (!ok) {
return false;
diff --git a/src/system2200.cpp b/src/system2200.cpp
index f5ed196..ebd9961 100644
--- a/src/system2200.cpp
+++ b/src/system2200.cpp
@@ -372,6 +372,7 @@ system2200::setConfig(const SysCfgState &new_cfg)
assert(false);
cpu_type = Cpu2200::CPUTYPE_2200T;
// fall through in non-debug build if config type is invalid
+ /*FALLTHRU*/
case Cpu2200::CPUTYPE_2200B:
case Cpu2200::CPUTYPE_2200T:
cpu = std::make_shared<Cpu2200t>(scheduler, ram_size, cpu_type);
--
2.51.0