Replace NULL with nullptr
This commit is contained in:
@ -46,7 +46,7 @@ void unregister_javascript_api() {
|
||||
memdelete(javascript_eval);
|
||||
}
|
||||
|
||||
JavaScript *JavaScript::singleton = NULL;
|
||||
JavaScript *JavaScript::singleton = nullptr;
|
||||
|
||||
JavaScript *JavaScript::get_singleton() {
|
||||
|
||||
@ -55,7 +55,7 @@ JavaScript *JavaScript::get_singleton() {
|
||||
|
||||
JavaScript::JavaScript() {
|
||||
|
||||
ERR_FAIL_COND_MSG(singleton != NULL, "JavaScript singleton already exist.");
|
||||
ERR_FAIL_COND_MSG(singleton != nullptr, "JavaScript singleton already exist.");
|
||||
singleton = this;
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
#include <emscripten.h>
|
||||
|
||||
AudioDriverJavaScript *AudioDriverJavaScript::singleton = NULL;
|
||||
AudioDriverJavaScript *AudioDriverJavaScript::singleton = nullptr;
|
||||
|
||||
const char *AudioDriverJavaScript::get_name() const {
|
||||
|
||||
@ -200,7 +200,7 @@ void AudioDriverJavaScript::finish() {
|
||||
|
||||
if (internal_buffer) {
|
||||
memdelete_arr(internal_buffer);
|
||||
internal_buffer = NULL;
|
||||
internal_buffer = nullptr;
|
||||
}
|
||||
_driver_id = 0;
|
||||
}
|
||||
@ -264,7 +264,7 @@ Error AudioDriverJavaScript::capture_stop() {
|
||||
AudioDriverJavaScript::AudioDriverJavaScript() {
|
||||
|
||||
_driver_id = 0;
|
||||
internal_buffer = NULL;
|
||||
internal_buffer = nullptr;
|
||||
buffer_length = 0;
|
||||
|
||||
singleton = this;
|
||||
|
||||
@ -390,7 +390,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
|
||||
return error;
|
||||
}
|
||||
|
||||
FileAccess *src_f = NULL;
|
||||
FileAccess *src_f = nullptr;
|
||||
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
|
||||
unzFile pkg = unzOpen2(template_path.utf8().get_data(), &io);
|
||||
|
||||
@ -410,7 +410,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
|
||||
//get filename
|
||||
unz_file_info info;
|
||||
char fname[16384];
|
||||
unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
|
||||
unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
|
||||
|
||||
String file = fname;
|
||||
|
||||
|
||||
@ -88,8 +88,8 @@ Error HTTPClient::prepare_request(Method p_method, const String &p_url, const Ve
|
||||
String url = (use_tls ? "https://" : "http://") + host + ":" + itos(port) + p_url;
|
||||
godot_xhr_reset(xhr_id);
|
||||
godot_xhr_open(xhr_id, _methods[p_method], url.utf8().get_data(),
|
||||
username.empty() ? NULL : username.utf8().get_data(),
|
||||
password.empty() ? NULL : password.utf8().get_data());
|
||||
username.empty() ? nullptr : username.utf8().get_data(),
|
||||
password.empty() ? nullptr : password.utf8().get_data());
|
||||
|
||||
for (int i = 0; i < p_headers.size(); i++) {
|
||||
int header_separator = p_headers[i].find(": ");
|
||||
|
||||
@ -49,7 +49,7 @@ extern int godot_xhr_new();
|
||||
extern void godot_xhr_reset(int p_xhr_id);
|
||||
extern bool godot_xhr_free(int p_xhr_id);
|
||||
|
||||
extern int godot_xhr_open(int p_xhr_id, const char *p_method, const char *p_url, const char *p_user = NULL, const char *p_password = NULL);
|
||||
extern int godot_xhr_open(int p_xhr_id, const char *p_method, const char *p_url, const char *p_user = nullptr, const char *p_password = nullptr);
|
||||
|
||||
extern void godot_xhr_set_request_header(int p_xhr_id, const char *p_header, const char *p_value);
|
||||
|
||||
|
||||
@ -167,7 +167,7 @@ void OS_JavaScript::set_window_maximized(bool p_enabled) {
|
||||
strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH;
|
||||
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF;
|
||||
strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT;
|
||||
strategy.canvasResizedCallback = NULL;
|
||||
strategy.canvasResizedCallback = nullptr;
|
||||
emscripten_enter_soft_fullscreen(GODOT_CANVAS_SELECTOR, &strategy);
|
||||
window_maximized = p_enabled;
|
||||
}
|
||||
@ -196,7 +196,7 @@ void OS_JavaScript::set_window_fullscreen(bool p_enabled) {
|
||||
strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH;
|
||||
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF;
|
||||
strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT;
|
||||
strategy.canvasResizedCallback = NULL;
|
||||
strategy.canvasResizedCallback = nullptr;
|
||||
EMSCRIPTEN_RESULT result = emscripten_request_fullscreen_strategy(GODOT_CANVAS_SELECTOR, false, &strategy);
|
||||
ERR_FAIL_COND_MSG(result == EMSCRIPTEN_RESULT_FAILED_NOT_DEFERRED, "Enabling fullscreen is only possible from an input callback for the HTML5 platform.");
|
||||
ERR_FAIL_COND_MSG(result != EMSCRIPTEN_RESULT_SUCCESS, "Enabling fullscreen is only possible from an input callback for the HTML5 platform.");
|
||||
@ -541,10 +541,10 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s
|
||||
PackedByteArray png;
|
||||
size_t len;
|
||||
PackedByteArray data = image->get_data();
|
||||
ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, data.ptr(), 0, NULL));
|
||||
ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, data.ptr(), 0, nullptr));
|
||||
|
||||
png.resize(len);
|
||||
ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, png.ptrw(), &len, 0, data.ptr(), 0, NULL));
|
||||
ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, png.ptrw(), &len, 0, data.ptr(), 0, nullptr));
|
||||
|
||||
char *object_url;
|
||||
/* clang-format off */
|
||||
@ -824,7 +824,7 @@ const char *OS_JavaScript::get_video_driver_name(int p_driver) const {
|
||||
case VIDEO_DRIVER_GLES2:
|
||||
return "GLES2";
|
||||
}
|
||||
ERR_FAIL_V_MSG(NULL, "Invalid video driver index: " + itos(p_driver) + ".");
|
||||
ERR_FAIL_V_MSG(nullptr, "Invalid video driver index: " + itos(p_driver) + ".");
|
||||
}
|
||||
|
||||
// Audio
|
||||
@ -969,11 +969,11 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
|
||||
#define EM_CHECK(ev) \
|
||||
if (result != EMSCRIPTEN_RESULT_SUCCESS) \
|
||||
ERR_PRINT("Error while setting " #ev " callback: Code " + itos(result));
|
||||
#define SET_EM_CALLBACK(target, ev, cb) \
|
||||
result = emscripten_set_##ev##_callback(target, NULL, true, &cb); \
|
||||
#define SET_EM_CALLBACK(target, ev, cb) \
|
||||
result = emscripten_set_##ev##_callback(target, nullptr, true, &cb); \
|
||||
EM_CHECK(ev)
|
||||
#define SET_EM_CALLBACK_NOTARGET(ev, cb) \
|
||||
result = emscripten_set_##ev##_callback(NULL, true, &cb); \
|
||||
#define SET_EM_CALLBACK_NOTARGET(ev, cb) \
|
||||
result = emscripten_set_##ev##_callback(nullptr, true, &cb); \
|
||||
EM_CHECK(ev)
|
||||
// These callbacks from Emscripten's html5.h suffice to access most
|
||||
// JavaScript APIs. For APIs that are not (sufficiently) exposed, EM_ASM
|
||||
@ -1072,7 +1072,7 @@ bool OS_JavaScript::main_loop_iterate() {
|
||||
strategy.scaleMode = EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH;
|
||||
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF;
|
||||
strategy.filteringMode = EMSCRIPTEN_FULLSCREEN_FILTERING_DEFAULT;
|
||||
strategy.canvasResizedCallback = NULL;
|
||||
strategy.canvasResizedCallback = nullptr;
|
||||
emscripten_enter_soft_fullscreen(GODOT_CANVAS_SELECTOR, &strategy);
|
||||
} else {
|
||||
emscripten_set_canvas_element_size(GODOT_CANVAS_SELECTOR, windowed_size.width, windowed_size.height);
|
||||
@ -1182,10 +1182,10 @@ void OS_JavaScript::set_icon(const Ref<Image> &p_icon) {
|
||||
PackedByteArray png;
|
||||
size_t len;
|
||||
PackedByteArray data = icon->get_data();
|
||||
ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, data.ptr(), 0, NULL));
|
||||
ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, data.ptr(), 0, nullptr));
|
||||
|
||||
png.resize(len);
|
||||
ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, png.ptrw(), &len, 0, data.ptr(), 0, NULL));
|
||||
ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, png.ptrw(), &len, 0, data.ptr(), 0, nullptr));
|
||||
|
||||
/* clang-format off */
|
||||
EM_ASM_ARGS({
|
||||
@ -1284,7 +1284,7 @@ OS_JavaScript::OS_JavaScript(int p_argc, char *p_argv[]) {
|
||||
just_exited_fullscreen = false;
|
||||
transparency_enabled = false;
|
||||
|
||||
main_loop = NULL;
|
||||
main_loop = nullptr;
|
||||
|
||||
idb_available = false;
|
||||
sync_wait_time = -1;
|
||||
|
||||
@ -145,7 +145,7 @@ public:
|
||||
void run_async();
|
||||
bool main_loop_iterate();
|
||||
|
||||
virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL);
|
||||
virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = nullptr, String *r_pipe = nullptr, int *r_exitcode = nullptr, bool read_stderr = false, Mutex *p_pipe_mutex = nullptr);
|
||||
virtual Error kill(const ProcessID &p_pid);
|
||||
virtual int get_process_id() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user