diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h index 1cf006832a7b..30dc91a5e519 100644 --- a/src/google/protobuf/io/coded_stream.h +++ b/src/google/protobuf/io/coded_stream.h @@ -399,13 +399,6 @@ class PROTOBUF_EXPORT CodedInputStream { // This is unrelated to PushLimit()/PopLimit(). void SetTotalBytesLimit(int total_bytes_limit); - PROTOBUF_DEPRECATED_MSG( - "Please use the single parameter version of SetTotalBytesLimit(). The " - "second parameter is ignored.") - void SetTotalBytesLimit(int total_bytes_limit, int) { - SetTotalBytesLimit(total_bytes_limit); - } - // The Total Bytes Limit minus the Current Position, or -1 if the total bytes // limit is INT_MAX. int BytesUntilTotalBytesLimit() const; diff --git a/src/google/protobuf/io/coded_stream_unittest.cc b/src/google/protobuf/io/coded_stream_unittest.cc index d02cc88f5b1b..671bde964f31 100644 --- a/src/google/protobuf/io/coded_stream_unittest.cc +++ b/src/google/protobuf/io/coded_stream_unittest.cc @@ -741,7 +741,7 @@ TEST_1D(CodedStreamTest, ReadStringReservesMemoryOnTotalLimit, kBlockSizes) { { CodedInputStream coded_input(&input); - coded_input.SetTotalBytesLimit(sizeof(kRawBytes), sizeof(kRawBytes)); + coded_input.SetTotalBytesLimit(sizeof(kRawBytes)); EXPECT_EQ(sizeof(kRawBytes), coded_input.BytesUntilTotalBytesLimit()); std::string str; @@ -864,7 +864,7 @@ TEST_F(CodedStreamTest, ReadStringNoReservationSizeIsOverTheTotalBytesLimit) { { CodedInputStream coded_input(&input); - coded_input.SetTotalBytesLimit(16, 16); + coded_input.SetTotalBytesLimit(16); std::string str; EXPECT_FALSE(coded_input.ReadString(&str, strlen(kRawBytes))); @@ -886,7 +886,7 @@ TEST_F(CodedStreamTest, { CodedInputStream coded_input(&input); coded_input.PushLimit(sizeof(buffer_)); - coded_input.SetTotalBytesLimit(16, 16); + coded_input.SetTotalBytesLimit(16); std::string str; EXPECT_FALSE(coded_input.ReadString(&str, strlen(kRawBytes))); @@ -908,7 +908,7 @@ TEST_F(CodedStreamTest, { CodedInputStream coded_input(&input); coded_input.PushLimit(16); - coded_input.SetTotalBytesLimit(sizeof(buffer_), sizeof(buffer_)); + coded_input.SetTotalBytesLimit(sizeof(buffer_)); EXPECT_EQ(sizeof(buffer_), coded_input.BytesUntilTotalBytesLimit()); std::string str; @@ -1180,7 +1180,7 @@ TEST_F(CodedStreamTest, OverflowLimit) { TEST_F(CodedStreamTest, TotalBytesLimit) { ArrayInputStream input(buffer_, sizeof(buffer_)); CodedInputStream coded_input(&input); - coded_input.SetTotalBytesLimit(16, -1); + coded_input.SetTotalBytesLimit(16); EXPECT_EQ(16, coded_input.BytesUntilTotalBytesLimit()); std::string str; @@ -1200,7 +1200,7 @@ TEST_F(CodedStreamTest, TotalBytesLimit) { "A protocol message was rejected because it was too big", errors[0]); - coded_input.SetTotalBytesLimit(32, -1); + coded_input.SetTotalBytesLimit(32); EXPECT_EQ(16, coded_input.BytesUntilTotalBytesLimit()); EXPECT_TRUE(coded_input.ReadString(&str, 16)); EXPECT_EQ(0, coded_input.BytesUntilTotalBytesLimit()); @@ -1213,7 +1213,7 @@ TEST_F(CodedStreamTest, TotalBytesLimitNotValidMessageEnd) { CodedInputStream coded_input(&input); // Set both total_bytes_limit and a regular limit at 16 bytes. - coded_input.SetTotalBytesLimit(16, -1); + coded_input.SetTotalBytesLimit(16); CodedInputStream::Limit limit = coded_input.PushLimit(16); // Read 16 bytes.