[valadoc] devhelp-doclet: _renderer: null pointer fix



commit e574124970642f3f3438c994dc38f441d92eaf3d
Author: Florian Brosch <flo brosch gmail com>
Date:   Wed Oct 21 12:41:33 2009 +0200

    devhelp-doclet: _renderer: null pointer fix

 src/doclets/devhelp/doclet/doclet.vala     |   44 +++++++++++++++------------
 src/doclets/htm/doclet/doclet.vala         |   24 +++++++-------
 src/doclets/htmlhelpers/doclet/doclet.vala |    2 +-
 3 files changed, 37 insertions(+), 33 deletions(-)
---
diff --git a/src/doclets/devhelp/doclet/doclet.vala b/src/doclets/devhelp/doclet/doclet.vala
index 39e5cca..28c2b60 100755
--- a/src/doclets/devhelp/doclet/doclet.vala
+++ b/src/doclets/devhelp/doclet/doclet.vala
@@ -204,23 +204,27 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
 	private DevhelpFormat devhelp;
 	private Api.Tree tree;
 
-	private string get_path ( Api.Node element ) {
+	construct {
+		_renderer = new HtmlRenderer (this);
+	}
+
+	private string get_path (Api.Node element) {
 		return element.full_name () + ".html";
 	}
 
-	private string get_real_path ( Api.Node element ) {
-		return GLib.Path.build_filename ( this.settings.path, this.package_dir_name, element.full_name () + ".html" );
+	private string get_real_path (Api.Node element) {
+		return GLib.Path.build_filename (this.settings.path, this.package_dir_name, element.full_name () + ".html");
 	}
 
 	public override void process (Settings settings, Api.Tree tree) {
 		this.settings = settings;
 		this.tree = tree;
 
-		DirUtils.create ( this.settings.path, 0777 );
+		DirUtils.create (this.settings.path, 0777);
 
-		this.devhelp = new DevhelpFormat ( settings.pkg_name, "" );
+		this.devhelp = new DevhelpFormat (settings.pkg_name, "");
 
-		write_wiki_pages ( tree, css_path_wiki, Path.build_filename(this.settings.path, this.settings.pkg_name, "content") );
+		write_wiki_pages (tree, css_path_wiki, Path.build_filename (this.settings.path, this.settings.pkg_name, "content"));
 
 		tree.accept (this);
 	}
@@ -232,25 +236,25 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
 	public override void visit_package (Package package) {
 		string pkg_name = package.name;
 
-		string path = GLib.Path.build_filename ( this.settings.path, pkg_name );
-		string filepath = GLib.Path.build_filename ( path, "index.htm" );
-		string imgpath = GLib.Path.build_filename ( path, "img" );
-		string devpath = GLib.Path.build_filename ( path, pkg_name + ".devhelp2" );
+		string path = GLib.Path.build_filename (this.settings.path, pkg_name);
+		string filepath = GLib.Path.build_filename (path, "index.htm");
+		string imgpath = GLib.Path.build_filename (path, "img");
+		string devpath = GLib.Path.build_filename (path, pkg_name + ".devhelp2");
 
 		WikiPage wikipage = null;
-		if ( this.settings.pkg_name == package.name && this.tree.wikitree != null ) {
+		if (this.settings.pkg_name == package.name && this.tree.wikitree != null) {
 			wikipage = this.tree.wikitree.search ("index.valadoc");
 		}
 
 		this.package_dir_name = pkg_name;
 
-		var rt = DirUtils.create ( path, 0777 );
-		rt = DirUtils.create ( imgpath, 0777 );
-		copy_directory ( Config.doclet_path + "deps/", path );
+		var rt = DirUtils.create (path, 0777);
+		rt = DirUtils.create (imgpath, 0777);
+		copy_directory (Config.doclet_path + "deps/", path);
 
-		this.devhelp = new DevhelpFormat ( pkg_name, "" );
+		this.devhelp = new DevhelpFormat (pkg_name, "");
 
-		GLib.FileStream file = GLib.FileStream.open ( filepath, "w" );
+		GLib.FileStream file = GLib.FileStream.open (filepath, "w");
 		writer = new MarkupWriter (file);
 		writer.xml_declaration ();
 		_renderer.set_writer (writer);
@@ -261,7 +265,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
 
 		package.accept_all_children (this);
 
-		this.devhelp.save_file ( devpath );
+		this.devhelp.save_file (devpath);
 	}
 
 	private void process_compound_node (Api.Node node, KeywordType type) {
@@ -275,7 +279,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
 			writer = new MarkupWriter (file);
 			writer.xml_declaration ();
 			_renderer.set_writer (writer);
-			write_file_header (css_path, node.full_name());
+			write_file_header (css_path, node.full_name ());
 			write_symbol_content (node);
 			write_file_footer ();
 			file = null;
@@ -364,8 +368,8 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
 }
 
 [ModuleInit]
-public Type register_plugin ( ) {
+public Type register_plugin () {
 	Valadoc.Html.get_html_link_imp = Valadoc.Devhelp.get_html_link;
-	return typeof ( Valadoc.Devhelp.Doclet );
+	return typeof (Valadoc.Devhelp.Doclet);
 }
 
diff --git a/src/doclets/htm/doclet/doclet.vala b/src/doclets/htm/doclet/doclet.vala
index 266c1de..41df8c4 100755
--- a/src/doclets/htm/doclet/doclet.vala
+++ b/src/doclets/htm/doclet/doclet.vala
@@ -116,12 +116,12 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
 	public override void process (Settings settings, Api.Tree tree) {
 		this.settings = settings;
 
-		DirUtils.create ( this.settings.path, 0777 );
-		copy_directory ( GLib.Path.build_filename ( Config.doclet_path, "deps" ), settings.path );
+		DirUtils.create (this.settings.path, 0777);
+		copy_directory (GLib.Path.build_filename ( Config.doclet_path, "deps"), settings.path);
 
-		write_wiki_pages ( tree, css_path_wiki, Path.build_filename(settings.path, "content") );
+		write_wiki_pages (tree, css_path_wiki, Path.build_filename(settings.path, "content"));
 
-		GLib.FileStream file = GLib.FileStream.open ( GLib.Path.build_filename ( settings.path, "index.html" ), "w" );
+		GLib.FileStream file = GLib.FileStream.open (GLib.Path.build_filename ( settings.path, "index.html" ), "w");
 		writer = new MarkupWriter (file);
 		writer.xml_declaration ();
 		_renderer.set_writer (writer);
@@ -142,10 +142,10 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
 		string pkg_name = package.name;
 		string path = GLib.Path.build_filename ( this.settings.path, pkg_name );
 
-		var rt = DirUtils.create ( path, 0777 );
-		rt = DirUtils.create ( GLib.Path.build_filename ( path, "img" ), 0777 );
+		var rt = DirUtils.create (path, 0777);
+		rt = DirUtils.create (GLib.Path.build_filename ( path, "img" ), 0777);
 
-		GLib.FileStream file = GLib.FileStream.open ( GLib.Path.build_filename ( path, "index.htm" ), "w" );
+		GLib.FileStream file = GLib.FileStream.open (GLib.Path.build_filename ( path, "index.htm" ), "w");
 		writer = new MarkupWriter (file);
 		writer.xml_declaration ();
 		_renderer.set_writer (writer);
@@ -158,15 +158,15 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
 		package.accept_all_children (this);
 	}
 
-	public override void visit_namespace ( Namespace ns ) {
-		string rpath = this.get_real_path ( ns );
+	public override void visit_namespace (Namespace ns) {
+		string rpath = this.get_real_path (ns);
 
-		if ( ns.name != null ) {
-			GLib.FileStream file = GLib.FileStream.open ( rpath, "w" );
+		if (ns.name != null) {
+			GLib.FileStream file = GLib.FileStream.open (rpath, "w");
 			writer = new MarkupWriter (file);
 			writer.xml_declaration ();
 			_renderer.set_writer (writer);
-			write_file_header (this.css_path, ns.full_name());
+			write_file_header (this.css_path, ns.full_name ());
 			write_navi_symbol (ns);
 			write_namespace_content (ns, ns);
 			write_file_footer ();
diff --git a/src/doclets/htmlhelpers/doclet/doclet.vala b/src/doclets/htmlhelpers/doclet/doclet.vala
index cb3799e..262b68b 100755
--- a/src/doclets/htmlhelpers/doclet/doclet.vala
+++ b/src/doclets/htmlhelpers/doclet/doclet.vala
@@ -221,7 +221,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
 
 	protected void write_navi_children (Api.Node node, Api.NodeType type, Api.Node? parent) {
 		var children = node.get_children_by_type (type);
-		//children.sort ();
+		//children.sort (); // ref counter err
 		foreach (Api.Node child in children) {
 			write_navi_entry (child, parent, get_html_css_class (child), child != parent);
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]