summaryrefslogtreecommitdiff
path: root/absl/random/internal/seed_material.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-09-12 16:04:42 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-09-12 16:05:39 -0700
commit5a547f8bbd310850bb8123446110730abafdad56 (patch)
tree3407227cb7ea1bac60e341c42cf5da32a3ed6ff1 /absl/random/internal/seed_material.cc
parent0a066f31d981d69f7bde961055691906dabd4a3c (diff)
Fix "unsafe narrowing" warnings in absl, 8/n.
Addresses failures with the following, in some files: -Wshorten-64-to-32 -Wimplicit-int-conversion -Wsign-compare -Wsign-conversion -Wtautological-unsigned-zero-compare (This specific CL focuses on .cc files in */internal/.) Bug: chromium:1292951 PiperOrigin-RevId: 473868797 Change-Id: Ibe0b76e33f9e001d59862beaac54fb47bacd39b2
Diffstat (limited to 'absl/random/internal/seed_material.cc')
-rw-r--r--absl/random/internal/seed_material.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/absl/random/internal/seed_material.cc b/absl/random/internal/seed_material.cc
index c03cad85..1041302b 100644
--- a/absl/random/internal/seed_material.cc
+++ b/absl/random/internal/seed_material.cc
@@ -173,12 +173,12 @@ bool ReadSeedMaterialFromDevURandom(absl::Span<uint32_t> values) {
}
while (success && buffer_size > 0) {
- int bytes_read = read(dev_urandom, buffer, buffer_size);
+ ssize_t bytes_read = read(dev_urandom, buffer, buffer_size);
int read_error = errno;
success = (bytes_read > 0);
if (success) {
buffer += bytes_read;
- buffer_size -= bytes_read;
+ buffer_size -= static_cast<size_t>(bytes_read);
} else if (bytes_read == -1 && read_error == EINTR) {
success = true; // Need to try again.
}