diff options
102 files changed, 397 insertions, 324 deletions
diff --git a/.gitignore b/.gitignore index 35fadafbda..6db75f2324 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,8 @@ platform/android/java/build.gradle  platform/android/java/AndroidManifest.xml  platform/android/java/libs/*  platform/android/java/assets +platform/android/java/.idea/* +platform/android/java/*.iml  # General c++ generated files  *.lib @@ -44,6 +46,7 @@ gmon.out  # QT project files  *.config  *.creator +*.creator.*  *.files  *.includes diff --git a/core/ustring.cpp b/core/ustring.cpp index 85b7a16e6a..51f05468e2 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -753,6 +753,46 @@ Vector<String> String::split(const String &p_splitter, bool p_allow_empty, int p  	return ret;  } +Vector<String> String::rsplit(const String &p_splitter, bool p_allow_empty, int p_maxsplit) const { + +	Vector<String> ret; +	const int len = length(); +	int from = len; + +	while (true) { + +		int end = rfind(p_splitter, from); +		if (end < 0) +			end = 0; + +		if (p_allow_empty || (end < from)) { +			const String str = substr(end > 0 ? end + p_splitter.length() : end, end > 0 ? from - end : from + 2); + +			if (p_maxsplit <= 0) { +				ret.push_back(str); +			} else if (p_maxsplit > 0) { + +				// Put rest of the string and leave cycle. +				if (p_maxsplit == ret.size()) { +					ret.push_back(substr(0, from + 2)); +					break; +				} + +				// Otherwise, push items until positive limit is reached. +				ret.push_back(str); +			} +		} + +		if (end == 0) +			break; + +		from = end - p_splitter.length(); +	} + +	ret.invert(); +	return ret; +} +  Vector<float> String::split_floats(const String &p_splitter, bool p_allow_empty) const {  	Vector<float> ret; diff --git a/core/ustring.h b/core/ustring.h index 1ed694bb80..b57e9629d9 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -172,6 +172,7 @@ public:  	String get_slicec(CharType p_splitter, int p_slice) const;  	Vector<String> split(const String &p_splitter, bool p_allow_empty = true, int p_maxsplit = 0) const; +	Vector<String> rsplit(const String &p_splitter, bool p_allow_empty = true, int p_maxsplit = 0) const;  	Vector<String> split_spaces() const;  	Vector<float> split_floats(const String &p_splitter, bool p_allow_empty = true) const;  	Vector<float> split_floats_mk(const Vector<String> &p_splitters, bool p_allow_empty = true) const; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 4e883d496f..4158c2a60e 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -257,6 +257,7 @@ struct _VariantCall {  	VCALL_LOCALMEM2R(String, insert);  	VCALL_LOCALMEM0R(String, capitalize);  	VCALL_LOCALMEM3R(String, split); +	VCALL_LOCALMEM3R(String, rsplit);  	VCALL_LOCALMEM2R(String, split_floats);  	VCALL_LOCALMEM0R(String, to_upper);  	VCALL_LOCALMEM0R(String, to_lower); @@ -1469,6 +1470,7 @@ void register_variant_methods() {  	ADDFUNC2R(STRING, STRING, String, insert, INT, "position", STRING, "what", varray());  	ADDFUNC0R(STRING, STRING, String, capitalize, varray());  	ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, split, STRING, "divisor", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0)); +	ADDFUNC3R(STRING, POOL_STRING_ARRAY, String, rsplit, STRING, "divisor", BOOL, "allow_empty", INT, "maxsplit", varray(true, 0));  	ADDFUNC2R(STRING, POOL_REAL_ARRAY, String, split_floats, STRING, "divisor", BOOL, "allow_empty", varray(true));  	ADDFUNC0R(STRING, STRING, String, to_upper, varray()); diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 83fb76f287..a55e184474 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -688,6 +688,20 @@  				If [code]maxsplit[/code] is given, at most maxsplit number of splits occur, and the remainder of the string is returned as the final element of the list (thus, the list will have at most maxsplit+1 elements)  			</description>  		</method> +		<method name="rsplit"> +			<return type="PoolStringArray"> +			</return> +			<argument index="0" name="divisor" type="String"> +			</argument> +			<argument index="1" name="allow_empty" type="bool" default="True"> +			</argument> +			<argument index="2" name="maxsplit" type="int" default="0"> +			</argument> +			<description> +				Splits the string by a [code]divisor[/code] string and returns an array of the substrings, starting from right. Example "One,Two,Three" will return ["One","Two","Three"] if split by ",". +				If [code]maxsplit[/code] is specified, then it is number of splits to do, default is 0 which splits all the items. +			</description> +		</method>  		<method name="split_floats">  			<return type="PoolRealArray">  			</return> diff --git a/doc/classes/TextureRect.xml b/doc/classes/TextureRect.xml index 7a4208ccea..95afc5d281 100644 --- a/doc/classes/TextureRect.xml +++ b/doc/classes/TextureRect.xml @@ -1,10 +1,10 @@  <?xml version="1.0" encoding="UTF-8" ?>  <class name="TextureRect" inherits="Control" category="Core" version="3.1">  	<brief_description> -		Draws a sprite or a texture inside a User Interface. The texture can tile or not. +		Control for drawing textures.  	</brief_description>  	<description> -		Use TextureRect to draw icons and sprites in your User Interfaces. To create panels and menu boxes, take a look at [NinePatchFrame]. Its Stretch Mode property controls the texture's scale and placement. It can scale, tile and stay centered inside its bounding rectangle. TextureRect is one of the 5 most common nodes to create game UI. +		Used to draw icons and sprites in a user interface. The texture's placement can be controlled with the [member stretch_mode] property. It can scale, tile, or stay centered inside its bounding rectangle.  	</description>  	<tutorials>  	</tutorials> @@ -14,10 +14,10 @@  	</methods>  	<members>  		<member name="expand" type="bool" setter="set_expand" getter="has_expand"> -			If [code]true[/code], the texture scales to fit its bounding rectangle. Default value: [code]false[/code]. +			If [code]true[/code] the texture scales to fit its bounding rectangle. Default value: [code]false[/code].  		</member>  		<member name="stretch_mode" type="int" setter="set_stretch_mode" getter="get_stretch_mode" enum="TextureRect.StretchMode"> -			Controls the texture's behavior when you resize the node's bounding rectangle. Set it to one of the [code]STRETCH_*[/code] constants. See the constants to learn more. +			Controls the texture's behavior when resizing the node's bounding rectangle. See [enum StretchMode].  		</member>  		<member name="texture" type="Texture" setter="set_texture" getter="get_texture">  			The node's [Texture] resource. diff --git a/doc/classes/VideoPlayer.xml b/doc/classes/VideoPlayer.xml index d2639590a1..9ffa3aa52b 100644 --- a/doc/classes/VideoPlayer.xml +++ b/doc/classes/VideoPlayer.xml @@ -1,10 +1,10 @@  <?xml version="1.0" encoding="UTF-8" ?>  <class name="VideoPlayer" inherits="Control" category="Core" version="3.1">  	<brief_description> -		Control to play video files. +		Control for playing video streams.  	</brief_description>  	<description> -		This control has the ability to play video streams. The only format accepted is the OGV Theora, so any other format must be converted before using in a project. +		Control node for playing video streams. Supported formats are WebM and OGV Theora.  	</description>  	<tutorials>  	</tutorials> @@ -15,51 +15,56 @@  			<return type="String">  			</return>  			<description> -				Get the name of the video stream. +				Returns the video stream's name.  			</description>  		</method>  		<method name="get_video_texture">  			<return type="Texture">  			</return>  			<description> -				Get the current frame of the video as a [Texture]. +				Returns the current frame as a [Texture].  			</description>  		</method>  		<method name="is_playing" qualifiers="const">  			<return type="bool">  			</return>  			<description> -				Get whether or not the video is playing. +				Returns [code]true[/code] if the video is playing.  			</description>  		</method>  		<method name="play">  			<return type="void">  			</return>  			<description> -				Start the video playback. +				Starts the video playback.  			</description>  		</method>  		<method name="stop">  			<return type="void">  			</return>  			<description> -				Stop the video playback. +				Stops the video playback.  			</description>  		</method>  	</methods>  	<members>  		<member name="audio_track" type="int" setter="set_audio_track" getter="get_audio_track"> +			The embedded audio track to play.  		</member>  		<member name="autoplay" type="bool" setter="set_autoplay" getter="has_autoplay"> +			If [code]true[/code] playback starts when the scene loads. Default value: [code]false[/code].  		</member>  		<member name="buffering_msec" type="int" setter="set_buffering_msec" getter="get_buffering_msec"> -			The amount of milliseconds to store in buffer while playing. +			Amount of time in milliseconds to store in buffer while playing.  		</member>  		<member name="bus" type="String" setter="set_bus" getter="get_bus"> +			Audio bus to use for sound playback.  		</member>  		<member name="expand" type="bool" setter="set_expand" getter="has_expand"> +			If [code]true[/code] the video scales to the control size. Default value: [code]true[/code].  		</member>  		<member name="paused" type="bool" setter="set_paused" getter="is_paused"> +			If [code]true[/code] the video is paused.  		</member>  		<member name="stream" type="VideoStream" setter="set_stream" getter="get_stream">  		</member> @@ -67,14 +72,16 @@  			The current position of the stream, in seconds.  		</member>  		<member name="volume" type="float" setter="set_volume" getter="get_volume"> -			The volume of the audio track as a linear value. +			Audio volume as a linear value.  		</member>  		<member name="volume_db" type="float" setter="set_volume_db" getter="get_volume_db"> +			Audio volume in dB.  		</member>  	</members>  	<signals>  		<signal name="finished">  			<description> +				Emitted when playback is finished.  			</description>  		</signal>  	</signals> diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 708bff252a..de9203232c 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -52,6 +52,13 @@ void EditorAutoloadSettings::_notification(int p_what) {  			file_dialog->add_filter("*." + E->get());  		} + +		for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) { +			AutoLoadInfo &info = E->get(); +			if (info.node && info.in_editor) { +				get_tree()->get_root()->call_deferred("add_child", info.node); +			} +		}  	}  } @@ -291,6 +298,36 @@ void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) {  	autoload_add_name->set_text(p_path.get_file().get_basename());  } +Node *EditorAutoloadSettings::_create_autoload(const String &p_path) { +	RES res = ResourceLoader::load(p_path); +	ERR_EXPLAIN("Can't autoload: " + p_path); +	ERR_FAIL_COND_V(res.is_null(), NULL); +	Node *n = NULL; +	if (res->is_class("PackedScene")) { +		Ref<PackedScene> ps = res; +		n = ps->instance(); +	} else if (res->is_class("Script")) { +		Ref<Script> s = res; +		StringName ibt = s->get_instance_base_type(); +		bool valid_type = ClassDB::is_parent_class(ibt, "Node"); +		ERR_EXPLAIN("Script does not inherit a Node: " + p_path); +		ERR_FAIL_COND_V(!valid_type, NULL); + +		Object *obj = ClassDB::instance(ibt); + +		ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt)); +		ERR_FAIL_COND_V(obj == NULL, NULL); + +		n = Object::cast_to<Node>(obj); +		n->set_script(s.get_ref_ptr()); +	} + +	ERR_EXPLAIN("Path in autoload not a node or script: " + p_path); +	ERR_FAIL_COND_V(!n, NULL); + +	return n; +} +  void EditorAutoloadSettings::update_autoload() {  	if (updating_autoload) @@ -299,15 +336,11 @@ void EditorAutoloadSettings::update_autoload() {  	updating_autoload = true;  	Map<String, AutoLoadInfo> to_remove; -	Map<String, AutoLoadInfo> to_remove_singleton; -	List<AutoLoadInfo> to_add; -	List<String> to_add_singleton; // Only for when the node is still the same +	List<AutoLoadInfo *> to_add;  	for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) { -		to_remove.insert(E->get().name, E->get()); -		if (E->get().is_singleton) { -			to_remove_singleton.insert(E->get().name, E->get()); -		} +		AutoLoadInfo &info = E->get(); +		to_remove.insert(info.name, info);  	}  	autoload_cache.clear(); @@ -331,11 +364,6 @@ void EditorAutoloadSettings::update_autoload() {  		if (name.empty())  			continue; -		AutoLoadInfo old_info; -		if (to_remove.has(name)) { -			old_info = to_remove[name]; -		} -  		AutoLoadInfo info;  		info.is_singleton = path.begins_with("*"); @@ -347,28 +375,31 @@ void EditorAutoloadSettings::update_autoload() {  		info.path = path;  		info.order = ProjectSettings::get_singleton()->get_order(pi.name); -		if (old_info.name == info.name) { +		bool need_to_add = true; +		if (to_remove.has(name)) { +			AutoLoadInfo &old_info = to_remove[name];  			if (old_info.path == info.path) { -				// Still the same resource, check singleton status -				to_remove.erase(name); -				if (info.is_singleton) { -					if (old_info.is_singleton) { -						to_remove_singleton.erase(name); +				// Still the same resource, check status +				info.node = old_info.node; +				if (info.node) { +					Ref<Script> scr = info.node->get_script(); +					info.in_editor = scr.is_valid() && scr->is_tool(); +					if (info.is_singleton == old_info.is_singleton && info.in_editor == old_info.in_editor) { +						to_remove.erase(name); +						need_to_add = false;  					} else { -						to_add_singleton.push_back(name); +						info.node = NULL;  					}  				} -			} else { -				// Resource changed -				to_add.push_back(info);  			} -		} else { -			// New autoload -			to_add.push_back(info);  		}  		autoload_cache.push_back(info); +		if (need_to_add) { +			to_add.push_back(&(autoload_cache.back()->get())); +		} +  		TreeItem *item = tree->create_item(root);  		item->set_text(0, name);  		item->set_editable(0, true); @@ -387,71 +418,54 @@ void EditorAutoloadSettings::update_autoload() {  		item->set_selectable(3, false);  	} -	// Remove autoload constants -	for (Map<String, AutoLoadInfo>::Element *E = to_remove_singleton.front(); E; E = E->next()) { -		for (int i = 0; i < ScriptServer::get_language_count(); i++) { -			ScriptServer::get_language(i)->remove_named_global_constant(E->get().name); -		} -	} - -	// Remove obsolete nodes from the tree +	// Remove deleted/changed autoloads  	for (Map<String, AutoLoadInfo>::Element *E = to_remove.front(); E; E = E->next()) {  		AutoLoadInfo &info = E->get(); -		Node *al = get_node("/root/" + info.name); -		ERR_CONTINUE(!al); -		get_tree()->get_root()->remove_child(al); -		memdelete(al); -	} +		if (info.is_singleton) { +			for (int i = 0; i < ScriptServer::get_language_count(); i++) { +				ScriptServer::get_language(i)->remove_named_global_constant(info.name); +			} +		} +		if (info.in_editor) { +			ERR_CONTINUE(!info.node); +			get_tree()->get_root()->remove_child(info.node); +		} -	// Register new singletons already in the tree -	for (List<String>::Element *E = to_add_singleton.front(); E; E = E->next()) { -		Node *al = get_node("/root/" + E->get()); -		ERR_CONTINUE(!al); -		for (int i = 0; i < ScriptServer::get_language_count(); i++) { -			ScriptServer::get_language(i)->add_named_global_constant(E->get(), al); +		if (info.node) { +			memdelete(info.node); +			info.node = NULL;  		}  	} -	// Add new nodes to the tree +	// Load new/changed autoloads  	List<Node *> nodes_to_add; -	for (List<AutoLoadInfo>::Element *E = to_add.front(); E; E = E->next()) { -		AutoLoadInfo &info = E->get(); +	for (List<AutoLoadInfo *>::Element *E = to_add.front(); E; E = E->next()) { +		AutoLoadInfo *info = E->get(); -		RES res = ResourceLoader::load(info.path); -		ERR_EXPLAIN("Can't autoload: " + info.path); -		ERR_CONTINUE(res.is_null()); -		Node *n = NULL; -		if (res->is_class("PackedScene")) { -			Ref<PackedScene> ps = res; -			n = ps->instance(); -		} else if (res->is_class("Script")) { -			Ref<Script> s = res; -			StringName ibt = s->get_instance_base_type(); -			bool valid_type = ClassDB::is_parent_class(ibt, "Node"); -			ERR_EXPLAIN("Script does not inherit a Node: " + info.path); -			ERR_CONTINUE(!valid_type); - -			Object *obj = ClassDB::instance(ibt); - -			ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt)); -			ERR_CONTINUE(obj == NULL); - -			n = Object::cast_to<Node>(obj); -			n->set_script(s.get_ref_ptr()); -		} +		info->node = _create_autoload(info->path); -		ERR_EXPLAIN("Path in autoload not a node or script: " + info.path); -		ERR_CONTINUE(!n); -		n->set_name(info.name); +		ERR_CONTINUE(!info->node); +		info->node->set_name(info->name); -		//defer so references are all valid on _ready() -		nodes_to_add.push_back(n); +		Ref<Script> scr = info->node->get_script(); +		info->in_editor = scr.is_valid() && scr->is_tool(); -		if (info.is_singleton) { +		if (info->in_editor) { +			//defer so references are all valid on _ready() +			nodes_to_add.push_back(info->node); +		} + +		if (info->is_singleton) {  			for (int i = 0; i < ScriptServer::get_language_count(); i++) { -				ScriptServer::get_language(i)->add_named_global_constant(info.name, n); +				ScriptServer::get_language(i)->add_named_global_constant(info->name, info->node);  			}  		} + +		if (!info->in_editor && !info->is_singleton) { +			// No reason to keep this node +			memdelete(info->node); +			info->node = NULL; +		}  	}  	for (List<Node *>::Element *E = nodes_to_add.front(); E; E = E->next()) { @@ -728,6 +742,24 @@ EditorAutoloadSettings::EditorAutoloadSettings() {  		info.name = name;  		info.path = path;  		info.order = ProjectSettings::get_singleton()->get_order(pi.name); +		info.node = _create_autoload(path); + +		if (info.node) { +			Ref<Script> scr = info.node->get_script(); +			info.in_editor = scr.is_valid() && scr->is_tool(); +			info.node->set_name(info.name); +		} + +		if (info.is_singleton) { +			for (int i = 0; i < ScriptServer::get_language_count(); i++) { +				ScriptServer::get_language(i)->add_named_global_constant(info.name, info.node); +			} +		} + +		if (!info.is_singleton && !info.in_editor) { +			memdelete(info.node); +			info.node = NULL; +		}  		autoload_cache.push_back(info);  	} @@ -796,3 +828,12 @@ EditorAutoloadSettings::EditorAutoloadSettings() {  	add_child(tree, true);  } + +EditorAutoloadSettings::~EditorAutoloadSettings() { +	for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) { +		AutoLoadInfo &info = E->get(); +		if (info.node && !info.in_editor) { +			memdelete(info.node); +		} +	} +} diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h index 1797c10e61..0b75faa009 100644 --- a/editor/editor_autoload_settings.h +++ b/editor/editor_autoload_settings.h @@ -52,11 +52,19 @@ class EditorAutoloadSettings : public VBoxContainer {  		String name;  		String path;  		bool is_singleton; +		bool in_editor;  		int order; +		Node *node;  		bool operator==(const AutoLoadInfo &p_info) {  			return order == p_info.order;  		} + +		AutoLoadInfo() { +			is_singleton = false; +			in_editor = false; +			node = NULL; +		}  	};  	List<AutoLoadInfo> autoload_cache; @@ -78,6 +86,7 @@ class EditorAutoloadSettings : public VBoxContainer {  	void _autoload_activated();  	void _autoload_open(const String &fpath);  	void _autoload_file_callback(const String &p_path); +	Node *_create_autoload(const String &p_path);  	Variant get_drag_data_fw(const Point2 &p_point, Control *p_control);  	bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control) const; @@ -93,6 +102,7 @@ public:  	void autoload_remove(const String &p_name);  	EditorAutoloadSettings(); +	~EditorAutoloadSettings();  };  #endif diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 0625aeee54..d1968468f8 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -1522,7 +1522,8 @@ EditorPropertyColor::EditorPropertyColor() {  void EditorPropertyNodePath::_node_selected(const NodePath &p_path) { -	emit_signal("property_changed", get_edited_property(), p_path); +	Node *base_node = Object::cast_to<Node>(get_edited_object()); +	emit_signal("property_changed", get_edited_property(), base_node->get_path().rel_path_to(p_path));  	update_property();  } diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index e7741c7926..297373d299 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -383,11 +383,11 @@ void FileSystemDock::_update_file_display_toggle_button() {  	if (button_display_mode->is_pressed()) {  		display_mode = DISPLAY_LIST;  		button_display_mode->set_icon(get_icon("FileThumbnail", "EditorIcons")); -		button_display_mode->set_tooltip(TTR("View items as a grid of thumbnails")); +		button_display_mode->set_tooltip(TTR("View items as a grid of thumbnails."));  	} else {  		display_mode = DISPLAY_THUMBNAILS;  		button_display_mode->set_icon(get_icon("FileList", "EditorIcons")); -		button_display_mode->set_tooltip(TTR("View items as a list")); +		button_display_mode->set_tooltip(TTR("View items as a list."));  	}  } @@ -1860,7 +1860,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {  	button_favorite->set_flat(true);  	button_favorite->set_toggle_mode(true);  	button_favorite->connect("pressed", this, "_favorites_pressed"); -	button_favorite->set_tooltip(TTR("Toggle folder status as Favorite")); +	button_favorite->set_tooltip(TTR("Toggle folder status as Favorite."));  	button_favorite->set_focus_mode(FOCUS_NONE);  	toolbar_hbc->add_child(button_favorite); @@ -1916,11 +1916,13 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {  	file_list_vb->add_child(path_hb);  	button_tree = memnew(ToolButton); +	button_tree->set_tooltip(TTR("Enter tree-view."));  	button_tree->hide();  	path_hb->add_child(button_tree);  	search_box = memnew(LineEdit);  	search_box->set_h_size_flags(SIZE_EXPAND_FILL); +	search_box->set_placeholder(TTR("Search files"));  	search_box->connect("text_changed", this, "_search_changed");  	path_hb->add_child(search_box); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 74ea46838b..ddf619866d 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -428,6 +428,7 @@ FindInFilesDialog::FindInFilesDialog() {  void FindInFilesDialog::set_search_text(String text) {  	_search_text_line_edit->set_text(text); +	_on_search_text_modified(text);  }  String FindInFilesDialog::get_search_text() const { diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 1d7545f182..2fb3bf7b1e 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -339,7 +339,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {  	NodeMap nm;  	nm.node = node;  	node_map[p_node->id] = nm; -	node_name_map[p_node->name] = p_node->id; +	node_name_map[node->get_name()] = p_node->id;  	Transform xf = p_node->default_transform;  	xf = collada.fix_transform(xf) * p_node->post_transform; diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 128196be5a..f91802b352 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -407,6 +407,7 @@ ImportDock::ImportDock() {  	set_name("Import");  	imported = memnew(Label);  	imported->add_style_override("normal", EditorNode::get_singleton()->get_gui_base()->get_stylebox("normal", "LineEdit")); +	imported->set_clip_text(true);  	add_child(imported);  	HBoxContainer *hb = memnew(HBoxContainer);  	add_margin_child(TTR("Import As:"), hb); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index d21c84eb61..d595d4dd98 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -705,7 +705,18 @@ void EditorAssetLibrary::_image_update(bool use_cache, bool final, const PoolByt  		int len = image_data.size();  		PoolByteArray::Read r = image_data.read(); -		Ref<Image> image = Ref<Image>(memnew(Image(r.ptr(), len))); +		Ref<Image> image = Ref<Image>(memnew(Image)); + +		uint8_t png_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; +		uint8_t jpg_signature[3] = { 255, 216, 255 }; + +		if (r.ptr()) { +			if (memcmp(&r[0], &png_signature[0], 8) == 0) { +				image->copy_internals_from(Image::_png_mem_loader_func(r.ptr(), len)); +			} else if (memcmp(&r[0], &jpg_signature[0], 3) == 0) { +				image->copy_internals_from(Image::_jpg_mem_loader_func(r.ptr(), len)); +			} +		}  		if (!image->empty()) {  			switch (image_queue[p_queue_id].image_type) { @@ -750,7 +761,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons  	ERR_FAIL_COND(!image_queue.has(p_queue_id)); -	if (p_status == HTTPRequest::RESULT_SUCCESS) { +	if (p_status == HTTPRequest::RESULT_SUCCESS && p_code < HTTPClient::RESPONSE_BAD_REQUEST) {  		if (p_code != HTTPClient::RESPONSE_NOT_MODIFIED) {  			for (int i = 0; i < headers.size(); i++) { @@ -781,7 +792,7 @@ void EditorAssetLibrary::_image_request_completed(int p_status, int p_code, cons  		_image_update(p_code == HTTPClient::RESPONSE_NOT_MODIFIED, true, p_data, p_queue_id);  	} else { -		WARN_PRINTS("Error getting PNG file from URL: " + image_queue[p_queue_id].image_url); +		// WARN_PRINTS("Error getting image file from URL: " + image_queue[p_queue_id].image_url);  		Object *obj = ObjectDB::get_instance(image_queue[p_queue_id].target);  		if (obj) {  			obj->call("set_image", image_queue[p_queue_id].image_type, image_queue[p_queue_id].image_index, get_icon("DefaultProjectIcon", "EditorIcons")); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 422d19c0e4..94dcbd8e18 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1404,6 +1404,7 @@ void ScriptEditor::_update_members_overview_visibility() {  	ScriptEditorBase *se = _get_current_editor();  	if (!se) { +		members_overview_buttons_hbox->set_visible(false);  		members_overview->set_visible(false);  		return;  	} @@ -2681,7 +2682,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {  	members_overview_vbox->add_child(members_overview_buttons_hbox);  	members_overview_alphabeta_sort_button = memnew(ToolButton); -	members_overview_alphabeta_sort_button->set_tooltip(TTR("Sort alphabetically")); +	members_overview_alphabeta_sort_button->set_tooltip(TTR("Toggle alphabetical sorting of the method list."));  	members_overview_alphabeta_sort_button->set_toggle_mode(true);  	members_overview_alphabeta_sort_button->set_pressed(EditorSettings::get_singleton()->get("text_editor/tools/sort_members_outline_alphabetically"));  	members_overview_alphabeta_sort_button->connect("toggled", this, "_toggle_members_overview_alpha_sort"); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 72b3af5a09..b6468111a5 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -133,14 +133,12 @@ void TileMapEditor::_menu_option(int p_option) {  				return;  			undo_redo->create_action(TTR("Erase Selection")); -			undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));  			for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {  				for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {  					_set_cell(Point2i(j, i), TileMap::INVALID_CELL, false, false, false);  				}  			} -			undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));  			undo_redo->commit_action();  			selection_active = false; @@ -200,6 +198,15 @@ void TileMapEditor::set_selected_tile(int p_tile) {  	}  } +void TileMapEditor::_create_set_cell_undo(const Point2i &p_pos, int p_value, bool p_flip_h, bool p_flip_v, bool p_transpose) { +	int prev_id = node->get_cell(p_pos.x, p_pos.y); +	bool prev_flip_h = node->is_cell_x_flipped(p_pos.x, p_pos.y); +	bool prev_flip_v = node->is_cell_y_flipped(p_pos.x, p_pos.y); +	bool prev_transpose = node->is_cell_transposed(p_pos.x, p_pos.y); +	undo_redo->add_undo_method(node, "set_cellv", Vector2(p_pos.x, p_pos.y), prev_id, prev_flip_h, prev_flip_v, prev_transpose); +	undo_redo->add_do_method(node, "set_cellv", Vector2(p_pos.x, p_pos.y), p_value, p_flip_h, p_flip_v, p_transpose); +} +  void TileMapEditor::_set_cell(const Point2i &p_pos, int p_value, bool p_flip_h, bool p_flip_v, bool p_transpose) {  	ERR_FAIL_COND(!node); @@ -213,6 +220,7 @@ void TileMapEditor::_set_cell(const Point2i &p_pos, int p_value, bool p_flip_h,  	if (p_value == prev_val && p_flip_h == prev_flip_h && p_flip_v == prev_flip_v && p_transpose == prev_transpose)  		return; //check that it's actually different +	_create_set_cell_undo(p_pos, p_value, p_flip_h, p_flip_v, p_transpose);  	node->set_cell(p_pos.x, p_pos.y, p_value, p_flip_h, p_flip_v, p_transpose);  	node->update_bitmask_area(Point2(p_pos));  } @@ -761,7 +769,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {  						tool = TOOL_PAINTING;  						undo_redo->create_action(TTR("Paint TileMap")); -						undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));  					}  				} else if (tool == TOOL_PICKING) { @@ -785,7 +792,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {  						if (id != TileMap::INVALID_CELL) {  							_set_cell(over_tile, id, flip_h, flip_v, transpose); -							undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));  							undo_redo->commit_action();  							paint_undo.clear(); @@ -797,12 +803,10 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {  						if (id != TileMap::INVALID_CELL) {  							undo_redo->create_action(TTR("Line Draw")); -							undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));  							for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {  								_set_cell(E->key(), id, flip_h, flip_v, transpose);  							} -							undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));  							undo_redo->commit_action();  							paint_undo.clear(); @@ -816,14 +820,12 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {  						if (id != TileMap::INVALID_CELL) {  							undo_redo->create_action(TTR("Rectangle Paint")); -							undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));  							for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {  								for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {  									_set_cell(Point2i(j, i), id, flip_h, flip_v, transpose);  								}  							} -							undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));  							undo_redo->commit_action();  							canvas_item_editor->update(); @@ -833,12 +835,10 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {  						Point2 ofs = over_tile - rectangle.position;  						undo_redo->create_action(TTR("Duplicate")); -						undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));  						for (List<TileData>::Element *E = copydata.front(); E; E = E->next()) {  							_set_cell(E->get().pos + ofs, E->get().cell, E->get().flip_h, E->get().flip_v, E->get().transpose);  						} -						undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));  						undo_redo->commit_action();  						copydata.clear(); @@ -849,7 +849,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {  						Point2 ofs = over_tile - rectangle.position;  						undo_redo->create_action(TTR("Move")); -						undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));  						for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {  							for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) { @@ -860,7 +859,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {  							_set_cell(E->get().pos + ofs, E->get().cell, E->get().flip_h, E->get().flip_v, E->get().transpose);  						} -						undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));  						undo_redo->commit_action();  						copydata.clear(); @@ -880,7 +878,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {  							return false;  						undo_redo->create_action(TTR("Bucket Fill")); -						undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));  						Dictionary op;  						op["id"] = get_selected_tile(); @@ -890,7 +887,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {  						_fill_points(points, op); -						undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));  						undo_redo->commit_action();  						// We want to keep the bucket-tool active @@ -943,7 +939,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {  					Point2 local = node->world_to_map(xform_inv.xform(mb->get_position()));  					undo_redo->create_action(TTR("Erase TileMap")); -					undo_redo->add_undo_method(node, "set", "tile_data", node->get("tile_data"));  					if (mb->get_shift()) {  #ifdef APPLE_STYLE_KEYS @@ -970,7 +965,6 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {  			} else {  				if (tool == TOOL_ERASING || tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) { -					undo_redo->add_do_method(node, "set", "tile_data", node->get("tile_data"));  					undo_redo->commit_action();  					if (tool == TOOL_RECTANGLE_ERASE || tool == TOOL_LINE_ERASE) { diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index 642870aec0..b344395489 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -174,6 +174,7 @@ class TileMapEditor : public VBoxContainer {  	void _update_palette();  	void _menu_option(int p_option); +	void _create_set_cell_undo(const Point2i &p_pos, int p_value, bool p_flip_h, bool p_flip_v, bool p_transpose);  	void _set_cell(const Point2i &p_pos, int p_value, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false);  	void _canvas_mouse_enter(); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 97d3a070ab..0d06b71420 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -199,6 +199,7 @@ private:  					sp = TTR("Imported Project");  				project_name->set_text(sp); +				_text_changed(sp);  			}  		} @@ -222,6 +223,7 @@ private:  		}  		String sp = p.simplify_path();  		project_path->set_text(sp); +		_path_text_changed(sp);  		get_ok()->call_deferred("grab_focus");  	} @@ -230,6 +232,7 @@ private:  		String p = p_path;  		String sp = p.simplify_path();  		project_path->set_text(sp); +		_path_text_changed(sp);  		get_ok()->call_deferred("grab_focus");  	} @@ -263,7 +266,9 @@ private:  				if (d->make_dir(project_name->get_text()) == OK) {  					d->change_dir(project_name->get_text()); -					project_path->set_text(d->get_current_dir()); +					String dir_str = d->get_current_dir(); +					project_path->set_text(dir_str); +					_path_text_changed(dir_str);  					created_folder_path = d->get_current_dir();  					create_dir->set_disabled(true);  				} else { @@ -475,7 +480,9 @@ private:  		_remove_created_folder();  		project_path->clear(); +		_path_text_changed("");  		project_name->clear(); +		_text_changed("");  		if (status_rect->get_texture() == get_icon("StatusError", "EditorIcons"))  			msg->show(); @@ -540,7 +547,9 @@ public:  				msg->show();  				get_ok()->set_disabled(true);  			} else if (current->has_setting("application/config/name")) { -				project_name->set_text(current->get("application/config/name")); +				String proj = current->get("application/config/name"); +				project_name->set_text(proj); +				_text_changed(proj);  			}  			project_name->call_deferred("grab_focus"); @@ -559,7 +568,9 @@ public:  				fdialog->set_current_dir(d->get_current_dir());  				memdelete(d);  			} -			project_name->set_text(TTR("New Game Project")); +			String proj = TTR("New Game Project"); +			project_name->set_text(proj); +			_text_changed(proj);  			project_path->set_editable(true);  			browse->set_disabled(false); diff --git a/main/main.cpp b/main/main.cpp index c287bc81cb..70713e2dd8 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1444,7 +1444,7 @@ bool Main::start() {  		}  #endif -		if (!project_manager) { // game or editor +		if (!project_manager && !editor) { // game  			if (game_path != "" || script != "") {  				//autoload  				List<PropertyInfo> props; @@ -1465,24 +1465,13 @@ bool Main::start() {  					if (global_var) {  						for (int i = 0; i < ScriptServer::get_language_count(); i++) { -#ifdef TOOLS_ENABLED -							if (editor) { -								ScriptServer::get_language(i)->add_named_global_constant(name, Variant()); -							} else { -								ScriptServer::get_language(i)->add_global_constant(name, Variant()); -							} -#else  							ScriptServer::get_language(i)->add_global_constant(name, Variant()); -#endif  						}  					}  				}  				//second pass, load into global constants  				List<Node *> to_add; -#ifdef TOOLS_ENABLED -				ResourceLoader::set_timestamp_on_load(editor); // Avoid problems when editing -#endif  				for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {  					String s = E->get().name; @@ -1528,23 +1517,11 @@ bool Main::start() {  					if (global_var) {  						for (int i = 0; i < ScriptServer::get_language_count(); i++) { -#ifdef TOOLS_ENABLED -							if (editor) { -								ScriptServer::get_language(i)->add_named_global_constant(name, n); -							} else { -								ScriptServer::get_language(i)->add_global_constant(name, n); -							} -#else  							ScriptServer::get_language(i)->add_global_constant(name, n); -#endif  						}  					}  				} -#ifdef TOOLS_ENABLED -				ResourceLoader::set_timestamp_on_load(false); -#endif -  				for (List<Node *>::Element *E = to_add.front(); E; E = E->next()) {  					sml->get_root()->add_child(E->get()); diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 9947512444..5c834966c5 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -738,6 +738,9 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::  				case GDScriptParser::OperatorNode::OP_NEG: {  					if (!_create_unary_operator(codegen, on, Variant::OP_NEGATE, p_stack_level)) return -1;  				} break; +				case GDScriptParser::OperatorNode::OP_POS: { +					if (!_create_unary_operator(codegen, on, Variant::OP_POSITIVE, p_stack_level)) return -1; +				} break;  				case GDScriptParser::OperatorNode::OP_NOT: {  					if (!_create_unary_operator(codegen, on, Variant::OP_NOT, p_stack_level)) return -1;  				} break; diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 30ef167466..4286412c14 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -416,7 +416,7 @@ String GDScriptLanguage::make_function(const String &p_class, const String &p_na  			s += p_args[i].get_slice(":", 0);  		}  	} -	s += "):\n" + _get_indentation() + "pass # replace with function body\n"; +	s += "):\n" + _get_indentation() + "pass # Replace with function body.\n";  	return s;  } diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 161e62c81f..24292b77ed 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -446,7 +446,7 @@ String CSharpLanguage::make_function(const String &p_class, const String &p_name  		s += variant_type_to_managed_name(arg.get_slice(":", 1)) + " " + escape_csharp_keyword(arg.get_slice(":", 0));  	} -	s += ")\n{\n    // Replace with function body\n}\n"; +	s += ")\n{\n    // Replace with function body.\n}\n";  	return s;  #else @@ -1954,11 +1954,6 @@ Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Variant::Call  ScriptInstance *CSharpScript::instance_create(Object *p_this) { -	if (!script_class) { -		ERR_EXPLAIN("Cannot find class " + name + " for script " + get_path()); -		ERR_FAIL_V(NULL); -	} -  	ERR_FAIL_COND_V(!valid, NULL);  	if (!tool && !ScriptServer::is_scripting_enabled()) { @@ -1972,6 +1967,18 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) {  		return NULL;  #endif  	} +	 +	if (!script_class) { +		if (GDMono::get_singleton()->get_project_assembly() == NULL) { +			// The project assembly is not loaded +			ERR_EXPLAIN("Cannot instance script because the project assembly is not loaded. Script: " + get_path()); +			ERR_FAIL_V(NULL); +		} +		 +			// The project assembly is loaded, but the class could not found +		ERR_EXPLAIN("Cannot instance script because the class '" + name + "' could not be found. Script: " + get_path()); +		ERR_FAIL_V(NULL); +	}  	update_signals(); diff --git a/modules/mono/glue/cs_files/StringExtensions.cs b/modules/mono/glue/cs_files/StringExtensions.cs index 21090fb68d..eaeed7b37b 100644 --- a/modules/mono/glue/cs_files/StringExtensions.cs +++ b/modules/mono/glue/cs_files/StringExtensions.cs @@ -225,7 +225,7 @@ namespace Godot              if (pos < 0)                  return instance; -            return instance.Substring(pos + 1, instance.Length); +            return instance.Substring(pos + 1);          }          // <summary> diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index 54d4755bd7..68a2d72464 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -56,8 +56,6 @@ extern "C" EMSCRIPTEN_KEEPALIVE void main_after_fs_sync(char *p_idbfs_err) {  int main(int argc, char *argv[]) { -	printf("let it go dude!\n"); -  	// sync from persistent state into memory and then  	// run the 'main_after_fs_sync' function  	/* clang-format off */ diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index c1022a1aca..2b2d21553b 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -109,6 +109,7 @@ public:  	bool minimized;  	bool maximized;  	bool zoomed; +	bool resizable;  	Size2 window_size;  	Rect2 restore_rect; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index bde0b4e898..5589f93a5d 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -913,7 +913,7 @@ static int remapKey(unsigned int key) {  	CFDataRef layoutData = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData);  	if (!layoutData) -		return nil; +		return 0;  	const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout *)CFDataGetBytePtr(layoutData); @@ -1184,6 +1184,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a  	if (p_desired.borderless_window) {  		styleMask = NSWindowStyleMaskBorderless;  	} else { +		resizable = p_desired.resizable;  		styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | (p_desired.resizable ? NSWindowStyleMaskResizable : 0);  	} @@ -1480,7 +1481,7 @@ void OS_OSX::set_cursor_shape(CursorShape p_shape) {  	if (cursor_shape == p_shape)  		return; -	if (mouse_mode != MOUSE_MODE_VISIBLE) { +	if (mouse_mode != MOUSE_MODE_VISIBLE && mouse_mode != MOUSE_MODE_CONFINED) {  		cursor_shape = p_shape;  		return;  	} @@ -1740,7 +1741,8 @@ String OS_OSX::get_godot_dir_name() const {  String OS_OSX::get_system_dir(SystemDir p_dir) const { -	NSSearchPathDirectory id = 0; +	NSSearchPathDirectory id; +	bool found = true;  	switch (p_dir) {  		case SYSTEM_DIR_DESKTOP: { @@ -1761,10 +1763,13 @@ String OS_OSX::get_system_dir(SystemDir p_dir) const {  		case SYSTEM_DIR_PICTURES: {  			id = NSPicturesDirectory;  		} break; +		default: { +			found = false; +		}  	}  	String ret; -	if (id) { +	if (found) {  		NSArray *paths = NSSearchPathForDirectoriesInDomains(id, NSUserDomainMask, YES);  		if (paths && [paths count] >= 1) { @@ -2110,6 +2115,8 @@ void OS_OSX::set_window_resizable(bool p_enabled) {  		[window_object setStyleMask:[window_object styleMask] | NSWindowStyleMaskResizable];  	else  		[window_object setStyleMask:[window_object styleMask] & ~NSWindowStyleMaskResizable]; + +	resizable = p_enabled;  };  bool OS_OSX::is_window_resizable() const { @@ -2219,7 +2226,7 @@ void OS_OSX::set_borderless_window(bool p_borderless) {  		if (layered_window)  			set_window_per_pixel_transparency_enabled(false); -		[window_object setStyleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable]; +		[window_object setStyleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | (resizable ? NSWindowStyleMaskResizable : 0)];  		// Force update of the window styles  		NSRect frameRect = [window_object frame]; @@ -2615,6 +2622,7 @@ OS_OSX::OS_OSX() {  	minimized = false;  	window_size = Vector2(1024, 600);  	zoomed = false; +	resizable = false;  	Vector<Logger *> loggers;  	loggers.push_back(memnew(OSXTerminalLogger)); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index d6cdea7b88..8d664b5832 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -623,9 +623,12 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)  		case WM_SIZE: {  			int window_w = LOWORD(lParam);  			int window_h = HIWORD(lParam); -			if (window_w > 0 && window_h > 0) { +			if (window_w > 0 && window_h > 0 && !preserve_window_size) {  				video_mode.width = window_w;  				video_mode.height = window_h; +			} else { +				preserve_window_size = false; +				set_window_size(Size2(video_mode.width, video_mode.height));  			}  			if (wParam == SIZE_MAXIMIZED) {  				maximized = true; @@ -777,7 +780,9 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)  						SetCursor(NULL);  				} else {  					if (hCursor != NULL) { -						SetCursor(hCursor); +						CursorShape c = cursor_shape; +						cursor_shape = CURSOR_MAX; +						set_cursor_shape(c);  						hCursor = NULL;  					}  				} @@ -1561,6 +1566,15 @@ void OS_Windows::set_window_size(const Size2 p_size) {  	}  	MoveWindow(hWnd, rect.left, rect.top, w, h, TRUE); + +	// Don't let the mouse leave the window when resizing to a smaller resolution +	if (mouse_mode == MOUSE_MODE_CONFINED) { +		RECT rect; +		GetClientRect(hWnd, &rect); +		ClientToScreen(hWnd, (POINT *)&rect.left); +		ClientToScreen(hWnd, (POINT *)&rect.right); +		ClipCursor(&rect); +	}  }  void OS_Windows::set_window_fullscreen(bool p_enabled) { @@ -1767,6 +1781,7 @@ void OS_Windows::set_borderless_window(bool p_borderless) {  	video_mode.borderless_window = p_borderless; +	preserve_window_size = true;  	_update_window_style();  } @@ -1785,7 +1800,7 @@ void OS_Windows::_update_window_style(bool repaint) {  		}  	} -	SetWindowPos(hWnd, video_mode.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); +	SetWindowPos(hWnd, video_mode.always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);  	if (repaint) {  		RECT rect; @@ -1996,7 +2011,7 @@ void OS_Windows::set_cursor_shape(CursorShape p_shape) {  	if (cursor_shape == p_shape)  		return; -	if (mouse_mode != MOUSE_MODE_VISIBLE) { +	if (mouse_mode != MOUSE_MODE_VISIBLE && mouse_mode != MOUSE_MODE_CONFINED) {  		cursor_shape = p_shape;  		return;  	} diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 221109318e..81849497ee 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -105,6 +105,7 @@ class OS_Windows : public OS {  	Size2 window_rect;  	VideoMode video_mode; +	bool preserve_window_size = false;  	MainLoop *main_loop; diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index eec371865e..7b514d0f90 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1292,6 +1292,9 @@ void OS_X11::set_borderless_window(bool p_borderless) {  	hints.decorations = current_videomode.borderless_window ? 0 : 1;  	property = XInternAtom(x11_display, "_MOTIF_WM_HINTS", True);  	XChangeProperty(x11_display, x11_window, property, property, 32, PropModeReplace, (unsigned char *)&hints, 5); + +	// Preserve window size +	set_window_size(Size2(current_videomode.width, current_videomode.height));  }  bool OS_X11::get_borderless_window() { @@ -2407,7 +2410,7 @@ void OS_X11::set_cursor_shape(CursorShape p_shape) {  	if (p_shape == current_cursor)  		return; -	if (mouse_mode == MOUSE_MODE_VISIBLE) { +	if (mouse_mode == MOUSE_MODE_VISIBLE && mouse_mode != MOUSE_MODE_CONFINED) {  		if (cursors[p_shape] != None)  			XDefineCursor(x11_display, x11_window, cursors[p_shape]);  		else if (cursors[CURSOR_ARROW] != None) diff --git a/thirdparty/README.md b/thirdparty/README.md index 09b016ad4d..f75cdf16d0 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -191,7 +191,7 @@ Files extracted from upstream source:  ## libvorbis  - Upstream: https://www.xiph.org/vorbis -- Version: 1.3.5 +- Version: 1.3.6  - License: BSD-3-Clause  Files extracted from upstream source: diff --git a/thirdparty/libvorbis/COPYING b/thirdparty/libvorbis/COPYING index 8f1d18cc2b..153b926a15 100644 --- a/thirdparty/libvorbis/COPYING +++ b/thirdparty/libvorbis/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2002-2015 Xiph.org Foundation +Copyright (c) 2002-2018 Xiph.org Foundation  Redistribution and use in source and binary forms, with or without  modification, are permitted provided that the following conditions diff --git a/thirdparty/libvorbis/analysis.c b/thirdparty/libvorbis/analysis.c index 01aa6f30db..0e11a167be 100644 --- a/thirdparty/libvorbis/analysis.c +++ b/thirdparty/libvorbis/analysis.c @@ -11,7 +11,6 @@   ********************************************************************   function: single-block PCM analysis mode dispatch - last mod: $Id: analysis.c 16226 2009-07-08 06:43:49Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/backends.h b/thirdparty/libvorbis/backends.h index ff5bcc95fe..22809d46d5 100644 --- a/thirdparty/libvorbis/backends.h +++ b/thirdparty/libvorbis/backends.h @@ -12,7 +12,6 @@   function: libvorbis backend and mapping structures; needed for             static mode headers - last mod: $Id: backends.h 16962 2010-03-11 07:30:34Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/barkmel.c b/thirdparty/libvorbis/barkmel.c index 37b6c4c7ba..4b19935f30 100644 --- a/thirdparty/libvorbis/barkmel.c +++ b/thirdparty/libvorbis/barkmel.c @@ -11,7 +11,6 @@   ********************************************************************   function: bark scale utility - last mod: $Id: barkmel.c 19454 2015-03-02 22:39:28Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/bitrate.c b/thirdparty/libvorbis/bitrate.c index 3a71b1dc23..96055140f7 100644 --- a/thirdparty/libvorbis/bitrate.c +++ b/thirdparty/libvorbis/bitrate.c @@ -11,7 +11,6 @@   ********************************************************************   function: bitrate tracking and management - last mod: $Id: bitrate.c 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/bitrate.h b/thirdparty/libvorbis/bitrate.h index db48fcb645..655a68cc09 100644 --- a/thirdparty/libvorbis/bitrate.h +++ b/thirdparty/libvorbis/bitrate.h @@ -11,7 +11,6 @@   ********************************************************************   function: bitrate tracking and management - last mod: $Id: bitrate.h 13293 2007-07-24 00:09:47Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/block.c b/thirdparty/libvorbis/block.c index 345c042769..db245b3e69 100644 --- a/thirdparty/libvorbis/block.c +++ b/thirdparty/libvorbis/block.c @@ -11,7 +11,6 @@   ********************************************************************   function: PCM data vector blocking, windowing and dis/reassembly - last mod: $Id: block.c 19457 2015-03-03 00:15:29Z giles $   Handle windowing, overlap-add, etc of the PCM vectors.  This is made   more amusing by Vorbis' current two allowed block sizes. diff --git a/thirdparty/libvorbis/books/coupled/res_books_51.h b/thirdparty/libvorbis/books/coupled/res_books_51.h index 93910ff481..47df4b221b 100644 --- a/thirdparty/libvorbis/books/coupled/res_books_51.h +++ b/thirdparty/libvorbis/books/coupled/res_books_51.h @@ -11,7 +11,6 @@   ********************************************************************   *   * function: static codebooks for 5.1 surround - * last modified: $Id: res_books_51.h 19057 2014-01-22 12:32:31Z xiphmont $   *   ********************************************************************/ diff --git a/thirdparty/libvorbis/books/coupled/res_books_stereo.h b/thirdparty/libvorbis/books/coupled/res_books_stereo.h index 9a9049f6ed..61d934046d 100644 --- a/thirdparty/libvorbis/books/coupled/res_books_stereo.h +++ b/thirdparty/libvorbis/books/coupled/res_books_stereo.h @@ -11,7 +11,6 @@   ********************************************************************   function: static codebooks autogenerated by huff/huffbuld - last modified: $Id: res_books_stereo.h 19057 2014-01-22 12:32:31Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/books/floor/floor_books.h b/thirdparty/libvorbis/books/floor/floor_books.h index e925313f7b..67d5f31a3b 100644 --- a/thirdparty/libvorbis/books/floor/floor_books.h +++ b/thirdparty/libvorbis/books/floor/floor_books.h @@ -11,7 +11,6 @@   ********************************************************************   function: static codebooks autogenerated by huff/huffbuld - last modified: $Id: floor_books.h 19057 2014-01-22 12:32:31Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h b/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h index 736353b675..3d658ec470 100644 --- a/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h +++ b/thirdparty/libvorbis/books/uncoupled/res_books_uncoupled.h @@ -11,7 +11,6 @@   ********************************************************************   function: static codebooks autogenerated by huff/huffbuld - last modified: $Id: res_books_uncoupled.h 19057 2014-01-22 12:32:31Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/codebook.c b/thirdparty/libvorbis/codebook.c index 72f8a17a35..78672e222d 100644 --- a/thirdparty/libvorbis/codebook.c +++ b/thirdparty/libvorbis/codebook.c @@ -11,7 +11,6 @@   ********************************************************************   function: basic codebook pack/unpack/code/decode operations - last mod: $Id: codebook.c 19457 2015-03-03 00:15:29Z giles $   ********************************************************************/ @@ -387,7 +386,7 @@ long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){        t[i] = book->valuelist+entry[i]*book->dim;      }      for(i=0,o=0;i<book->dim;i++,o+=step) -      for (j=0;j<step;j++) +      for (j=0;o+j<n && j<step;j++)          a[o+j]+=t[j][i];    }    return(0); @@ -399,41 +398,12 @@ long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){      int i,j,entry;      float *t; -    if(book->dim>8){ -      for(i=0;i<n;){ -        entry = decode_packed_entry_number(book,b); -        if(entry==-1)return(-1); -        t     = book->valuelist+entry*book->dim; -        for (j=0;j<book->dim;) -          a[i++]+=t[j++]; -      } -    }else{ -      for(i=0;i<n;){ -        entry = decode_packed_entry_number(book,b); -        if(entry==-1)return(-1); -        t     = book->valuelist+entry*book->dim; -        j=0; -        switch((int)book->dim){ -        case 8: -          a[i++]+=t[j++]; -        case 7: -          a[i++]+=t[j++]; -        case 6: -          a[i++]+=t[j++]; -        case 5: -          a[i++]+=t[j++]; -        case 4: -          a[i++]+=t[j++]; -        case 3: -          a[i++]+=t[j++]; -        case 2: -          a[i++]+=t[j++]; -        case 1: -          a[i++]+=t[j++]; -        case 0: -          break; -        } -      } +    for(i=0;i<n;){ +      entry = decode_packed_entry_number(book,b); +      if(entry==-1)return(-1); +      t     = book->valuelist+entry*book->dim; +      for(j=0;i<n && j<book->dim;) +        a[i++]+=t[j++];      }    }    return(0); @@ -471,12 +441,13 @@ long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,    long i,j,entry;    int chptr=0;    if(book->used_entries>0){ -    for(i=offset/ch;i<(offset+n)/ch;){ +    int m=(offset+n)/ch; +    for(i=offset/ch;i<m;){        entry = decode_packed_entry_number(book,b);        if(entry==-1)return(-1);        {          const float *t = book->valuelist+entry*book->dim; -        for (j=0;j<book->dim;j++){ +        for (j=0;i<m && j<book->dim;j++){            a[chptr++][i]+=t[j];            if(chptr==ch){              chptr=0; diff --git a/thirdparty/libvorbis/codebook.h b/thirdparty/libvorbis/codebook.h index 537d6c12d3..08440c6962 100644 --- a/thirdparty/libvorbis/codebook.h +++ b/thirdparty/libvorbis/codebook.h @@ -11,7 +11,6 @@   ********************************************************************   function: basic shared codebook operations - last mod: $Id: codebook.h 19457 2015-03-03 00:15:29Z giles $   ********************************************************************/ diff --git a/thirdparty/libvorbis/codec_internal.h b/thirdparty/libvorbis/codec_internal.h index de1bccaedf..e522be18da 100644 --- a/thirdparty/libvorbis/codec_internal.h +++ b/thirdparty/libvorbis/codec_internal.h @@ -11,7 +11,6 @@   ********************************************************************   function: libvorbis codec headers - last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/envelope.c b/thirdparty/libvorbis/envelope.c index 010c66e2d6..da75237542 100644 --- a/thirdparty/libvorbis/envelope.c +++ b/thirdparty/libvorbis/envelope.c @@ -11,7 +11,6 @@   ********************************************************************   function: PCM data envelope analysis - last mod: $Id: envelope.c 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/envelope.h b/thirdparty/libvorbis/envelope.h index fd15fb32a7..f466efde8a 100644 --- a/thirdparty/libvorbis/envelope.h +++ b/thirdparty/libvorbis/envelope.h @@ -11,7 +11,6 @@   ********************************************************************   function: PCM data envelope analysis and manipulation - last mod: $Id: envelope.h 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/floor0.c b/thirdparty/libvorbis/floor0.c index 213cce4ec8..443c0e5a96 100644 --- a/thirdparty/libvorbis/floor0.c +++ b/thirdparty/libvorbis/floor0.c @@ -11,7 +11,6 @@   ********************************************************************   function: floor backend 0 implementation - last mod: $Id: floor0.c 19457 2015-03-03 00:15:29Z giles $   ********************************************************************/ diff --git a/thirdparty/libvorbis/floor1.c b/thirdparty/libvorbis/floor1.c index d8bd4645c1..673e954c53 100644 --- a/thirdparty/libvorbis/floor1.c +++ b/thirdparty/libvorbis/floor1.c @@ -11,7 +11,6 @@   ********************************************************************   function: floor backend 1 implementation - last mod: $Id: floor1.c 19457 2015-03-03 00:15:29Z giles $   ********************************************************************/ diff --git a/thirdparty/libvorbis/highlevel.h b/thirdparty/libvorbis/highlevel.h index e38f370fd6..337b75bfa4 100644 --- a/thirdparty/libvorbis/highlevel.h +++ b/thirdparty/libvorbis/highlevel.h @@ -11,7 +11,6 @@   ********************************************************************   function: highlevel encoder setup struct separated out for vorbisenc clarity - last mod: $Id: highlevel.h 17195 2010-05-05 21:49:51Z giles $   ********************************************************************/ diff --git a/thirdparty/libvorbis/info.c b/thirdparty/libvorbis/info.c index 8a2a001f99..3fbb7c757a 100644 --- a/thirdparty/libvorbis/info.c +++ b/thirdparty/libvorbis/info.c @@ -11,7 +11,6 @@   ********************************************************************   function: maintain the info structure, info <-> header packets - last mod: $Id: info.c 19441 2015-01-21 01:17:41Z xiphmont $   ********************************************************************/ @@ -31,8 +30,8 @@  #include "misc.h"  #include "os.h" -#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.5" -#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20150105 (⛄⛄⛄⛄)" +#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.6" +#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20180316 (Now 100% fewer shells)"  /* helpers */  static void _v_writestring(oggpack_buffer *o,const char *s, int bytes){ @@ -65,11 +64,13 @@ void vorbis_comment_add(vorbis_comment *vc,const char *comment){  }  void vorbis_comment_add_tag(vorbis_comment *vc, const char *tag, const char *contents){ -  char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */ +  /* Length for key and value +2 for = and \0 */ +  char *comment=_ogg_malloc(strlen(tag)+strlen(contents)+2);    strcpy(comment, tag);    strcat(comment, "=");    strcat(comment, contents);    vorbis_comment_add(vc, comment); +  _ogg_free(comment);  }  /* This is more or less the same as strncasecmp - but that doesn't exist @@ -88,27 +89,30 @@ char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count){    long i;    int found = 0;    int taglen = strlen(tag)+1; /* +1 for the = we append */ -  char *fulltag = alloca(taglen+ 1); +  char *fulltag = _ogg_malloc(taglen+1);    strcpy(fulltag, tag);    strcat(fulltag, "=");    for(i=0;i<vc->comments;i++){      if(!tagcompare(vc->user_comments[i], fulltag, taglen)){ -      if(count == found) +      if(count == found) {          /* We return a pointer to the data, not a copy */ -              return vc->user_comments[i] + taglen; -      else +        _ogg_free(fulltag); +        return vc->user_comments[i] + taglen; +      } else {          found++; +      }      }    } +  _ogg_free(fulltag);    return NULL; /* didn't find anything */  }  int vorbis_comment_query_count(vorbis_comment *vc, const char *tag){    int i,count=0;    int taglen = strlen(tag)+1; /* +1 for the = we append */ -  char *fulltag = alloca(taglen+1); +  char *fulltag = _ogg_malloc(taglen+1);    strcpy(fulltag,tag);    strcat(fulltag, "="); @@ -117,6 +121,7 @@ int vorbis_comment_query_count(vorbis_comment *vc, const char *tag){        count++;    } +  _ogg_free(fulltag);    return count;  } @@ -206,9 +211,9 @@ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){    vi->channels=oggpack_read(opb,8);    vi->rate=oggpack_read(opb,32); -  vi->bitrate_upper=oggpack_read(opb,32); -  vi->bitrate_nominal=oggpack_read(opb,32); -  vi->bitrate_lower=oggpack_read(opb,32); +  vi->bitrate_upper=(ogg_int32_t)oggpack_read(opb,32); +  vi->bitrate_nominal=(ogg_int32_t)oggpack_read(opb,32); +  vi->bitrate_lower=(ogg_int32_t)oggpack_read(opb,32);    ci->blocksizes[0]=1<<oggpack_read(opb,4);    ci->blocksizes[1]=1<<oggpack_read(opb,4); @@ -583,7 +588,8 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,    oggpack_buffer opb;    private_state *b=v->backend_state; -  if(!b||vi->channels<=0){ +  if(!b||vi->channels<=0||vi->channels>256){ +    b = NULL;      ret=OV_EFAULT;      goto err_out;    } @@ -642,7 +648,7 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,    memset(op_code,0,sizeof(*op_code));    if(b){ -    oggpack_writeclear(&opb); +    if(vi->channels>0)oggpack_writeclear(&opb);      if(b->header)_ogg_free(b->header);      if(b->header1)_ogg_free(b->header1);      if(b->header2)_ogg_free(b->header2); diff --git a/thirdparty/libvorbis/lookup.c b/thirdparty/libvorbis/lookup.c index 3321ed3dbc..1cc1f88ee9 100644 --- a/thirdparty/libvorbis/lookup.c +++ b/thirdparty/libvorbis/lookup.c @@ -11,7 +11,6 @@   ********************************************************************    function: lookup based functions -  last mod: $Id: lookup.c 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/lookup.h b/thirdparty/libvorbis/lookup.h index f8b5b82730..4bc0f3a206 100644 --- a/thirdparty/libvorbis/lookup.h +++ b/thirdparty/libvorbis/lookup.h @@ -11,7 +11,6 @@   ********************************************************************    function: lookup based functions -  last mod: $Id: lookup.h 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/lookup_data.h b/thirdparty/libvorbis/lookup_data.h index 2424a1b386..5de3cfdc7e 100644 --- a/thirdparty/libvorbis/lookup_data.h +++ b/thirdparty/libvorbis/lookup_data.h @@ -11,7 +11,6 @@   ********************************************************************    function: lookup data; generated by lookups.pl; edit there -  last mod: $Id: lookup_data.h 16037 2009-05-26 21:10:58Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/lpc.c b/thirdparty/libvorbis/lpc.c index f5199ec235..798f4cf076 100644 --- a/thirdparty/libvorbis/lpc.c +++ b/thirdparty/libvorbis/lpc.c @@ -11,7 +11,6 @@   ********************************************************************    function: LPC low level routines -  last mod: $Id: lpc.c 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/lpc.h b/thirdparty/libvorbis/lpc.h index 39d237601b..9cc79451b6 100644 --- a/thirdparty/libvorbis/lpc.h +++ b/thirdparty/libvorbis/lpc.h @@ -11,7 +11,6 @@   ********************************************************************    function: LPC low level routines -  last mod: $Id: lpc.h 16037 2009-05-26 21:10:58Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/lsp.c b/thirdparty/libvorbis/lsp.c index 6a619f7b0c..8588054515 100644 --- a/thirdparty/libvorbis/lsp.c +++ b/thirdparty/libvorbis/lsp.c @@ -11,7 +11,6 @@   ********************************************************************    function: LSP (also called LSF) conversion routines -  last mod: $Id: lsp.c 19453 2015-03-02 22:35:34Z xiphmont $    The LSP generation code is taken (with minimal modification and a    few bugfixes) from "On the Computation of the LSP Frequencies" by diff --git a/thirdparty/libvorbis/lsp.h b/thirdparty/libvorbis/lsp.h index bacfb0971f..8a8d10e978 100644 --- a/thirdparty/libvorbis/lsp.h +++ b/thirdparty/libvorbis/lsp.h @@ -11,7 +11,6 @@   ********************************************************************    function: LSP (also called LSF) conversion routines -  last mod: $Id: lsp.h 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/mapping0.c b/thirdparty/libvorbis/mapping0.c index 85c7d22d83..ccb4493d4c 100644 --- a/thirdparty/libvorbis/mapping0.c +++ b/thirdparty/libvorbis/mapping0.c @@ -11,7 +11,6 @@   ********************************************************************   function: channel mapping 0 implementation - last mod: $Id: mapping0.c 19441 2015-01-21 01:17:41Z xiphmont $   ********************************************************************/ @@ -93,7 +92,6 @@ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb)    int i,b;    vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info));    codec_setup_info     *ci=vi->codec_setup; -  memset(info,0,sizeof(*info));    if(vi->channels<=0)goto err_out;    b=oggpack_read(opb,1); diff --git a/thirdparty/libvorbis/masking.h b/thirdparty/libvorbis/masking.h index 3576ab7885..955e18c719 100644 --- a/thirdparty/libvorbis/masking.h +++ b/thirdparty/libvorbis/masking.h @@ -11,7 +11,6 @@   ********************************************************************   function: masking curve data for psychoacoustics - last mod: $Id: masking.h 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/mdct.c b/thirdparty/libvorbis/mdct.c index 0816331805..f3f1ed805b 100644 --- a/thirdparty/libvorbis/mdct.c +++ b/thirdparty/libvorbis/mdct.c @@ -12,7 +12,6 @@   function: normalized modified discrete cosine transform             power of two length transform only [64 <= n ] - last mod: $Id: mdct.c 16227 2009-07-08 06:58:46Z xiphmont $   Original algorithm adapted long ago from _The use of multirate filter   banks for coding of high quality digital audio_, by T. Sporer, diff --git a/thirdparty/libvorbis/mdct.h b/thirdparty/libvorbis/mdct.h index 3ed94333c5..3b8c9ba4a2 100644 --- a/thirdparty/libvorbis/mdct.h +++ b/thirdparty/libvorbis/mdct.h @@ -11,7 +11,6 @@   ********************************************************************   function: modified discrete cosine transform prototypes - last mod: $Id: mdct.h 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/misc.h b/thirdparty/libvorbis/misc.h index 73b4519898..13788445a3 100644 --- a/thirdparty/libvorbis/misc.h +++ b/thirdparty/libvorbis/misc.h @@ -11,7 +11,6 @@   ********************************************************************   function: miscellaneous prototypes - last mod: $Id: misc.h 19457 2015-03-03 00:15:29Z giles $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/floor_all.h b/thirdparty/libvorbis/modes/floor_all.h index 4292be326e..20928aac87 100644 --- a/thirdparty/libvorbis/modes/floor_all.h +++ b/thirdparty/libvorbis/modes/floor_all.h @@ -11,7 +11,6 @@   ********************************************************************   function: key floor settings - last mod: $Id: floor_all.h 17050 2010-03-26 01:34:42Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/psych_11.h b/thirdparty/libvorbis/modes/psych_11.h index 844a8ed3cd..cc5eea2402 100644 --- a/thirdparty/libvorbis/modes/psych_11.h +++ b/thirdparty/libvorbis/modes/psych_11.h @@ -11,7 +11,6 @@   ********************************************************************   function: 11kHz settings - last mod: $Id: psych_11.h 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/psych_16.h b/thirdparty/libvorbis/modes/psych_16.h index 1c10b3954e..477cb4d90f 100644 --- a/thirdparty/libvorbis/modes/psych_16.h +++ b/thirdparty/libvorbis/modes/psych_16.h @@ -11,7 +11,6 @@   ********************************************************************   function: 16kHz settings - last mod: $Id: psych_16.h 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/psych_44.h b/thirdparty/libvorbis/modes/psych_44.h index f05c032653..6c9eaa4e5f 100644 --- a/thirdparty/libvorbis/modes/psych_44.h +++ b/thirdparty/libvorbis/modes/psych_44.h @@ -11,7 +11,6 @@   ********************************************************************   function: key psychoacoustic settings for 44.1/48kHz - last mod: $Id: psych_44.h 16962 2010-03-11 07:30:34Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/psych_8.h b/thirdparty/libvorbis/modes/psych_8.h index 0e2dd57371..277db8436c 100644 --- a/thirdparty/libvorbis/modes/psych_8.h +++ b/thirdparty/libvorbis/modes/psych_8.h @@ -11,7 +11,6 @@   ********************************************************************   function: 8kHz psychoacoustic settings - last mod: $Id: psych_8.h 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/residue_16.h b/thirdparty/libvorbis/modes/residue_16.h index dcaca5451e..3e05471cec 100644 --- a/thirdparty/libvorbis/modes/residue_16.h +++ b/thirdparty/libvorbis/modes/residue_16.h @@ -11,7 +11,6 @@   ********************************************************************   function: toplevel residue templates 16/22kHz - last mod: $Id: residue_16.h 16962 2010-03-11 07:30:34Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/residue_44.h b/thirdparty/libvorbis/modes/residue_44.h index 236c18341b..e89bc0e486 100644 --- a/thirdparty/libvorbis/modes/residue_44.h +++ b/thirdparty/libvorbis/modes/residue_44.h @@ -11,7 +11,6 @@   ********************************************************************   function: toplevel residue templates for 32/44.1/48kHz - last mod: $Id: residue_44.h 16962 2010-03-11 07:30:34Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/residue_44p51.h b/thirdparty/libvorbis/modes/residue_44p51.h index a52cc5245e..7f33e250e2 100644 --- a/thirdparty/libvorbis/modes/residue_44p51.h +++ b/thirdparty/libvorbis/modes/residue_44p51.h @@ -11,7 +11,6 @@   ********************************************************************   function: toplevel residue templates for 32/44.1/48kHz uncoupled - last mod: $Id: residue_44p51.h 19013 2013-11-12 04:04:50Z giles $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/residue_44u.h b/thirdparty/libvorbis/modes/residue_44u.h index 92c4a09ce3..e55ac12548 100644 --- a/thirdparty/libvorbis/modes/residue_44u.h +++ b/thirdparty/libvorbis/modes/residue_44u.h @@ -11,7 +11,6 @@   ********************************************************************   function: toplevel residue templates for 32/44.1/48kHz uncoupled - last mod: $Id: residue_44u.h 16962 2010-03-11 07:30:34Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/residue_8.h b/thirdparty/libvorbis/modes/residue_8.h index 94c6d84c44..ae123a276a 100644 --- a/thirdparty/libvorbis/modes/residue_8.h +++ b/thirdparty/libvorbis/modes/residue_8.h @@ -11,7 +11,6 @@   ********************************************************************   function: toplevel residue templates 8/11kHz - last mod: $Id: residue_8.h 16962 2010-03-11 07:30:34Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/setup_11.h b/thirdparty/libvorbis/modes/setup_11.h index 4c2d619ca2..0cbcaafcb2 100644 --- a/thirdparty/libvorbis/modes/setup_11.h +++ b/thirdparty/libvorbis/modes/setup_11.h @@ -11,7 +11,6 @@   ********************************************************************   function: 11kHz settings - last mod: $Id: setup_11.h 16894 2010-02-12 20:32:12Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/setup_16.h b/thirdparty/libvorbis/modes/setup_16.h index 336007f98e..d59ad70d2e 100644 --- a/thirdparty/libvorbis/modes/setup_16.h +++ b/thirdparty/libvorbis/modes/setup_16.h @@ -11,7 +11,6 @@   ********************************************************************   function: 16kHz settings - last mod: $Id: setup_16.h 16894 2010-02-12 20:32:12Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/setup_22.h b/thirdparty/libvorbis/modes/setup_22.h index 4fd5e57111..bc38af9630 100644 --- a/thirdparty/libvorbis/modes/setup_22.h +++ b/thirdparty/libvorbis/modes/setup_22.h @@ -11,7 +11,6 @@   ********************************************************************   function: 22kHz settings - last mod: $Id: setup_22.h 17026 2010-03-25 05:00:27Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/setup_32.h b/thirdparty/libvorbis/modes/setup_32.h index 2275ac9615..f66a0bcd00 100644 --- a/thirdparty/libvorbis/modes/setup_32.h +++ b/thirdparty/libvorbis/modes/setup_32.h @@ -11,7 +11,6 @@   ********************************************************************   function: toplevel settings for 32kHz - last mod: $Id: setup_32.h 16894 2010-02-12 20:32:12Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/setup_44.h b/thirdparty/libvorbis/modes/setup_44.h index 3b88a89ac5..a189b5fb95 100644 --- a/thirdparty/libvorbis/modes/setup_44.h +++ b/thirdparty/libvorbis/modes/setup_44.h @@ -11,7 +11,6 @@   ********************************************************************   function: toplevel settings for 44.1/48kHz - last mod: $Id: setup_44.h 16962 2010-03-11 07:30:34Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/setup_44p51.h b/thirdparty/libvorbis/modes/setup_44p51.h index 67d9979608..3bde7b340c 100644 --- a/thirdparty/libvorbis/modes/setup_44p51.h +++ b/thirdparty/libvorbis/modes/setup_44p51.h @@ -11,7 +11,6 @@   ********************************************************************   function: toplevel settings for 44.1/48kHz 5.1 surround modes - last mod: $Id: setup_44p51.h 19013 2013-11-12 04:04:50Z giles $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/setup_44u.h b/thirdparty/libvorbis/modes/setup_44u.h index 568b5f8959..7ae3af6b2a 100644 --- a/thirdparty/libvorbis/modes/setup_44u.h +++ b/thirdparty/libvorbis/modes/setup_44u.h @@ -11,7 +11,6 @@   ********************************************************************   function: toplevel settings for 44.1/48kHz uncoupled modes - last mod: $Id: setup_44u.h 16962 2010-03-11 07:30:34Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/setup_8.h b/thirdparty/libvorbis/modes/setup_8.h index 14c48374fa..7502556879 100644 --- a/thirdparty/libvorbis/modes/setup_8.h +++ b/thirdparty/libvorbis/modes/setup_8.h @@ -11,7 +11,6 @@   ********************************************************************   function: 8kHz settings - last mod: $Id: setup_8.h 16894 2010-02-12 20:32:12Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/modes/setup_X.h b/thirdparty/libvorbis/modes/setup_X.h index a69f5d40a2..2229a5ef2f 100644 --- a/thirdparty/libvorbis/modes/setup_X.h +++ b/thirdparty/libvorbis/modes/setup_X.h @@ -11,7 +11,6 @@   ********************************************************************   function: catch-all toplevel settings for q modes only - last mod: $Id: setup_X.h 16894 2010-02-12 20:32:12Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/os.h b/thirdparty/libvorbis/os.h index 8bc3e5fe9c..416a401dd1 100644 --- a/thirdparty/libvorbis/os.h +++ b/thirdparty/libvorbis/os.h @@ -13,7 +13,6 @@   ********************************************************************   function: #ifdef jail to whip a few platforms into the UNIX ideal. - last mod: $Id: os.h 19457 2015-03-03 00:15:29Z giles $   ********************************************************************/ @@ -31,7 +30,7 @@  #  ifdef __GNUC__  #    define STIN static __inline__ -#  elif _WIN32 +#  elif defined(_WIN32)  #    define STIN static __inline  #  else  #    define STIN static diff --git a/thirdparty/libvorbis/psy.c b/thirdparty/libvorbis/psy.c index f7a44c6d00..422c6f1e41 100644 --- a/thirdparty/libvorbis/psy.c +++ b/thirdparty/libvorbis/psy.c @@ -11,7 +11,6 @@   ********************************************************************   function: psychoacoustics not including preecho - last mod: $Id: psy.c 18077 2011-09-02 02:49:00Z giles $   ********************************************************************/ diff --git a/thirdparty/libvorbis/psy.h b/thirdparty/libvorbis/psy.h index c1ea824401..ab2534db3a 100644 --- a/thirdparty/libvorbis/psy.h +++ b/thirdparty/libvorbis/psy.h @@ -11,7 +11,6 @@   ********************************************************************   function: random psychoacoustics (not including preecho) - last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/psytune.c b/thirdparty/libvorbis/psytune.c index 64c13171f7..6952136c6b 100644 --- a/thirdparty/libvorbis/psytune.c +++ b/thirdparty/libvorbis/psytune.c @@ -12,7 +12,6 @@   function: simple utility that runs audio through the psychoacoustics             without encoding - last mod: $Id: psytune.c 16037 2009-05-26 21:10:58Z xiphmont $   ********************************************************************/ @@ -41,11 +40,11 @@  static vorbis_info_psy_global _psy_set0G={    0,   /* decaydBpms */    8,   /* lines per eighth octave */ -   +    /* thresh sample period, preecho clamp trigger threshhold, range, minenergy */    256, {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f, -  -6.f,  -   +  -6.f, +    0,    0., @@ -68,7 +67,7 @@ static vp_couple _vp_couple0[]={  static vorbis_info_psy _psy_set0={    ATH_Bark_dB_lineaggressive, -   +    -100.f,    -140.f,    6.f, /* floor master att */ @@ -148,7 +147,7 @@ static vorbis_info_psy _psy_set0={     .900f, 0.f, /*11500*/     .900f, 1.f, /*16000*/    }, -  +    95.f,  /* even decade + 5 is important; saves an rint() later in a              tight loop) */    -44., @@ -159,7 +158,7 @@ static vorbis_info_psy _psy_set0={  static vorbis_info_floor1 _floor_set0={1,                                          {0}, -                                         +                                          {32},                                          {0},                                          {0}, @@ -171,12 +170,12 @@ static vorbis_info_floor1 _floor_set0={1,                                           88,31,243,                                           14,54,143,460, -                                          -                                         6,3,10, 22,18,26, 41,36,47,  -                                         69,61,78, 112,99,126, 185,162,211,   + +                                         6,3,10, 22,18,26, 41,36,47, +                                         69,61,78, 112,99,126, 185,162,211,                                           329,282,387, 672,553,825                                           }, -                                         +                                          60,30,400,                                          20,8,1,18.,                                          20,600, @@ -184,8 +183,8 @@ static vorbis_info_floor1 _floor_set0={1,  static vorbis_info_mapping0 mapping_info={1,{0,1},{0},{0},{0},0, 1, {0},{1}}; -static codec_setup_info codec_setup0={ {0,0},  -                                       1,1,1,1,1,0,1,         +static codec_setup_info codec_setup0={ {0,0}, +                                       1,1,1,1,1,0,1,                                         {NULL},                                         {0},{&mapping_info},                                         {0},{NULL}, @@ -194,7 +193,7 @@ static codec_setup_info codec_setup0={ {0,0},                                         {NULL},                                         {&_psy_set0},                                         &_psy_set0G}; -                                        +  static int noisy=0;  void analysis(char *base,int i,float *v,int n,int bark,int dB){    if(noisy){ @@ -212,7 +211,7 @@ void analysis(char *base,int i,float *v,int n,int bark,int dB){            fprintf(of,"%g ",toBARK(22050.f*j/n));          else            fprintf(of,"%g ",(float)j); -       +          if(dB){            fprintf(of,"%g\n",todB(v+j));          }else{ @@ -269,7 +268,7 @@ int main(int argc,char *argv[]){          framesize=atoi(argv[0]);      argv++;    } -   +    vi.channels=2;    vi.codec_setup=&codec_setup0; @@ -292,7 +291,7 @@ int main(int argc,char *argv[]){    /* we cheat on the WAV header; we just bypass 44 bytes and never       verify that it matches 16bit/stereo/44.1kHz. */ -   +    fread(buffer,1,44,stdin);    fwrite(buffer,1,44,stdout);    memset(buffer,0,framesize*2); @@ -302,10 +301,10 @@ int main(int argc,char *argv[]){    fprintf(stderr,"Processing for frame size %d...\n",framesize);    while(!eos){ -    long bytes=fread(buffer2,1,framesize*2,stdin);  +    long bytes=fread(buffer2,1,framesize*2,stdin);      if(bytes<framesize*2)        memset(buffer2+bytes,0,framesize*2-bytes); -     +      if(bytes!=0){        int nonzero[2]; @@ -316,10 +315,10 @@ int main(int argc,char *argv[]){          pcm[1][i]=((buffer[i*4+3]<<8)|                     (0x00ff&(int)buffer[i*4+2]))/32768.f;        } -       +        {          float secs=framesize/44100.; -         +          ampmax+=secs*ampmax_att_per_sec;          if(ampmax<-9999)ampmax=-9999;        } @@ -331,11 +330,11 @@ int main(int argc,char *argv[]){          float *logmdct=mdct+framesize/2;          analysis("pre",frameno+i,pcm[i],framesize,0,0); -         +          /* fft and mdct transforms  */          for(j=0;j<framesize;j++)            fft[j]=pcm[i][j]*=window[j]; -         +          drft_forward(&f_look,fft);          local_ampmax[i]=-9999.f; @@ -347,7 +346,7 @@ int main(int argc,char *argv[]){            if(temp>local_ampmax[i])local_ampmax[i]=temp;          }          if(local_ampmax[i]>ampmax)ampmax=local_ampmax[i]; -         +          mdct_forward(&m_look,pcm[i],mdct);          for(j=0;j<framesize/2;j++)            logmdct[j]=todB(mdct+j); @@ -391,7 +390,7 @@ int main(int argc,char *argv[]){                                            logmdct,                                            mask,                                            logmax, -                                           +                                            flr[i]);          } @@ -406,7 +405,7 @@ int main(int argc,char *argv[]){          for(j=0;j<framesize/2;j++)            if(fabs(pcm[i][j])>1500)              fprintf(stderr,"%ld ",frameno+i); -         +          analysis("res",frameno+i,pcm[i],framesize/2,1,0);          analysis("codedflr",frameno+i,flr[i],framesize/2,1,1);        } @@ -416,7 +415,7 @@ int main(int argc,char *argv[]){                               &vi,                               pcm,                               nonzero); -         +        for(i=0;i<2;i++)          analysis("quant",frameno+i,pcm[i],framesize/2,1,0); @@ -426,7 +425,7 @@ int main(int argc,char *argv[]){                   &mapping_info,                   pcm,                   nonzero); -   +        for(i=0;i<2;i++)          analysis("coupled",frameno+i,pcm[i],framesize/2,1,0); @@ -434,11 +433,11 @@ int main(int argc,char *argv[]){        for(i=mapping_info.coupling_steps-1;i>=0;i--){          float *pcmM=pcm[mapping_info.coupling_mag[i]];          float *pcmA=pcm[mapping_info.coupling_ang[i]]; -         +          for(j=0;j<framesize/2;j++){            float mag=pcmM[j];            float ang=pcmA[j]; -           +            if(mag>0)              if(ang>0){                pcmM[j]=mag; @@ -457,7 +456,7 @@ int main(int argc,char *argv[]){              }          }        } -     +        for(i=0;i<2;i++)          analysis("decoupled",frameno+i,pcm[i],framesize/2,1,0); @@ -479,7 +478,7 @@ int main(int argc,char *argv[]){        } -            +        /* write data.  Use the part of buffer we're about to shift out */        for(i=0;i<2;i++){          char  *ptr=buffer+i*2; @@ -503,7 +502,7 @@ int main(int argc,char *argv[]){            ptr+=4;          }        } -  +        fprintf(stderr,"*");        fwrite(buffer,1,framesize*2,stdout);        memmove(buffer,buffer2,framesize*2); diff --git a/thirdparty/libvorbis/registry.c b/thirdparty/libvorbis/registry.c index 3961ed1403..74f7ef0396 100644 --- a/thirdparty/libvorbis/registry.c +++ b/thirdparty/libvorbis/registry.c @@ -11,7 +11,6 @@   ********************************************************************   function: registry for time, floor, res backends and channel mappings - last mod: $Id: registry.c 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/registry.h b/thirdparty/libvorbis/registry.h index 3ae04776d8..599d959942 100644 --- a/thirdparty/libvorbis/registry.h +++ b/thirdparty/libvorbis/registry.h @@ -11,7 +11,6 @@   ********************************************************************   function: registry for time, floor, res backends and channel mappings - last mod: $Id: registry.h 15531 2008-11-24 23:50:06Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/res0.c b/thirdparty/libvorbis/res0.c index ec11488c2f..6d623d730f 100644 --- a/thirdparty/libvorbis/res0.c +++ b/thirdparty/libvorbis/res0.c @@ -11,7 +11,6 @@   ********************************************************************   function: residue backend 0, 1 and 2 implementation - last mod: $Id: res0.c 19441 2015-01-21 01:17:41Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/scales.h b/thirdparty/libvorbis/scales.h index 613f796e77..18bc4e7518 100644 --- a/thirdparty/libvorbis/scales.h +++ b/thirdparty/libvorbis/scales.h @@ -11,7 +11,6 @@   ********************************************************************   function: linear scale -> dB, Bark and Mel scales - last mod: $Id: scales.h 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/sharedbook.c b/thirdparty/libvorbis/sharedbook.c index 6bfdf7311e..4545d4f459 100644 --- a/thirdparty/libvorbis/sharedbook.c +++ b/thirdparty/libvorbis/sharedbook.c @@ -11,11 +11,11 @@   ********************************************************************   function: basic shared codebook operations - last mod: $Id: sharedbook.c 19457 2015-03-03 00:15:29Z giles $   ********************************************************************/  #include <stdlib.h> +#include <limits.h>  #include <math.h>  #include <string.h>  #include <ogg/ogg.h> @@ -158,25 +158,34 @@ ogg_uint32_t *_make_words(char *l,long n,long sparsecount){     that's portable and totally safe against roundoff, but I haven't     thought of it.  Therefore, we opt on the side of caution */  long _book_maptype1_quantvals(const static_codebook *b){ -  long vals=floor(pow((float)b->entries,1.f/b->dim)); +  long vals; +  if(b->entries<1){ +    return(0); +  } +  vals=floor(pow((float)b->entries,1.f/b->dim));    /* the above *should* be reliable, but we'll not assume that FP is       ever reliable when bitstream sync is at stake; verify via integer       means that vals really is the greatest value of dim for which       vals^b->bim <= b->entries */    /* treat the above as an initial guess */ +  if(vals<1){ +    vals=1; +  }    while(1){      long acc=1;      long acc1=1;      int i;      for(i=0;i<b->dim;i++){ +      if(b->entries/vals<acc)break;        acc*=vals; -      acc1*=vals+1; +      if(LONG_MAX/(vals+1)<acc1)acc1=LONG_MAX; +      else acc1*=vals+1;      } -    if(acc<=b->entries && acc1>b->entries){ +    if(i>=b->dim && acc<=b->entries && acc1>b->entries){        return(vals);      }else{ -      if(acc>b->entries){ +      if(i<b->dim || acc>b->entries){          vals--;        }else{          vals++; diff --git a/thirdparty/libvorbis/smallft.c b/thirdparty/libvorbis/smallft.c index ae2bc41b6b..6d528af423 100644 --- a/thirdparty/libvorbis/smallft.c +++ b/thirdparty/libvorbis/smallft.c @@ -11,7 +11,6 @@   ********************************************************************   function: *unnormalized* fft transform - last mod: $Id: smallft.c 16227 2009-07-08 06:58:46Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/smallft.h b/thirdparty/libvorbis/smallft.h index 456497326c..9e867c67d2 100644 --- a/thirdparty/libvorbis/smallft.h +++ b/thirdparty/libvorbis/smallft.h @@ -11,7 +11,6 @@   ********************************************************************   function: fft transform - last mod: $Id: smallft.h 13293 2007-07-24 00:09:47Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/synthesis.c b/thirdparty/libvorbis/synthesis.c index 932d271a63..5f6092c3d3 100644 --- a/thirdparty/libvorbis/synthesis.c +++ b/thirdparty/libvorbis/synthesis.c @@ -11,7 +11,6 @@   ********************************************************************   function: single-block PCM synthesis - last mod: $Id: synthesis.c 19441 2015-01-21 01:17:41Z xiphmont $   ********************************************************************/ @@ -117,7 +116,7 @@ int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){    if(!ci->mode_param[mode]){      return(OV_EBADPACKET);    } -   +    vb->W=ci->mode_param[mode]->blockflag;    if(vb->W){      vb->lW=oggpack_read(opb,1); diff --git a/thirdparty/libvorbis/tone.c b/thirdparty/libvorbis/tone.c index 73afc67d4c..5b8b020604 100644 --- a/thirdparty/libvorbis/tone.c +++ b/thirdparty/libvorbis/tone.c @@ -12,7 +12,7 @@ int main (int argc,char *argv[]){    int i,j;    double *f;    double *amp; -   +    if(argc<2)usage();    f=alloca(sizeof(*f)*(argc-1)); @@ -21,7 +21,7 @@ int main (int argc,char *argv[]){    i=0;    while(argv[i+1]){      char *pos=strchr(argv[i+1],','); -     +      f[i]=atof(argv[i+1]);      if(pos)        amp[i]=atof(pos+1)*32767.f; diff --git a/thirdparty/libvorbis/vorbis/codec.h b/thirdparty/libvorbis/vorbis/codec.h index 999aa33510..42aa29138e 100644 --- a/thirdparty/libvorbis/vorbis/codec.h +++ b/thirdparty/libvorbis/vorbis/codec.h @@ -11,7 +11,6 @@   ********************************************************************   function: libvorbis codec headers - last mod: $Id: codec.h 17021 2010-03-24 09:29:41Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/vorbis/vorbisenc.h b/thirdparty/libvorbis/vorbis/vorbisenc.h index 02332b50ca..55f3b4a667 100644 --- a/thirdparty/libvorbis/vorbis/vorbisenc.h +++ b/thirdparty/libvorbis/vorbis/vorbisenc.h @@ -11,7 +11,6 @@   ********************************************************************   function: vorbis encode-engine setup - last mod: $Id: vorbisenc.h 17021 2010-03-24 09:29:41Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/vorbis/vorbisfile.h b/thirdparty/libvorbis/vorbis/vorbisfile.h index 9271331e72..56626119bb 100644 --- a/thirdparty/libvorbis/vorbis/vorbisfile.h +++ b/thirdparty/libvorbis/vorbis/vorbisfile.h @@ -11,7 +11,6 @@   ********************************************************************   function: stdio-based convenience library for opening/seeking/decoding - last mod: $Id: vorbisfile.h 17182 2010-04-29 03:48:32Z xiphmont $   ********************************************************************/ diff --git a/thirdparty/libvorbis/vorbisenc.c b/thirdparty/libvorbis/vorbisenc.c index b5d621e900..4a4607cb41 100644 --- a/thirdparty/libvorbis/vorbisenc.c +++ b/thirdparty/libvorbis/vorbisenc.c @@ -11,7 +11,6 @@   ********************************************************************   function: simple programmatic interface for encoder mode setup - last mod: $Id: vorbisenc.c 19457 2015-03-03 00:15:29Z giles $   ********************************************************************/ diff --git a/thirdparty/libvorbis/vorbisfile.c b/thirdparty/libvorbis/vorbisfile.c index fc0c86ff11..b570c3c5f6 100644 --- a/thirdparty/libvorbis/vorbisfile.c +++ b/thirdparty/libvorbis/vorbisfile.c @@ -11,7 +11,6 @@   ********************************************************************   function: stdio-based convenience library for opening/seeking/decoding - last mod: $Id: vorbisfile.c 19457 2015-03-03 00:15:29Z giles $   ********************************************************************/ diff --git a/thirdparty/libvorbis/window.c b/thirdparty/libvorbis/window.c index 0305b79297..b3b7ce0163 100644 --- a/thirdparty/libvorbis/window.c +++ b/thirdparty/libvorbis/window.c @@ -11,7 +11,6 @@   ********************************************************************   function: window functions - last mod: $Id: window.c 19028 2013-12-02 23:23:39Z tterribe $   ********************************************************************/ diff --git a/thirdparty/libvorbis/window.h b/thirdparty/libvorbis/window.h index 51f97599f5..6ac260749e 100644 --- a/thirdparty/libvorbis/window.h +++ b/thirdparty/libvorbis/window.h @@ -11,7 +11,6 @@   ********************************************************************   function: window functions - last mod: $Id: window.h 19028 2013-12-02 23:23:39Z tterribe $   ********************************************************************/  |