]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix uninitialized variables when Source_file::get_counts returns early due to !contai...
authorReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 23 Aug 2011 11:06:30 +0000 (13:06 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 23 Aug 2011 16:42:03 +0000 (18:42 +0200)
lily/source-file.cc

index b42fb7a5b37a508f69ce8d31925ae9478e7972c4..041c046d2bfc2fa4761df56005f2e76692f962f7 100644 (file)
@@ -261,7 +261,11 @@ Source_file::get_counts (char const *pos_str0,
                          int *column,
                          int *byte_offset) const
 {
+  // Initialize arguments to defaults, needed if pos_str0 is not in source
   *line_number = 0;
+  *line_char = 0;
+  *column = 0;
+  *byte_offset = 0;
 
   if (!contains (pos_str0))
     return;
@@ -276,10 +280,6 @@ Source_file::get_counts (char const *pos_str0,
   string line_begin (line_start, left);
   char const *line_chars = line_begin.c_str ();
 
-  *line_char = 0;
-  *column = 0;
-  *byte_offset = 0;
-
   while (left > 0)
     {
       size_t thislen = utf8_char_len (*line_chars);