Skip to content

Commit

Permalink
NULL -> nullptr in CPP files
Browse files Browse the repository at this point in the history
This should clean up clangtidy warnings

Change-Id: Ifb5a986121b2d0bd71b9ad39a79dd46c63bdb998
  • Loading branch information
jeromejj committed Jul 27, 2020
1 parent dbe00bb commit b358f90
Show file tree
Hide file tree
Showing 46 changed files with 376 additions and 354 deletions.
2 changes: 1 addition & 1 deletion test/active_map_refresh_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ActiveMapRefreshTest
} else if (video->frame() >= 2 && video->img()) {
vpx_image_t *current = video->img();
vpx_image_t *previous = y4m_holder_->img();
ASSERT_TRUE(previous != NULL);
ASSERT_NE(previous, nullptr);
vpx_active_map_t map = vpx_active_map_t();
const int width = static_cast<int>(current->d_w);
const int height = static_cast<int>(current->d_h);
Expand Down
2 changes: 1 addition & 1 deletion test/active_map_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ActiveMapTest
vpx_active_map_t map = vpx_active_map_t();
map.cols = (kWidth + 15) / 16;
map.rows = (kHeight + 15) / 16;
map.active_map = NULL;
map.active_map = nullptr;
encoder->Control(VP8E_SET_ACTIVEMAP, &map);
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/add_noise_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) {
const int clamp = vpx_setup_noise(GET_PARAM(0), noise, kNoiseSize);
uint8_t *const s =
reinterpret_cast<uint8_t *>(vpx_calloc(image_size, sizeof(*s)));
ASSERT_TRUE(s != NULL);
ASSERT_NE(s, nullptr);
memset(s, 99, image_size * sizeof(*s));

ASM_REGISTER_STATE_CHECK(
Expand Down Expand Up @@ -106,8 +106,8 @@ TEST_P(AddNoiseTest, CheckCvsAssembly) {

uint8_t *const s = reinterpret_cast<uint8_t *>(vpx_calloc(image_size, 1));
uint8_t *const d = reinterpret_cast<uint8_t *>(vpx_calloc(image_size, 1));
ASSERT_TRUE(s != NULL);
ASSERT_TRUE(d != NULL);
ASSERT_NE(s, nullptr);
ASSERT_NE(d, nullptr);

memset(s, 99, image_size);
memset(d, 99, image_size);
Expand Down
25 changes: 13 additions & 12 deletions test/avg_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ template <typename Pixel>
class AverageTestBase : public ::testing::Test {
public:
AverageTestBase(int width, int height)
: width_(width), height_(height), source_data_(NULL), source_stride_(0),
bit_depth_(8) {}
: width_(width), height_(height), source_data_(nullptr),
source_stride_(0), bit_depth_(8) {}

virtual void TearDown() {
vpx_free(source_data_);
source_data_ = NULL;
source_data_ = nullptr;
libvpx_test::ClearSystemState();
}

Expand All @@ -52,7 +52,7 @@ class AverageTestBase : public ::testing::Test {
virtual void SetUp() {
source_data_ = reinterpret_cast<Pixel *>(
vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
ASSERT_TRUE(source_data_ != NULL);
ASSERT_NE(source_data_, nullptr);
source_stride_ = (width_ + 31) & ~31;
bit_depth_ = 8;
rnd_.Reset(ACMRandom::DeterministicSeed());
Expand Down Expand Up @@ -162,7 +162,8 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
public ::testing::WithParamInterface<IntProRowParam> {
public:
IntProRowTest()
: AverageTestBase(16, GET_PARAM(0)), hbuf_asm_(NULL), hbuf_c_(NULL) {
: AverageTestBase(16, GET_PARAM(0)), hbuf_asm_(nullptr),
hbuf_c_(nullptr) {
asm_func_ = GET_PARAM(1);
c_func_ = GET_PARAM(2);
}
Expand All @@ -171,7 +172,7 @@ class IntProRowTest : public AverageTestBase<uint8_t>,
virtual void SetUp() {
source_data_ = reinterpret_cast<uint8_t *>(
vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
ASSERT_TRUE(source_data_ != NULL);
ASSERT_NE(source_data_, nullptr);

hbuf_asm_ = reinterpret_cast<int16_t *>(
vpx_memalign(kDataAlignment, sizeof(*hbuf_asm_) * 16));
Expand All @@ -181,11 +182,11 @@ class IntProRowTest : public AverageTestBase<uint8_t>,

virtual void TearDown() {
vpx_free(source_data_);
source_data_ = NULL;
source_data_ = nullptr;
vpx_free(hbuf_c_);
hbuf_c_ = NULL;
hbuf_c_ = nullptr;
vpx_free(hbuf_asm_);
hbuf_asm_ = NULL;
hbuf_asm_ = nullptr;
}

void RunComparison() {
Expand Down Expand Up @@ -241,7 +242,7 @@ class SatdTest : public ::testing::Test,
rnd_.Reset(ACMRandom::DeterministicSeed());
src_ = reinterpret_cast<tran_low_t *>(
vpx_memalign(16, sizeof(*src_) * satd_size_));
ASSERT_TRUE(src_ != NULL);
ASSERT_NE(src_, nullptr);
}

virtual void TearDown() {
Expand Down Expand Up @@ -297,8 +298,8 @@ class BlockErrorTestFP
vpx_memalign(16, sizeof(*coeff_) * txfm_size_));
dqcoeff_ = reinterpret_cast<tran_low_t *>(
vpx_memalign(16, sizeof(*dqcoeff_) * txfm_size_));
ASSERT_TRUE(coeff_ != NULL);
ASSERT_TRUE(dqcoeff_ != NULL);
ASSERT_NE(coeff_, nullptr);
ASSERT_NE(dqcoeff_, nullptr);
}

virtual void TearDown() {
Expand Down
8 changes: 4 additions & 4 deletions test/blockiness_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class BlockinessTestBase : public ::testing::Test {

static void TearDownTestSuite() {
vpx_free(source_data_);
source_data_ = NULL;
source_data_ = nullptr;
vpx_free(reference_data_);
reference_data_ = NULL;
reference_data_ = nullptr;
}

virtual void TearDown() { libvpx_test::ClearSystemState(); }
Expand Down Expand Up @@ -154,8 +154,8 @@ class BlockinessVP9Test
};
#endif // CONFIG_VP9_ENCODER

uint8_t *BlockinessTestBase::source_data_ = NULL;
uint8_t *BlockinessTestBase::reference_data_ = NULL;
uint8_t *BlockinessTestBase::source_data_ = nullptr;
uint8_t *BlockinessTestBase::reference_data_ = nullptr;

#if CONFIG_VP9_ENCODER
TEST_P(BlockinessVP9Test, SourceBlockierThanReference) {
Expand Down
17 changes: 9 additions & 8 deletions test/byte_alignment_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,24 @@ const ByteAlignmentTestParam kBaTestParams[] = {
class ByteAlignmentTest
: public ::testing::TestWithParam<ByteAlignmentTestParam> {
protected:
ByteAlignmentTest() : video_(NULL), decoder_(NULL), md5_file_(NULL) {}
ByteAlignmentTest()
: video_(nullptr), decoder_(nullptr), md5_file_(nullptr) {}

virtual void SetUp() {
video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
ASSERT_TRUE(video_ != NULL);
ASSERT_NE(video_, nullptr);
video_->Init();
video_->Begin();

const vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
ASSERT_TRUE(decoder_ != NULL);
ASSERT_NE(decoder_, nullptr);

OpenMd5File(kVP9Md5File);
}

virtual void TearDown() {
if (md5_file_ != NULL) fclose(md5_file_);
if (md5_file_ != nullptr) fclose(md5_file_);

delete decoder_;
delete video_;
Expand All @@ -90,7 +91,7 @@ class ByteAlignmentTest
}

vpx_codec_err_t DecodeRemainingFrames(int byte_alignment_to_check) {
for (; video_->cxdata() != NULL; video_->Next()) {
for (; video_->cxdata() != nullptr; video_->Next()) {
const vpx_codec_err_t res =
decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
if (res != VPX_CODEC_OK) return res;
Expand All @@ -113,7 +114,7 @@ class ByteAlignmentTest
const vpx_image_t *img;

// Get decompressed data
while ((img = dec_iter.Next()) != NULL) {
while ((img = dec_iter.Next()) != nullptr) {
if (byte_alignment_to_check == kLegacyByteAlignment) {
CheckByteAlignment(img->planes[0], kLegacyYPlaneByteAlignment);
} else {
Expand All @@ -128,12 +129,12 @@ class ByteAlignmentTest
// TODO(fgalligan): Move the MD5 testing code into another class.
void OpenMd5File(const std::string &md5_file_name_) {
md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
ASSERT_TRUE(md5_file_ != NULL)
ASSERT_NE(md5_file_, nullptr)
<< "MD5 file open failed. Filename: " << md5_file_name_;
}

void CheckMd5(const vpx_image_t &img) {
ASSERT_TRUE(md5_file_ != NULL);
ASSERT_NE(md5_file_, nullptr);
char expected_md5[33];
char junk[128];

Expand Down
6 changes: 3 additions & 3 deletions test/comp_avg_pred_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ uint8_t avg_with_rounding(uint8_t a, uint8_t b) { return (a + b + 1) >> 1; }

void reference_pred(const Buffer<uint8_t> &pred, const Buffer<uint8_t> &ref,
int width, int height, Buffer<uint8_t> *avg) {
ASSERT_TRUE(avg->TopLeftPixel() != NULL);
ASSERT_TRUE(pred.TopLeftPixel() != NULL);
ASSERT_TRUE(ref.TopLeftPixel() != NULL);
ASSERT_NE(avg->TopLeftPixel(), nullptr);
ASSERT_NE(pred.TopLeftPixel(), nullptr);
ASSERT_NE(ref.TopLeftPixel(), nullptr);

for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
Expand Down
14 changes: 7 additions & 7 deletions test/consistency_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ class ConsistencyTestBase : public ::testing::Test {
static void ClearSsim() { memset(ssim_array_, 0, kDataBufferSize / 16); }
static void TearDownTestSuite() {
vpx_free(source_data_[0]);
source_data_[0] = NULL;
source_data_[0] = nullptr;
vpx_free(reference_data_[0]);
reference_data_[0] = NULL;
reference_data_[0] = nullptr;
vpx_free(source_data_[1]);
source_data_[1] = NULL;
source_data_[1] = nullptr;
vpx_free(reference_data_[1]);
reference_data_[1] = NULL;
reference_data_[1] = nullptr;

delete[] ssim_array_;
}
Expand Down Expand Up @@ -145,9 +145,9 @@ class ConsistencyVP9Test
};
#endif // CONFIG_VP9_ENCODER

uint8_t *ConsistencyTestBase::source_data_[2] = { NULL, NULL };
uint8_t *ConsistencyTestBase::reference_data_[2] = { NULL, NULL };
Ssimv *ConsistencyTestBase::ssim_array_ = NULL;
uint8_t *ConsistencyTestBase::source_data_[2] = { nullptr, nullptr };
uint8_t *ConsistencyTestBase::reference_data_[2] = { nullptr, nullptr };
Ssimv *ConsistencyTestBase::ssim_array_ = nullptr;

#if CONFIG_VP9_ENCODER
TEST_P(ConsistencyVP9Test, ConsistencyIsZero) {
Expand Down
46 changes: 24 additions & 22 deletions test/convolve_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,18 +365,18 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {

static void TearDownTestSuite() {
vpx_free(input_ - 1);
input_ = NULL;
input_ = nullptr;
vpx_free(output_);
output_ = NULL;
output_ = nullptr;
vpx_free(output_ref_);
output_ref_ = NULL;
output_ref_ = nullptr;
#if CONFIG_VP9_HIGHBITDEPTH
vpx_free(input16_ - 1);
input16_ = NULL;
input16_ = nullptr;
vpx_free(output16_);
output16_ = NULL;
output16_ = nullptr;
vpx_free(output16_ref_);
output16_ref_ = NULL;
output16_ref_ = nullptr;
#endif
}

Expand Down Expand Up @@ -541,13 +541,13 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
#endif
};

uint8_t *ConvolveTest::input_ = NULL;
uint8_t *ConvolveTest::output_ = NULL;
uint8_t *ConvolveTest::output_ref_ = NULL;
uint8_t *ConvolveTest::input_ = nullptr;
uint8_t *ConvolveTest::output_ = nullptr;
uint8_t *ConvolveTest::output_ref_ = nullptr;
#if CONFIG_VP9_HIGHBITDEPTH
uint16_t *ConvolveTest::input16_ = NULL;
uint16_t *ConvolveTest::output16_ = NULL;
uint16_t *ConvolveTest::output16_ref_ = NULL;
uint16_t *ConvolveTest::input16_ = nullptr;
uint16_t *ConvolveTest::output16_ = nullptr;
uint16_t *ConvolveTest::output16_ref_ = nullptr;
#endif

TEST_P(ConvolveTest, GuardBlocks) { CheckGuardBlocks(); }
Expand All @@ -562,7 +562,7 @@ TEST_P(ConvolveTest, DISABLED_Copy_Speed) {

vpx_usec_timer_start(&timer);
for (int n = 0; n < kNumTests; ++n) {
UUT_->copy_[0](in, kInputStride, out, kOutputStride, NULL, 0, 0, 0, 0,
UUT_->copy_[0](in, kInputStride, out, kOutputStride, nullptr, 0, 0, 0, 0,
width, height);
}
vpx_usec_timer_mark(&timer);
Expand All @@ -582,7 +582,7 @@ TEST_P(ConvolveTest, DISABLED_Avg_Speed) {

vpx_usec_timer_start(&timer);
for (int n = 0; n < kNumTests; ++n) {
UUT_->copy_[1](in, kInputStride, out, kOutputStride, NULL, 0, 0, 0, 0,
UUT_->copy_[1](in, kInputStride, out, kOutputStride, nullptr, 0, 0, 0, 0,
width, height);
}
vpx_usec_timer_mark(&timer);
Expand Down Expand Up @@ -780,7 +780,8 @@ TEST_P(ConvolveTest, Copy) {
uint8_t *const out = output();

ASM_REGISTER_STATE_CHECK(UUT_->copy_[0](in, kInputStride, out, kOutputStride,
NULL, 0, 0, 0, 0, Width(), Height()));
nullptr, 0, 0, 0, 0, Width(),
Height()));

CheckGuardBlocks();

Expand All @@ -799,7 +800,8 @@ TEST_P(ConvolveTest, Avg) {
CopyOutputToRef();

ASM_REGISTER_STATE_CHECK(UUT_->copy_[1](in, kInputStride, out, kOutputStride,
NULL, 0, 0, 0, 0, Width(), Height()));
nullptr, 0, 0, 0, 0, Width(),
Height()));

CheckGuardBlocks();

Expand Down Expand Up @@ -955,9 +957,9 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
UUT_->h8_[i](in, kInputStride, out, kOutputStride, filters,
filter_x, 16, 0, 16, Width(), Height()));
else
ASM_REGISTER_STATE_CHECK(UUT_->copy_[i](in, kInputStride, out,
kOutputStride, NULL, 0, 0,
0, 0, Width(), Height()));
ASM_REGISTER_STATE_CHECK(
UUT_->copy_[i](in, kInputStride, out, kOutputStride, nullptr, 0,
0, 0, 0, Width(), Height()));

CheckGuardBlocks();

Expand Down Expand Up @@ -1053,9 +1055,9 @@ TEST_P(ConvolveTest, FilterExtremes) {
UUT_->h8_[0](in, kInputStride, out, kOutputStride, filters,
filter_x, 16, 0, 16, Width(), Height()));
else
ASM_REGISTER_STATE_CHECK(UUT_->copy_[0](in, kInputStride, out,
kOutputStride, NULL, 0, 0,
0, 0, Width(), Height()));
ASM_REGISTER_STATE_CHECK(
UUT_->copy_[0](in, kInputStride, out, kOutputStride, nullptr,
0, 0, 0, 0, Width(), Height()));

for (int y = 0; y < Height(); ++y) {
for (int x = 0; x < Width(); ++x)
Expand Down
4 changes: 2 additions & 2 deletions test/dct_partial_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ typedef tuple<PartialFdctFunc, int /* size */, vpx_bit_depth_t>

tran_low_t partial_fdct_ref(const Buffer<int16_t> &in, int size) {
int64_t sum = 0;
if (in.TopLeftPixel() != NULL) {
if (in.TopLeftPixel() != nullptr) {
for (int y = 0; y < size; ++y) {
for (int x = 0; x < size; ++x) {
sum += in.TopLeftPixel()[y * in.stride() + x];
Expand Down Expand Up @@ -81,7 +81,7 @@ class PartialFdctTest : public ::testing::TestWithParam<PartialFdctParam> {
Buffer<tran_low_t> output_block = Buffer<tran_low_t>(size_, size_, 0, 16);
ASSERT_TRUE(output_block.Init());

if (output_block.TopLeftPixel() != NULL) {
if (output_block.TopLeftPixel() != nullptr) {
for (int i = 0; i < 100; ++i) {
if (i == 0) {
input_block.Set(maxvalue);
Expand Down
Loading

0 comments on commit b358f90

Please sign in to comment.