]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
libvaladoc: Replace deprecated function calls
authorFlorian Brosch <flo.brosch@gmail.com>
Tue, 8 Feb 2011 16:07:29 +0000 (17:07 +0100)
committerFlorian Brosch <flo.brosch@gmail.com>
Tue, 8 Feb 2011 19:03:30 +0000 (20:03 +0100)
src/doclets/devhelp/doclet.vala
src/doclets/htm/doclet.vala
src/libvaladoc/api/tree.vala
src/libvaladoc/filehelper.vala
src/libvaladoc/html/basicdoclet.vala
src/libvaladoc/html/linkhelper.vala
src/libvaladoc/importer/valadocdocumentationimporter.vala
src/libvaladoc/taglets/tagletlink.vala
src/libvaladoc/taglets/tagletsee.vala

index 2496391b08538aa01bc294f585b445fda88eab13..e369337b3f780f56e8c51325ea5f503b4ed68759 100755 (executable)
@@ -40,10 +40,6 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
 
        private Devhelp.MarkupWriter _devhelpwriter;
 
-       construct {
-               _renderer = new HtmlRenderer (this);
-       }
-
        private string get_path (Api.Node element) {
                return element.get_full_name () + ".html";
        }
index a93e5a7ed311bc65c86b601c9c4b21d4a0d4bbb3..0faf737d1821583c444a769d22c823846ed442ad 100755 (executable)
@@ -37,10 +37,6 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
        private const string js_path_wiki = "../scripts.js";
        private const string js_path = "../scripts.js";
 
-       construct {
-               _renderer = new HtmlRenderer (this);
-       }
-
        private string get_real_path ( Api.Node element ) {
                return GLib.Path.build_filename ( this.settings.path, element.package.name, element.get_full_name () + ".html" );
        }
index 42835d3f08ea8b34132695eecfcc8acb7309a035..254dcc0f9f2ab798a2874f8b5cb298f6f84e487d 100644 (file)
@@ -324,7 +324,7 @@ public class Valadoc.Api.Tree {
                                        context.add_source_file (source_file);
                                } else if (source.has_suffix (".vapi")) {
                                        string file_name = Path.get_basename (source);
-                                       file_name = file_name.ndup (file_name.length - ".vapi".length);
+                                       file_name = file_name.substring (0, file_name.length - ".vapi".length);
 
                                        var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, rpath);
                                        Package vdpkg = new Package (vfile, file_name);
index a14f8ae0f83f38d988d850405aa81199d044dad1..edd47bfca4f6c5216a5290dbebedf96c51baecdf 100755 (executable)
@@ -91,78 +91,8 @@ namespace Valadoc {
                return true;
        }
 
-       /* cp from valacompiler.vala, ported from glibc */
-       private static bool ends_with_dir_separator (string s) {
-               return Path.is_dir_separator (s.offset (s.length - 1).get_char ());
-       }
-
-       public string realpath (string name) {
-               string rpath;
-
-               // start of path component
-               weak string start;
-               // end of path component
-               weak string end;
-
-               if (!Path.is_absolute (name)) {
-                       // relative path
-                       rpath = Environment.get_current_dir ();
-
-                       start = end = name;
-               } else {
-                       // set start after root
-                       start = end = Path.skip_root (name);
-
-                       // extract root
-                       rpath = name.substring (0, name.pointer_to_offset (start));
-               }
-
-               long root_len = rpath.pointer_to_offset (Path.skip_root (rpath));
-
-               for (; start.get_char () != 0; start = end) {
-                       // skip sequence of multiple path-separators
-                       while (Path.is_dir_separator (start.get_char ())) {
-                               start = start.next_char ();
-                       }
-
-                       // find end of path component
-                       long len = 0;
-                       for (end = start; end.get_char () != 0 && !Path.is_dir_separator (end.get_char ()); end = end.next_char ()) {
-                               len++;
-                       }
-
-                       if (len == 0) {
-                               break;
-                       } else if (len == 1 && start.get_char () == '.') {
-                               // do nothing
-                       } else if (len == 2 && start.has_prefix ("..")) {
-                               // back up to previous component, ignore if at root already
-                               if (rpath.length > root_len) {
-                                       do {
-                                               rpath = rpath.substring (0, rpath.length - 1);
-                                       } while (!ends_with_dir_separator (rpath));
-                               }
-                       } else {
-                               if (!ends_with_dir_separator (rpath)) {
-                                       rpath += Path.DIR_SEPARATOR_S;
-                               }
-
-                               rpath += start.substring (0, len);
-                       }
-               }
-
-               if (rpath.length > root_len && ends_with_dir_separator (rpath)) {
-                       rpath = rpath.substring (0, rpath.length - 1);
-               }
-
-               if (Path.DIR_SEPARATOR != '/') {
-                       // don't use backslashes internally,
-                       // to avoid problems in #include directives
-                       string[] components = rpath.split ("\\");
-                       rpath = string.joinv ("/", components);
-               }
-
-               return rpath;
+       public string realpath (string basedir) {
+               return Vala.CodeContext.realpath (basedir);
        }
 }
 
