From b42cc8efe9930b8c3a4839158d41e2e3c0046ec5 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Tue, 7 Sep 2021 13:35:27 -0700 Subject: [PATCH] Fix Linux build gcc is justifiably annoyed by variable initialization crossed by a goto. (issue #51) --- diskimg/ProDOS.cpp | 4 ++-- diskimg/TwoImg.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/diskimg/ProDOS.cpp b/diskimg/ProDOS.cpp index b848822..90d604d 100644 --- a/diskimg/ProDOS.cpp +++ b/diskimg/ProDOS.cpp @@ -4538,6 +4538,8 @@ DIError A2FDProDOS::Write(const void* buf, size_t len, size_t* pActual) bool allocSparse = (pDiskFS->GetParameter(DiskFS::kParmProDOS_AllocSparse) != 0); uint8_t blkBuf[kBlkSize]; uint16_t keyBlock; + bool allZero = true; + const uint8_t* scanPtr = (const uint8_t*)buf; if (len >= 0x01000000) { // 16MB assert(false); @@ -4578,8 +4580,6 @@ DIError A2FDProDOS::Write(const void* buf, size_t len, size_t* pActual) * where we store it as a seedling. (GS/OS seems to do this, ProDOS 8 * v2.0.3 tends to allocate the first block.) */ - bool allZero = true; - const uint8_t* scanPtr = (const uint8_t*)buf; for (unsigned int i = 0; i < len; ++i, ++scanPtr) { if (*scanPtr != 0x00) { allZero = false; diff --git a/diskimg/TwoImg.cpp b/diskimg/TwoImg.cpp index 9d21cb0..e42499a 100644 --- a/diskimg/TwoImg.cpp +++ b/diskimg/TwoImg.cpp @@ -30,7 +30,7 @@ int TwoImgHeader::InitHeader(int imageFormat, uint32_t imageSize, { if (imageSize == 0) return -1; - if (imageFormat < kImageFormatDOS || imageFormat > (int) kImageFormatNibble) + if (imageFormat < (int) kImageFormatDOS || imageFormat > (int) kImageFormatNibble) return -1; if (imageFormat != kImageFormatNibble &&