diff options
author | Vas Crabb <vas@vastheman.com> | 2022-08-03 02:27:49 +1000 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2022-08-03 02:27:49 +1000 |
commit | 7cc3481d8ff8893fa8a5ccef4cffd97d73403bc0 (patch) | |
tree | 4c0c2f68a4c0298fee81a5430c318bfc2e2158f5 /src/frontend/mame | |
parent | 9bbf203c39fbd306772620f84de8f6cb2c20f926 (diff) |
ui/icorender.cpp: Revert initialisations that can hide real bugs.
MSVC isn't smart enough to detect that these can only be used after
being assigned while clang and GCC can work it out fine. Initialising
them to zero at declaration has the potential to mask real bugs if some
code path tries to use them without assigning them. Code flow analysis
(e.g. Coverity) or memory analysers (e.g. valgrind or Purify) won't pick
up on the buggy path because the variable will technically be
initialised.
MSVC is problematic when it comes to warnings about uninitialised
variables in general. Unfortunately MSVC has no option to selectively
treat warnings as errors, unlike clang/GCC which have -Wno-error= which
we use extensively. Until Microsoft addresses these issues, you'll have
to use NOWERROR=1 when building with MSVC.
Also, some cleanup.
Diffstat (limited to 'src/frontend/mame')
-rw-r--r-- | src/frontend/mame/ui/icorender.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/frontend/mame/ui/icorender.cpp b/src/frontend/mame/ui/icorender.cpp index 63d3bb4b72a..363e64bad8b 100644 --- a/src/frontend/mame/ui/icorender.cpp +++ b/src/frontend/mame/ui/icorender.cpp @@ -179,7 +179,7 @@ bool load_ico_image(util::core_file &fp, unsigned count, unsigned index, bitmap_ { // read the directory entry std::error_condition err; - size_t actual = 0; + size_t actual; icon_dir_entry_t dir; err = fp.seek(sizeof(icon_dir_t) + (sizeof(icon_dir_entry_t) * index), SEEK_SET); if (!err) @@ -212,8 +212,8 @@ int images_in_ico(util::core_file &fp) { // read and check the icon file header std::error_condition err; - size_t actual = 0; - icon_dir_t header = { }; + size_t actual; + icon_dir_t header; err = fp.seek(0, SEEK_SET); if (!err) err = fp.read(&header, sizeof(header), actual); |