From 59f9dcb72f46258ffefea3aaf93f51e927c1cc10 Mon Sep 17 00:00:00 2001 From: rsgowman Date: Tue, 10 Apr 2018 14:48:18 -0400 Subject: FIREBASE_DEV_ASSERT -> FIREBASE_ASSERT within serializer.cc (#1062) --- .../src/firebase/firestore/remote/serializer.cc | 30 +++++++--------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'Firestore/core') diff --git a/Firestore/core/src/firebase/firestore/remote/serializer.cc b/Firestore/core/src/firebase/firestore/remote/serializer.cc index 25f4979..ff135fd 100644 --- a/Firestore/core/src/firebase/firestore/remote/serializer.cc +++ b/Firestore/core/src/firebase/firestore/remote/serializer.cc @@ -176,9 +176,7 @@ void Writer::WriteTag(pb_wire_type_t wiretype, uint32_t field_number) { if (!status_.ok()) return; if (!pb_encode_tag(&stream_, wiretype, field_number)) { - const char* errmsg = PB_GET_ERROR(&stream_); - FIREBASE_DEV_ASSERT_MESSAGE(false, errmsg); - status_ = Status(FirestoreErrorCode::Internal, errmsg); + FIREBASE_ASSERT_MESSAGE(false, PB_GET_ERROR(&stream_)); } } @@ -190,9 +188,7 @@ void Writer::WriteVarint(uint64_t value) { if (!status_.ok()) return; if (!pb_encode_varint(&stream_, value)) { - const char* errmsg = PB_GET_ERROR(&stream_); - FIREBASE_DEV_ASSERT_MESSAGE(false, errmsg); - status_ = Status(FirestoreErrorCode::Internal, errmsg); + FIREBASE_ASSERT_MESSAGE(false, PB_GET_ERROR(&stream_)); } } @@ -257,9 +253,7 @@ void Writer::WriteString(const std::string& string_value) { if (!pb_encode_string( &stream_, reinterpret_cast(string_value.c_str()), string_value.length())) { - const char* errmsg = PB_GET_ERROR(&stream_); - FIREBASE_DEV_ASSERT_MESSAGE(false, errmsg); - status_ = Status(FirestoreErrorCode::Internal, errmsg); + FIREBASE_ASSERT_MESSAGE(false, PB_GET_ERROR(&stream_)); } } @@ -408,20 +402,16 @@ void Writer::WriteNestedMessage( // fail since sizing streams don't actually have any buffer space.) if (stream_.callback == nullptr) { if (!pb_write(&stream_, nullptr, size)) { - const char* errmsg = PB_GET_ERROR(&stream_); - FIREBASE_DEV_ASSERT_MESSAGE(false, errmsg); - status_ = Status(FirestoreErrorCode::Internal, errmsg); + FIREBASE_ASSERT_MESSAGE(false, PB_GET_ERROR(&stream_)); } return; } // Ensure the output stream has enough space if (stream_.bytes_written + size > stream_.max_size) { - const char* errmsg = - "Insufficient space in the output stream to write the given message"; - FIREBASE_DEV_ASSERT_MESSAGE(false, errmsg); - status_ = Status(FirestoreErrorCode::Internal, errmsg); - return; + FIREBASE_ASSERT_MESSAGE( + false, + "Insufficient space in the output stream to write the given message"); } // Use a substream to verify that a callback doesn't write more than what it @@ -441,10 +431,8 @@ void Writer::WriteNestedMessage( if (writer.bytes_written() != size) { // submsg size changed - const char* errmsg = - "Parsing the nested message twice yielded different sizes"; - FIREBASE_DEV_ASSERT_MESSAGE(false, errmsg); - status_ = Status(FirestoreErrorCode::Internal, errmsg); + FIREBASE_ASSERT_MESSAGE( + false, "Parsing the nested message twice yielded different sizes"); } } -- cgit v1.2.3