Call to virtual method ... during construction bypasses virtual dispatch (scan-build / clang analyzer)

This commit is contained in:
folkert van heusden 2024-04-28 01:54:33 +02:00
parent 6d7f3d9512
commit e07d0589ee
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
2 changed files with 11 additions and 4 deletions

View file

@ -10,11 +10,8 @@
#include "memory.h"
#include "utils.h"
tm_11::tm_11(const std::string & file, memory *const m) : m(m)
tm_11::tm_11(const std::string & file, memory *const m): file(file), m(m)
{
fh = fopen(file.c_str(), "rb");
reset();
}
tm_11::~tm_11()
@ -22,6 +19,13 @@ tm_11::~tm_11()
fclose(fh);
}
void tm_11::begin()
{
fh = fopen(file.c_str(), "rb");
reset();
}
void tm_11::reset()
{
memset(registers, 0x00, sizeof registers );

View file

@ -24,6 +24,7 @@ class memory;
class tm_11 : public device
{
private:
std::string file;
memory *const m { nullptr };
uint16_t registers[6] { 0 };
uint8_t xfer_buffer[65536];
@ -34,6 +35,8 @@ public:
tm_11(const std::string & file, memory *const m);
virtual ~tm_11();
void begin();
void reset() override;
uint8_t readByte(const uint16_t addr) override;