Browse Source

Style: Apply clang-format to @reduz's changes

[ci skip]
Rémi Verschelde 8 years ago
parent
commit
e73e00d369

+ 1 - 1
core/os/file_access.h

@@ -174,7 +174,7 @@ struct FileAccessRef {
 
 
 	operator bool() const { return f != NULL; }
 	operator bool() const { return f != NULL; }
 	FileAccess *f;
 	FileAccess *f;
-	operator FileAccess*() { return f; }
+	operator FileAccess *() { return f; }
 	FileAccessRef(FileAccess *fa) { f = fa; }
 	FileAccessRef(FileAccess *fa) { f = fa; }
 	~FileAccessRef() {
 	~FileAccessRef() {
 		if (f) memdelete(f);
 		if (f) memdelete(f);

+ 11 - 11
drivers/gles3/shader_compiler_gles3.cpp

@@ -441,12 +441,12 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
 			if (!bnode->single_statement) {
 			if (!bnode->single_statement) {
 				code += _mktab(p_level - 1) + "{\n";
 				code += _mktab(p_level - 1) + "{\n";
 			}
 			}
-	
+
 			for (int i = 0; i < bnode->statements.size(); i++) {
 			for (int i = 0; i < bnode->statements.size(); i++) {
 
 
 				String scode = _dump_node_code(bnode->statements[i], p_level, r_gen_code, p_actions, p_default_actions);
 				String scode = _dump_node_code(bnode->statements[i], p_level, r_gen_code, p_actions, p_default_actions);
 
 
-				if (bnode->statements[i]->type == SL::Node::TYPE_CONTROL_FLOW || bnode->single_statement ) {
+				if (bnode->statements[i]->type == SL::Node::TYPE_CONTROL_FLOW || bnode->single_statement) {
 					code += scode; //use directly
 					code += scode; //use directly
 				} else {
 				} else {
 					code += _mktab(p_level) + scode + ";\n";
 					code += _mktab(p_level) + scode + ";\n";
@@ -461,20 +461,20 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
 			SL::VariableDeclarationNode *vdnode = (SL::VariableDeclarationNode *)p_node;
 			SL::VariableDeclarationNode *vdnode = (SL::VariableDeclarationNode *)p_node;
 
 
 			String declaration = _prestr(vdnode->precision) + _typestr(vdnode->datatype);
 			String declaration = _prestr(vdnode->precision) + _typestr(vdnode->datatype);
-			for(int i=0;i<vdnode->declarations.size();i++) {
-				if (i>0) {
-					declaration+=",";
+			for (int i = 0; i < vdnode->declarations.size(); i++) {
+				if (i > 0) {
+					declaration += ",";
 				} else {
 				} else {
-					declaration+=" ";
+					declaration += " ";
 				}
 				}
-				declaration +=  _mkid(vdnode->declarations[i].name);
+				declaration += _mkid(vdnode->declarations[i].name);
 				if (vdnode->declarations[i].initializer) {
 				if (vdnode->declarations[i].initializer) {
-					declaration+="=";
-					declaration+=_dump_node_code(vdnode->declarations[i].initializer, p_level, r_gen_code, p_actions, p_default_actions);
+					declaration += "=";
+					declaration += _dump_node_code(vdnode->declarations[i].initializer, p_level, r_gen_code, p_actions, p_default_actions);
 				}
 				}
 			}
 			}
 
 
-			code+=declaration;
+			code += declaration;
 		} break;
 		} break;
 		case SL::Node::TYPE_VARIABLE: {
 		case SL::Node::TYPE_VARIABLE: {
 			SL::VariableNode *vnode = (SL::VariableNode *)p_node;
 			SL::VariableNode *vnode = (SL::VariableNode *)p_node;
@@ -623,7 +623,7 @@ String ShaderCompilerGLES3::_dump_node_code(SL::Node *p_node, int p_level, Gener
 				String left = _dump_node_code(cfnode->blocks[0], p_level, r_gen_code, p_actions, p_default_actions);
 				String left = _dump_node_code(cfnode->blocks[0], p_level, r_gen_code, p_actions, p_default_actions);
 				String middle = _dump_node_code(cfnode->expressions[0], p_level, r_gen_code, p_actions, p_default_actions);
 				String middle = _dump_node_code(cfnode->expressions[0], p_level, r_gen_code, p_actions, p_default_actions);
 				String right = _dump_node_code(cfnode->expressions[1], p_level, r_gen_code, p_actions, p_default_actions);
 				String right = _dump_node_code(cfnode->expressions[1], p_level, r_gen_code, p_actions, p_default_actions);
-				code += _mktab(p_level) + "for (" +left+";"+middle+";"+right+")\n";
+				code += _mktab(p_level) + "for (" + left + ";" + middle + ";" + right + ")\n";
 				code += _dump_node_code(cfnode->blocks[1], p_level + 1, r_gen_code, p_actions, p_default_actions);
 				code += _dump_node_code(cfnode->blocks[1], p_level + 1, r_gen_code, p_actions, p_default_actions);
 
 
 			} else if (cfnode->flow_op == SL::FLOW_OP_RETURN) {
 			} else if (cfnode->flow_op == SL::FLOW_OP_RETURN) {

+ 4 - 4
editor/editor_help.cpp

@@ -652,7 +652,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
 	Ref<Font> doc_font = get_font("doc", "EditorFonts");
 	Ref<Font> doc_font = get_font("doc", "EditorFonts");
 	Ref<Font> doc_title_font = get_font("doc_title", "EditorFonts");
 	Ref<Font> doc_title_font = get_font("doc_title", "EditorFonts");
 	Ref<Font> doc_code_font = get_font("doc_source", "EditorFonts");
 	Ref<Font> doc_code_font = get_font("doc_source", "EditorFonts");
-	String link_color_text=Color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")).to_html(false);
+	String link_color_text = Color(EditorSettings::get_singleton()->get("text_editor/highlighting/keyword_color")).to_html(false);
 
 
 	h_color = Color(1, 1, 1, 1);
 	h_color = Color(1, 1, 1, 1);
 
 
@@ -1256,7 +1256,7 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
 				class_desc->add_image(get_icon("Error", "EditorIcons"));
 				class_desc->add_image(get_icon("Error", "EditorIcons"));
 				class_desc->add_text(" ");
 				class_desc->add_text(" ");
 				class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"));
 				class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"));
-				class_desc->append_bbcode(TTR("There is currently no description for this property. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url",CONTRIBUTE_URL).replace("$color",link_color_text));
+				class_desc->append_bbcode(TTR("There is currently no description for this property. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text));
 				class_desc->pop();
 				class_desc->pop();
 			}
 			}
 			class_desc->pop();
 			class_desc->pop();
@@ -1340,13 +1340,13 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
 			class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
 			class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/text_color"));
 			class_desc->push_font(doc_font);
 			class_desc->push_font(doc_font);
 			class_desc->push_indent(1);
 			class_desc->push_indent(1);
-			if (methods[i].description.strip_edges()!=String()) {
+			if (methods[i].description.strip_edges() != String()) {
 				_add_text(methods[i].description);
 				_add_text(methods[i].description);
 			} else {
 			} else {
 				class_desc->add_image(get_icon("Error", "EditorIcons"));
 				class_desc->add_image(get_icon("Error", "EditorIcons"));
 				class_desc->add_text(" ");
 				class_desc->add_text(" ");
 				class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"));
 				class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/highlighting/comment_color"));
-				class_desc->append_bbcode(TTR("There is currently no description for this method. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url",CONTRIBUTE_URL).replace("$color",link_color_text));
+				class_desc->append_bbcode(TTR("There is currently no description for this method. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text));
 				class_desc->pop();
 				class_desc->pop();
 			}
 			}
 
 

+ 4 - 3
editor/import/resource_importer_texture.cpp

@@ -30,10 +30,11 @@
 #include "resource_importer_texture.h"
 #include "resource_importer_texture.h"
 
 
 #include "editor/editor_file_system.h"
 #include "editor/editor_file_system.h"
+#include "editor/editor_node.h"
 #include "io/config_file.h"
 #include "io/config_file.h"
 #include "io/image_loader.h"
 #include "io/image_loader.h"
 #include "scene/resources/texture.h"
 #include "scene/resources/texture.h"
-#include "editor/editor_node.h"
+
 void ResourceImporterTexture::_texture_reimport_srgb(const Ref<StreamTexture> &p_tex) {
 void ResourceImporterTexture::_texture_reimport_srgb(const Ref<StreamTexture> &p_tex) {
 
 
 	singleton->mutex->lock();
 	singleton->mutex->lock();
@@ -412,13 +413,13 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
 		//must import in all formats, in order of priority (so platform choses the best supported one. IE, etc2 over etc).
 		//must import in all formats, in order of priority (so platform choses the best supported one. IE, etc2 over etc).
 		//Android, GLES 2.x
 		//Android, GLES 2.x
 
 
-		bool ok_on_pc=false;
+		bool ok_on_pc = false;
 
 
 		if (ProjectSettings::get_singleton()->get("rendering/vram_compression/import_s3tc")) {
 		if (ProjectSettings::get_singleton()->get("rendering/vram_compression/import_s3tc")) {
 
 
 			_save_stex(image, p_save_path + ".s3tc.stex", compress_mode, lossy, Image::COMPRESS_S3TC, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal);
 			_save_stex(image, p_save_path + ".s3tc.stex", compress_mode, lossy, Image::COMPRESS_S3TC, mipmaps, tex_flags, stream, detect_3d, detect_srgb, force_rgbe, detect_normal, force_normal);
 			r_platform_variants->push_back("s3tc");
 			r_platform_variants->push_back("s3tc");
-			ok_on_pc=true;
+			ok_on_pc = true;
 		}
 		}
 
 
 		if (ProjectSettings::get_singleton()->get("rendering/vram_compression/import_etc2")) {
 		if (ProjectSettings::get_singleton()->get("rendering/vram_compression/import_etc2")) {

+ 9 - 11
main/main.cpp

@@ -58,9 +58,9 @@
 
 
 #ifdef TOOLS_ENABLED
 #ifdef TOOLS_ENABLED
 #include "editor/doc/doc_data.h"
 #include "editor/doc/doc_data.h"
+#include "editor/doc/doc_data_class_path.gen.h"
 #include "editor/editor_node.h"
 #include "editor/editor_node.h"
 #include "editor/project_manager.h"
 #include "editor/project_manager.h"
-#include "editor/doc/doc_data_class_path.gen.h"
 #endif
 #endif
 
 
 #include "io/file_access_network.h"
 #include "io/file_access_network.h"
@@ -75,7 +75,6 @@
 #include "translation.h"
 #include "translation.h"
 #include "version.h"
 #include "version.h"
 
 
-
 static ProjectSettings *globals = NULL;
 static ProjectSettings *globals = NULL;
 static Engine *engine = NULL;
 static Engine *engine = NULL;
 static InputMap *input_map = NULL;
 static InputMap *input_map = NULL;
@@ -1155,37 +1154,36 @@ bool Main::start() {
 		DocData doc;
 		DocData doc;
 		doc.generate(doc_base);
 		doc.generate(doc_base);
 
 
-
 		DocData docsrc;
 		DocData docsrc;
-		Map<String,String> doc_data_classes;
+		Map<String, String> doc_data_classes;
 		Set<String> checked_paths;
 		Set<String> checked_paths;
 		print_line("Loading docs..");
 		print_line("Loading docs..");
 
 
-		for(int i=0;i<_doc_data_class_path_count;i++) {
+		for (int i = 0; i < _doc_data_class_path_count; i++) {
 			String path = doc_tool.plus_file(_doc_data_class_paths[i].path);
 			String path = doc_tool.plus_file(_doc_data_class_paths[i].path);
 			String name = _doc_data_class_paths[i].name;
 			String name = _doc_data_class_paths[i].name;
-			doc_data_classes[name]=path;
+			doc_data_classes[name] = path;
 			if (!checked_paths.has(path)) {
 			if (!checked_paths.has(path)) {
 				checked_paths.insert(path);
 				checked_paths.insert(path);
 				docsrc.load_classes(path);
 				docsrc.load_classes(path);
-				print_line("Loading docs from: "+path);
+				print_line("Loading docs from: " + path);
 			}
 			}
 		}
 		}
 
 
 		String index_path = doc_tool.plus_file("doc/classes");
 		String index_path = doc_tool.plus_file("doc/classes");
 		docsrc.load_classes(index_path);
 		docsrc.load_classes(index_path);
 		checked_paths.insert(index_path);
 		checked_paths.insert(index_path);
-		print_line("Loading docs from: "+index_path);
+		print_line("Loading docs from: " + index_path);
 
 
 		print_line("Merging docs..");
 		print_line("Merging docs..");
 		doc.merge_from(docsrc);
 		doc.merge_from(docsrc);
-		for (Set<String>::Element *E=checked_paths.front();E;E=E->next()) {
-			print_line("Erasing old docs at: "+E->get());
+		for (Set<String>::Element *E = checked_paths.front(); E; E = E->next()) {
+			print_line("Erasing old docs at: " + E->get());
 			DocData::erase_classes(E->get());
 			DocData::erase_classes(E->get());
 		}
 		}
 
 
 		print_line("Generating new docs..");
 		print_line("Generating new docs..");
-		doc.save_classes(index_path,doc_data_classes);
+		doc.save_classes(index_path, doc_data_classes);
 
 
 		return false;
 		return false;
 	}
 	}

+ 6 - 8
platform/windows/os_windows.cpp

@@ -888,12 +888,11 @@ static int QueryDpiForMonitor(HMONITOR hmon, _MonitorDpiType dpiType = MDT_Defau
 }
 }
 
 
 typedef enum _SHC_PROCESS_DPI_AWARENESS {
 typedef enum _SHC_PROCESS_DPI_AWARENESS {
-  SHC_PROCESS_DPI_UNAWARE            = 0,
-  SHC_PROCESS_SYSTEM_DPI_AWARE       = 1,
-  SHC_PROCESS_PER_MONITOR_DPI_AWARE  = 2
+	SHC_PROCESS_DPI_UNAWARE = 0,
+	SHC_PROCESS_SYSTEM_DPI_AWARE = 1,
+	SHC_PROCESS_PER_MONITOR_DPI_AWARE = 2
 } SHC_PROCESS_DPI_AWARENESS;
 } SHC_PROCESS_DPI_AWARENESS;
 
 
-
 void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
 void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
 
 
 	main_loop = NULL;
 	main_loop = NULL;
@@ -902,12 +901,12 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
 	WNDCLASSEXW wc;
 	WNDCLASSEXW wc;
 
 
 	if (is_hidpi_allowed()) {
 	if (is_hidpi_allowed()) {
-		HMODULE Shcore = LoadLibraryW(L"Shcore.dll");;
+		HMODULE Shcore = LoadLibraryW(L"Shcore.dll");
 
 
 		if (Shcore != NULL) {
 		if (Shcore != NULL) {
-			typedef HRESULT (WINAPI *SetProcessDpiAwareness_t)(SHC_PROCESS_DPI_AWARENESS);
+			typedef HRESULT(WINAPI * SetProcessDpiAwareness_t)(SHC_PROCESS_DPI_AWARENESS);
 
 
-			SetProcessDpiAwareness_t  SetProcessDpiAwareness = (SetProcessDpiAwareness_t)GetProcAddress(Shcore, "SetProcessDpiAwareness");
+			SetProcessDpiAwareness_t SetProcessDpiAwareness = (SetProcessDpiAwareness_t)GetProcAddress(Shcore, "SetProcessDpiAwareness");
 
 
 			if (SetProcessDpiAwareness) {
 			if (SetProcessDpiAwareness) {
 				SetProcessDpiAwareness(SHC_PROCESS_SYSTEM_DPI_AWARE);
 				SetProcessDpiAwareness(SHC_PROCESS_SYSTEM_DPI_AWARE);
@@ -915,7 +914,6 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
 		}
 		}
 	}
 	}
 
 
-
 	video_mode = p_desired;
 	video_mode = p_desired;
 	//printf("**************** desired %s, mode %s\n", p_desired.fullscreen?"true":"false", video_mode.fullscreen?"true":"false");
 	//printf("**************** desired %s, mode %s\n", p_desired.fullscreen?"true":"false", video_mode.fullscreen?"true":"false");
 	RECT WindowRect;
 	RECT WindowRect;

+ 1 - 1
servers/visual/shader_language.h

@@ -371,7 +371,7 @@ public:
 			type = TYPE_BLOCK;
 			type = TYPE_BLOCK;
 			parent_block = NULL;
 			parent_block = NULL;
 			parent_function = NULL;
 			parent_function = NULL;
-			single_statement=false;
+			single_statement = false;
 		}
 		}
 	};
 	};