aboutsummaryrefslogtreecommitdiff
path: root/image_utils.h
diff options
context:
space:
mode:
authorBruce Dawson <brucedawson@chromium.org>2018-05-03 09:47:04 +0000
committerEdward Lesmes <ehmaldonado@google.com>2021-07-23 22:21:12 +0000
commitc9f72e0570b61584a9def111f665bd1207aa43de (patch)
tree01a638457903d0639585baff5202d916d2269aa8 /image_utils.h
parentf0791f794f6a2c5fd275dead9973ff10c4611d15 (diff)
downloadzucchini-c9f72e0570b61584a9def111f665bd1207aa43de.tar.gz
Add narrowing casts for VC++ compatibility
New versions of C++ make aggregate initalization with truncation a hard error. VC++ gives warnings if old initialization syntaxes are used, for backwards compatibility, but gives a hard error for C++ 11 syntax. This change adds the casts needed to make this one spot build, which is sufficient since it is currently the only troublesome spot by the VC++ rules. Change-Id: I3b597cc8ce628135cfdbb3b91a8b2f9d54562d34 Reviewed-on: https://chromium-review.googlesource.com/1039195 Commit-Queue: Bruce Dawson <brucedawson@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Cr-Commit-Position: refs/heads/master@{#555683} NOKEYCHECK=True GitOrigin-RevId: 6ae3411d3056477d85d7111cbbda6df64ea47b3e
Diffstat (limited to 'image_utils.h')
-rw-r--r--image_utils.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/image_utils.h b/image_utils.h
index de8cfee..9f561ba 100644
--- a/image_utils.h
+++ b/image_utils.h
@@ -183,7 +183,9 @@ constexpr ExecutableType CastToExecutableType(uint32_t possible_exe_type) {
inline std::string CastExecutableTypeToString(ExecutableType exe_type) {
uint32_t v = static_cast<uint32_t>(exe_type);
- return {v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF, (v >> 24) & 0xFF};
+ char result[] = {v & 0xFF, (v >> 8) & 0xFF, (v >> 16) & 0xFF,
+ (v >> 24) & 0xFF, 0};
+ return result;
}
// A region in an image with associated executable type |exe_type|. If