From 28b6e7b66ffa33e03bdad30419da06caea3711ec Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 29 Dec 2024 17:25:05 -0330 Subject: [PATCH] Fixes for minor warnings from clang-tidy. --- src/emucore/Console.cxx | 14 +++++----- src/emucore/Console.hxx | 27 +++++++++---------- .../tia/frame-manager/FrameManager.cxx | 2 ++ 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 3aa436a03..cde06c589 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -395,22 +395,24 @@ string Console::formatFromSignature() const static constexpr uInt8 PAL_60[] = { 'P', 'A', 'L', ' ', '6', '0'}; static constexpr uInt8 PAL__60[] = { 'P', 'A', 'L', '-', '6', '0'}; - size_t size; + size_t size = 0; const ByteBuffer& image = myCart->getImage(size); if(searchForBytes(image, size, PAL60, 5) || - searchForBytes(image, size, PAL_60, 6) || - searchForBytes(image, size, PAL__60, 6)) + searchForBytes(image, size, PAL_60, 6) || + searchForBytes(image, size, PAL__60, 6)) return "PAL60"; + // Nothing found return "AUTO"; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Console::searchForBytes(const ByteBuffer& image, size_t imagesize, - const uInt8* signature, uInt32 sigsize) const + const uInt8* signature, uInt32 sigsize) { if(imagesize >= sigsize) + { for(uInt32 i = 0; i < imagesize - sigsize; ++i) { uInt32 matches = 0; @@ -422,11 +424,9 @@ bool Console::searchForBytes(const ByteBuffer& image, size_t imagesize, break; } if(matches == sigsize) - { return true; - } } - + } return false; } diff --git a/src/emucore/Console.hxx b/src/emucore/Console.hxx index f58e842cb..ff0667060 100644 --- a/src/emucore/Console.hxx +++ b/src/emucore/Console.hxx @@ -426,20 +426,6 @@ class Console : public Serializable, public ConsoleIO */ string formatFromSignature() const; - /** - Search the image for the specified byte signature. - - @param image A pointer to the ROM image - @param imagesize The size of the ROM image - @param signature The byte sequence to search for - @param sigsize The number of bytes in the signature - - @return True if the signature was found, else false - */ - bool searchForBytes(const ByteBuffer& image, size_t imagesize, - const uInt8* signature, uInt32 sigsize) const; - - /** Create the audio queue */ @@ -457,6 +443,19 @@ class Console : public Serializable, public ConsoleIO void toggleTIACollision(TIABit bit, string_view bitname, bool show = true, bool toggle = true) const; + /** + Search the image for the specified byte signature. + + @param image A pointer to the ROM image + @param imagesize The size of the ROM image + @param signature The byte sequence to search for + @param sigsize The number of bytes in the signature + + @return True if the signature was found, else false + */ + static bool searchForBytes(const ByteBuffer& image, size_t imagesize, + const uInt8* signature, uInt32 sigsize); + private: // Reference to the osystem object OSystem& myOSystem; diff --git a/src/emucore/tia/frame-manager/FrameManager.cxx b/src/emucore/tia/frame-manager/FrameManager.cxx index 15326df0f..6214e2639 100644 --- a/src/emucore/tia/frame-manager/FrameManager.cxx +++ b/src/emucore/tia/frame-manager/FrameManager.cxx @@ -121,6 +121,7 @@ void FrameManager::setAdjustVSize(Int32 adjustVSize) void FrameManager::onSetVblank(uInt64 cycles) { if (myState == State::waitForVsyncEnd) + { if (myVblank) // VBLANK switched on { myVblankStart = cycles; @@ -129,6 +130,7 @@ void FrameManager::onSetVblank(uInt64 cycles) { myVblankCycles += cycles - myVblankStart; } + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -