diff options
author | 2024-02-25 02:27:26 +1100 | |
---|---|---|
committer | 2024-02-25 02:27:26 +1100 | |
commit | 1615b8551a3a73532ac234973cfb04dd8ed98ba4 (patch) | |
tree | 25575506b4117afa614b94b4370af7f16eb9dbb5 /src/devices/machine/ds2430a.cpp | |
parent | 334ec12e0043ef939be418283235e3dbe5a005fe (diff) |
util/ioprocs.cpp: Added wrappers for common patterns. (#11608)
emu/diimage.h: Removed fread overloads that allocate memory for output.
util/core_file.cpp: Changed output size of load to size_t.
Diffstat (limited to 'src/devices/machine/ds2430a.cpp')
-rw-r--r-- | src/devices/machine/ds2430a.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/devices/machine/ds2430a.cpp b/src/devices/machine/ds2430a.cpp index b788f2e061d..fca443e76a1 100644 --- a/src/devices/machine/ds2430a.cpp +++ b/src/devices/machine/ds2430a.cpp @@ -39,6 +39,7 @@ #include "ds2430a.h" #include <numeric> // std::accumulate +#include <tuple> // std::tie #define LOG_PULSE (1U << 1) #define LOG_BITS (1U << 2) @@ -458,10 +459,13 @@ void ds2430a_device::device_start() bool ds2430a_device::nvram_read(util::read_stream &file) { + std::error_condition err; size_t actual; - if (file.read(&m_eeprom[0], 0x20, actual) || actual != 0x20) + std::tie(err, actual) = read(file, &m_eeprom[0], 0x20); + if (err || (0x20 != actual)) return false; - if (file.read(&m_rom[0], 8, actual) || actual != 8) + std::tie(err, actual) = read(file, &m_rom[0], 8); + if (err || (8 != actual)) return false; if (m_rom[0] != 0x14) @@ -481,10 +485,13 @@ bool ds2430a_device::nvram_read(util::read_stream &file) bool ds2430a_device::nvram_write(util::write_stream &file) { + std::error_condition err; size_t actual; - if (file.write(&m_eeprom[0], 0x20, actual) || actual != 0x20) + std::tie(err, actual) = write(file, &m_eeprom[0], 0x20); + if (err) return false; - if (file.write(&m_rom[0], 8, actual) || actual != 8) + std::tie(err, actual) = write(file, &m_rom[0], 8); + if (err) return false; return true; |