From: Reinhold Kainhofer Date: Tue, 23 Aug 2011 11:06:30 +0000 (+0200) Subject: Fix uninitialized variables when Source_file::get_counts returns early due to !contai... X-Git-Tag: release/2.15.9-1~9^2~9 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b29bb82ddbf82b9989fa1f1e552491a2f6e5504a;p=lilypond.git Fix uninitialized variables when Source_file::get_counts returns early due to !contains (pos_str0) --- diff --git a/lily/source-file.cc b/lily/source-file.cc index b42fb7a5b3..041c046d2b 100644 --- a/lily/source-file.cc +++ b/lily/source-file.cc @@ -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);