Revision: 3834 http://geany.svn.sourceforge.net/geany/?rev=3834&view=rev Author: eht16 Date: 2009-06-01 21:51:33 +0000 (Mon, 01 Jun 2009)
Log Message: ----------- Fix crashes when parsing the output of a compiler which reports errors on line 0.
Modified Paths: -------------- trunk/ChangeLog trunk/src/build.c trunk/src/editor.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-06-01 21:41:35 UTC (rev 3833) +++ trunk/ChangeLog 2009-06-01 21:51:33 UTC (rev 3834) @@ -1,3 +1,10 @@ +2009-06-01 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * src/build.c, src/editor.c: + Fix crashes when parsing the output of a compiler which reports + errors on line 0. + + 2009-06-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/highlighting.c:
Modified: trunk/src/build.c =================================================================== --- trunk/src/build.c 2009-06-01 21:41:35 UTC (rev 3833) +++ trunk/src/build.c 2009-06-01 21:51:33 UTC (rev 3834) @@ -824,7 +824,11 @@ GeanyDocument *doc = document_find_by_filename(filename);
if (doc) - editor_indicator_set_on_line(doc->editor, GEANY_INDICATOR_ERROR, line - 1); + { + if (line > 0) /* some compilers, like pdflatex report errors on line 0 */ + line--; /* so only adjust the line number if it is greater than 0 */ + editor_indicator_set_on_line(doc->editor, GEANY_INDICATOR_ERROR, line); + } color = COLOR_RED; /* error message parsed on the line */ } g_free(filename);
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2009-06-01 21:41:35 UTC (rev 3833) +++ trunk/src/editor.c 2009-06-01 21:51:33 UTC (rev 3834) @@ -3769,20 +3769,25 @@ gchar *linebuf;
g_return_if_fail(editor != NULL); + g_return_if_fail(line >= 0);
start = sci_get_position_from_line(editor->sci, line); end = sci_get_position_from_line(editor->sci, line + 1);
/* skip blank lines */ if ((start + 1) == end || + start > end || sci_get_line_length(editor->sci, line) == editor_get_eol_char_len(editor)) + { return; + }
len = end - start; linebuf = sci_get_line(editor->sci, line);
/* don't set the indicator on whitespace */ - while (isspace(linebuf[i])) i++; + while (isspace(linebuf[i])) + i++; while (len > 1 && len > i && isspace(linebuf[len-1])) { len--;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.