Clone in a terminal:
Commit 149786f
Johan Mattsson - 2015-03-23T22:24:45+00:00
149786ffbc165216c377be4c873d530d157b4492johan.mattsson.m@gmail.com

Fix compilers warnings

Changed files (20)

Diff

diff --git a/libbirdfont/BirdFontFile.vala b/libbirdfont/BirdFontFile.valaindex 6080c52..6e0cd13 100644--- a/libbirdfont/BirdFontFile.vala+++ b/libbirdfont/BirdFontFile.vala@@ -1556,12 +1556,16 @@ class BirdFontFile : GLib.Object { 			} 		}); 		-		foreach (ContextualLigature c in ligatures.contextual_ligatures) {-			os.put_string (@"<contextual "-				+ @"ligature=\"$(c.ligatures)\" "-				+ @"backtrack=\"$(c.backtrack)\" "-				+ @"input=\"$(c.input)\" "-				+ @"lookahead=\"$(c.lookahead)\" />\n");+		try {+			foreach (ContextualLigature c in ligatures.contextual_ligatures) {+				os.put_string (@"<contextual "+					+ @"ligature=\"$(c.ligatures)\" "+					+ @"backtrack=\"$(c.backtrack)\" "+					+ @"input=\"$(c.input)\" "+					+ @"lookahead=\"$(c.lookahead)\" />\n");+			}+		} catch (GLib.Error e) {+			warning (e.message); 		} 	} 	diff --git a/libbirdfont/ClickMap.vala b/libbirdfont/ClickMap.valaindex 01e1b3c..9683ef6 100644--- a/libbirdfont/ClickMap.vala+++ b/libbirdfont/ClickMap.vala@@ -40,7 +40,6 @@ public class ClickMap : GLib.Object { 	} 		 	public void create_click_map (Path path) {-		double w, h; 		Context c; 				 		c = new Context (map);diff --git a/libbirdfont/DefaultCharactersSet.vala b/libbirdfont/DefaultCharactersSet.valaindex ef1974b..5769711 100644--- a/libbirdfont/DefaultCharactersSet.vala+++ b/libbirdfont/DefaultCharactersSet.vala@@ -109,17 +109,22 @@ public class DefaultCharacterSet { 		string all_characters; 		 		all_characters = get_characters_for_prefered_language ();-		if (all_characters != "") {-			gr.parse_ranges (all_characters);-		} else {			-			/// All lower case letters in alphabetic order separated by space. Letters with diacritical marks should be included.-			lower_case = t_("a b c d e f g h i j k l m n o p q r s t u v w x y z");-			-			/// All upper case letters in alphabetic order separated by space. Letters with diacritical marks should be included.-			upper_case = t_("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z");+		+		try {+			if (all_characters != "") {+				gr.parse_ranges (all_characters);+			} else {			+				/// All lower case letters in alphabetic order separated by space. Letters with diacritical marks should be included.+				lower_case = t_("a b c d e f g h i j k l m n o p q r s t u v w x y z");+				+				/// All upper case letters in alphabetic order separated by space. Letters with diacritical marks should be included.+				upper_case = t_("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"); -			gr.parse_ranges (lower_case);-			gr.parse_ranges (upper_case);+				gr.parse_ranges (lower_case);+				gr.parse_ranges (upper_case);+			}+		} catch (GLib.Error e) {+			warning (e.message); 		} 		 		gr.add_range ('0', '9');diff --git a/libbirdfont/Expander.vala b/libbirdfont/Expander.valaindex 9f88315..7a02eb4 100644--- a/libbirdfont/Expander.vala+++ b/libbirdfont/Expander.vala@@ -221,8 +221,6 @@ public class Expander : GLib.Object { 	 	public void draw (int wd, int hd, Context cr) { 		double yt = y + scroll + 2;-		double ih2 = 5.4 / 2;-		double iw2 = 5.4 / 2; 		Text title;  		if (tool.size > 0) {diff --git a/libbirdfont/FontSettings.vala b/libbirdfont/FontSettings.valaindex b6a1b75..3f6dd1d 100644--- a/libbirdfont/FontSettings.vala+++ b/libbirdfont/FontSettings.vala@@ -42,7 +42,6 @@ public class FontSettings : GLib.Object { 	 	File get_settings_file () { 		File config_directory = BirdFont.get_settings_directory ();-		File settings = get_child (config_directory, "settings"); 		return get_child (config_directory, font_name.replace (".bf", ".config")); 	} 	@@ -87,14 +86,18 @@ public class FontSettings : GLib.Object { 		string xml_data; 		XmlParser parser; 		-		settings.clear ();-		font_name = font_file_name;-		f = get_settings_file ();-		-		if (f.query_exists ()) {-			FileUtils.get_contents((!) f.get_path (), out xml_data);-			parser = new XmlParser (xml_data);-			parse_settings (parser.get_root_tag ());	+		try {+			settings.clear ();+			font_name = font_file_name;+			f = get_settings_file ();+			+			if (f.query_exists ()) {+				FileUtils.get_contents((!) f.get_path (), out xml_data);+				parser = new XmlParser (xml_data);+				parse_settings (parser.get_root_tag ());	+			}+		} catch (GLib.Error e) {+			warning (e.message); 		} 	} 	diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 594afec..cb9b7d9 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -431,8 +431,6 @@ public class Glyph : FontDisplay { 					 		left_line = new Line ("left", left_limit, true); 		left_line.position_updated.connect ((pos) => {-			double x1, y1, x2, y2;-			 			left_limit = pos; 			update_other_spacing_classes (); 			@@ -442,8 +440,6 @@ public class Glyph : FontDisplay { 		 		right_line = new Line ("right", right_limit, true); 		right_line.position_updated.connect ((pos) => {-			double x1, y1, x2, y2;-			 			right_limit = pos; 			update_other_spacing_classes (); 			diff --git a/libbirdfont/GuideTab.vala b/libbirdfont/GuideTab.valaindex 68b782c..d2fd838 100644--- a/libbirdfont/GuideTab.vala+++ b/libbirdfont/GuideTab.vala@@ -32,7 +32,7 @@ public class GuideTab : Table { 		int index = row.get_index (); 		 		if (delete_button) {-			return_if_fail (0 <= index < BirdFont.get_current_font ().custom_guides.size);+			return_if_fail (0 <= index < font.custom_guides.size); 			BirdFont.get_current_font ().custom_guides.remove_at (index); 			update_rows (); 		}@@ -40,7 +40,6 @@ public class GuideTab : Table { 	 	public override void update_rows () { 		int i = 0;-		SpacingData spacing = BirdFont.get_current_font ().get_spacing (); 		 		rows.clear (); 		diff --git a/libbirdfont/KerningStrings.vala b/libbirdfont/KerningStrings.valaindex 7d9360e..8b1e3d5 100644--- a/libbirdfont/KerningStrings.vala+++ b/libbirdfont/KerningStrings.vala@@ -77,7 +77,6 @@ public class KerningStrings : GLib.Object { 	} 	 	public void load_new_string (Font font, string kerning_strings_file) {-		File f; 		string data; 		string[] strings; 		string w;diff --git a/libbirdfont/Menu.vala b/libbirdfont/Menu.valaindex 6d97297..2a34a16 100644--- a/libbirdfont/Menu.vala+++ b/libbirdfont/Menu.vala@@ -469,7 +469,6 @@ public class Menu : GLib.Object { 		string display; 		FontDisplay current_display = MainWindow.get_current_display (); 		ToolItem tm;-		unichar c = (unichar) keyval;  		foreach (MenuItem item in sorted_menu_items) {		 			if (item.key == (unichar) keyval && item.modifiers == KeyBindings.modifier) {diff --git a/libbirdfont/OpenFontFormat/ContextualLigature.vala b/libbirdfont/OpenFontFormat/ContextualLigature.valaindex 37d2387..b260ef5 100644--- a/libbirdfont/OpenFontFormat/ContextualLigature.vala+++ b/libbirdfont/OpenFontFormat/ContextualLigature.vala@@ -40,7 +40,8 @@ public class ContextualLigature : GLib.Object { 		return ligature_list; 	} 	-	public FontData get_data (GlyfTable glyf_table, uint16 ligature_lookup_index) {+	public FontData get_font_data (GlyfTable glyf_table, uint16 ligature_lookup_index) +		throws GLib.Error { 		FontData fd = new FontData (); 		 		Gee.ArrayList<string> backtrack = GsubTable.get_names (backtrack);diff --git a/libbirdfont/OpenFontFormat/GposTable.vala b/libbirdfont/OpenFontFormat/GposTable.valaindex f9063e6..a952a71 100644--- a/libbirdfont/OpenFontFormat/GposTable.vala+++ b/libbirdfont/OpenFontFormat/GposTable.vala@@ -70,7 +70,7 @@ public class GposTable : OtfTable { 		fd.add_ushort (1); // number of lookups 		fd.add_ushort (4); // offset to lookup 1 		-		fd.add_ushort (2); // lookup type // FIXME	+		fd.add_ushort (2); // lookup type  		fd.add_ushort (0); // lookup flags 		fd.add_ushort (1); // number of subtables 		fd.add_ushort (8); // array of offsets to subtablesdiff --git a/libbirdfont/OpenFontFormat/GsubTable.vala b/libbirdfont/OpenFontFormat/GsubTable.valaindex 4088a8f..cec53dc 100644--- a/libbirdfont/OpenFontFormat/GsubTable.vala+++ b/libbirdfont/OpenFontFormat/GsubTable.vala@@ -86,7 +86,7 @@ public class GsubTable : OtfTable { 			fd.add_ushort (0); // lookup clig_subtable 		} 		-		clig_subtable = clig.get_data (glyf_table);+		clig_subtable = clig.get_font_data (glyf_table); 		chain_data = get_chaining_contextual_substition_subtable (contextual); 		 		// lookup table@@ -144,7 +144,7 @@ public class GsubTable : OtfTable {  				LigatureCollection ligature_set = contextual.ligatures.get (i); 				fd.add_ushort (lookups_end + length); // array of offsets to subtable-				length += (uint16) ligature_set.get_data (glyf_table).length_with_padding ();+				length += (uint16) ligature_set.get_font_data (glyf_table).length_with_padding (); 				 				lookups_end -= 8; 			}@@ -169,7 +169,7 @@ public class GsubTable : OtfTable { 		 		if (contextual.has_ligatures ()) { 			foreach (LigatureCollection s in contextual.ligatures) {-				fd.append (s.get_data (glyf_table));+				fd.append (s.get_font_data (glyf_table)); 			}  			foreach (FontData d in chain_data) {@@ -188,60 +188,13 @@ public class GsubTable : OtfTable { 		uint16 ligature_lookup_index = 1; 		 		foreach (ContextualLigature context in contexts.ligature_context) {-			fd.add (context.get_data (glyf_table, ligature_lookup_index)); +			fd.add (context.get_font_data (glyf_table, ligature_lookup_index));  			ligature_lookup_index++; 		} 		 		return fd; 	} 	-	void parse_ligatures (FontData fd, int table_start) {-		fd.seek (table_start);-		-		uint16 identifier = fd.read_ushort ();-		-		if (identifier != 1) {-			warning (@"Bad identifier expecting 1 found $identifier");-		}-		-		uint16 coverage_offset = fd.read_ushort (); // TODO: read coverage-		uint16 num_sets = fd.read_ushort ();-		-		Gee.ArrayList<int> liga_set_offsets = new Gee.ArrayList<int> ();-		for (int i = 0; i < num_sets; i++) {-			uint16 liga_set_offset = fd.read_ushort ();-			liga_set_offsets.add (table_start + liga_set_offset);-		}-		-		foreach (int liga_set_pos in liga_set_offsets) {-			fd.seek (liga_set_pos);-			parse_ligature_set (fd);-		}		-	}-	-	/** Parse ligature set at the current position. */-	void parse_ligature_set (FontData fd) {-		int liga_start = fd.get_read_pos ();-		uint nliga = fd.read_ushort ();-		Gee.ArrayList<int> offsets = new Gee.ArrayList<int> ();-		-		for (uint i = 0; i < nliga; i++) {-			int off = fd.read_ushort ();-			offsets.add (off);-		}--		foreach (int off in offsets) {-			fd.seek (liga_start);-			fd.seek_relative (off);-			uint16 lig = fd.read_ushort ();-			uint16 nlig_comp = fd.read_ushort ();-			-			for (int i = 1; i < nlig_comp; i++) {-				uint16 lig_comp = fd.read_ushort ();-			} -		}-	}- 	/**  	 * @param glyphs Name of glyphs or unicode values separated by space. 	 * @return glyph namesdiff --git a/libbirdfont/OpenFontFormat/LigatureCollection.vala b/libbirdfont/OpenFontFormat/LigatureCollection.valaindex e7fcd20..ee066c7 100644--- a/libbirdfont/OpenFontFormat/LigatureCollection.vala+++ b/libbirdfont/OpenFontFormat/LigatureCollection.vala@@ -54,7 +54,6 @@ public class LigatureCollection : GLib.Object { 	}  	// multiple ligatures in non-contextual substitution-	// FIXME: what if parts equals "" ? Which set does ligatures becomes a part of? 	public void add_ligatures (GlyfTable glyf_table, string characters, string ligatures)  		requires (!is_null (lig_set) && !is_null (last_set)) { 			@@ -97,7 +96,7 @@ public class LigatureCollection : GLib.Object { 		}		 	} -	public FontData get_data (GlyfTable glyf_table) throws GLib.Error {+	public FontData get_font_data (GlyfTable glyf_table) throws GLib.Error { 		FontData set_data; 		uint16 ligature_pos; 		uint16 table_start;diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex d0fc700..041dc45 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -1400,8 +1400,6 @@ public class PenTool : Tool { 		double y = Glyph.path_coordinate_y (event_y); 		double distance; 		PointSelection e;-		int px, py;-		double coordinate_x, coordinate_y; 		set_active_edit_point (null, new Path ()); 		 		if (ep == null) {diff --git a/libbirdfont/Renderer/Text.vala b/libbirdfont/Renderer/Text.valaindex 5505f54..389753a 100644--- a/libbirdfont/Renderer/Text.vala+++ b/libbirdfont/Renderer/Text.vala@@ -354,8 +354,6 @@ public class Text : Widget { 		if (use_cached_glyphs) { 			iterate ((glyph, kerning, last) => { 				double end;-				int offset_x, offset_y;-				string cache_id; 				 				x += kerning * ratio; 				end = x + glyph.get_width () * ratio;diff --git a/libbirdfont/TabBar.vala b/libbirdfont/TabBar.valaindex ef0bc55..d8e5182 100644--- a/libbirdfont/TabBar.vala+++ b/libbirdfont/TabBar.vala@@ -612,7 +612,6 @@ public class TabBar : GLib.Object { 	public void draw (Context cr, int width, int height) { 		double next_tab_x; 		double w, h;-		double progress_y; 		 		this.width = width; 		this.height = height;@@ -653,8 +652,6 @@ public class TabBar : GLib.Object { 		// progress wheel 		if (has_progress_wheel ()) { 			double progress_size = 40 / scale;-			Surface s = new Surface.similar (cr.get_target (), Cairo.Content.COLOR_ALPHA, (int) progress_size, (int) progress_size);-			Context c = new Context (s); 			 			Theme.text_color (progress_icon, "Foreground 2"); 			diff --git a/libbirdfont/Theme.vala b/libbirdfont/Theme.valaindex 8fafc4f..9f9cdcc 100644--- a/libbirdfont/Theme.vala+++ b/libbirdfont/Theme.vala@@ -81,8 +81,6 @@ public class Theme : GLib.Object { 	} 	 	public static Color get_color (string name) {-		Color c;-		 		if (unlikely (!colors.has_key (name))) { 			warning (@"Theme does not have a color for $name"); 			return new Color (0, 0, 0, 1);diff --git a/libbirdfont/Tool.vala b/libbirdfont/Tool.valaindex 16c7878..f142f32 100644--- a/libbirdfont/Tool.vala+++ b/libbirdfont/Tool.vala@@ -29,7 +29,6 @@ public class Tool : Widget { 	public bool selected = false; 	 	Text icon_font;-	ImageSurface? icon = null; 		 	public signal void select_action (Tool selected); 	public signal void deselect_action (Tool selected);diff --git a/libbirdxml/Attributes.vala b/libbirdxml/Attributes.valaindex 6a36504..1b3964b 100644--- a/libbirdxml/Attributes.vala+++ b/libbirdxml/Attributes.vala@@ -50,7 +50,7 @@ public class Attributes : GLib.Object { 			return next_attribute != null; 		} -		public Attribute get () {+		public new Attribute get () { 			if (next_attribute == null) { 				XmlParser.warning ("No attribute is parsed yet."); 				return new Attribute.empty ();diff --git a/libbirdxml/Tag.vala b/libbirdxml/Tag.valaindex f0b0d98..4794e4b 100644--- a/libbirdxml/Tag.vala+++ b/libbirdxml/Tag.vala@@ -153,15 +153,16 @@ public class Tag : GLib.Object { 		XmlString name; 		XmlString attributes; 		XmlString content;-	++		end_tag_index = -1;+			 		if (start < 0) { 			warn ("Negative index."); 			return new Tag.empty (); 		} 	 		index = start;-		end_tag_index = -1;-		+ 		d = data; 		if (d == null) { 			warn ("No data in xml string.");@@ -439,7 +440,7 @@ public class Tag : GLib.Object { 			return next_tag != null; 		} -		public Tag get () {+		public new Tag get () { 			if (next_tag == null) { 				XmlParser.warning ("No tag is parsed yet."); 				return new Tag.empty ();

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112