From ec38bf152d53f29cdddd3384cddc161fc4fc963a Mon Sep 17 00:00:00 2001 From: Scott Graham Date: Thu, 18 Dec 2014 08:42:26 -0800 Subject: [PATCH] win: Add static_cast to AssignIfInRange Otherwise, when assigning to a smaller type, MSVC warns e.g. d:\src\crashpad\crashpad\util\numeric\safe_assignment.h(38) : error C2220: warning treated as error - no 'object' file generated d:\src\crashpad\crashpad\util\file\string_file_writer.cc(127) : see reference to function template instantiation 'bool crashpad::AssignIfInRange(Destination *,Source)' being compiled with [ Destination=size_t , Source=FileOffset ] d:\src\crashpad\crashpad\util\numeric\safe_assignment.h(38) : warning C4244: '=' : conversion from 'FileOffset' to 'size_t', possible loss of data R=mark@chromium.org BUG=crashpad:1 Review URL: https://codereview.chromium.org/809303003 --- util/numeric/safe_assignment.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/numeric/safe_assignment.h b/util/numeric/safe_assignment.h index 05e0b2d9..358d9837 100644 --- a/util/numeric/safe_assignment.h +++ b/util/numeric/safe_assignment.h @@ -35,7 +35,7 @@ bool AssignIfInRange(Destination* destination, Source source) { return false; } - *destination = source; + *destination = static_cast(source); return true; }