index e32e818e736cbdcd0046abc794eba8330f2f77af..acda5d8e466dfa510e3c9bdc651f7c16e5d8ee26 100755 (executable)
@@ -182,7 +182,7 @@ public abstract class Valadoc.Html.BasicDoclet : Api.Visitor, Doclet {
        }
 
        protected virtual void write_wiki_page (WikiPage page, string contentp, string css_path, string js_path, string pkg_name) {
-               GLib.FileStream file = GLib.FileStream.open (Path.build_filename(contentp, page.name.ndup(page.name.length-7).replace ("/", ".")+"html"), "w");
+               GLib.FileStream file = GLib.FileStream.open (Path.build_filename(contentp, page.name.substring (0, page.name.length-7).replace ("/", ".")+"html"), "w");
                writer = new MarkupWriter (file);
                _renderer.set_writer (writer);
                this.write_file_header (css_path, js_path, pkg_name);
index 83e4747c1e360be202e397e14accabc61f46f38f..e7cf4e7f32bfd06e03875fc2649363210319f8ad 100644 (file)
@@ -78,8 +78,7 @@ public class Valadoc.Html.LinkHelper : Object {
 
        private string translate_wiki_name (WikiPage page) {
                var name = page.name;
-
-               return name.ndup (name.pointer_to_offset (name.chr (-1, '.'))).replace ("/", ".") + ".html";
+               return name.substring (name.last_index_of_char ('.')).replace ("/", ".") + ".html";
        }
 
 
index 2f11f447d3989f4dc41c5458316fbd132239c64c..c35bd37ba2074d313bd5c9d4e7cd60c7c403910f 100644 (file)
@@ -115,7 +115,7 @@ public class Valadoc.Importer.ValadocDocumentationImporter : DocumentationImport
                Api.Node? symbol = null;
 
                if (symbol_name.has_prefix ("c::")) {
-                       symbol = tree.search_symbol_cstr (symbol_name.offset (3));
+                       symbol = tree.search_symbol_cstr (symbol_name.substring (3));
                } else {
                        symbol = tree.search_symbol_str (null, symbol_name);
                }
index ad77b4cc23adb28926dd8536e6e519580d21a477..d7fba14974206313b7abc6bc24a05147316fe6ed 100755 (executable)
@@ -37,7 +37,7 @@ public class Valadoc.Taglets.Link : InlineTaglet {
 
        public override void check (Api.Tree api_root, Api.Node container, ErrorReporter reporter, Settings settings) {
                if (symbol_name.has_prefix ("c::")) {
-                       _symbol_name = _symbol_name.offset (3);
+                       _symbol_name = _symbol_name.substring (3);
                        _symbol = api_root.search_symbol_cstr (symbol_name);
                        if (_symbol != null) {
                                symbol_name = _symbol.name;
index e1b3dc5978d0a97c9365a83e7b582d45d0bd9ffd..bea41d5c1d745bcd9ae1c93e237224aee2894252 100755 (executable)
@@ -36,7 +36,7 @@ public class Valadoc.Taglets.See : ContentElement, Taglet, Block {
 
        public override void check (Api.Tree api_root, Api.Node container, ErrorReporter reporter, Settings settings) {
                if (symbol_name.has_prefix ("c::")) {
-                       symbol_name = symbol_name.offset (3);
+                       symbol_name = symbol_name.substring (3);
                        symbol = api_root.search_symbol_cstr (symbol_name);
                        if (symbol != null) {
                                symbol_name = _symbol.name;