Replace SimpleItoa with StrCat

pull/6032/head
Hao Nguyen 6 years ago
parent 5b232b8ecb
commit 1a23e2ab2d
  1. 2
      src/google/protobuf/compiler/objectivec/objectivec_enum.cc
  2. 2
      src/google/protobuf/compiler/objectivec/objectivec_extension.cc
  3. 6
      src/google/protobuf/compiler/objectivec/objectivec_field.cc
  4. 2
      src/google/protobuf/compiler/objectivec/objectivec_file.cc
  5. 10
      src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
  6. 6
      src/google/protobuf/compiler/objectivec/objectivec_message.cc
  7. 6
      src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
  8. 2
      src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc

@ -142,7 +142,7 @@ void EnumGenerator::GenerateHeader(io::Printer* printer) {
"$name$$deprecated_attribute$ = $value$,\n",
"name", EnumValueName(all_values_[i]),
"deprecated_attribute", GetOptionalDeprecatedAttribute(all_values_[i]),
"value", SimpleItoa(all_values_[i]->number()));
"value", StrCat(all_values_[i]->number()));
}
printer->Outdent();
printer->Print(

@ -85,7 +85,7 @@ void ExtensionGenerator::GenerateStaticVariablesInitialization(
std::map<string, string> vars;
vars["root_class_and_method_name"] = root_class_and_method_name_;
vars["extended_type"] = ClassName(descriptor_->containing_type());
vars["number"] = SimpleItoa(descriptor_->number());
vars["number"] = StrCat(descriptor_->number());
std::vector<string> options;
if (descriptor_->is_repeated()) options.push_back("GPBExtensionRepeated");

@ -75,7 +75,7 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
(*variables)["raw_field_name"] = raw_field_name;
(*variables)["field_number_name"] =
classname + "_FieldNumber_" + capitalized_name;
(*variables)["field_number"] = SimpleItoa(descriptor->number());
(*variables)["field_number"] = StrCat(descriptor->number());
(*variables)["field_type"] = GetCapitalizedType(descriptor);
(*variables)["deprecated_attribute"] = GetOptionalDeprecatedAttribute(descriptor);
std::vector<string> field_flags;
@ -213,7 +213,7 @@ void FieldGenerator::GenerateFieldDescription(
}
void FieldGenerator::SetRuntimeHasBit(int has_index) {
variables_["has_index"] = SimpleItoa(has_index);
variables_["has_index"] = StrCat(has_index);
}
void FieldGenerator::SetNoHasBit(void) {
@ -236,7 +236,7 @@ void FieldGenerator::SetOneofIndexBase(int index_base) {
if (descriptor_->containing_oneof() != NULL) {
int index = descriptor_->containing_oneof()->index() + index_base;
// Flip the sign to mark it as a oneof.
variables_["has_index"] = SimpleItoa(-index);
variables_["has_index"] = StrCat(-index);
}
}

@ -241,7 +241,7 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
"#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.\n"
"#endif\n"
"\n",
"google_protobuf_objc_version", SimpleItoa(GOOGLE_PROTOBUF_OBJC_VERSION));
"google_protobuf_objc_version", StrCat(GOOGLE_PROTOBUF_OBJC_VERSION));
// #import any headers for "public imports" in the proto file.
{

@ -805,17 +805,17 @@ string DefaultValue(const FieldDescriptor* field) {
if (field->default_value_int32() == INT_MIN) {
return "-0x80000000";
}
return SimpleItoa(field->default_value_int32());
return StrCat(field->default_value_int32());
case FieldDescriptor::CPPTYPE_UINT32:
return SimpleItoa(field->default_value_uint32()) + "U";
return StrCat(field->default_value_uint32()) + "U";
case FieldDescriptor::CPPTYPE_INT64:
// gcc and llvm reject the decimal form of kint32min and kint64min.
if (field->default_value_int64() == LLONG_MIN) {
return "-0x8000000000000000LL";
}
return SimpleItoa(field->default_value_int64()) + "LL";
return StrCat(field->default_value_int64()) + "LL";
case FieldDescriptor::CPPTYPE_UINT64:
return SimpleItoa(field->default_value_uint64()) + "ULL";
return StrCat(field->default_value_uint64()) + "ULL";
case FieldDescriptor::CPPTYPE_DOUBLE:
return HandleExtremeFloatingPoint(
SimpleDtoa(field->default_value_double()), false);
@ -1547,7 +1547,7 @@ bool ParseSimpleFile(
if (!parser.ParseChunk(StringPiece(static_cast<const char*>(buf), buf_len))) {
*out_error =
string("error: ") + path +
" Line " + SimpleItoa(parser.last_line()) + ", " + parser.error_str();
" Line " + StrCat(parser.last_line()) + ", " + parser.error_str();
return false;
}
}

@ -461,7 +461,7 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
"typedef struct $classname$__storage_ {\n"
" uint32_t _has_storage_[$sizeof_has_storage$];\n",
"classname", class_name_,
"sizeof_has_storage", SimpleItoa(sizeof_has_storage));
"sizeof_has_storage", StrCat(sizeof_has_storage));
printer->Indent();
for (int i = 0; i < descriptor_->field_count(); i++) {
@ -582,8 +582,8 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
" static const GPBExtensionRange ranges[] = {\n");
for (int i = 0; i < sorted_extensions.size(); i++) {
printer->Print(" { .start = $start$, .end = $end$ },\n",
"start", SimpleItoa(sorted_extensions[i]->start),
"end", SimpleItoa(sorted_extensions[i]->end));
"start", StrCat(sorted_extensions[i]->start),
"end", StrCat(sorted_extensions[i]->end));
}
printer->Print(
" };\n"

@ -46,7 +46,7 @@ OneofGenerator::OneofGenerator(const OneofDescriptor* descriptor)
variables_["enum_name"] = OneofEnumName(descriptor_);
variables_["name"] = OneofName(descriptor_);
variables_["capitalized_name"] = OneofNameCapitalized(descriptor_);
variables_["raw_index"] = SimpleItoa(descriptor_->index());
variables_["raw_index"] = StrCat(descriptor_->index());
const Descriptor* msg_descriptor = descriptor_->containing_type();
variables_["owning_message_class"] = ClassName(msg_descriptor);
@ -65,7 +65,7 @@ OneofGenerator::~OneofGenerator() {}
void OneofGenerator::SetOneofIndexBase(int index_base) {
int index = descriptor_->index() + index_base;
// Flip the sign to mark it as a oneof.
variables_["index"] = SimpleItoa(-index);
variables_["index"] = StrCat(-index);
}
void OneofGenerator::GenerateCaseEnum(io::Printer* printer) {
@ -84,7 +84,7 @@ void OneofGenerator::GenerateCaseEnum(io::Printer* printer) {
"$enum_name$_$field_name$ = $field_number$,\n",
"enum_name", enum_name,
"field_name", field_name,
"field_number", SimpleItoa(field->number()));
"field_number", StrCat(field->number()));
}
printer->Outdent();
printer->Print(

@ -152,7 +152,7 @@ int PrimitiveFieldGenerator::ExtraRuntimeHasBitsNeeded(void) const {
void PrimitiveFieldGenerator::SetExtraRuntimeHasBitsBase(int has_base) {
if (GetObjectiveCType(descriptor_) == OBJECTIVECTYPE_BOOLEAN) {
// Set into the offset the has bit to use for the actual value.
variables_["storage_offset_value"] = SimpleItoa(has_base);
variables_["storage_offset_value"] = StrCat(has_base);
variables_["storage_offset_comment"] =
" // Stored in _has_storage_ to save space.";
}

Loading…
Cancel
Save