Skip to content

Commit 6920c82

Browse files
committed
Style: Fix issues with clang-format 8.0
1 parent 8b0ea33 commit 6920c82

9 files changed

+43
-57
lines changed

core/io/resource_importer.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,7 @@ String ResourceFormatImporter::get_import_group_file(const String &p_path) const
301301
bool valid = true;
302302
PathAndType pat;
303303
_get_path_and_type(p_path, pat, &valid);
304-
return valid?pat.group_file:String();
305-
304+
return valid ? pat.group_file : String();
306305
}
307306

308307
bool ResourceFormatImporter::is_import_valid(const String &p_path) const {

core/io/resource_importer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class ResourceImporter : public Reference {
126126

127127
virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL) = 0;
128128

129-
virtual Error import_group_file(const String& p_group_file,const Map<String,Map<StringName, Variant> >&p_source_file_options, const Map<String,String>& p_base_paths) { return ERR_UNAVAILABLE; }
129+
virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant> > &p_source_file_options, const Map<String, String> &p_base_paths) { return ERR_UNAVAILABLE; }
130130
virtual bool are_import_settings_valid(const String &p_path) const { return true; }
131131
virtual String get_import_settings_string() const { return String(); }
132132
};

editor/editor_folding.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void EditorFolding::load_resource_folding(RES p_resource, const String &p_path)
9292
_set_unfolds(p_resource.ptr(), unfolds);
9393
}
9494

