Properly fix parsing of compiler error messages.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3477 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2009-01-17 13:10:46 +00:00
parent b42da26f78
commit 27205da2c6
2 changed files with 10 additions and 4 deletions

View File

@ -12,6 +12,8 @@
installation when the installation directory were different. installation when the installation directory were different.
Install GTK translation files only if installation of translation Install GTK translation files only if installation of translation
files were requested (saves about 22 MB otherwise). files were requested (saves about 22 MB otherwise).
* src/msgwindow.c:
Properly fix parsing of compiler error messages.
2009-01-16 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> 2009-01-16 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -582,7 +582,6 @@ gboolean msgwin_goto_compiler_file_line()
path = gtk_tree_model_get_path(model, &iter); path = gtk_tree_model_get_path(model, &iter);
find_prev_build_dir(path, model, &dir); find_prev_build_dir(path, model, &dir);
gtk_tree_path_free(path); gtk_tree_path_free(path);
g_strchug(string); /* remove possible leading whitespace */
msgwin_parse_compiler_error_line(string, dir, &filename, &line); msgwin_parse_compiler_error_line(string, dir, &filename, &line);
if (dir != NULL) if (dir != NULL)
@ -683,7 +682,7 @@ static void parse_file_line(ParseData *data, gchar **filename, gint *line)
} }
void parse_compiler_error_line(const gchar *string, static void parse_compiler_error_line(const gchar *string,
gchar **filename, gint *line) gchar **filename, gint *line)
{ {
ParseData data = {NULL, NULL, 0, 0, 0}; ParseData data = {NULL, NULL, 0, 0, 0};
@ -855,6 +854,7 @@ void msgwin_parse_compiler_error_line(const gchar *string, const gchar *dir,
gchar **filename, gint *line) gchar **filename, gint *line)
{ {
GeanyFiletype *ft; GeanyFiletype *ft;
gchar *trimmed_string;
*filename = NULL; *filename = NULL;
*line = -1; *line = -1;
@ -866,15 +866,19 @@ void msgwin_parse_compiler_error_line(const gchar *string, const gchar *dir,
dir = build_info.dir; dir = build_info.dir;
g_return_if_fail(dir != NULL); g_return_if_fail(dir != NULL);
trimmed_string = g_strdup(string);
g_strchug(trimmed_string); /* remove possible leading whitespace */
ft = filetypes[build_info.file_type_id]; ft = filetypes[build_info.file_type_id];
/* try parsing with a custom regex */ /* try parsing with a custom regex */
if (!filetypes_parse_error_message(ft, string, filename, line)) if (!filetypes_parse_error_message(ft, trimmed_string, filename, line))
{ {
/* fallback to default old-style parsing */ /* fallback to default old-style parsing */
parse_compiler_error_line(string, filename, line); parse_compiler_error_line(trimmed_string, filename, line);
} }
make_absolute(filename, dir); make_absolute(filename, dir);
g_free(trimmed_string);
} }