Skip to content

Commit 00633b8

Browse files
committed
Switch from StrCat to ShortFormat
To avoid direct dependency on absl.
1 parent 6d846d9 commit 00633b8

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

examples/libfuzzer/libfuzzer_bin_example.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ DEFINE_BINARY_PROTO_FUZZER(const libfuzzer_example::Msg& message) {
5555
!std::isnan(message.optional_float()) &&
5656
std::fabs(message.optional_float()) > 1000 &&
5757
message.any().UnpackTo(&file) && !file.name().empty()) {
58-
std::cerr << absl::StrCat(message) << "\n";
58+
std::cerr << protobuf_mutator::protobuf::ShortFormat(message) << "\n";
5959
abort();
6060
}
6161
}

examples/libfuzzer/libfuzzer_example.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ DEFINE_PROTO_FUZZER(const libfuzzer_example::Msg& message) {
5555
!std::isnan(message.optional_float()) &&
5656
std::fabs(message.optional_float()) > 1000 &&
5757
message.any().UnpackTo(&file) && !file.name().empty()) {
58-
std::cerr << absl::StrCat(message) << "\n";
58+
std::cerr << protobuf_mutator::protobuf::ShortFormat(message) << "\n";
5959
abort();
6060
}
6161
}

src/field_instance.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ class ConstFieldInstance {
195195
const protobuf::FieldDescriptor* descriptor() const { return descriptor_; }
196196

197197
std::string DebugString() const {
198-
std::string s = absl::StrCat(*descriptor_);
199-
if (is_repeated()) s += absl::StrCat("[", index_, "]");
200-
return s + " of\n" + absl::StrCat(*message_);
198+
std::string s = descriptor_->DebugString();
199+
if (is_repeated()) s += "[" + std::to_string(index_) + "]";
200+
return s + " of\n" + protobuf::ShortFormat(*message_);
201201
}
202202

203203
protected:

src/mutator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ std::string Mutator::MutateUtf8String(const std::string& value,
801801

802802
bool Mutator::IsInitialized(const Message& message) const {
803803
if (!keep_initialized_ || message.IsInitialized()) return true;
804-
std::cerr << "Uninitialized: " << absl::StrCat(message) << "\n";
804+
std::cerr << "Uninitialized: " << protobuf::ShortFormat(message) << "\n";
805805
return false;
806806
}
807807

src/mutator_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ bool Mutate(const protobuf::Message& from, const protobuf::Message& to,
410410
}
411411

412412
ADD_FAILURE() << "Failed to get from:\n"
413-
<< absl::StrCat(from) << "\nto:\n"
414-
<< absl::StrCat(to);
413+
<< protobuf::ShortFormat(from) << "\nto:\n"
414+
<< protobuf::ShortFormat(to);
415415
return false;
416416
}
417417

0 commit comments

Comments
 (0)