Sync from Piper @305960231
PROTOBUF_SYNC_PIPER
This commit is contained in:
commit
fb32b5a343
@ -81,8 +81,6 @@ function(protobuf_generate)
|
||||
list(APPEND _protobuf_include_path -I ${_abs_path})
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
foreach(DIR ${protobuf_generate_IMPORT_DIRS})
|
||||
@ -93,12 +91,31 @@ function(protobuf_generate)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT _protobuf_include_path)
|
||||
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
set(_generated_srcs_all)
|
||||
foreach(_proto ${protobuf_generate_PROTOS})
|
||||
get_filename_component(_abs_file ${_proto} ABSOLUTE)
|
||||
get_filename_component(_abs_dir ${_abs_file} DIRECTORY)
|
||||
get_filename_component(_basename ${_proto} NAME_WE)
|
||||
file(RELATIVE_PATH _rel_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_abs_dir})
|
||||
get_filename_component(_basename ${_proto} NAME_WLE)
|
||||
|
||||
set(_suitable_include_found FALSE)
|
||||
foreach(DIR ${_protobuf_include_path})
|
||||
if(NOT DIR STREQUAL "-I")
|
||||
file(RELATIVE_PATH _rel_dir ${DIR} ${_abs_dir})
|
||||
if(NOT "${_rel_dir}" MATCHES "^\.\.[/\\].*")
|
||||
set(_suitable_include_found TRUE)
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT _suitable_include_found)
|
||||
message(SEND_ERROR "Error: protobuf_generate could not find any correct proto include directory.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(_generated_srcs)
|
||||
foreach(_ext ${protobuf_generate_GENERATE_EXTENSIONS})
|
||||
|
@ -33,11 +33,14 @@
|
||||
|
||||
#include <google/protobuf/pyext/message.h>
|
||||
|
||||
#include <structmember.h> // A Python header file.
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <structmember.h> // A Python header file.
|
||||
|
||||
#include <google/protobuf/stubs/strutil.h>
|
||||
|
||||
#ifndef PyVarObject_HEAD_INIT
|
||||
#define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size,
|
||||
@ -456,7 +459,7 @@ static PyObject* GetClassAttribute(CMessageClass *self, PyObject* name) {
|
||||
Py_ssize_t attr_size;
|
||||
static const char kSuffix[] = "_FIELD_NUMBER";
|
||||
if (PyString_AsStringAndSize(name, &attr, &attr_size) >= 0 &&
|
||||
strings::EndsWith(StringPiece(attr, attr_size), kSuffix)) {
|
||||
HasSuffixString(StringPiece(attr, attr_size), kSuffix)) {
|
||||
std::string field_name(attr, attr_size - sizeof(kSuffix) + 1);
|
||||
LowerString(&field_name);
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include <google/protobuf/compiler/cpp/cpp_file.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
@ -94,7 +94,9 @@ bool CollectExtensions(const Message& message, FieldDescriptorSet* extensions) {
|
||||
reflection->ListFields(message, &fields);
|
||||
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
if (fields[i]->is_extension()) extensions->insert(fields[i]);
|
||||
if (fields[i]->is_extension()) {
|
||||
extensions->insert(fields[i]);
|
||||
}
|
||||
|
||||
if (GetJavaType(fields[i]) == JAVATYPE_MESSAGE) {
|
||||
if (fields[i]->is_repeated()) {
|
||||
|
@ -106,9 +106,8 @@ class MockCodeGenerator : public CodeGenerator {
|
||||
|
||||
// implements CodeGenerator ----------------------------------------
|
||||
|
||||
virtual bool Generate(const FileDescriptor* file,
|
||||
const std::string& parameter, GeneratorContext* context,
|
||||
std::string* error) const;
|
||||
bool Generate(const FileDescriptor* file, const std::string& parameter,
|
||||
GeneratorContext* context, std::string* error) const override;
|
||||
|
||||
uint64 GetSupportedFeatures() const override;
|
||||
void SuppressFeatures(uint64 features);
|
||||
|
@ -69,10 +69,9 @@ class PROTOC_EXPORT Generator : public CodeGenerator {
|
||||
virtual ~Generator();
|
||||
|
||||
// CodeGenerator methods.
|
||||
virtual bool Generate(const FileDescriptor* file,
|
||||
const std::string& parameter,
|
||||
GeneratorContext* generator_context,
|
||||
std::string* error) const;
|
||||
bool Generate(const FileDescriptor* file, const std::string& parameter,
|
||||
GeneratorContext* generator_context,
|
||||
std::string* error) const override;
|
||||
|
||||
uint64 GetSupportedFeatures() const override;
|
||||
|
||||
|
@ -737,7 +737,7 @@ const Message* DynamicMessageFactory::GetPrototypeNoLock(
|
||||
uint32* has_bits_indices = new uint32[type->field_count()];
|
||||
for (int i = 0; i < type->field_count(); i++) {
|
||||
// Initialize to -1, fields that need a hasbit will overwrite.
|
||||
has_bits_indices[i] = -1;
|
||||
has_bits_indices[i] = static_cast<uint32>(-1);
|
||||
}
|
||||
type_info->has_bits_indices.reset(has_bits_indices);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ struct ReflectionSchema {
|
||||
|
||||
// Bit index within the bit array of hasbits. Bit order is low-to-high.
|
||||
uint32 HasBitIndex(const FieldDescriptor* field) const {
|
||||
if (has_bits_offset_ == -1) return -1;
|
||||
if (has_bits_offset_ == -1) return static_cast<uint32>(-1);
|
||||
GOOGLE_DCHECK(HasHasbits());
|
||||
return has_bit_indices_[field->index()];
|
||||
}
|
||||
|
@ -153,6 +153,7 @@ class StatusOr {
|
||||
// If you need to initialize a T object from the stored value,
|
||||
// ConsumeValueOrDie() may be more efficient.
|
||||
const T& ValueOrDie() const;
|
||||
const T& value () const;
|
||||
|
||||
private:
|
||||
Status status_;
|
||||
@ -254,6 +255,14 @@ inline const T& StatusOr<T>::ValueOrDie() const {
|
||||
}
|
||||
return value_;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline const T& StatusOr<T>::value() const {
|
||||
if (!status_.ok()) {
|
||||
internal::StatusOrHelper::Crash(status_);
|
||||
}
|
||||
return value_;
|
||||
}
|
||||
} // namespace util
|
||||
} // namespace protobuf
|
||||
} // namespace google
|
||||
|
@ -173,7 +173,7 @@ StatusOr<double> DataPiece::ToDouble() const {
|
||||
if (str_ == "-Infinity") return -std::numeric_limits<double>::infinity();
|
||||
if (str_ == "NaN") return std::numeric_limits<double>::quiet_NaN();
|
||||
StatusOr<double> value = StringToNumber<double>(safe_strtod);
|
||||
if (value.ok() && !std::isfinite(value.ValueOrDie())) {
|
||||
if (value.ok() && !std::isfinite(value.value())) {
|
||||
// safe_strtod converts out-of-range values to +inf/-inf, but we want
|
||||
// to report them as errors.
|
||||
return InvalidArgument(StrCat("\"", str_, "\""));
|
||||
@ -289,7 +289,7 @@ StatusOr<int> DataPiece::ToEnum(const google::protobuf::Enum* enum_type,
|
||||
StatusOr<int32> int_value = ToInt32();
|
||||
if (int_value.ok()) {
|
||||
if (const google::protobuf::EnumValue* enum_value =
|
||||
FindEnumValueByNumberOrNull(enum_type, int_value.ValueOrDie())) {
|
||||
FindEnumValueByNumberOrNull(enum_type, int_value.value())) {
|
||||
return enum_value->number();
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ T ConvertTo(StringPiece value,
|
||||
StatusOr<T> (DataPiece::*converter_fn)() const, T default_value) {
|
||||
if (value.empty()) return default_value;
|
||||
StatusOr<T> result = (DataPiece(value, true).*converter_fn)();
|
||||
return result.ok() ? result.ValueOrDie() : default_value;
|
||||
return result.ok() ? result.value() : default_value;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -290,7 +290,7 @@ const google::protobuf::Type* DefaultValueObjectWriter::Node::GetMapValueType(
|
||||
if (!sub_type.ok()) {
|
||||
GOOGLE_LOG(WARNING) << "Cannot resolve type '" << sub_field.type_url() << "'.";
|
||||
} else {
|
||||
return sub_type.ValueOrDie();
|
||||
return sub_type.value();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -354,7 +354,7 @@ void DefaultValueObjectWriter::Node::PopulateChildren(
|
||||
// "field" is of an unknown type.
|
||||
GOOGLE_LOG(WARNING) << "Cannot resolve type '" << field.type_url() << "'.";
|
||||
} else {
|
||||
const google::protobuf::Type* found_type = found_result.ValueOrDie();
|
||||
const google::protobuf::Type* found_type = found_result.value();
|
||||
is_map = IsMap(field, *found_type);
|
||||
|
||||
if (!is_map) {
|
||||
@ -587,7 +587,7 @@ void DefaultValueObjectWriter::RenderDataPiece(StringPiece name,
|
||||
name == "@type") {
|
||||
util::StatusOr<std::string> data_string = data.ToString();
|
||||
if (data_string.ok()) {
|
||||
const std::string& string_value = data_string.ValueOrDie();
|
||||
const std::string& string_value = data_string.value();
|
||||
// If the type of current_ is "Any" and its "@type" field is being set
|
||||
// here, sets the type of current_ to be the type specified by the
|
||||
// "@type".
|
||||
@ -596,7 +596,7 @@ void DefaultValueObjectWriter::RenderDataPiece(StringPiece name,
|
||||
if (!found_type.ok()) {
|
||||
GOOGLE_LOG(WARNING) << "Failed to resolve type '" << string_value << "'.";
|
||||
} else {
|
||||
current_->set_type(found_type.ValueOrDie());
|
||||
current_->set_type(found_type.value());
|
||||
}
|
||||
current_->set_is_any(true);
|
||||
// If the "@type" field is placed after other fields, we should populate
|
||||
|
@ -42,35 +42,35 @@ void ObjectWriter::RenderDataPieceTo(const DataPiece& data,
|
||||
StringPiece name, ObjectWriter* ow) {
|
||||
switch (data.type()) {
|
||||
case DataPiece::TYPE_INT32: {
|
||||
ow->RenderInt32(name, data.ToInt32().ValueOrDie());
|
||||
ow->RenderInt32(name, data.ToInt32().value());
|
||||
break;
|
||||
}
|
||||
case DataPiece::TYPE_INT64: {
|
||||
ow->RenderInt64(name, data.ToInt64().ValueOrDie());
|
||||
ow->RenderInt64(name, data.ToInt64().value());
|
||||
break;
|
||||
}
|
||||
case DataPiece::TYPE_UINT32: {
|
||||
ow->RenderUint32(name, data.ToUint32().ValueOrDie());
|
||||
ow->RenderUint32(name, data.ToUint32().value());
|
||||
break;
|
||||
}
|
||||
case DataPiece::TYPE_UINT64: {
|
||||
ow->RenderUint64(name, data.ToUint64().ValueOrDie());
|
||||
ow->RenderUint64(name, data.ToUint64().value());
|
||||
break;
|
||||
}
|
||||
case DataPiece::TYPE_DOUBLE: {
|
||||
ow->RenderDouble(name, data.ToDouble().ValueOrDie());
|
||||
ow->RenderDouble(name, data.ToDouble().value());
|
||||
break;
|
||||
}
|
||||
case DataPiece::TYPE_FLOAT: {
|
||||
ow->RenderFloat(name, data.ToFloat().ValueOrDie());
|
||||
ow->RenderFloat(name, data.ToFloat().value());
|
||||
break;
|
||||
}
|
||||
case DataPiece::TYPE_BOOL: {
|
||||
ow->RenderBool(name, data.ToBool().ValueOrDie());
|
||||
ow->RenderBool(name, data.ToBool().value());
|
||||
break;
|
||||
}
|
||||
case DataPiece::TYPE_STRING: {
|
||||
ow->RenderString(name, data.ToString().ValueOrDie());
|
||||
ow->RenderString(name, data.ToString().value());
|
||||
break;
|
||||
}
|
||||
case DataPiece::TYPE_BYTES: {
|
||||
|
@ -124,7 +124,7 @@ inline Status WriteInt32(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<int32> i32 = data.ToInt32();
|
||||
if (i32.ok()) {
|
||||
WireFormatLite::WriteInt32(field_number, i32.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteInt32(field_number, i32.value(), stream);
|
||||
}
|
||||
return i32.status();
|
||||
}
|
||||
@ -134,7 +134,7 @@ inline Status WriteSFixed32(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<int32> i32 = data.ToInt32();
|
||||
if (i32.ok()) {
|
||||
WireFormatLite::WriteSFixed32(field_number, i32.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteSFixed32(field_number, i32.value(), stream);
|
||||
}
|
||||
return i32.status();
|
||||
}
|
||||
@ -144,7 +144,7 @@ inline Status WriteSInt32(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<int32> i32 = data.ToInt32();
|
||||
if (i32.ok()) {
|
||||
WireFormatLite::WriteSInt32(field_number, i32.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteSInt32(field_number, i32.value(), stream);
|
||||
}
|
||||
return i32.status();
|
||||
}
|
||||
@ -154,7 +154,7 @@ inline Status WriteFixed32(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<uint32> u32 = data.ToUint32();
|
||||
if (u32.ok()) {
|
||||
WireFormatLite::WriteFixed32(field_number, u32.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteFixed32(field_number, u32.value(), stream);
|
||||
}
|
||||
return u32.status();
|
||||
}
|
||||
@ -164,7 +164,7 @@ inline Status WriteUInt32(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<uint32> u32 = data.ToUint32();
|
||||
if (u32.ok()) {
|
||||
WireFormatLite::WriteUInt32(field_number, u32.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteUInt32(field_number, u32.value(), stream);
|
||||
}
|
||||
return u32.status();
|
||||
}
|
||||
@ -174,7 +174,7 @@ inline Status WriteInt64(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<int64> i64 = data.ToInt64();
|
||||
if (i64.ok()) {
|
||||
WireFormatLite::WriteInt64(field_number, i64.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteInt64(field_number, i64.value(), stream);
|
||||
}
|
||||
return i64.status();
|
||||
}
|
||||
@ -184,7 +184,7 @@ inline Status WriteSFixed64(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<int64> i64 = data.ToInt64();
|
||||
if (i64.ok()) {
|
||||
WireFormatLite::WriteSFixed64(field_number, i64.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteSFixed64(field_number, i64.value(), stream);
|
||||
}
|
||||
return i64.status();
|
||||
}
|
||||
@ -194,7 +194,7 @@ inline Status WriteSInt64(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<int64> i64 = data.ToInt64();
|
||||
if (i64.ok()) {
|
||||
WireFormatLite::WriteSInt64(field_number, i64.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteSInt64(field_number, i64.value(), stream);
|
||||
}
|
||||
return i64.status();
|
||||
}
|
||||
@ -204,7 +204,7 @@ inline Status WriteFixed64(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<uint64> u64 = data.ToUint64();
|
||||
if (u64.ok()) {
|
||||
WireFormatLite::WriteFixed64(field_number, u64.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteFixed64(field_number, u64.value(), stream);
|
||||
}
|
||||
return u64.status();
|
||||
}
|
||||
@ -214,7 +214,7 @@ inline Status WriteUInt64(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<uint64> u64 = data.ToUint64();
|
||||
if (u64.ok()) {
|
||||
WireFormatLite::WriteUInt64(field_number, u64.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteUInt64(field_number, u64.value(), stream);
|
||||
}
|
||||
return u64.status();
|
||||
}
|
||||
@ -224,7 +224,7 @@ inline Status WriteDouble(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<double> d = data.ToDouble();
|
||||
if (d.ok()) {
|
||||
WireFormatLite::WriteDouble(field_number, d.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteDouble(field_number, d.value(), stream);
|
||||
}
|
||||
return d.status();
|
||||
}
|
||||
@ -234,7 +234,7 @@ inline Status WriteFloat(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<float> f = data.ToFloat();
|
||||
if (f.ok()) {
|
||||
WireFormatLite::WriteFloat(field_number, f.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteFloat(field_number, f.value(), stream);
|
||||
}
|
||||
return f.status();
|
||||
}
|
||||
@ -244,7 +244,7 @@ inline Status WriteBool(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<bool> b = data.ToBool();
|
||||
if (b.ok()) {
|
||||
WireFormatLite::WriteBool(field_number, b.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteBool(field_number, b.value(), stream);
|
||||
}
|
||||
return b.status();
|
||||
}
|
||||
@ -264,7 +264,7 @@ inline Status WriteString(int field_number, const DataPiece& data,
|
||||
CodedOutputStream* stream) {
|
||||
StatusOr<std::string> s = data.ToString();
|
||||
if (s.ok()) {
|
||||
WireFormatLite::WriteString(field_number, s.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteString(field_number, s.value(), stream);
|
||||
}
|
||||
return s.status();
|
||||
}
|
||||
@ -602,7 +602,7 @@ Status ProtoWriter::WriteEnum(int field_number, const DataPiece& data,
|
||||
case_insensitive_enum_parsing,
|
||||
ignore_unknown_values, &is_unknown_enum_value);
|
||||
if (e.ok() && !is_unknown_enum_value) {
|
||||
WireFormatLite::WriteEnum(field_number, e.ValueOrDie(), stream);
|
||||
WireFormatLite::WriteEnum(field_number, e.value(), stream);
|
||||
}
|
||||
return e.status();
|
||||
}
|
||||
@ -704,8 +704,8 @@ ProtoWriter* ProtoWriter::RenderPrimitiveField(
|
||||
break;
|
||||
}
|
||||
default: // TYPE_GROUP or TYPE_MESSAGE
|
||||
status = Status(util::error::INVALID_ARGUMENT,
|
||||
data.ToString().ValueOrDie());
|
||||
status =
|
||||
Status(util::error::INVALID_ARGUMENT, data.ToString().value());
|
||||
}
|
||||
|
||||
if (!status.ok()) {
|
||||
|
@ -647,7 +647,7 @@ Status ProtoStreamObjectSource::RenderAny(const ProtoStreamObjectSource* os,
|
||||
resolved_type.status().message());
|
||||
}
|
||||
// nested_type cannot be null at this time.
|
||||
const google::protobuf::Type* nested_type = resolved_type.ValueOrDie();
|
||||
const google::protobuf::Type* nested_type = resolved_type.value();
|
||||
|
||||
io::ArrayInputStream zero_copy_stream(value.data(), value.size());
|
||||
io::CodedInputStream in_stream(&zero_copy_stream);
|
||||
|
@ -334,7 +334,7 @@ void ProtoStreamObjectWriter::AnyWriter::StartAny(const DataPiece& value) {
|
||||
invalid_ = true;
|
||||
return;
|
||||
}
|
||||
type_url_ = s.ValueOrDie();
|
||||
type_url_ = s.value();
|
||||
}
|
||||
// Resolve the type url, and report an error if we failed to resolve it.
|
||||
StatusOr<const google::protobuf::Type*> resolved_type =
|
||||
@ -345,7 +345,7 @@ void ProtoStreamObjectWriter::AnyWriter::StartAny(const DataPiece& value) {
|
||||
return;
|
||||
}
|
||||
// At this point, type is never null.
|
||||
const google::protobuf::Type* type = resolved_type.ValueOrDie();
|
||||
const google::protobuf::Type* type = resolved_type.value();
|
||||
|
||||
well_known_type_render_ = FindTypeRenderer(type_url_);
|
||||
if (well_known_type_render_ != nullptr ||
|
||||
@ -897,7 +897,7 @@ Status ProtoStreamObjectWriter::RenderStructValue(ProtoStreamObjectWriter* ow,
|
||||
if (int_value.ok()) {
|
||||
ow->ProtoWriter::RenderDataPiece(
|
||||
"string_value",
|
||||
DataPiece(SimpleDtoa(int_value.ValueOrDie()), true));
|
||||
DataPiece(SimpleDtoa(int_value.value()), true));
|
||||
return Status();
|
||||
}
|
||||
}
|
||||
@ -910,7 +910,7 @@ Status ProtoStreamObjectWriter::RenderStructValue(ProtoStreamObjectWriter* ow,
|
||||
if (int_value.ok()) {
|
||||
ow->ProtoWriter::RenderDataPiece(
|
||||
"string_value",
|
||||
DataPiece(SimpleDtoa(int_value.ValueOrDie()), true));
|
||||
DataPiece(SimpleDtoa(int_value.value()), true));
|
||||
return Status();
|
||||
}
|
||||
}
|
||||
@ -924,8 +924,7 @@ Status ProtoStreamObjectWriter::RenderStructValue(ProtoStreamObjectWriter* ow,
|
||||
StatusOr<int64> int_value = data.ToInt64();
|
||||
if (int_value.ok()) {
|
||||
ow->ProtoWriter::RenderDataPiece(
|
||||
"string_value",
|
||||
DataPiece(StrCat(int_value.ValueOrDie()), true));
|
||||
"string_value", DataPiece(StrCat(int_value.value()), true));
|
||||
return Status();
|
||||
}
|
||||
}
|
||||
@ -939,8 +938,7 @@ Status ProtoStreamObjectWriter::RenderStructValue(ProtoStreamObjectWriter* ow,
|
||||
StatusOr<uint64> int_value = data.ToUint64();
|
||||
if (int_value.ok()) {
|
||||
ow->ProtoWriter::RenderDataPiece(
|
||||
"string_value",
|
||||
DataPiece(StrCat(int_value.ValueOrDie()), true));
|
||||
"string_value", DataPiece(StrCat(int_value.value()), true));
|
||||
return Status();
|
||||
}
|
||||
}
|
||||
@ -953,7 +951,7 @@ Status ProtoStreamObjectWriter::RenderStructValue(ProtoStreamObjectWriter* ow,
|
||||
if (float_value.ok()) {
|
||||
ow->ProtoWriter::RenderDataPiece(
|
||||
"string_value",
|
||||
DataPiece(SimpleDtoa(float_value.ValueOrDie()), true));
|
||||
DataPiece(SimpleDtoa(float_value.value()), true));
|
||||
return Status();
|
||||
}
|
||||
}
|
||||
@ -966,7 +964,7 @@ Status ProtoStreamObjectWriter::RenderStructValue(ProtoStreamObjectWriter* ow,
|
||||
if (double_value.ok()) {
|
||||
ow->ProtoWriter::RenderDataPiece(
|
||||
"string_value",
|
||||
DataPiece(SimpleDtoa(double_value.ValueOrDie()), true));
|
||||
DataPiece(SimpleDtoa(double_value.value()), true));
|
||||
return Status();
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class TypeInfoForTypeResolver : public TypeInfo {
|
||||
const google::protobuf::Type* GetTypeByTypeUrl(
|
||||
StringPiece type_url) const override {
|
||||
StatusOrType result = ResolveTypeUrl(type_url);
|
||||
return result.ok() ? result.ValueOrDie() : NULL;
|
||||
return result.ok() ? result.value() : NULL;
|
||||
}
|
||||
|
||||
const google::protobuf::Enum* GetEnumByTypeUrl(
|
||||
@ -89,7 +89,7 @@ class TypeInfoForTypeResolver : public TypeInfo {
|
||||
std::map<StringPiece, StatusOrEnum>::iterator it =
|
||||
cached_enums_.find(type_url);
|
||||
if (it != cached_enums_.end()) {
|
||||
return it->second.ok() ? it->second.ValueOrDie() : NULL;
|
||||
return it->second.ok() ? it->second.value() : NULL;
|
||||
}
|
||||
// Stores the string value so it can be referenced using StringPiece in the
|
||||
// cached_enums_ map.
|
||||
@ -102,7 +102,7 @@ class TypeInfoForTypeResolver : public TypeInfo {
|
||||
StatusOrEnum result =
|
||||
status.ok() ? StatusOrEnum(enum_type.release()) : StatusOrEnum(status);
|
||||
cached_enums_[string_type_url] = result;
|
||||
return result.ok() ? result.ValueOrDie() : NULL;
|
||||
return result.ok() ? result.value() : NULL;
|
||||
}
|
||||
|
||||
const google::protobuf::Field* FindField(
|
||||
@ -134,7 +134,7 @@ class TypeInfoForTypeResolver : public TypeInfo {
|
||||
cached_types->begin();
|
||||
it != cached_types->end(); ++it) {
|
||||
if (it->second.ok()) {
|
||||
delete it->second.ValueOrDie();
|
||||
delete it->second.value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user