summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/xmlfile.cpp
diff options
context:
space:
mode:
author Vas Crabb <cuavas@users.noreply.github.com>2024-02-25 02:27:26 +1100
committer GitHub <noreply@github.com>2024-02-25 02:27:26 +1100
commit1615b8551a3a73532ac234973cfb04dd8ed98ba4 (patch)
tree25575506b4117afa614b94b4370af7f16eb9dbb5 /src/lib/util/xmlfile.cpp
parent334ec12e0043ef939be418283235e3dbe5a005fe (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/xmlfile.cpp')
-rw-r--r--src/lib/util/xmlfile.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/lib/util/xmlfile.cpp b/src/lib/util/xmlfile.cpp
index 39604a29a87..7cd6a4eecda 100644
--- a/src/lib/util/xmlfile.cpp
+++ b/src/lib/util/xmlfile.cpp
@@ -41,14 +41,14 @@ constexpr unsigned TEMP_BUFFER_SIZE(4096U);
void write_escaped(core_file &file, std::string const &str)
{
+ // FIXME: check for errors
std::string::size_type pos = 0;
while ((str.size() > pos) && (std::string::npos != pos))
{
std::string::size_type const found = str.find_first_of("\"&<>", pos);
if (found != std::string::npos)
{
- std::size_t written;
- file.write(&str[pos], found - pos, written);
+ write(file, &str[pos], found - pos);
switch (str[found])
{
case '"': file.puts("&quot;"); pos = found + 1; break;
@@ -60,8 +60,7 @@ void write_escaped(core_file &file, std::string const &str)
}
else
{
- std::size_t written;
- file.write(&str[pos], str.size() - pos, written);
+ write(file, &str[pos], str.size() - pos);
pos = found;
}
}
@@ -134,8 +133,7 @@ file::ptr file::read(read_stream &file, parse_options const *opts)
char tempbuf[TEMP_BUFFER_SIZE];
// read as much as we can
- size_t bytes;
- file.read(tempbuf, sizeof(tempbuf), bytes); // TODO: better error handling
+ auto const [err, bytes] = util::read(file, tempbuf, sizeof(tempbuf)); // FIXME: better error handling
done = !bytes;
// parse the data