Skip to content

Commit

Permalink
Style: Apply new clang-format 5.0 style to all files
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga committed Dec 7, 2017
1 parent a8ceb7e commit 13c2ff9
Show file tree
Hide file tree
Showing 199 changed files with 957 additions and 878 deletions.
8 changes: 4 additions & 4 deletions core/class_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ struct MethodDefinition {
StringName name;
Vector<StringName> args;
MethodDefinition() {}
MethodDefinition(const char *p_name)
: name(p_name) {}
MethodDefinition(const StringName &p_name)
: name(p_name) {}
MethodDefinition(const char *p_name) :
name(p_name) {}
MethodDefinition(const StringName &p_name) :
name(p_name) {}
};

MethodDefinition D_METHOD(const char *p_name);
Expand Down
28 changes: 14 additions & 14 deletions core/core_string_names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@

CoreStringNames *CoreStringNames::singleton = NULL;

CoreStringNames::CoreStringNames()
: _free(StaticCString::create("free")),
changed(StaticCString::create("changed")),
_meta(StaticCString::create("__meta__")),
_script(StaticCString::create("script")),
script_changed(StaticCString::create("script_changed")),
___pdcdata(StaticCString::create("___pdcdata")),
__getvar(StaticCString::create("__getvar")),
_iter_init(StaticCString::create("_iter_init")),
_iter_next(StaticCString::create("_iter_next")),
_iter_get(StaticCString::create("_iter_get")),
get_rid(StaticCString::create("get_rid")),
CoreStringNames::CoreStringNames() :
_free(StaticCString::create("free")),
changed(StaticCString::create("changed")),
_meta(StaticCString::create("__meta__")),
_script(StaticCString::create("script")),
script_changed(StaticCString::create("script_changed")),
___pdcdata(StaticCString::create("___pdcdata")),
__getvar(StaticCString::create("__getvar")),
_iter_init(StaticCString::create("_iter_init")),
_iter_next(StaticCString::create("_iter_next")),
_iter_get(StaticCString::create("_iter_get")),
get_rid(StaticCString::create("get_rid")),
#ifdef TOOLS_ENABLED
_sections_unfolded(StaticCString::create("_sections_unfolded")),
_sections_unfolded(StaticCString::create("_sections_unfolded")),
#endif
_custom_features(StaticCString::create("_custom_features")) {
_custom_features(StaticCString::create("_custom_features")) {

x = StaticCString::create("x");
y = StaticCString::create("y");
Expand Down
2 changes: 1 addition & 1 deletion core/dvector.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class PoolVector {
}

if (old_alloc->refcount.unref() == true) {
//this should never happen but..
//this should never happen but..

#ifdef DEBUG_ENABLED
MemoryPool::alloc_mutex->lock();
Expand Down
6 changes: 3 additions & 3 deletions core/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class Engine {
struct Singleton {
StringName name;
Object *ptr;
Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL)
: name(p_name),
ptr(p_ptr) {
Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL) :
name(p_name),
ptr(p_ptr) {
}
};

Expand Down
14 changes: 7 additions & 7 deletions core/global_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ struct _GlobalConstant {
_GlobalConstant() {}

#ifdef DEBUG_METHODS_ENABLED
_GlobalConstant(const StringName &p_enum_name, const char *p_name, int p_value)
: enum_name(p_enum_name),
name(p_name),
value(p_value) {
_GlobalConstant(const StringName &p_enum_name, const char *p_name, int p_value) :
enum_name(p_enum_name),
name(p_name),
value(p_value) {
}
#else
_GlobalConstant(const char *p_name, int p_value)
: name(p_name),
value(p_value) {
_GlobalConstant(const char *p_name, int p_value) :
name(p_name),
value(p_value) {
}
#endif
};
Expand Down
6 changes: 3 additions & 3 deletions core/hash_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class HashMap {
TData data;

Pair() {}
Pair(const TKey &p_key, const TData &p_data)
: key(p_key),
data(p_data) {
Pair(const TKey &p_key, const TData &p_data) :
key(p_key),
data(p_data) {
}
};

Expand Down
9 changes: 4 additions & 5 deletions core/helper/math_fieldwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const

ERR_FAIL_COND_V(p_target.get_type() != p_source.get_type(), p_target);

switch (p_source.get_type()) {
/* clang-format makes a mess of this macro usage */
/* clang-format off */

/* clang-format makes a mess of this macro usage */
/* clang-format off */
switch (p_source.get_type()) {

case Variant::VECTOR2: {

Expand Down Expand Up @@ -174,9 +174,8 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const
default: {
ERR_FAIL_V(p_target);
}

/* clang-format on */
}
/* clang-format on */
}

#endif // TOOLS_ENABLED
6 changes: 3 additions & 3 deletions core/io/file_access_pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ bool FileAccessPack::file_exists(const String &p_name) {
return false;
}

FileAccessPack::FileAccessPack(const String &p_path, const PackedData::PackedFile &p_file)
: pf(p_file),
f(FileAccess::open(pf.pack, FileAccess::READ)) {
FileAccessPack::FileAccessPack(const String &p_path, const PackedData::PackedFile &p_file) :
pf(p_file),
f(FileAccess::open(pf.pack, FileAccess::READ)) {
if (!f) {
ERR_EXPLAIN("Can't open pack-referenced file: " + String(pf.pack));
ERR_FAIL_COND(!f);
Expand Down
4 changes: 2 additions & 2 deletions core/io/marshalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
r_variant = str;

} break;
// math types

// math types
case Variant::VECTOR2: {

ERR_FAIL_COND_V(len < (int)4 * 2, ERR_INVALID_DATA);
Expand Down Expand Up @@ -959,8 +959,8 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
_encode_string(p_variant, buf, r_len);

} break;
// math types

// math types
case Variant::VECTOR2: {

if (buf) {
Expand Down
6 changes: 3 additions & 3 deletions core/io/resource_import.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ class ResourceImporter : public Reference {
PropertyInfo option;
Variant default_value;

ImportOption(const PropertyInfo &p_info, const Variant &p_default)
: option(p_info),
default_value(p_default) {
ImportOption(const PropertyInfo &p_info, const Variant &p_default) :
option(p_info),
default_value(p_default) {
}
ImportOption() {}
};
Expand Down
4 changes: 2 additions & 2 deletions core/math/a_star.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class AStar : public Reference {
Point *prev_point;
real_t distance;

Point()
: list(this) {}
Point() :
list(this) {}
};

Map<int, Point *> points;
Expand Down
6 changes: 3 additions & 3 deletions core/math/aabb.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ class AABB {
operator String() const;

_FORCE_INLINE_ AABB() {}
inline AABB(const Vector3 &p_pos, const Vector3 &p_size)
: position(p_pos),
size(p_size) {
inline AABB(const Vector3 &p_pos, const Vector3 &p_size) :
position(p_pos),
size(p_size) {
}
};

Expand Down
10 changes: 5 additions & 5 deletions core/math/bsp_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,11 @@ BSP_Tree::BSP_Tree(const PoolVector<Face3> &p_faces, real_t p_error_radius) {
error_radius = p_error_radius;
}

BSP_Tree::BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const AABB &p_aabb, real_t p_error_radius)
: nodes(p_nodes),
planes(p_planes),
aabb(p_aabb),
error_radius(p_error_radius) {
BSP_Tree::BSP_Tree(const Vector<Node> &p_nodes, const Vector<Plane> &p_planes, const AABB &p_aabb, real_t p_error_radius) :
nodes(p_nodes),
planes(p_planes),
aabb(p_aabb),
error_radius(p_error_radius) {
}

BSP_Tree::~BSP_Tree() {
Expand Down
3 changes: 1 addition & 2 deletions core/math/face3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,8 @@ bool Face3::intersects_aabb(const AABB &p_aabb) const {
if (!p_aabb.intersects_plane(get_plane()))
return false;

/** TEST FACE AXIS */

#define TEST_AXIS(m_ax) \
/** TEST FACE AXIS */ \
{ \
real_t aabb_min = p_aabb.position.m_ax; \
real_t aabb_max = p_aabb.position.m_ax + p_aabb.size.m_ax; \
Expand Down
30 changes: 15 additions & 15 deletions core/math/math_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,13 @@ struct Rect2 {
operator String() const { return String(position) + ", " + String(size); }

Rect2() {}
Rect2(real_t p_x, real_t p_y, real_t p_width, real_t p_height)
: position(Point2(p_x, p_y)),
size(Size2(p_width, p_height)) {
Rect2(real_t p_x, real_t p_y, real_t p_width, real_t p_height) :
position(Point2(p_x, p_y)),
size(Size2(p_width, p_height)) {
}
Rect2(const Point2 &p_pos, const Size2 &p_size)
: position(p_pos),
size(p_size) {
Rect2(const Point2 &p_pos, const Size2 &p_size) :
position(p_pos),
size(p_size) {
}
};

Expand Down Expand Up @@ -578,18 +578,18 @@ struct Rect2i {
operator String() const { return String(position) + ", " + String(size); }

operator Rect2() const { return Rect2(position, size); }
Rect2i(const Rect2 &p_r2)
: position(p_r2.position),
size(p_r2.size) {
Rect2i(const Rect2 &p_r2) :
position(p_r2.position),
size(p_r2.size) {
}
Rect2i() {}
Rect2i(int p_x, int p_y, int p_width, int p_height)
: position(Point2(p_x, p_y)),
size(Size2(p_width, p_height)) {
Rect2i(int p_x, int p_y, int p_width, int p_height) :
position(Point2(p_x, p_y)),
size(Size2(p_width, p_height)) {
}
Rect2i(const Point2 &p_pos, const Size2 &p_size)
: position(p_pos),
size(p_size) {
Rect2i(const Point2 &p_pos, const Size2 &p_size) :
position(p_pos),
size(p_size) {
}
};

Expand Down
2 changes: 1 addition & 1 deletion core/math/math_funcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class Math {

#elif defined(_MSC_VER) && _MSC_VER < 1800
__asm fld a __asm fistp b
/*#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
/*#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
// use AT&T inline assembly style, document that
// we use memory as output (=m) and input (m)
__asm__ __volatile__ (
Expand Down
18 changes: 9 additions & 9 deletions core/math/plane.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class Plane {
operator String() const;

_FORCE_INLINE_ Plane() { d = 0; }
_FORCE_INLINE_ Plane(real_t p_a, real_t p_b, real_t p_c, real_t p_d)
: normal(p_a, p_b, p_c),
d(p_d){};
_FORCE_INLINE_ Plane(real_t p_a, real_t p_b, real_t p_c, real_t p_d) :
normal(p_a, p_b, p_c),
d(p_d){};

_FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d);
_FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3 &p_normal);
Expand All @@ -100,14 +100,14 @@ bool Plane::has_point(const Vector3 &p_point, real_t _epsilon) const {
return (dist <= _epsilon);
}

Plane::Plane(const Vector3 &p_normal, real_t p_d)
: normal(p_normal),
d(p_d) {
Plane::Plane(const Vector3 &p_normal, real_t p_d) :
normal(p_normal),
d(p_d) {
}

Plane::Plane(const Vector3 &p_point, const Vector3 &p_normal)
: normal(p_normal),
d(p_normal.dot(p_point)) {
Plane::Plane(const Vector3 &p_point, const Vector3 &p_normal) :
normal(p_normal),
d(p_normal.dot(p_point)) {
}

Plane::Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, ClockDirection p_dir) {
Expand Down
6 changes: 3 additions & 3 deletions core/math/transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Transform::operator String() const {
return basis.operator String() + " - " + origin.operator String();
}

Transform::Transform(const Basis &p_basis, const Vector3 &p_origin)
: basis(p_basis),
origin(p_origin) {
Transform::Transform(const Basis &p_basis, const Vector3 &p_origin) :
basis(p_basis),
origin(p_origin) {
}
Loading

0 comments on commit 13c2ff9

Please sign in to comment.