From d6fadd04d296deffcf14b3b850475067530604e8 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 11 Aug 2024 14:25:39 -0230 Subject: [PATCH] Minor style/formatting fixes. --- src/emucore/CartELF.cxx | 2 +- src/emucore/CortexM0.hxx | 4 ++-- src/emucore/elf/ElfFile.hxx | 2 +- src/emucore/elf/ElfLinker.cxx | 4 ++-- src/emucore/elf/ElfParser.cxx | 18 ++++++++++-------- src/emucore/elf/ElfParser.hxx | 2 +- src/emucore/elf/VcsLib.cxx | 1 + 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/emucore/CartELF.cxx b/src/emucore/CartELF.cxx index 1d6618753..44ade2f14 100644 --- a/src/emucore/CartELF.cxx +++ b/src/emucore/CartELF.cxx @@ -173,7 +173,7 @@ namespace { { if (!props) return SystemType::ntsc; - string displayFormat = props->get(PropType::Display_Format); + const string displayFormat = props->get(PropType::Display_Format); if(displayFormat == "PAL" || displayFormat == "SECAM") return SystemType::pal; if(displayFormat == "PAL60") return SystemType::pal60; diff --git a/src/emucore/CortexM0.hxx b/src/emucore/CortexM0.hxx index c7d79141d..a952c2b43 100644 --- a/src/emucore/CortexM0.hxx +++ b/src/emucore/CortexM0.hxx @@ -166,8 +166,8 @@ class CortexM0 bool readOnly{false}; std::variant< - MemoryRegionAccessData, // ::get<0>, directData - MemoryRegionAccessCode, // ::get<1>, directCode + MemoryRegionAccessData, // ::get<0>, directData + MemoryRegionAccessCode, // ::get<1>, directCode BusTransactionDelegate*, // ::get<2>, delegate std::monostate > access; diff --git a/src/emucore/elf/ElfFile.hxx b/src/emucore/elf/ElfFile.hxx index f2b111173..7d87f79c4 100644 --- a/src/emucore/elf/ElfFile.hxx +++ b/src/emucore/elf/ElfFile.hxx @@ -64,7 +64,7 @@ class ElfFile { ElfFile() = default; virtual ~ElfFile() = default; - virtual const uInt8 *getData() const = 0; + virtual const uInt8* getData() const = 0; virtual size_t getSize() const = 0; virtual const vector
& getSections() const = 0; diff --git a/src/emucore/elf/ElfLinker.cxx b/src/emucore/elf/ElfLinker.cxx index bcb5b351b..daf55c7ac 100644 --- a/src/emucore/elf/ElfLinker.cxx +++ b/src/emucore/elf/ElfLinker.cxx @@ -166,7 +166,7 @@ ElfLinker::RelocatedSymbol ElfLinker::findRelocatedSymbol(string_view name) cons if (!myRelocatedSymbols[i]) ElfSymbolResolutionError::raise("symbol could not be relocated"); - return myRelocatedSymbols[i].value(); + return myRelocatedSymbols[i].value(); // NOLINT: we know the value is valid } ElfSymbolResolutionError::raise("symbol not found"); @@ -423,7 +423,7 @@ void ElfLinker::copyInitArrays(vector& initArray, const std::unordered_m void ElfLinker::applyRelocationToSection(const ElfFile::Relocation& relocation, size_t iSection) { const auto& targetSection = myElf.getSections()[iSection]; - const auto& targetSectionRelocated = myRelocatedSections[iSection].value(); + const auto& targetSectionRelocated = myRelocatedSections[iSection].value(); // NOLINT const auto& symbol = myElf.getSymbols()[relocation.symbol]; const auto& relocatedSymbol = myRelocatedSymbols[relocation.symbol]; diff --git a/src/emucore/elf/ElfParser.cxx b/src/emucore/elf/ElfParser.cxx index f67ddb7d6..b3541c525 100644 --- a/src/emucore/elf/ElfParser.cxx +++ b/src/emucore/elf/ElfParser.cxx @@ -109,7 +109,7 @@ void ElfParser::parse(const uInt8 *elfData, size_t size) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const uInt8 *ElfParser::getData() const { return myData; } +const uInt8* ElfParser::getData() const { return myData; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - size_t ElfParser::getSize() const { return mySize; } @@ -142,19 +142,21 @@ uInt8 ElfParser::read8(uInt32 offset) const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt16 ElfParser::read16(uInt32 offset) const +uInt16 ElfParser::read16(uInt32 offset) const { - return myBigEndian ? ((read8(offset) << 8) | read8(offset + 1)) - : ((read8(offset + 1) << 8) | read8(offset)); + return myBigEndian + ? ((read8(offset) << 8) | read8(offset + 1)) + : ((read8(offset + 1) << 8) | read8(offset)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt32 ElfParser::read32(uInt32 offset) const { - return myBigEndian ? ((read8(offset) << 24) | (read8(offset + 1) << 16) | - (read8(offset + 2) << 8) | read8(offset + 3)) - : ((read8(offset + 3) << 24) | (read8(offset + 2) << 16) | - (read8(offset + 1) << 8) | read8(offset)); + return myBigEndian + ? ((read8(offset) << 24) | (read8(offset + 1) << 16) | + (read8(offset + 2) << 8) | read8(offset + 3)) + : ((read8(offset + 3) << 24) | (read8(offset + 2) << 16) | + (read8(offset + 1) << 8) | read8(offset)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/elf/ElfParser.hxx b/src/emucore/elf/ElfParser.hxx index 858b31461..f46c71af6 100644 --- a/src/emucore/elf/ElfParser.hxx +++ b/src/emucore/elf/ElfParser.hxx @@ -48,7 +48,7 @@ class ElfParser : public ElfFile { void parse(const uInt8 *elfData, size_t size); - const uInt8 *getData() const override; + const uInt8* getData() const override; size_t getSize() const override; const vector
& getSections() const override; diff --git a/src/emucore/elf/VcsLib.cxx b/src/emucore/elf/VcsLib.cxx index 86ecbd48c..8eace4581 100644 --- a/src/emucore/elf/VcsLib.cxx +++ b/src/emucore/elf/VcsLib.cxx @@ -176,6 +176,7 @@ void VcsLib::vcsLda2(uInt8 value) .injectROM(value); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CortexM0::err_t VcsLib::stackOperation(uInt16& value, uInt8& op, uInt8 opcode) { myTransactionQueue