summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/sega8/sega8_slot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/sega8/sega8_slot.cpp')
-rw-r--r--src/devices/bus/sega8/sega8_slot.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/devices/bus/sega8/sega8_slot.cpp b/src/devices/bus/sega8/sega8_slot.cpp
index 8a998e71bf0..e6d6f17a5f4 100644
--- a/src/devices/bus/sega8/sega8_slot.cpp
+++ b/src/devices/bus/sega8/sega8_slot.cpp
@@ -666,18 +666,17 @@ std::string sega8_cart_slot_device::get_default_card_software(get_default_card_s
{
if (hook.image_file())
{
- const char *slot_string;
- uint32_t len = hook.image_file()->size(), offset = 0;
+ uint64_t len;
+ hook.image_file()->length(len); // FIXME: check error return, guard against excessively large files
std::vector<uint8_t> rom(len);
- int type;
- hook.image_file()->read(&rom[0], len);
+ size_t actual;
+ hook.image_file()->read(&rom[0], len, actual); // FIXME: check error return or read returning short
- if ((len % 0x4000) == 512)
- offset = 512;
+ uint32_t const offset = ((len % 0x4000) == 512) ? 512 : 0;
- type = get_cart_type(&rom[offset], len - offset);
- slot_string = sega8_get_slot(type);
+ int const type = get_cart_type(&rom[offset], len - offset);
+ char const *const slot_string = sega8_get_slot(type);
//printf("type: %s\n", slot_string);