Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: third_party/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc

Issue 2590803003: Revert "third_party/protobuf: Update to HEAD (83d681ee2c)" (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc
diff --git a/third_party/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc b/third_party/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc
index 6e4edd883607703d3b76a7404ca4a491d31e6ab9..b84210c10b9a43b098e6f7b32d187e4269ee47e8 100644
--- a/third_party/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc
+++ b/third_party/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc
@@ -147,7 +147,7 @@ JsonObjectWriter* JsonObjectWriter::RenderBytes(StringPiece name,
string base64;
if (use_websafe_base64_for_bytes_)
- WebSafeBase64EscapeWithPadding(value.ToString(), &base64);
+ WebSafeBase64Escape(value.ToString(), &base64);
else
Base64Escape(value, &base64);
@@ -164,32 +164,19 @@ JsonObjectWriter* JsonObjectWriter::RenderNull(StringPiece name) {
return RenderSimple(name, "null");
}
-JsonObjectWriter* JsonObjectWriter::RenderNullAsEmpty(StringPiece name) {
- return RenderSimple(name, "");
-}
-
void JsonObjectWriter::WritePrefix(StringPiece name) {
bool not_first = !element()->is_first();
if (not_first) WriteChar(',');
if (not_first || !element()->is_root()) NewLine();
- bool empty_key_ok = GetAndResetEmptyKeyOk();
- if (!name.empty() || empty_key_ok) {
+ if (!name.empty()) {
WriteChar('"');
- if (!name.empty()) {
- ArrayByteSource source(name);
- JsonEscaping::Escape(&source, &sink_);
- }
+ ArrayByteSource source(name);
+ JsonEscaping::Escape(&source, &sink_);
stream_->WriteString("\":");
if (!indent_string_.empty()) WriteChar(' ');
}
}
-bool JsonObjectWriter::GetAndResetEmptyKeyOk() {
- bool retval = empty_name_ok_for_next_key_;
- empty_name_ok_for_next_key_ = false;
- return retval;
-}
-
} // namespace converter
} // namespace util
} // namespace protobuf

Powered by Google App Engine
This is Rietveld 408576698