[latexila] Vala 0.14: always set value to out parameters



commit 206d99b59a6b6b15e7597a80611696ebb77595f4
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Sat Sep 17 23:00:20 2011 +0200

    Vala 0.14: always set value to out parameters
    
    It avoids some warnings.

 src/completion.vala         |    3 +++
 src/document.vala           |    8 ++++++++
 src/document_structure.vala |   23 +++++++++++++++++++++++
 src/projects.vala           |    2 ++
 src/structure_model.vala    |    8 ++++++++
 5 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/src/completion.vala b/src/completion.vala
index 4814f60..af4b785 100644
--- a/src/completion.vala
+++ b/src/completion.vala
@@ -760,6 +760,9 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
                                             out string argument_contents = null,
                                             out bool valid_arg_contents = null)
     {
+        cmd_name = null;
+        argument_contents = null;
+
         string text = get_text_line_at_iter (iter);
 
         bool fetch_argument_contents = true;
diff --git a/src/document.vala b/src/document.vala
index f63b560..3b2cfae 100644
--- a/src/document.vala
+++ b/src/document.vala
@@ -591,6 +591,8 @@ public class Document : Gtk.SourceBuffer
     public void set_search_text (string text, bool case_sensitive, bool entire_word,
         out uint nb_matches, out uint num_match, bool select = true)
     {
+        num_match = 0;
+
         // connect signals
         if (search_text == null)
         {
@@ -782,6 +784,9 @@ public class Document : Gtk.SourceBuffer
     private bool iter_forward_search (TextIter start, TextIter? end,
         out TextIter match_start, out TextIter match_end)
     {
+        match_start = TextIter ();
+        match_end = TextIter ();
+
         bool found = false;
         while (! found)
         {
@@ -804,6 +809,9 @@ public class Document : Gtk.SourceBuffer
     private bool iter_backward_search (TextIter start, TextIter? end,
         out TextIter match_start, out TextIter match_end)
     {
+        match_start = TextIter ();
+        match_end = TextIter ();
+
         bool found = false;
         while (! found)
         {
diff --git a/src/document_structure.vala b/src/document_structure.vala
index 76c079c..da79725 100644
--- a/src/document_structure.vala
+++ b/src/document_structure.vala
@@ -219,6 +219,11 @@ public class DocumentStructure : GLib.Object
         out LowLevelType? type, out string? contents,
         out int? start_match_index, out int? end_match_index)
     {
+        type = null;
+        contents = null;
+        start_match_index = null;
+        end_match_index = null;
+
         /* search the character '\' or '%' */
         MatchInfo match_info;
         try
@@ -283,6 +288,10 @@ public class DocumentStructure : GLib.Object
     private bool search_markup (string line, int after_backslash_index,
         out LowLevelType? type, out string? contents, out int? end_match_index)
     {
+        type = null;
+        contents = null;
+        end_match_index = null;
+
         /* get markup name */
         int? begin_contents_index;
         string? name = get_markup_name (line, after_backslash_index,
@@ -312,6 +321,8 @@ public class DocumentStructure : GLib.Object
     private bool search_env (string line, int begin_contents_index, bool is_begin_env,
         out LowLevelType? type, out int? end_match_index)
     {
+        type = null;
+
         string? contents = get_markup_contents (line, begin_contents_index,
             out end_match_index);
 
@@ -349,6 +360,8 @@ public class DocumentStructure : GLib.Object
     private string? get_markup_name (string line, int after_backslash_index,
         out int? begin_contents_index = null)
     {
+        begin_contents_index = null;
+
         /* Get the markup name */
         string after_backslash_text = line.substring (after_backslash_index);
 
@@ -376,6 +389,8 @@ public class DocumentStructure : GLib.Object
     private bool search_firt_non_optional_arg (string line, int start_index,
         out int begin_contents_index)
     {
+        begin_contents_index = 0;
+
         int cur_index = start_index;
         bool in_optional_arg = false;
         int additional_bracket_level = 0;
@@ -440,6 +455,8 @@ public class DocumentStructure : GLib.Object
     private string? get_markup_contents (string line, int begin_contents_index,
         out int? end_match_index)
     {
+        end_match_index = null;
+
         int brace_level = 0;
         int cur_index = begin_contents_index;
 
@@ -482,6 +499,10 @@ public class DocumentStructure : GLib.Object
     private bool search_comment (string line, int after_percent_index,
         out LowLevelType? type, out string? contents, out int? end_match_index)
     {
+        type = null;
+        contents = null;
+        end_match_index = null;
+
         string text_after = line.substring (after_percent_index).strip ();
 
         MatchInfo match_info;
@@ -920,6 +941,8 @@ public class DocumentStructure : GLib.Object
     private bool get_low_level_item_bounds (StructType item_type, string item_contents,
         TextIter start_match_iter, bool is_start, out TextIter? end_match_iter)
     {
+        end_match_iter = null;
+
         int line_num = start_match_iter.get_line ();
         string line = get_document_line_contents (line_num);
 
diff --git a/src/projects.vala b/src/projects.vala
index c237b46..dd90515 100644
--- a/src/projects.vala
+++ b/src/projects.vala
@@ -87,6 +87,8 @@ public class Projects
     // returns true if project successfully added
     public bool add (Project new_project, out File conflict_file)
     {
+        conflict_file = null;
+
         foreach (Project project in projects)
         {
             if (conflict (project.directory, new_project.directory))
diff --git a/src/structure_model.vala b/src/structure_model.vala
index 43b08f6..c721b5f 100644
--- a/src/structure_model.vala
+++ b/src/structure_model.vala
@@ -228,6 +228,8 @@ public class StructureModel : TreeModel, GLib.Object
 
     public bool iter_children (out TreeIter iter, TreeIter? parent)
     {
+        iter = TreeIter ();
+
         unowned Node<StructData?> node;
         if (parent == null)
             node = _tree;
@@ -259,6 +261,8 @@ public class StructureModel : TreeModel, GLib.Object
 
     public bool iter_nth_child (out TreeIter iter, TreeIter? parent, int n)
     {
+        iter = TreeIter ();
+
         unowned Node<StructData?> node;
         if (parent == null)
             node = _tree;
@@ -280,6 +284,8 @@ public class StructureModel : TreeModel, GLib.Object
 
     public bool iter_parent (out TreeIter iter, TreeIter child)
     {
+        iter = TreeIter ();
+
         return_val_if_fail (iter_is_valid (child), false);
 
         unowned Node<StructData?> node = get_node_from_iter (child);
@@ -298,6 +304,8 @@ public class StructureModel : TreeModel, GLib.Object
 
     public bool get_iter (out TreeIter iter, TreePath path)
     {
+        iter = TreeIter ();
+
         int depth = path.get_depth ();
         return_val_if_fail (1 <= depth, false);
 



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