Skip to content

Commit

Permalink
Fix some clang-tidy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
pafuent committed Oct 4, 2024
1 parent 5ccbf6e commit f14c26c
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 20 deletions.
1 change: 0 additions & 1 deletion core/config/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "core/os/main_loop.h"
#include "core/string/ustring.h"
#include "core/templates/list.h"
#include "core/templates/vector.h"

template <typename T>
class TypedArray;
Expand Down
1 change: 0 additions & 1 deletion core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "core/io/marshalls.h"
#include "core/io/resource_uid.h"
#include "core/object/script_language.h"
#include "core/os/keyboard.h"
#include "core/templates/rb_set.h"
#include "core/variant/typed_array.h"
#include "core/variant/variant_parser.h"
Expand Down
4 changes: 2 additions & 2 deletions core/io/ip_address.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ struct IPAddress {
uint32_t field32[4];
};

bool valid;
bool wildcard;
bool valid = false;
bool wildcard = false;

protected:
void _parse_ipv6(const String &p_string);
Expand Down
10 changes: 5 additions & 5 deletions core/io/marshalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static inline unsigned int encode_uint32(uint32_t p_uint, uint8_t *p_arr) {
}

static inline unsigned int encode_float(float p_float, uint8_t *p_arr) {
MarshallFloat mf;
MarshallFloat mf{};
mf.f = p_float;
encode_uint32(mf.i, p_arr);

Expand All @@ -103,7 +103,7 @@ static inline unsigned int encode_uint64(uint64_t p_uint, uint8_t *p_arr) {
}

static inline unsigned int encode_double(double p_double, uint8_t *p_arr) {
MarshallDouble md;
MarshallDouble md{};
md.d = p_double;
encode_uint64(md.l, p_arr);

Expand All @@ -121,7 +121,7 @@ static inline unsigned int encode_uintr(uintr_t p_uint, uint8_t *p_arr) {
}

static inline unsigned int encode_real(real_t p_real, uint8_t *p_arr) {
MarshallReal mr;
MarshallReal mr{};
mr.r = p_real;
encode_uintr(mr.i, p_arr);

Expand Down Expand Up @@ -173,7 +173,7 @@ static inline uint32_t decode_uint32(const uint8_t *p_arr) {
}

static inline float decode_float(const uint8_t *p_arr) {
MarshallFloat mf;
MarshallFloat mf{};
mf.i = decode_uint32(p_arr);
return mf.f;
}
Expand All @@ -192,7 +192,7 @@ static inline uint64_t decode_uint64(const uint8_t *p_arr) {
}

static inline double decode_double(const uint8_t *p_arr) {
MarshallDouble md;
MarshallDouble md{};
md.l = decode_uint64(p_arr);
return md.d;
}
Expand Down
2 changes: 1 addition & 1 deletion core/math/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ struct [[nodiscard]] Color {
union {
float f;
int32_t i;
} R, G, B, E;
} R{ 0.0f }, G{ 0.0f }, B{ 0.0f }, E{ 0.0f };

E.f = MaxChannel;
E.i += 0x07804000; // Add 15 to the exponent and 0x4000 to the mantissa
Expand Down
4 changes: 2 additions & 2 deletions core/object/callable_method_pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@

class CallableCustomMethodPointerBase : public CallableCustom {
uint32_t *comp_ptr = nullptr;
uint32_t comp_size;
uint32_t h;
uint32_t comp_size = 0U;
uint32_t h = 0U;
#ifdef DEBUG_METHODS_ENABLED
const char *text = "";
#endif
Expand Down
2 changes: 1 addition & 1 deletion core/object/message_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class CallQueue {
bool is_flushing() const;
int get_max_buffer_usage() const;

CallQueue(Allocator *p_custom_allocator = 0, uint32_t p_max_pages = 8192, const String &p_error_text = String());
CallQueue(Allocator *p_custom_allocator = nullptr, uint32_t p_max_pages = 8192, const String &p_error_text = String());
virtual ~CallQueue();
};

Expand Down
8 changes: 4 additions & 4 deletions core/templates/hashfuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static _FORCE_INLINE_ uint32_t hash_murmur3_one_float(float p_in, uint32_t p_see
union {
float f;
uint32_t i;
} u;
} u = { 0.0f };

// Normalize +/- 0.0 and NaN values so they hash the same.
if (p_in == 0.0f) {
Expand All @@ -153,7 +153,7 @@ static _FORCE_INLINE_ uint32_t hash_murmur3_one_double(double p_in, uint32_t p_s
union {
double d;
uint64_t i;
} u;
} u = { 0.0 };

// Normalize +/- 0.0 and NaN values so they hash the same.
if (p_in == 0.0f) {
Expand Down Expand Up @@ -241,7 +241,7 @@ static _FORCE_INLINE_ uint32_t hash_djb2_one_float(double p_in, uint32_t p_prev
union {
double d;
uint64_t i;
} u;
} u = { 0.0 };

// Normalize +/- 0.0 and NaN values so they hash the same.
if (p_in == 0.0f) {
Expand Down Expand Up @@ -270,7 +270,7 @@ static _FORCE_INLINE_ uint64_t hash_djb2_one_float_64(double p_in, uint64_t p_pr
union {
double d;
uint64_t i;
} u;
} u = { 0.0 };

// Normalize +/- 0.0 and NaN values so they hash the same.
if (p_in == 0.0f) {
Expand Down
2 changes: 1 addition & 1 deletion core/templates/safe_refcount.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class SafeNumeric {
};

class SafeFlag {
std::atomic_bool flag;
std::atomic_bool flag = false;

static_assert(std::atomic_bool::is_always_lock_free);

Expand Down
3 changes: 1 addition & 2 deletions core/variant/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,7 @@ class Variant {
static void unregister_types();

Variant(const Variant &p_variant);
_FORCE_INLINE_ Variant() :
type(NIL) {}
_FORCE_INLINE_ Variant() {}
_FORCE_INLINE_ ~Variant() {
clear();
}
Expand Down

0 comments on commit f14c26c

Please sign in to comment.