blob: 90fe162c295e698c180c64f81fa9f87e5ff2aeac [file] [log] [blame]
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Johnson <johnson.peter@gmail.com>
Date: Sat, 10 Jun 2023 15:03:38 -0700
Subject: [PATCH 04/11] Fix coded_stream WriteRaw
---
src/google/protobuf/implicit_weak_message.h | 2 +-
src/google/protobuf/io/coded_stream.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h
index b894ab4809090011f381828857d1674a6b7bff9b..c358c14c06f773d87f5089c75566a5a6fcba13e6 100644
--- a/src/google/protobuf/implicit_weak_message.h
+++ b/src/google/protobuf/implicit_weak_message.h
@@ -100,7 +100,7 @@ class PROTOBUF_EXPORT ImplicitWeakMessage : public MessageLite {
if (data_ == nullptr) {
return target;
}
- return stream->WriteRaw(data_->data(), static_cast<int>(data_->size()),
+ return stream->WriteRaw(data_->data(), data_->size(),
target);
}
diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h
index c8fc994f916d047c0a7b176e53c9e946ebd752de..6c0dd4ab4099d1d748957af8bfc5f8c59c2aa3d6 100644
--- a/src/google/protobuf/io/coded_stream.h
+++ b/src/google/protobuf/io/coded_stream.h
@@ -677,8 +677,8 @@ class PROTOBUF_EXPORT EpsCopyOutputStream {
return ptr;
}
- uint8_t* WriteRaw(const void* data, int size, uint8_t* ptr) {
- if (PROTOBUF_PREDICT_FALSE(end_ - ptr < size)) {
+ uint8_t* WriteRaw(const void* data, size_t size, uint8_t* ptr) {
+ if (PROTOBUF_PREDICT_FALSE(end_ - ptr < static_cast<int>(size))) {
return WriteRawFallback(data, size, ptr);
}
std::memcpy(ptr, data, size);