You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
#include "core/project_settings.h"
|
||||
#include "servers/audio_server.h"
|
||||
|
||||
VideoDecoderServer *VideoDecoderServer::instance = NULL;
|
||||
VideoDecoderServer *VideoDecoderServer::instance = nullptr;
|
||||
|
||||
static VideoDecoderServer decoder_server;
|
||||
|
||||
@@ -112,7 +112,7 @@ void GDAPI godot_videodecoder_register_decoder(const godot_videodecoder_interfac
|
||||
// VideoStreamPlaybackGDNative starts here.
|
||||
|
||||
bool VideoStreamPlaybackGDNative::open_file(const String &p_file) {
|
||||
ERR_FAIL_COND_V(interface == NULL, false);
|
||||
ERR_FAIL_COND_V(interface == nullptr, false);
|
||||
file = FileAccess::open(p_file, FileAccess::READ);
|
||||
bool file_opened = interface->open_file(data_struct, file);
|
||||
|
||||
@@ -145,7 +145,7 @@ void VideoStreamPlaybackGDNative::update(float p_delta) {
|
||||
return;
|
||||
}
|
||||
time += p_delta;
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
interface->update(data_struct, p_delta);
|
||||
|
||||
// Don't mix if there's no audio (num_channels == 0).
|
||||
@@ -184,7 +184,7 @@ void VideoStreamPlaybackGDNative::update(float p_delta) {
|
||||
void VideoStreamPlaybackGDNative::update_texture() {
|
||||
PoolByteArray *pba = (PoolByteArray *)interface->get_videoframe(data_struct);
|
||||
|
||||
if (pba == NULL) {
|
||||
if (pba == nullptr) {
|
||||
playing = false;
|
||||
return;
|
||||
}
|
||||
@@ -200,19 +200,19 @@ VideoStreamPlaybackGDNative::VideoStreamPlaybackGDNative() :
|
||||
texture(Ref<ImageTexture>(memnew(ImageTexture))),
|
||||
playing(false),
|
||||
paused(false),
|
||||
mix_udata(NULL),
|
||||
mix_callback(NULL),
|
||||
mix_udata(nullptr),
|
||||
mix_callback(nullptr),
|
||||
num_channels(-1),
|
||||
time(0),
|
||||
seek_backward(false),
|
||||
mix_rate(0),
|
||||
delay_compensation(0),
|
||||
pcm(NULL),
|
||||
pcm(nullptr),
|
||||
pcm_write_idx(0),
|
||||
samples_decoded(0),
|
||||
file(NULL),
|
||||
interface(NULL),
|
||||
data_struct(NULL) {}
|
||||
file(nullptr),
|
||||
interface(nullptr),
|
||||
data_struct(nullptr) {}
|
||||
|
||||
VideoStreamPlaybackGDNative::~VideoStreamPlaybackGDNative() {
|
||||
cleanup();
|
||||
@@ -226,18 +226,18 @@ void VideoStreamPlaybackGDNative::cleanup() {
|
||||
if (file) {
|
||||
file->close();
|
||||
memdelete(file);
|
||||
file = NULL;
|
||||
file = nullptr;
|
||||
}
|
||||
pcm = NULL;
|
||||
pcm = nullptr;
|
||||
time = 0;
|
||||
num_channels = -1;
|
||||
interface = NULL;
|
||||
data_struct = NULL;
|
||||
interface = nullptr;
|
||||
data_struct = nullptr;
|
||||
}
|
||||
|
||||
void VideoStreamPlaybackGDNative::set_interface(const godot_videodecoder_interface_gdnative *p_interface) {
|
||||
ERR_FAIL_COND(p_interface == NULL);
|
||||
if (interface != NULL) {
|
||||
ERR_FAIL_COND(p_interface == nullptr);
|
||||
if (interface != nullptr) {
|
||||
cleanup();
|
||||
}
|
||||
interface = p_interface;
|
||||
@@ -271,7 +271,7 @@ void VideoStreamPlaybackGDNative::stop() {
|
||||
}
|
||||
|
||||
void VideoStreamPlaybackGDNative::seek(float p_time) {
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
interface->seek(data_struct, p_time);
|
||||
if (p_time < time)
|
||||
seek_backward = true;
|
||||
@@ -291,12 +291,12 @@ Ref<Texture> VideoStreamPlaybackGDNative::get_texture() const {
|
||||
}
|
||||
|
||||
float VideoStreamPlaybackGDNative::get_length() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
return interface->get_length(data_struct);
|
||||
}
|
||||
|
||||
float VideoStreamPlaybackGDNative::get_playback_position() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
return interface->get_playback_position(data_struct);
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ void VideoStreamPlaybackGDNative::set_loop(bool p_enable) {
|
||||
}
|
||||
|
||||
void VideoStreamPlaybackGDNative::set_audio_track(int p_idx) {
|
||||
ERR_FAIL_COND(interface == NULL);
|
||||
ERR_FAIL_COND(interface == nullptr);
|
||||
interface->set_audio_track(data_struct, p_idx);
|
||||
}
|
||||
|
||||
@@ -320,13 +320,13 @@ void VideoStreamPlaybackGDNative::set_mix_callback(AudioMixCallback p_callback,
|
||||
}
|
||||
|
||||
int VideoStreamPlaybackGDNative::get_channels() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
|
||||
return (num_channels > 0) ? num_channels : 0;
|
||||
}
|
||||
|
||||
int VideoStreamPlaybackGDNative::get_mix_rate() const {
|
||||
ERR_FAIL_COND_V(interface == NULL, 0);
|
||||
ERR_FAIL_COND_V(interface == nullptr, 0);
|
||||
|
||||
return mix_rate;
|
||||
}
|
||||
@@ -336,13 +336,13 @@ int VideoStreamPlaybackGDNative::get_mix_rate() const {
|
||||
Ref<VideoStreamPlayback> VideoStreamGDNative::instance_playback() {
|
||||
Ref<VideoStreamPlaybackGDNative> pb = memnew(VideoStreamPlaybackGDNative);
|
||||
VideoDecoderGDNative *decoder = decoder_server.get_decoder(file.get_extension().to_lower());
|
||||
if (decoder == NULL)
|
||||
return NULL;
|
||||
if (decoder == nullptr)
|
||||
return nullptr;
|
||||
pb->set_interface(decoder->interface);
|
||||
pb->set_audio_track(audio_track);
|
||||
if (pb->open_file(file))
|
||||
return pb;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VideoStreamGDNative::set_file(const String &p_file) {
|
||||
|
||||
Reference in New Issue
Block a user