mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-04-20 10:16:48 +00:00
Lots of various changes suggested by the code analysis tools.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
+1
-1
@@ -4,5 +4,5 @@
|
||||
#include <stdexcept>
|
||||
|
||||
uint8_t& EightBit::Memory::reference(uint16_t) {
|
||||
throw new std::logic_error("Reference operation not allowed.");
|
||||
throw std::logic_error("Reference operation not allowed.");
|
||||
}
|
||||
|
||||
+4
-4
@@ -41,7 +41,7 @@ void EightBit::Rom::poke(const uint16_t address, const uint8_t value) {
|
||||
BYTES()[address] = value;
|
||||
}
|
||||
|
||||
EightBit::Rom::Rom(const size_t size) noexcept
|
||||
EightBit::Rom::Rom(const size_t size)
|
||||
: m_bytes(size) {}
|
||||
|
||||
size_t EightBit::Rom::size() const {
|
||||
@@ -49,18 +49,18 @@ size_t EightBit::Rom::size() const {
|
||||
}
|
||||
|
||||
int EightBit::Rom::load(std::ifstream& file, const int writeOffset, const int readOffset, const int limit) {
|
||||
const auto maximumSize = (int)size() - writeOffset;
|
||||
const auto maximumSize = size() - writeOffset;
|
||||
return load(file, m_bytes, writeOffset, readOffset, limit, maximumSize);
|
||||
}
|
||||
|
||||
int EightBit::Rom::load(const std::string& path, const int writeOffset, const int readOffset, const int limit) {
|
||||
const auto maximumSize = (int)size() - writeOffset;
|
||||
const auto maximumSize = size() - writeOffset;
|
||||
return load(path, m_bytes, writeOffset, readOffset, limit, maximumSize);
|
||||
}
|
||||
|
||||
int EightBit::Rom::load(const std::vector<uint8_t>& bytes, const int writeOffset, const int readOffset, int limit) {
|
||||
if (limit < 0)
|
||||
limit = (int)bytes.size() - readOffset;
|
||||
limit = bytes.size() - readOffset;
|
||||
std::copy(bytes.cbegin() + readOffset, bytes.cbegin() + limit, m_bytes.begin() + writeOffset);
|
||||
return limit;
|
||||
}
|
||||
|
||||
@@ -13,17 +13,17 @@ uint8_t EightBit::UnusedMemory::peek(uint16_t) const {
|
||||
}
|
||||
|
||||
int EightBit::UnusedMemory::load(std::ifstream&, int, int, int) {
|
||||
throw new std::logic_error("load operation not allowed.");
|
||||
throw std::logic_error("load operation not allowed.");
|
||||
}
|
||||
|
||||
int EightBit::UnusedMemory::load(const std::string&, int, int, int) {
|
||||
throw new std::logic_error("load operation not allowed.");
|
||||
throw std::logic_error("load operation not allowed.");
|
||||
}
|
||||
|
||||
int EightBit::UnusedMemory::load(const std::vector<uint8_t>&, int, int, int) {
|
||||
throw new std::logic_error("load operation not allowed.");
|
||||
throw std::logic_error("load operation not allowed.");
|
||||
}
|
||||
|
||||
void EightBit::UnusedMemory::poke(uint16_t, uint8_t) {
|
||||
throw new std::logic_error("Poke operation not allowed.");
|
||||
throw std::logic_error("Poke operation not allowed.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user