From 5eff91e2143bf25ad8fb31aa2485b87cb05a07ed Mon Sep 17 00:00:00 2001 From: Bradley White <14679271+devbww@users.noreply.github.com> Date: Wed, 8 Feb 2023 04:18:17 -0500 Subject: [PATCH] cleanup: cater to platforms with 32-bit std::streamsize Explicitly cast a 64-bit value to `std::streamsize`. This is safe because the value being cast is bounded by another value that originated as a `std::streamsize`. Part of #10775. --- .../benchmarks/aggregate_upload_throughput_benchmark.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/google/cloud/storage/benchmarks/aggregate_upload_throughput_benchmark.cc b/google/cloud/storage/benchmarks/aggregate_upload_throughput_benchmark.cc index 5cceb060414..10040013dcc 100644 --- a/google/cloud/storage/benchmarks/aggregate_upload_throughput_benchmark.cc +++ b/google/cloud/storage/benchmarks/aggregate_upload_throughput_benchmark.cc @@ -320,7 +320,9 @@ UploadDetail UploadOneObject(gcs::Client& client, while (object_bytes < upload.object_size) { auto n = std::min(static_cast(buffer_size), upload.object_size - object_bytes); - if (!stream.write(write_block.data(), n)) break; + if (!stream.write(write_block.data(), static_cast(n))) { + break; + } object_bytes += n; } stream.Close();