commit 98f19e565d23ea724fd2ac30e5e7e2f7cc8d08f0
parent 8405ec0853ed3312c04c6ab19ce983b39c1dd9d2
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Wed, 1 May 2024 15:21:46 +0200
remove now obsolete data pointer, we always work with our buffer vector
Diffstat:
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/source/wLib/wRom.cpp b/source/wLib/wRom.cpp
@@ -11,6 +11,9 @@ namespace wLib
bool ROM::loadFromFile(const std::string& _filename, const uint32_t _expectedSize)
{
+ if(_filename.empty())
+ return false;
+
if(!synthLib::readFile(m_buffer, _filename))
return false;
@@ -24,12 +27,7 @@ namespace wLib
m_buffer.resize(_expectedSize, 0xff);
}
- if(!m_buffer.empty())
- {
- m_data = m_buffer.data();
- return true;
- }
- return false;
+ return m_buffer.size() == _expectedSize;
}
bool ROM::loadFromMidi(std::vector<unsigned char>& _buffer, const std::string& _filename)
diff --git a/source/wLib/wRom.h b/source/wLib/wRom.h
@@ -13,12 +13,10 @@ namespace wLib
{
if (m_buffer.size() != _expectedSize)
loadFromFile(_filename, _expectedSize);
- else
- m_data = m_buffer.data();
}
virtual ~ROM() = default;
- const uint8_t* getData() const { return m_data; }
+ const uint8_t* getData() const { return m_buffer.data(); }
bool isValid() const { return !m_buffer.empty(); }
virtual uint32_t getSize() const = 0;
@@ -30,7 +28,6 @@ namespace wLib
private:
bool loadFromFile(const std::string& _filename, uint32_t _expectedSize);
- const uint8_t* m_data;
std::vector<uint8_t> m_buffer;
};
}