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

Unified Diff: webrtc/test/rtp_file_reader.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 months 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: webrtc/test/rtp_file_reader.cc
diff --git a/webrtc/test/rtp_file_reader.cc b/webrtc/test/rtp_file_reader.cc
index c4fd42dd05a45c9fbbcdaa5a436825d6162b1e6a..aae76456dee8c5a429425a360f6156c0f08bd117 100644
--- a/webrtc/test/rtp_file_reader.cc
+++ b/webrtc/test/rtp_file_reader.cc
@@ -69,23 +69,23 @@ class RtpFileReaderImpl : public RtpFileReader {
class InterleavedRtpFileReader : public RtpFileReaderImpl {
public:
virtual ~InterleavedRtpFileReader() {
- if (file_ != NULL) {
+ if (file_ != nullptr) {
fclose(file_);
- file_ = NULL;
+ file_ = nullptr;
}
}
virtual bool Init(const std::string& filename,
const std::set<uint32_t>& ssrc_filter) {
file_ = fopen(filename.c_str(), "rb");
- if (file_ == NULL) {
+ if (file_ == nullptr) {
printf("ERROR: Can't open file: %s\n", filename.c_str());
return false;
}
return true;
}
virtual bool NextPacket(RtpPacket* packet) {
- assert(file_ != NULL);
+ assert(file_ != nullptr);
packet->length = RtpPacket::kMaxPacketBufferSize;
uint32_t len = 0;
TRY(ReadUint32(&len, file_));
@@ -106,7 +106,7 @@ class InterleavedRtpFileReader : public RtpFileReaderImpl {
}
private:
- FILE* file_ = NULL;
+ FILE* file_ = nullptr;
int64_t time_ms_ = 0;
};
@@ -114,24 +114,24 @@ class InterleavedRtpFileReader : public RtpFileReaderImpl {
// http://www.cs.columbia.edu/irt/software/rtptools/
class RtpDumpReader : public RtpFileReaderImpl {
public:
- RtpDumpReader() : file_(NULL) {}
+ RtpDumpReader() : file_(nullptr) {}
virtual ~RtpDumpReader() {
- if (file_ != NULL) {
+ if (file_ != nullptr) {
fclose(file_);
- file_ = NULL;
+ file_ = nullptr;
}
}
bool Init(const std::string& filename,
const std::set<uint32_t>& ssrc_filter) override {
file_ = fopen(filename.c_str(), "rb");
- if (file_ == NULL) {
+ if (file_ == nullptr) {
printf("ERROR: Can't open file: %s\n", filename.c_str());
return false;
}
char firstline[kFirstLineLength + 1] = {0};
- if (fgets(firstline, kFirstLineLength, file_) == NULL) {
+ if (fgets(firstline, kFirstLineLength, file_) == nullptr) {
LOG(LS_INFO) << "Can't read from file";
return false;
}
@@ -241,23 +241,23 @@ const uint32_t kPcapBOMNoSwapOrder = 0xa1b2c3d4UL;
class PcapReader : public RtpFileReaderImpl {
public:
PcapReader()
- : file_(NULL),
- swap_pcap_byte_order_(false),
+ : file_(nullptr),
+ swap_pcap_byte_order_(false),
#ifdef WEBRTC_ARCH_BIG_ENDIAN
- swap_network_byte_order_(false),
+ swap_network_byte_order_(false),
#else
- swap_network_byte_order_(true),
+ swap_network_byte_order_(true),
#endif
- read_buffer_(),
- packets_by_ssrc_(),
- packets_(),
- next_packet_it_() {
+ read_buffer_(),
+ packets_by_ssrc_(),
+ packets_(),
+ next_packet_it_() {
}
virtual ~PcapReader() {
- if (file_ != NULL) {
+ if (file_ != nullptr) {
fclose(file_);
- file_ = NULL;
+ file_ = nullptr;
}
}
@@ -269,7 +269,7 @@ class PcapReader : public RtpFileReaderImpl {
int Initialize(const std::string& filename,
const std::set<uint32_t>& ssrc_filter) {
file_ = fopen(filename.c_str(), "rb");
- if (file_ == NULL) {
+ if (file_ == nullptr) {
printf("ERROR: Can't open file: %s\n", filename.c_str());
return kResultFail;
}
@@ -408,7 +408,7 @@ class PcapReader : public RtpFileReaderImpl {
TRY_PCAP(Read(&snaplen, false));
TRY_PCAP(Read(&network, false));
- // Accept only LINKTYPE_NULL and LINKTYPE_ETHERNET.
+ // Accept only LINKTYPE_null and LINKTYPE_ETHERNET.
// See: http://www.tcpdump.org/linktypes.html
if (network != kLinktypeNull && network != kLinktypeEthernet) {
return kResultFail;
@@ -639,7 +639,7 @@ class PcapReader : public RtpFileReaderImpl {
RtpFileReader* RtpFileReader::Create(FileFormat format,
const std::string& filename,
const std::set<uint32_t>& ssrc_filter) {
- RtpFileReaderImpl* reader = NULL;
+ RtpFileReaderImpl* reader = nullptr;
switch (format) {
case kPcap:
reader = new PcapReader();
@@ -653,7 +653,7 @@ RtpFileReader* RtpFileReader::Create(FileFormat format,
}
if (!reader->Init(filename, ssrc_filter)) {
delete reader;
- return NULL;
+ return nullptr;
}
return reader;
}

Powered by Google App Engine
This is Rietveld 408576698