diff options
author | 2024-02-25 02:27:26 +1100 | |
---|---|---|
committer | 2024-02-25 02:27:26 +1100 | |
commit | 1615b8551a3a73532ac234973cfb04dd8ed98ba4 (patch) | |
tree | 25575506b4117afa614b94b4370af7f16eb9dbb5 /src/lib/util/cdrom.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/lib/util/cdrom.cpp')
-rw-r--r-- | src/lib/util/cdrom.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/util/cdrom.cpp b/src/lib/util/cdrom.cpp index 56ce590bc6c..ee415cba1b0 100644 --- a/src/lib/util/cdrom.cpp +++ b/src/lib/util/cdrom.cpp @@ -25,6 +25,7 @@ #include <cassert> #include <cstdlib> +#include <tuple> /*************************************************************************** @@ -400,11 +401,11 @@ std::error_condition cdrom_file::read_partial_sector(void *dest, uint32_t lbasec if (EXTRA_VERBOSE) printf("Reading %u bytes from sector %d from track %d at offset %lu\n", (unsigned)length, chdsector, tracknum + 1, (unsigned long)sourcefileoffset); - size_t actual; result = srcfile.seek(sourcefileoffset, SEEK_SET); + size_t actual; if (!result) - result = srcfile.read(dest, length, actual); - // FIXME: if (actual < length) report error + std::tie(result, actual) = read(srcfile, dest, length); + // FIXME: if (!result && (actual < length)) report error needswap = cdtrack_info.track[tracknum].swap; } @@ -414,7 +415,8 @@ std::error_condition cdrom_file::read_partial_sector(void *dest, uint32_t lbasec uint8_t *buffer = (uint8_t *)dest - startoffs; for (int swapindex = startoffs; swapindex < 2352; swapindex += 2 ) { - std::swap(buffer[ swapindex ], buffer[ swapindex + 1 ]); + using std::swap; + swap(buffer[ swapindex ], buffer[ swapindex + 1 ]); } } return result; |