Make implicit 64-to-32-bit conversions in core_message_serialize.cpp explicit

(This is a merge of http://go/wvgerrit/134404.)

There were two lines that were tripping Clang's `-Wshorten-64-to-32`
warning. This CL makes both conversions explicit to appease the warning.
There should be no change in behavior.

Bug: 194971260
Test: ODK Unit Tests
Change-Id: I6d111e9a4efc1f0e31b51e455c47c0e885d48e6b
This commit is contained in:
John W. Bruce
2021-10-27 12:41:47 -07:00
parent 8d35b2c4e2
commit 71aaf870c8

View File

@@ -56,7 +56,7 @@ bool CreateResponse(uint32_t message_type, const S& core_request,
return false;
}
uint32_t message_length = ODK_Message_GetSize(&msg);
uint32_t message_length = static_cast<uint32_t>(ODK_Message_GetSize(&msg));
msg = ODK_Message_Create(buf.data() + sizeof(header->message_type),
sizeof(header->message_length));
Pack_uint32_t(&msg, &message_length);
@@ -72,7 +72,7 @@ bool CopyDeviceId(const ODK_ProvisioningRequest& src,
if (request.device_id_length > sizeof(request.device_id)) {
return false;
}
request.device_id_length = device_id.size();
request.device_id_length = static_cast<uint32_t>(device_id.size());
memset(request.device_id, 0, sizeof(request.device_id));
memcpy(request.device_id, device_id.data(), request.device_id_length);
return true;