summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/rendlay.cpp
diff options
context:
space:
mode:
author Vas Crabb <cuavas@users.noreply.github.com>2021-10-05 03:34:45 +1100
committer GitHub <noreply@github.com>2021-10-05 03:34:45 +1100
commitaeb9eae87469e67bc6a91caf3840c34c11d959fc (patch)
tree45bffedf374dbce47caca633ad7bda547592e6c9 /src/emu/rendlay.cpp
parent33723892a3f06e678d817b36aef84364c32848ec (diff)
util: Further API cleanups: (#8661)
* Turned `core_file` into an implementation of `random_read_write`. * Turned PNG errors into a standard error category. * Added a helper for generating what look like derived classes on-the-fly.
Diffstat (limited to 'src/emu/rendlay.cpp')
-rw-r--r--src/emu/rendlay.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp
index b33c58e8fef..b6709626d97 100644
--- a/src/emu/rendlay.cpp
+++ b/src/emu/rendlay.cpp
@@ -1860,7 +1860,7 @@ private:
}
}
- bool load_bitmap(util::core_file &file)
+ bool load_bitmap(util::random_read &file)
{
ru_imgformat const format = render_detect_image(file);
switch (format)
@@ -1890,9 +1890,16 @@ private:
}
}
- void load_svg(util::core_file &file)
+ void load_svg(util::random_read &file)
{
- u64 len(file.size());
+ std::error_condition filerr;
+ u64 len;
+ filerr = file.length(len);
+ if (filerr)
+ {
+ osd_printf_warning("Error getting length of component image '%s'\n", m_imagefile);
+ return;
+ }
if ((std::numeric_limits<size_t>::max() - 1) < len)
{
osd_printf_warning("Component image '%s' is too large to read into memory\n", m_imagefile);
@@ -1907,9 +1914,9 @@ private:
svgbuf[len] = '\0';
for (char *ptr = svgbuf.get(); len; )
{
- u32 const block(u32(std::min<u64>(std::numeric_limits<u32>::max(), len)));
- u32 const read(file.read(ptr, block));
- if (!read)
+ size_t read;
+ filerr = file.read(ptr, size_t(len), read);
+ if (filerr || !read)
{
osd_printf_warning("Error reading component image '%s'\n", m_imagefile);
return;