Remove empty-string comparisons.
Use .empty() and !.empty() in favor of == "" or != "". BUG= R=tommi@webrtc.org Review URL: https://codereview.webrtc.org/1228913003 Cr-Commit-Position: refs/heads/master@{#9559}
This commit is contained in:
@ -2192,7 +2192,7 @@ bool ParseMediaDescription(const std::string& message,
|
||||
for (size_t j = 3 ; j < fields.size(); ++j) {
|
||||
// TODO(wu): Remove when below bug is fixed.
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=996329
|
||||
if (fields[j] == "" && j == fields.size() - 1) {
|
||||
if (fields[j].empty() && j == fields.size() - 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ std::string OutputFilePath(std::string name,
|
||||
ss << output_rate / 1000 << "_pcm";
|
||||
|
||||
std::string filename = ss.str();
|
||||
if (temp_filenames[filename] == "")
|
||||
if (temp_filenames[filename].empty())
|
||||
temp_filenames[filename] = test::TempFilename(test::OutputPath(), filename);
|
||||
return temp_filenames[filename];
|
||||
}
|
||||
|
@ -64,12 +64,12 @@ int main(int argc, char* argv[]) {
|
||||
google::SetUsageMessage(kUsage);
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
|
||||
if (!((FLAGS_i == "") ^ (FLAGS_dump == ""))) {
|
||||
if (!((FLAGS_i.empty()) ^ (FLAGS_dump.empty()))) {
|
||||
fprintf(stderr,
|
||||
"An input file must be specified with either -i or -dump.\n");
|
||||
return 1;
|
||||
}
|
||||
if (FLAGS_dump != "") {
|
||||
if (!FLAGS_dump.empty()) {
|
||||
fprintf(stderr, "FIXME: the -dump option is not yet implemented.\n");
|
||||
return 1;
|
||||
}
|
||||
@ -96,7 +96,7 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<AudioProcessing> ap(AudioProcessing::Create(config));
|
||||
if (FLAGS_dump != "") {
|
||||
if (!FLAGS_dump.empty()) {
|
||||
CHECK_EQ(kNoErr, ap->echo_cancellation()->Enable(FLAGS_aec || FLAGS_all));
|
||||
} else if (FLAGS_aec) {
|
||||
fprintf(stderr, "-aec requires a -dump file.\n");
|
||||
|
@ -150,13 +150,13 @@ void void_main() {
|
||||
|
||||
// Prepare the detection file.
|
||||
FILE* detection_file = NULL;
|
||||
if (FLAGS_detection_file_name != "") {
|
||||
if (!FLAGS_detection_file_name.empty()) {
|
||||
detection_file = fopen(FLAGS_detection_file_name.c_str(), "rb");
|
||||
}
|
||||
|
||||
// Prepare the reference file.
|
||||
FILE* reference_file = NULL;
|
||||
if (FLAGS_reference_file_name != "") {
|
||||
if (!FLAGS_reference_file_name.empty()) {
|
||||
reference_file = fopen(FLAGS_reference_file_name.c_str(), "rb");
|
||||
}
|
||||
|
||||
|
@ -116,9 +116,9 @@ Logging::State::State(const std::string& tag, int64_t timestamp_ms,
|
||||
}
|
||||
|
||||
void Logging::State::MergePrevious(const State& previous) {
|
||||
if (tag == "") {
|
||||
if (tag.empty()) {
|
||||
tag = previous.tag;
|
||||
} else if (previous.tag != "") {
|
||||
} else if (!previous.tag.empty()) {
|
||||
tag = previous.tag + "_" + tag;
|
||||
}
|
||||
timestamp_ms = std::max(previous.timestamp_ms, timestamp_ms);
|
||||
|
@ -111,7 +111,7 @@ int Log(const char *format, ...) {
|
||||
// Returns 0 if everything is OK, otherwise an exit code.
|
||||
int HandleCommandLineFlags(webrtc::test::TestConfig* config) {
|
||||
// Validate the mandatory flags:
|
||||
if (FLAGS_input_filename == "" || FLAGS_width == -1 || FLAGS_height == -1) {
|
||||
if (FLAGS_input_filename.empty() || FLAGS_width == -1 || FLAGS_height == -1) {
|
||||
printf("%s\n", google::ProgramUsage());
|
||||
return 1;
|
||||
}
|
||||
@ -140,7 +140,7 @@ int HandleCommandLineFlags(webrtc::test::TestConfig* config) {
|
||||
config->output_dir = FLAGS_output_dir;
|
||||
|
||||
// Manufacture an output filename if none was given.
|
||||
if (FLAGS_output_filename == "") {
|
||||
if (FLAGS_output_filename.empty()) {
|
||||
// Cut out the filename without extension from the given input file
|
||||
// (which may include a path)
|
||||
int startIndex = FLAGS_input_filename.find_last_of("/") + 1;
|
||||
|
@ -73,7 +73,7 @@ FileOutputFrameReceiver::FileOutputFrameReceiver(
|
||||
count_(0) {
|
||||
std::string basename;
|
||||
std::string extension;
|
||||
if (base_out_filename == "") {
|
||||
if (base_out_filename.empty()) {
|
||||
basename = webrtc::test::OutputPath() + "rtp_decoded";
|
||||
extension = "yuv";
|
||||
} else {
|
||||
|
@ -44,9 +44,8 @@ int RtpPlay(const CmdArgs& args) {
|
||||
kDefaultVp8PayloadType, "VP8", webrtc::kVideoCodecVP8));
|
||||
|
||||
std::string output_file = args.outputFile;
|
||||
if (output_file == "") {
|
||||
if (output_file.empty())
|
||||
output_file = webrtc::test::OutputPath() + "RtpPlay_decoded.yuv";
|
||||
}
|
||||
|
||||
webrtc::SimulatedClock clock(0);
|
||||
webrtc::rtpplayer::VcmPayloadSinkFactory factory(output_file, &clock,
|
||||
|
@ -49,7 +49,7 @@ void InitFieldTrialsFromString(const std::string& trials_string) {
|
||||
assert(field_trials_initiated_ == false);
|
||||
field_trials_initiated_ = true;
|
||||
|
||||
if (trials_string == "")
|
||||
if (trials_string.empty())
|
||||
return;
|
||||
|
||||
size_t next_item = 0;
|
||||
|
@ -91,7 +91,7 @@ void RunAgc() {
|
||||
ASSERT_TRUE(out_file != NULL);
|
||||
|
||||
int gain_map[256];
|
||||
if (FLAGS_gain_file != "") {
|
||||
if (!FLAGS_gain_file.empty()) {
|
||||
FILE* gain_file = fopen(FLAGS_gain_file.c_str(), "rt");
|
||||
ASSERT_TRUE(gain_file != NULL);
|
||||
ReadGainMapFromFile(gain_file, FLAGS_gain_offset, gain_map);
|
||||
|
@ -2001,7 +2001,7 @@ TEST_F(EndToEndTest, GetStats) {
|
||||
stats.frame_counts.key_frames != 0 ||
|
||||
stats.frame_counts.delta_frames != 0;
|
||||
|
||||
receive_stats_filled_["CName"] |= stats.c_name != "";
|
||||
receive_stats_filled_["CName"] |= !stats.c_name.empty();
|
||||
|
||||
receive_stats_filled_["RtcpPacketTypeCount"] |=
|
||||
stats.rtcp_packet_type_counts.fir_packets != 0 ||
|
||||
|
@ -106,7 +106,7 @@ static const bool timestamp_offset_dummy =
|
||||
// Flag for rtpdump input file.
|
||||
bool ValidateInputFilenameNotEmpty(const char* flagname,
|
||||
const std::string& string) {
|
||||
return string != "";
|
||||
return !string.empty();
|
||||
}
|
||||
|
||||
DEFINE_string(input_file, "", "input file");
|
||||
@ -156,7 +156,7 @@ class FileRenderPassthrough : public VideoRenderer {
|
||||
int time_to_render_ms) override {
|
||||
if (renderer_ != nullptr)
|
||||
renderer_->RenderFrame(video_frame, time_to_render_ms);
|
||||
if (basename_ == "")
|
||||
if (basename_.empty())
|
||||
return;
|
||||
if (last_width_ != video_frame.width() ||
|
||||
last_height_ != video_frame.height()) {
|
||||
@ -241,13 +241,13 @@ void RtpReplay() {
|
||||
encoder_settings.payload_type = flags::PayloadType();
|
||||
VideoReceiveStream::Decoder decoder;
|
||||
rtc::scoped_ptr<DecoderBitstreamFileWriter> bitstream_writer;
|
||||
if (flags::DecoderBitstreamFilename() != "") {
|
||||
if (!flags::DecoderBitstreamFilename().empty()) {
|
||||
bitstream_writer.reset(new DecoderBitstreamFileWriter(
|
||||
flags::DecoderBitstreamFilename().c_str()));
|
||||
receive_config.pre_decode_callback = bitstream_writer.get();
|
||||
}
|
||||
decoder = test::CreateMatchingDecoder(encoder_settings);
|
||||
if (flags::DecoderBitstreamFilename() != "") {
|
||||
if (!flags::DecoderBitstreamFilename().empty()) {
|
||||
// Replace with a null decoder if we're writing the bitstream to a file
|
||||
// instead.
|
||||
delete decoder.decoder;
|
||||
|
Reference in New Issue
Block a user