Commit 6ae3411d authored by Bruce Dawson's avatar Bruce Dawson Committed by Commit Bot

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: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555683}
parent 2a799fa8
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment