Replace more occurrences of NULL with nullptr

This commit is contained in:
Rémi Verschelde 2020-04-02 14:41:58 +02:00
parent 058a0afdec
commit ea7b497065
13 changed files with 18 additions and 65 deletions

View File

@ -73,7 +73,7 @@ def make_default_controller_mappings(target, source, env):
g.write('\t"{}",\n'.format(mapping))
g.write("#endif\n")
g.write("\tNULL\n};\n")
g.write("\tnullptr\n};\n")
g.close()

View File

@ -115,7 +115,7 @@ def make_translations_header(target, source, env, category):
g.write(
'\t{{ "{}", {}, {}, _{}_translation_{}_compressed }},\n'.format(x[0], str(x[1]), str(x[2]), category, x[0])
)
g.write("\t{NULL, 0, 0, NULL}\n")
g.write("\t{nullptr, 0, 0, nullptr}\n")
g.write("};\n")
g.write("#endif")

View File

@ -395,7 +395,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
enum_vals.append(c)
enum_constants.append(x[i])
strs += "NULL}"
strs += "nullptr}"
fd.write(
"\t\t\t{(uint64_t(1<<" + str(bits) + ")-1)<<" + str(bitofs) + "," + str(bitofs) + "," + strs + "},\n"
@ -422,7 +422,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
conditionals_found.append(x)
fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
fd.write("\t\tstatic const char **_conditional_strings=nullptr;\n")
if header_data.uniforms:
@ -432,7 +432,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
fd.write('\t\t\t"' + x + '",\n')
fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
fd.write("\t\tstatic const char **_uniform_strings=nullptr;\n")
if output_attribs:
if header_data.attributes:
@ -442,7 +442,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
fd.write('\t\t\t{"' + x[0] + '",' + x[1] + "},\n")
fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n")
fd.write("\t\tstatic AttributePair *_attribute_pairs=nullptr;\n")
feedback_count = 0
@ -464,7 +464,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
if gles2:
pass
else:
fd.write("\t\tstatic const Feedback* _feedbacks=NULL;\n")
fd.write("\t\tstatic const Feedback* _feedbacks=nullptr;\n")
if header_data.texunits:
fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")
@ -472,7 +472,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
fd.write('\t\t\t{"' + x[0] + '",' + x[1] + "},\n")
fd.write("\t\t};\n\n")
else:
fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n")
fd.write("\t\tstatic TexUnitPair *_texunit_pairs=nullptr;\n")
if not gles2 and header_data.ubos:
fd.write("\t\tstatic UBOPair _ubo_pairs[]={\n")
@ -483,7 +483,7 @@ def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2
if gles2:
pass
else:
fd.write("\t\tstatic UBOPair *_ubo_pairs=NULL;\n")
fd.write("\t\tstatic UBOPair *_ubo_pairs=nullptr;\n")
fd.write("\t\tstatic const char _vertex_code[]={\n")
for x in header_data.vertex_lines:

View File

@ -163,7 +163,7 @@ def _build_gdnative_api_struct_source(api):
"\t{" + str(ext["version"]["major"]) + ", " + str(ext["version"]["minor"]) + "},",
"\t"
+ (
"NULL"
"nullptr"
if not ext["next"]
else ("(const godot_gdnative_api_struct *)&" + get_extension_struct_instance_name(name, ext["next"]))
)
@ -191,7 +191,7 @@ def _build_gdnative_api_struct_source(api):
"\t{" + str(core["version"]["major"]) + ", " + str(core["version"]["minor"]) + "},",
"\t"
+ (
"NULL"
"nullptr"
if not core["next"]
else (
"(const godot_gdnative_api_struct *)& api_{0}_{1}".format(

View File

@ -156,7 +156,7 @@ struct LocationLink {
* Used as the underlined span for mouse interaction. Defaults to the word range at
* the mouse position.
*/
Range *originSelectionRange = NULL;
Range *originSelectionRange = nullptr;
/**
* The target resource identifier of this link.
@ -1686,8 +1686,8 @@ struct InitializeResult {
struct GodotNativeClassInfo {
String name;
const DocData::ClassDoc *class_doc = NULL;
const ClassDB::ClassInfo *class_info = NULL;
const DocData::ClassDoc *class_doc = nullptr;
const ClassDB::ClassInfo *class_info = nullptr;
Dictionary to_json() {
Dictionary dict;

View File

@ -2187,7 +2187,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte
}
p_output.append(CS_PARAM_METHODBIND "->call(" CS_PARAM_INSTANCE ", ");
p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ".ptr()" : "NULL");
p_output.append(p_imethod.arguments.size() ? C_LOCAL_PTRCALL_ARGS ".ptr()" : "nullptr");
p_output.append(", total_length, vcall_error);\n");
if (!ret_void) {

View File

@ -1364,7 +1364,7 @@ void DisplayServerWindows::cursor_set_custom_image(const RES &p_cursor, CursorSh
GetMaskBitmaps(bitmap, clrTransparent, hAndMask, hXorMask);
if (NULL == hAndMask || nullptr == hXorMask) {
if (nullptr == hAndMask || nullptr == hXorMask) {
memfree(buffer);
DeleteObject(bitmap);
return;
@ -2445,7 +2445,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
case WM_ENTERSIZEMOVE: {
InputFilter::get_singleton()->release_pressed_events();
move_timer_id = SetTimer(windows[window_id].hWnd, 1, USER_TIMER_MINIMUM, (TIMERPROC)NULL);
move_timer_id = SetTimer(windows[window_id].hWnd, 1, USER_TIMER_MINIMUM, (TIMERPROC) nullptr);
} break;
case WM_EXITSIZEMOVE: {
KillTimer(windows[window_id].hWnd, move_timer_id);

View File

@ -176,7 +176,7 @@ int _main() {
wc_argv = CommandLineToArgvW(GetCommandLineW(), &argc);
if (NULL == wc_argv) {
if (nullptr == wc_argv) {
wprintf(L"CommandLineToArgvW failed\n");
return 0;
}

View File

@ -413,23 +413,6 @@ Vector3 Camera3D::project_position(const Point2 &p_point, float p_z_depth) const
return get_camera_transform().xform(p);
}
/*
void Camera::_camera_make_current(Node *p_camera) {
if (p_camera==this) {
RenderingServer::get_singleton()->viewport_attach_camera(viewport_id,camera);
active=true;
} else {
if (active && p_camera==NULL) {
//detech camera because no one else will claim it
RenderingServer::get_singleton()->viewport_attach_camera(viewport_id,RID());
}
active=false;
}
}
*/
void Camera3D::set_environment(const Ref<Environment> &p_environment) {
environment = p_environment;

View File

@ -1242,19 +1242,6 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float
bool AnimationPlayer::is_playing() const {
return playing;
/*
if (playback.current.from==NULL)
return false;
float len=playback.current.from->animation->get_length();
float pos = playback.current.pos;
bool loop=playback.current.from->animation->has_loop();
if (!loop && pos >= len) {
return false;
};
return true;
*/
}
void AnimationPlayer::set_current_animation(const String &p_anim) {

View File

@ -561,12 +561,6 @@ void Control::_notification(int p_notification) {
data.parent = nullptr;
data.parent_canvas_item = nullptr;
/*
if (data.theme_owner && data.theme.is_null()) {
data.theme_owner=NULL;
notification(NOTIFICATION_THEME_CHANGED);
}
*/
} break;
case NOTIFICATION_MOVED_IN_PARENT: {

View File

@ -1469,7 +1469,6 @@ CanvasItem::CanvasItem() :
drawing = false;
behind = false;
block_transform_notify = false;
//viewport=NULL;
canvas_layer = nullptr;
use_parent_material = false;
global_invalid = true;

View File

@ -2506,16 +2506,6 @@ void Viewport::_gui_hid_control(Control *p_control) {
_drop_mouse_focus();
}
/* ???
if (data.window==p_control) {
window->drag_data=Variant();
if (window->drag_preview) {
memdelete( window->drag_preview);
window->drag_preview=NULL;
}
}
*/
if (gui.key_focus == p_control)
_gui_remove_focus();
if (gui.mouse_over == p_control)