mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03: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:
@@ -685,7 +685,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
|
||||
PoolByteArray barr;
|
||||
bool full_objects = *p_inputs[1];
|
||||
int len;
|
||||
Error err = encode_variant(*p_inputs[0], NULL, len, full_objects);
|
||||
Error err = encode_variant(*p_inputs[0], nullptr, len, full_objects);
|
||||
if (err) {
|
||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||
r_error.argument = 0;
|
||||
@@ -715,7 +715,7 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant
|
||||
Variant ret;
|
||||
{
|
||||
PoolByteArray::Read r = varr.read();
|
||||
Error err = decode_variant(ret, r.ptr(), varr.size(), NULL, allow_objects);
|
||||
Error err = decode_variant(ret, r.ptr(), varr.size(), nullptr, allow_objects);
|
||||
if (err != OK) {
|
||||
r_error_str = RTR("Not enough bytes for decoding bytes, or invalid format.");
|
||||
r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||
@@ -1206,12 +1206,12 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
|
||||
while (true) {
|
||||
//keep appending stuff to expression
|
||||
ENode *expr = NULL;
|
||||
ENode *expr = nullptr;
|
||||
|
||||
Token tk;
|
||||
_get_token(tk);
|
||||
if (error_set)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
switch (tk.type) {
|
||||
case TK_CURLY_BRACKET_OPEN: {
|
||||
@@ -1228,18 +1228,18 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
//parse an expression
|
||||
ENode *subexpr = _parse_expression();
|
||||
if (!subexpr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
dn->dict.push_back(subexpr);
|
||||
|
||||
_get_token(tk);
|
||||
if (tk.type != TK_COLON) {
|
||||
_set_error("Expected ':'");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
subexpr = _parse_expression();
|
||||
if (!subexpr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
dn->dict.push_back(subexpr);
|
||||
|
||||
@@ -1271,7 +1271,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
//parse an expression
|
||||
ENode *subexpr = _parse_expression();
|
||||
if (!subexpr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
an->array.push_back(subexpr);
|
||||
|
||||
cofs = str_ofs;
|
||||
@@ -1291,11 +1291,11 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
//a suexpression
|
||||
ENode *e = _parse_expression();
|
||||
if (error_set)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
_get_token(tk);
|
||||
if (tk.type != TK_PARENTHESIS_CLOSE) {
|
||||
_set_error("Expected ')'");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
expr = e;
|
||||
@@ -1323,7 +1323,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
//parse an expression
|
||||
ENode *subexpr = _parse_expression();
|
||||
if (!subexpr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
func_call->arguments.push_back(subexpr);
|
||||
|
||||
@@ -1385,7 +1385,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
_get_token(tk);
|
||||
if (tk.type != TK_PARENTHESIS_OPEN) {
|
||||
_set_error("Expected '('");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ConstructorNode *constructor = alloc_node<ConstructorNode>();
|
||||
@@ -1401,7 +1401,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
//parse an expression
|
||||
ENode *subexpr = _parse_expression();
|
||||
if (!subexpr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
constructor->arguments.push_back(subexpr);
|
||||
|
||||
@@ -1425,7 +1425,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
_get_token(tk);
|
||||
if (tk.type != TK_PARENTHESIS_OPEN) {
|
||||
_set_error("Expected '('");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BuiltinFuncNode *bifunc = alloc_node<BuiltinFuncNode>();
|
||||
@@ -1441,7 +1441,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
//parse an expression
|
||||
ENode *subexpr = _parse_expression();
|
||||
if (!subexpr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
bifunc->arguments.push_back(subexpr);
|
||||
|
||||
@@ -1481,7 +1481,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
|
||||
default: {
|
||||
_set_error("Expected expression.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} break;
|
||||
}
|
||||
|
||||
@@ -1491,7 +1491,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
int cofs2 = str_ofs;
|
||||
_get_token(tk);
|
||||
if (error_set)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
bool done = false;
|
||||
|
||||
@@ -1504,14 +1504,14 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
|
||||
ENode *what = _parse_expression();
|
||||
if (!what)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
index->index = what;
|
||||
|
||||
_get_token(tk);
|
||||
if (tk.type != TK_BRACKET_CLOSE) {
|
||||
_set_error("Expected ']' at end of index.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
expr = index;
|
||||
|
||||
@@ -1521,7 +1521,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
_get_token(tk);
|
||||
if (tk.type != TK_IDENTIFIER) {
|
||||
_set_error("Expected identifier after '.'");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
StringName identifier = tk.value;
|
||||
@@ -1544,7 +1544,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
//parse an expression
|
||||
ENode *subexpr = _parse_expression();
|
||||
if (!subexpr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
func_call->arguments.push_back(subexpr);
|
||||
|
||||
@@ -1594,7 +1594,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
int cofs = str_ofs;
|
||||
_get_token(tk);
|
||||
if (error_set)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
Variant::Operator op = Variant::OP_MAX;
|
||||
|
||||
@@ -1777,7 +1777,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
|
||||
default: {
|
||||
_set_error("Parser bug, invalid operator in expression: " + itos(expression[i].op));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1793,7 +1793,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
|
||||
if (next_op == -1) {
|
||||
_set_error("Yet another parser bug....");
|
||||
ERR_FAIL_V(NULL);
|
||||
ERR_FAIL_V(nullptr);
|
||||
}
|
||||
|
||||
// OK! create operator..
|
||||
@@ -1804,7 +1804,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
if (expr_pos == expression.size()) {
|
||||
//can happen..
|
||||
_set_error("Unexpected end of expression...");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1813,7 +1813,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
OperatorNode *op = alloc_node<OperatorNode>();
|
||||
op->op = expression[i].op;
|
||||
op->nodes[0] = expression[i + 1].node;
|
||||
op->nodes[1] = NULL;
|
||||
op->nodes[1] = nullptr;
|
||||
expression.write[i].is_op = false;
|
||||
expression.write[i].node = op;
|
||||
expression.remove(i + 1);
|
||||
@@ -1822,7 +1822,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
} else {
|
||||
if (next_op < 1 || next_op >= (expression.size() - 1)) {
|
||||
_set_error("Parser bug...");
|
||||
ERR_FAIL_V(NULL);
|
||||
ERR_FAIL_V(nullptr);
|
||||
}
|
||||
|
||||
OperatorNode *op = alloc_node<OperatorNode>();
|
||||
@@ -1830,7 +1830,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
|
||||
if (expression[next_op - 1].is_op) {
|
||||
_set_error("Parser bug...");
|
||||
ERR_FAIL_V(NULL);
|
||||
ERR_FAIL_V(nullptr);
|
||||
}
|
||||
|
||||
if (expression[next_op + 1].is_op) {
|
||||
@@ -1840,7 +1840,7 @@ Expression::ENode *Expression::_parse_expression() {
|
||||
// due to how precedence works, unaries will always disappear first
|
||||
|
||||
_set_error("Unexpected two consecutive operators.");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
op->nodes[0] = expression[next_op - 1].node; //expression goes as left
|
||||
@@ -1862,8 +1862,8 @@ bool Expression::_compile_expression() {
|
||||
|
||||
if (nodes) {
|
||||
memdelete(nodes);
|
||||
nodes = NULL;
|
||||
root = NULL;
|
||||
nodes = nullptr;
|
||||
root = nullptr;
|
||||
}
|
||||
|
||||
error_str = String();
|
||||
@@ -1873,11 +1873,11 @@ bool Expression::_compile_expression() {
|
||||
root = _parse_expression();
|
||||
|
||||
if (error_set) {
|
||||
root = NULL;
|
||||
root = nullptr;
|
||||
if (nodes) {
|
||||
memdelete(nodes);
|
||||
}
|
||||
nodes = NULL;
|
||||
nodes = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2100,8 +2100,8 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression:
|
||||
Error Expression::parse(const String &p_expression, const Vector<String> &p_input_names) {
|
||||
if (nodes) {
|
||||
memdelete(nodes);
|
||||
nodes = NULL;
|
||||
root = NULL;
|
||||
nodes = nullptr;
|
||||
root = nullptr;
|
||||
}
|
||||
|
||||
error_str = String();
|
||||
@@ -2113,11 +2113,11 @@ Error Expression::parse(const String &p_expression, const Vector<String> &p_inpu
|
||||
root = _parse_expression();
|
||||
|
||||
if (error_set) {
|
||||
root = NULL;
|
||||
root = nullptr;
|
||||
if (nodes) {
|
||||
memdelete(nodes);
|
||||
}
|
||||
nodes = NULL;
|
||||
nodes = nullptr;
|
||||
return ERR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -2159,8 +2159,8 @@ Expression::Expression() :
|
||||
output_type(Variant::NIL),
|
||||
sequenced(false),
|
||||
error_set(true),
|
||||
root(NULL),
|
||||
nodes(NULL),
|
||||
root(nullptr),
|
||||
nodes(nullptr),
|
||||
execution_error(false) {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user