1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-19 17:25:17 +03:00
aports/testing/google-cloud-cpp/20-streamsize.patch
Holger Jaekel 0a9db55dae testing/google-cloud-cpp: new aport
https://cloud.google.com/sdk
C++ Client Libraries for Google Cloud Services
2023-02-09 01:20:19 +00:00

29 lines
1.3 KiB
Diff

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<std::uint64_t>(buffer_size),
upload.object_size - object_bytes);
- if (!stream.write(write_block.data(), n)) break;
+ if (!stream.write(write_block.data(), static_cast<std::streamsize>(n))) {
+ break;
+ }
object_bytes += n;
}
stream.Close();