summaryrefslogtreecommitdiff
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-06-20 18:49:32 +0000
committerBram Moolenaar <Bram@vim.org>2006-06-20 18:49:32 +0000
commit4169da7845ed24b03cd6208c1acb27eba774a971 (patch)
treedd2e5dd2138f07707bdd8915f19bf9a6ff365255 /src/quickfix.c
parent7b240600c56fe55a81999dec4a79f4a3c12fc28f (diff)
downloadvim-4169da7845ed24b03cd6208c1acb27eba774a971.zip
updated for version 7.0-021
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index 19e03c4da..8c3dbbff6 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -602,13 +602,19 @@ restofline:
else
type = 0;
/*
- * Extract error message data from matched line
+ * Extract error message data from matched line.
+ * We check for an actual submatch, because "\[" and "\]" in
+ * the 'errorformat' may cause the wrong submatch to be used.
*/
if ((i = (int)fmt_ptr->addr[0]) > 0) /* %f */
{
- int c = *regmatch.endp[i];
+ int c;
+
+ if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
+ continue;
/* Expand ~/file and $HOME/file to full path. */
+ c = *regmatch.endp[i];
*regmatch.endp[i] = NUL;
expand_env(regmatch.startp[i], namebuf, CMDBUFFSIZE);
*regmatch.endp[i] = c;
@@ -618,35 +624,63 @@ restofline:
continue;
}
if ((i = (int)fmt_ptr->addr[1]) > 0) /* %n */
+ {
+ if (regmatch.startp[i] == NULL)
+ continue;
enr = (int)atol((char *)regmatch.startp[i]);
+ }
if ((i = (int)fmt_ptr->addr[2]) > 0) /* %l */
+ {
+ if (regmatch.startp[i] == NULL)
+ continue;
lnum = atol((char *)regmatch.startp[i]);
+ }
if ((i = (int)fmt_ptr->addr[3]) > 0) /* %c */
+ {
+ if (regmatch.startp[i] == NULL)
+ continue;
col = (int)atol((char *)regmatch.startp[i]);
+ }
if ((i = (int)fmt_ptr->addr[4]) > 0) /* %t */
+ {
+ if (regmatch.startp[i] == NULL)
+ continue;
type = *regmatch.startp[i];
+ }
if (fmt_ptr->flags == '+' && !multiscan) /* %+ */
STRCPY(errmsg, IObuff);
else if ((i = (int)fmt_ptr->addr[5]) > 0) /* %m */
{
+ if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
+ continue;
len = (int)(regmatch.endp[i] - regmatch.startp[i]);
vim_strncpy(errmsg, regmatch.startp[i], len);
}
if ((i = (int)fmt_ptr->addr[6]) > 0) /* %r */
+ {
+ if (regmatch.startp[i] == NULL)
+ continue;
tail = regmatch.startp[i];
+ }
if ((i = (int)fmt_ptr->addr[7]) > 0) /* %p */
{
+ if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
+ continue;
col = (int)(regmatch.endp[i] - regmatch.startp[i] + 1);
if (*((char_u *)regmatch.startp[i]) != TAB)
use_viscol = TRUE;
}
if ((i = (int)fmt_ptr->addr[8]) > 0) /* %v */
{
+ if (regmatch.startp[i] == NULL)
+ continue;
col = (int)atol((char *)regmatch.startp[i]);
use_viscol = TRUE;
}
if ((i = (int)fmt_ptr->addr[9]) > 0) /* %s */
{
+ if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
+ continue;
len = (int)(regmatch.endp[i] - regmatch.startp[i]);
if (len > CMDBUFFSIZE - 5)
len = CMDBUFFSIZE - 5;