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

Unified Diff: third_party/protobuf/src/google/protobuf/util/internal/datapiece.h

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/datapiece.h
diff --git a/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h b/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h
index 83516d09725175ea072071fad2a04431cfffc41e..8b2e35d3adc50776c7a63392cd5ad3d04d32fa47 100644
--- a/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h
+++ b/third_party/protobuf/src/google/protobuf/util/internal/datapiece.h
@@ -76,22 +76,13 @@ class LIBPROTOBUF_EXPORT DataPiece {
};
// Constructors and Destructor
- explicit DataPiece(const int32 value)
- : type_(TYPE_INT32), i32_(value), use_strict_base64_decoding_(false) {}
- explicit DataPiece(const int64 value)
- : type_(TYPE_INT64), i64_(value), use_strict_base64_decoding_(false) {}
- explicit DataPiece(const uint32 value)
- : type_(TYPE_UINT32), u32_(value), use_strict_base64_decoding_(false) {}
- explicit DataPiece(const uint64 value)
- : type_(TYPE_UINT64), u64_(value), use_strict_base64_decoding_(false) {}
- explicit DataPiece(const double value)
- : type_(TYPE_DOUBLE),
- double_(value),
- use_strict_base64_decoding_(false) {}
- explicit DataPiece(const float value)
- : type_(TYPE_FLOAT), float_(value), use_strict_base64_decoding_(false) {}
- explicit DataPiece(const bool value)
- : type_(TYPE_BOOL), bool_(value), use_strict_base64_decoding_(false) {}
+ explicit DataPiece(const int32 value) : type_(TYPE_INT32), i32_(value) {}
+ explicit DataPiece(const int64 value) : type_(TYPE_INT64), i64_(value) {}
+ explicit DataPiece(const uint32 value) : type_(TYPE_UINT32), u32_(value) {}
+ explicit DataPiece(const uint64 value) : type_(TYPE_UINT64), u64_(value) {}
+ explicit DataPiece(const double value) : type_(TYPE_DOUBLE), double_(value) {}
+ explicit DataPiece(const float value) : type_(TYPE_FLOAT), float_(value) {}
+ explicit DataPiece(const bool value) : type_(TYPE_BOOL), bool_(value) {}
DataPiece(StringPiece value, bool use_strict_base64_decoding)
: type_(TYPE_STRING),
str_(StringPiecePod::CreateFromStringPiece(value)),
@@ -101,11 +92,10 @@ class LIBPROTOBUF_EXPORT DataPiece {
: type_(TYPE_BYTES),
str_(StringPiecePod::CreateFromStringPiece(value)),
use_strict_base64_decoding_(use_strict_base64_decoding) {}
-
- DataPiece(const DataPiece& r) : type_(r.type_) { InternalCopy(r); }
-
+ DataPiece(const DataPiece& r) : type_(r.type_), str_(r.str_) {}
DataPiece& operator=(const DataPiece& x) {
- InternalCopy(x);
+ type_ = x.type_;
+ str_ = x.str_;
return *this;
}
@@ -117,8 +107,6 @@ class LIBPROTOBUF_EXPORT DataPiece {
// Accessors
Type type() const { return type_; }
- bool use_strict_base64_decoding() { return use_strict_base64_decoding_; }
-
StringPiece str() const {
GOOGLE_LOG_IF(DFATAL, type_ != TYPE_STRING) << "Not a string type.";
return str_;
@@ -159,20 +147,16 @@ class LIBPROTOBUF_EXPORT DataPiece {
// string, first attempts conversion by name, trying names as follows:
// 1) the directly provided string value.
// 2) the value upper-cased and replacing '-' by '_'
- // 3) if use_lower_camel_for_enums is true it also attempts by comparing
- // enum name without underscore with the value upper cased above.
// If the value is not a string, attempts to convert to a 32-bit integer.
// If none of these succeeds, returns a conversion error status.
- util::StatusOr<int> ToEnum(const google::protobuf::Enum* enum_type,
- bool use_lower_camel_for_enums) const;
+ util::StatusOr<int> ToEnum(const google::protobuf::Enum* enum_type) const;
private:
// Disallow implicit constructor.
DataPiece();
// Helper to create NULL or ENUM types.
- DataPiece(Type type, int32 val)
- : type_(type), i32_(val), use_strict_base64_decoding_(false) {}
+ DataPiece(Type type, int32 val) : type_(type), i32_(val) {}
// For numeric conversion between
// int32, int64, uint32, uint64, double, float and bool
@@ -187,9 +171,6 @@ class LIBPROTOBUF_EXPORT DataPiece {
// Decodes a base64 string. Returns true on success.
bool DecodeBase64(StringPiece src, string* dest) const;
- // Helper function to initialize this DataPiece with 'other'.
- void InternalCopy(const DataPiece& other);
-
// Data type for this piece of data.
Type type_;

Powered by Google App Engine
This is Rietveld 408576698