Merge pull request #59895 from akien-mga/clang-tidy

This commit is contained in:
Rémi Verschelde 2022-05-02 17:45:13 +02:00 committed by GitHub
commit 78193788d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
156 changed files with 749 additions and 951 deletions

View file

@ -321,9 +321,9 @@ bool ProjectSettings::_get(const StringName &p_name, Variant &r_ret) const {
struct _VCSort {
String name;
Variant::Type type;
int order;
uint32_t flags;
Variant::Type type = Variant::VARIANT_MAX;
int order = 0;
uint32_t flags = 0;
bool operator<(const _VCSort &p_vcs) const { return order == p_vcs.order ? name < p_vcs.name : order < p_vcs.order; }
};

View file

@ -41,7 +41,7 @@ struct _CoreConstant {
StringName enum_name;
bool ignore_value_in_docs = false;
#endif
const char *name;
const char *name = nullptr;
int value = 0;
_CoreConstant() {}

View file

@ -113,10 +113,10 @@ private:
int mouse_from_touch_index = -1;
struct VelocityTrack {
uint64_t last_tick;
uint64_t last_tick = 0;
Vector2 velocity;
Vector2 accum;
float accum_t;
float accum_t = 0.0f;
float min_ref_frame;
float max_ref_frame;

View file

@ -86,15 +86,15 @@ class FileAccessNetwork : public FileAccess {
Semaphore page_sem;
Mutex buffer_mutex;
bool opened = false;
uint64_t total_size;
uint64_t total_size = 0;
mutable uint64_t pos = 0;
int32_t id;
int32_t id = -1;
mutable bool eof_flag = false;
mutable int32_t last_page = -1;
mutable uint8_t *last_page_buff = nullptr;
int32_t page_size;
int32_t read_ahead;
int32_t page_size = 0;
int32_t read_ahead = 0;
mutable int waiting_on_page = -1;
@ -108,7 +108,8 @@ class FileAccessNetwork : public FileAccess {
mutable Error response;
uint64_t exists_modtime;
uint64_t exists_modtime = 0;
friend class FileAccessNetworkClient;
void _queue_page(int32_t p_page) const;
void _respond(uint64_t p_len, Error p_status);

View file

@ -80,7 +80,7 @@ class FileAccessZip : public FileAccess {
unzFile zfile = nullptr;
unz_file_info64 file_info;
mutable bool at_eof;
mutable bool at_eof = false;
void _close();

View file

@ -74,8 +74,7 @@ struct _IP_ResolverPrivate {
Semaphore sem;
Thread thread;
//Semaphore* semaphore;
bool thread_abort;
bool thread_abort = false;
void resolve_queues() {
for (int i = 0; i < IP::RESOLVER_MAX_QUERIES; i++) {

View file

@ -666,7 +666,7 @@ public:
face_pool.reset(true);
}
Vertex *vertex_list;
Vertex *vertex_list = nullptr;
void compute(const Vector3 *p_coords, int32_t p_count);

View file

@ -74,14 +74,14 @@ Vector<Vector<Vector2>> Geometry2D::decompose_polygon_in_convex(Vector<Point2> p
struct _AtlasWorkRect {
Size2i s;
Point2i p;
int idx;
int idx = 0;
_FORCE_INLINE_ bool operator<(const _AtlasWorkRect &p_r) const { return s.width > p_r.s.width; };
};
struct _AtlasWorkRectResult {
Vector<_AtlasWorkRect> result;
int max_w;
int max_h;
int max_w = 0;
int max_h = 0;
};
void Geometry2D::make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_result, Size2i &r_size) {

View file

@ -61,8 +61,8 @@ static int __bsr_clz32(uint32_t x) {
class RandomPCG {
pcg32_random_t pcg;
uint64_t current_seed; // The seed the current generator state started from.
uint64_t current_inc;
uint64_t current_seed = 0; // The seed the current generator state started from.
uint64_t current_inc = 0;
public:
static const uint64_t DEFAULT_SEED = 12047754176567800795U;

View file

@ -54,7 +54,6 @@ class OS {
bool _single_window = false;
String _local_clipboard;
int _exit_code = EXIT_FAILURE; // unexpected exit is marked as failure
int _orientation;
bool _allow_hidpi = false;
bool _allow_layered = false;
bool _stdout_enabled = true;
@ -68,7 +67,7 @@ class OS {
// for the user interface we keep a record of the current display driver
// so we can retrieve the rendering drivers available
int _display_driver_id = -1;
String _current_rendering_driver_name = "";
String _current_rendering_driver_name;
protected:
void _set_logger(CompositeLogger *p_logger);

View file

@ -77,20 +77,20 @@ private:
Entry *entry_array = nullptr;
int *entry_indices = nullptr;
int entry_max;
int entry_count;
int entry_max = 0;
int entry_count = 0;
uint8_t *pool = nullptr;
void *mem_ptr = nullptr;
int pool_size;
int pool_size = 0;
int free_mem;
int free_mem_peak;
int free_mem = 0;
int free_mem_peak = 0;
unsigned int check_count;
int align;
unsigned int check_count = 0;
int align = 1;
bool needs_locking;
bool needs_locking = false;
inline int entry_end(const Entry &p_entry) const {
return p_entry.pos + aligned(p_entry.len);

View file

@ -37,9 +37,9 @@ extern "C" {
}
struct CompressedString {
int orig_len;
int orig_len = 0;
CharString compressed;
int offset;
int offset = 0;
};
void OptimizedTranslation::generate(const Ref<Translation> &p_from) {

View file

@ -949,20 +949,20 @@ struct _VariantCall {
_VariantCall::ConstantData *_VariantCall::constant_data = nullptr;
struct VariantBuiltInMethodInfo {
void (*call)(Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error);
Variant::ValidatedBuiltInMethod validated_call;
Variant::PTRBuiltInMethod ptrcall;
void (*call)(Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) = nullptr;
Variant::ValidatedBuiltInMethod validated_call = nullptr;
Variant::PTRBuiltInMethod ptrcall = nullptr;
Vector<Variant> default_arguments;
Vector<String> argument_names;
bool is_const;
bool is_static;
bool has_return_type;
bool is_vararg;
bool is_const = false;
bool is_static = false;
bool has_return_type = false;
bool is_vararg = false;
Variant::Type return_type;
int argument_count;
Variant::Type (*get_argument_type)(int p_arg);
int argument_count = 0;
Variant::Type (*get_argument_type)(int p_arg) = nullptr;
};
typedef OAHashMap<StringName, VariantBuiltInMethodInfo> BuiltinMethodMap;

View file

@ -31,11 +31,11 @@
#include "variant_construct.h"
struct VariantConstructData {
void (*construct)(Variant &r_base, const Variant **p_args, Callable::CallError &r_error);
Variant::ValidatedConstructor validated_construct;
Variant::PTRConstructor ptr_construct;
Variant::Type (*get_argument_type)(int);
int argument_count;
void (*construct)(Variant &r_base, const Variant **p_args, Callable::CallError &r_error) = nullptr;
Variant::ValidatedConstructor validated_construct = nullptr;
Variant::PTRConstructor ptr_construct = nullptr;
Variant::Type (*get_argument_type)(int) = nullptr;
int argument_count = 0;
Vector<String> arg_names;
};

View file

@ -805,16 +805,16 @@ INDEXED_SETGET_STRUCT_TYPED(PackedColorArray, Color)
INDEXED_SETGET_STRUCT_DICT(Dictionary)
struct VariantIndexedSetterGetterInfo {
void (*setter)(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob);
void (*getter)(const Variant *base, int64_t index, Variant *value, bool *oob);
void (*setter)(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob) = nullptr;
void (*getter)(const Variant *base, int64_t index, Variant *value, bool *oob) = nullptr;
Variant::ValidatedIndexedSetter validated_setter;
Variant::ValidatedIndexedGetter validated_getter;
Variant::ValidatedIndexedSetter validated_setter = nullptr;
Variant::ValidatedIndexedGetter validated_getter = nullptr;
Variant::PTRIndexedSetter ptr_setter;
Variant::PTRIndexedGetter ptr_getter;
Variant::PTRIndexedSetter ptr_setter = nullptr;
Variant::PTRIndexedGetter ptr_getter = nullptr;
uint64_t (*get_indexed_size)(const Variant *base);
uint64_t (*get_indexed_size)(const Variant *base) = nullptr;
Variant::Type index_type;
@ -1018,13 +1018,13 @@ struct VariantKeyedSetGetObject {
};
struct VariantKeyedSetterGetterInfo {
Variant::ValidatedKeyedSetter validated_setter;
Variant::ValidatedKeyedGetter validated_getter;
Variant::ValidatedKeyedChecker validated_checker;
Variant::ValidatedKeyedSetter validated_setter = nullptr;
Variant::ValidatedKeyedGetter validated_getter = nullptr;
Variant::ValidatedKeyedChecker validated_checker = nullptr;
Variant::PTRKeyedSetter ptr_setter;
Variant::PTRKeyedGetter ptr_getter;
Variant::PTRKeyedChecker ptr_checker;
Variant::PTRKeyedSetter ptr_setter = nullptr;
Variant::PTRKeyedGetter ptr_getter = nullptr;
Variant::PTRKeyedChecker ptr_checker = nullptr;
bool valid = false;
};

View file

@ -1110,14 +1110,14 @@ static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {
register_utility_function<Func_##m_func>(#m_func, m_args)
struct VariantUtilityFunctionInfo {
void (*call_utility)(Variant *r_ret, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
Variant::ValidatedUtilityFunction validated_call_utility;
Variant::PTRUtilityFunction ptr_call_utility;
void (*call_utility)(Variant *r_ret, const Variant **p_args, int p_argcount, Callable::CallError &r_error) = nullptr;
Variant::ValidatedUtilityFunction validated_call_utility = nullptr;
Variant::PTRUtilityFunction ptr_call_utility = nullptr;
Vector<String> argnames;
bool is_vararg;
bool returns_value;
int argcount;
Variant::Type (*get_arg_type)(int);
bool is_vararg = false;
bool returns_value = false;
int argcount = 0;
Variant::Type (*get_arg_type)(int) = nullptr;
Variant::Type return_type;
Variant::UtilityFunctionType type;
};