95-
void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p_folds, Array &resource_folds, Array& nodes_folded,Set<RES> &resources) {
95+
void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p_folds, Array &resource_folds, Array &nodes_folded, Set<RES> &resources) {
9696
if (p_root != p_node) {
9797
if (!p_node->get_owner()) {
9898
return; //not owned, bye
@@ -130,7 +130,7 @@ void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p
130130
}
131131

132132
for (int i = 0; i < p_node->get_child_count(); i++) {
133-
_fill_folds(p_root, p_node->get_child(i), p_folds, resource_folds, nodes_folded,resources);
133+
_fill_folds(p_root, p_node->get_child(i), p_folds, resource_folds, nodes_folded, resources);
134134
}
135135
}
136136
void EditorFolding::save_scene_folding(const Node *p_scene, const String &p_path) {
@@ -205,7 +205,7 @@ void EditorFolding::load_scene_folding(Node *p_scene, const String &p_path) {
205205
_set_unfolds(res.ptr(), unfolds2);
206206
}
207207

208-
for(int i=0;i<nodes_folded.size();i++) {
208+
for (int i = 0; i < nodes_folded.size(); i++) {
209209
NodePath fold_path = nodes_folded[i];
210210
if (p_scene->has_node(fold_path)) {
211211
Node *node = p_scene->get_node(fold_path);

scene/audio/audio_stream_player.cpp

+13-17
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232

3333
#include "core/engine.h"
3434

35-
36-
void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames,int p_amount) {
35+
void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames, int p_amount) {
3736

3837
int bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus);
3938

@@ -66,10 +65,8 @@ void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames,int p_amount) {
6665
}
6766
}
6867

69-
7068
void AudioStreamPlayer::_mix_internal(bool p_fadeout) {
7169

72-
7370
//get data
7471
AudioFrame *buffer = mix_buffer.ptrw();
7572
int buffer_size = mix_buffer.size();
@@ -94,15 +91,14 @@ void AudioStreamPlayer::_mix_internal(bool p_fadeout) {
9491
//set volume for next mix
9592
mix_volume_db = target_volume;
9693

97-
_mix_to_bus(buffer,buffer_size);
98-
94+
_mix_to_bus(buffer, buffer_size);
9995
}
10096

10197
void AudioStreamPlayer::_mix_audio() {
10298

10399
if (use_fadeout) {
104-
_mix_to_bus(fadeout_buffer.ptr(),fadeout_buffer.size());
105-
use_fadeout=false;
100+
_mix_to_bus(fadeout_buffer.ptr(), fadeout_buffer.size());
101+
use_fadeout = false;
106102
}
107103

108104
if (!stream_playback.is_valid() || !active ||
@@ -121,7 +117,7 @@ void AudioStreamPlayer::_mix_audio() {
121117
if (setstop) {
122118
_mix_internal(true);
123119
stream_playback->stop();
124-
setstop=false;
120+
setstop = false;
125121
}
126122

127123
if (setseek >= 0.0 && !stop_has_priority) {
@@ -154,7 +150,7 @@ void AudioStreamPlayer::_notification(int p_what) {
154150
if (p_what == NOTIFICATION_INTERNAL_PROCESS) {
155151

156152
if (!active || (setseek < 0 && !stream_playback->is_playing())) {
157-
active = false;
153+
active = false;
158154
set_process_internal(false);
159155
emit_signal("finished");
160156
}
@@ -200,7 +196,7 @@ void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {
200196
vol += vol_inc;
201197
}
202198

203-
use_fadeout=true;
199+
use_fadeout = true;
204200
}
205201

206202
mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size());
@@ -252,7 +248,7 @@ void AudioStreamPlayer::play(float p_from_pos) {
252248
if (stream_playback.is_valid()) {
253249
//mix_volume_db = volume_db; do not reset volume ramp here, can cause clicks
254250
setseek = p_from_pos;
255-
stop_has_priority=false;
251+
stop_has_priority = false;
256252
active = true;
257253
set_process_internal(true);
258254
}
@@ -268,8 +264,8 @@ void AudioStreamPlayer::seek(float p_seconds) {
268264
void AudioStreamPlayer::stop() {
269265

270266
if (stream_playback.is_valid() && active) {
271-
setstop=true;
272-
stop_has_priority=true;
267+
setstop = true;
268+
stop_has_priority = true;
273269
}
274270
}
275271

@@ -357,7 +353,7 @@ void AudioStreamPlayer::_validate_property(PropertyInfo &property) const {
357353
if (property.name == "bus") {
358354

359355
String options;
360-
for (int i = 0; i <AudioServer::get_singleton()->get_bus_count(); i++) {
356+
for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
361357
if (i > 0)
362358
options += ",";
363359
String name = AudioServer::get_singleton()->get_bus_name(i);
@@ -442,8 +438,8 @@ AudioStreamPlayer::AudioStreamPlayer() {
442438
stream_paused_fade = false;
443439
mix_target = MIX_TARGET_STEREO;
444440
fadeout_buffer.resize(512);
445-
setstop=false;
446-
use_fadeout=false;
441+
setstop = false;
442+
use_fadeout = false;
447443

448444
AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed");
449445
}

scene/audio/audio_stream_player.h

-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ class AudioStreamPlayer : public Node {
112112

113113
Ref<AudioStreamPlayback> get_stream_playback();
114114

115-
116115
AudioStreamPlayer();
117116
~AudioStreamPlayer();
118117
};

scene/resources/bit_map.cpp

+19-21
Original file line numberDiff line numberDiff line change
@@ -595,16 +595,16 @@ Array BitMap::_opaque_to_polygons_bind(const Rect2 &p_rect, float p_epsilon) con
595595
return result_array;
596596
}
597597

598-
void BitMap::resize(const Size2& p_new_size) {
598+
void BitMap::resize(const Size2 &p_new_size) {
599599

600600
Ref<BitMap> new_bitmap;
601601
new_bitmap.instance();
602602
new_bitmap->create(p_new_size);
603-
int lw = MIN(width,p_new_size.width);
604-
int lh = MIN(height,p_new_size.height);
605-
for(int x=0;x<lw;x++) {
606-
for(int y=0;y<lh;y++) {
607-
new_bitmap->set_bit(Vector2(x,y),get_bit(Vector2(x,y)));
603+
int lw = MIN(width, p_new_size.width);
604+
int lh = MIN(height, p_new_size.height);
605+
for (int x = 0; x < lw; x++) {
606+
for (int y = 0; y < lh; y++) {
607+
new_bitmap->set_bit(Vector2(x, y), get_bit(Vector2(x, y)));
608608
}
609609
}
610610

@@ -617,42 +617,40 @@ Ref<Image> BitMap::convert_to_image() const {
617617

618618
Ref<Image> image;
619619
image.instance();
620-
image->create(width,height,false,Image::FORMAT_L8);
620+
image->create(width, height, false, Image::FORMAT_L8);
621621
image->lock();
622-
for(int i=0;i<width;i++) {
623-
for(int j=0;j<height;j++) {
624-
image->set_pixel( i,j,get_bit(Point2(i,j)) ? Color(1,1,1) : Color(0,0,0));
622+
for (int i = 0; i < width; i++) {
623+
for (int j = 0; j < height; j++) {
624+
image->set_pixel(i, j, get_bit(Point2(i, j)) ? Color(1, 1, 1) : Color(0, 0, 0));
625625
}
626626
}
627627

628628
image->unlock();
629629

630630
return image;
631631
}
632-
void BitMap::blit(const Vector2& p_pos,const Ref<BitMap>& p_bitmap) {
632+
void BitMap::blit(const Vector2 &p_pos, const Ref<BitMap> &p_bitmap) {
633633

634634
int x = p_pos.x;
635635
int y = p_pos.y;
636636
int w = p_bitmap->get_size().width;
637637
int h = p_bitmap->get_size().height;
638638

639-
for(int i=0;i<w;i++) {
640-
for (int j=0;j<h;j++) {
641-
int px = x+i;
642-
int py = y+j;
643-
if (px<0 || px>=width)
639+
for (int i = 0; i < w; i++) {
640+
for (int j = 0; j < h; j++) {
641+
int px = x + i;
642+
int py = y + j;
643+
if (px < 0 || px >= width)
644644
continue;
645-
if (py<0 || py>=height)
645+
if (py < 0 || py >= height)
646646
continue;
647-
if (p_bitmap->get_bit(Vector2(i,j))) {
648-
set_bit(Vector2(x,y),true);
647+
if (p_bitmap->get_bit(Vector2(i, j))) {
648+
set_bit(Vector2(x, y), true);
649649
}
650650
}
651651
}
652-
653652
}
654653

655-
656654
void BitMap::_bind_methods() {
657655

658656
ClassDB::bind_method(D_METHOD("create", "size"), &BitMap::create);

scene/resources/bit_map.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ class BitMap : public Resource {
6464
int get_true_bit_count() const;
6565

6666
Size2 get_size() const;
67-
void resize(const Size2& p_new_size);
67+
void resize(const Size2 &p_new_size);
6868

6969
void grow_mask(int p_pixels, const Rect2 &p_rect);
7070

71-
void blit(const Vector2& p_pos,const Ref<BitMap>& p_bitmap);
71+
void blit(const Vector2 &p_pos, const Ref<BitMap> &p_bitmap);
7272
Ref<Image> convert_to_image() const;
7373

7474
Vector<Vector<Vector2> > clip_opaque_to_polygons(const Rect2 &p_rect, float p_epsilon = 2.0) const;

scene/resources/resource_format_text.cpp

+3-8
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,8 @@ Error ResourceInteractiveLoaderText::poll() {
447447
resource_cache.push_back(res);
448448
#ifdef TOOLS_ENABLED
449449
//remember ID for saving
450-
res->set_id_for_path(local_path,index);
450+
res->set_id_for_path(local_path, index);
451451
#endif
452-
453452
}
454453

455454
ExtResource er;
@@ -1545,9 +1544,6 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
15451544
}
15461545

15471546
{
1548-
1549-
1550-
15511547
}
15521548

15531549
#ifdef TOOLS_ENABLED
@@ -1569,15 +1565,15 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
15691565
}
15701566

15711567
int attempt = 1; //start from one, more readable format
1572-
while(cached_ids_found.has(attempt)) {
1568+
while (cached_ids_found.has(attempt)) {
15731569
attempt++;
15741570
}
15751571

15761572
cached_ids_found.insert(attempt);
15771573
E->get() = attempt;
15781574
//update also in resource
15791575
Ref<Resource> res = E->key();
1580-
res->set_id_for_path(local_path,attempt);
1576+
res->set_id_for_path(local_path, attempt);
15811577
}
15821578
#else
15831579
//make sure to start from one, as it makes format more readable
@@ -1598,7 +1594,6 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r
15981594

15991595
sorted_er.sort();
16001596

1601-
16021597
for (int i = 0; i < sorted_er.size(); i++) {
16031598
String p = sorted_er[i].resource->get_path();
16041599

scene/resources/resource_format_text.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,9 @@ class ResourceFormatSaverTextInstance {
172172
struct ResourceSort {
173173
RES resource;
174174
int index;
175-
bool operator<(const ResourceSort& p_right) const {
175+
bool operator<(const ResourceSort &p_right) const {
176176
return index < p_right.index;
177177
}
178-
179178
};
180179

181180
void _find_resources(const Variant &p_variant, bool p_main = false);

0 commit comments

Comments
 (0)