From 08467a88a67c1d8b8530694b27ca04fbba8dd8d8 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Fri, 15 Feb 2013 17:40:10 -0500 Subject: dev: Use the correct return type for disk offsets Replace the use of off_t in the various DiskImage related classes with std::streampos. off_t is a signed 32 bit integer on most 32-bit systems, whereas std::streampos is normally a 64 bit integer on most modern systems. Furthermore, std::streampos is the type used by tellg() and seekg() in the standard library, so it should have been used in the first place. This patch makes it possible to use disk images larger than 2 GiB on 32 bit systems with a modern C++ standard library. --- src/dev/ide_disk.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dev/ide_disk.cc') diff --git a/src/dev/ide_disk.cc b/src/dev/ide_disk.cc index 6c5ccdd86..bc7210d42 100644 --- a/src/dev/ide_disk.cc +++ b/src/dev/ide_disk.cc @@ -590,7 +590,7 @@ IdeDisk::startCommand() switch (cmdReg.command) { // Supported non-data commands case WDSF_READ_NATIVE_MAX: - size = image->size() - 1; + size = (uint32_t)image->size() - 1; cmdReg.sec_num = (size & 0xff); cmdReg.cyl_low = ((size & 0xff00) >> 8); cmdReg.cyl_high = ((size & 0xff0000) >> 16); -- cgit v1.2.3