mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	quickfix.c: enable -Wconversion
This commit is contained in:
		@@ -87,7 +87,6 @@ set(CONV_SOURCES
 | 
			
		||||
  misc1.c
 | 
			
		||||
  ops.c
 | 
			
		||||
  path.c
 | 
			
		||||
  quickfix.c
 | 
			
		||||
  regexp.c
 | 
			
		||||
  screen.c
 | 
			
		||||
  search.c
 | 
			
		||||
 
 | 
			
		||||
@@ -819,8 +819,8 @@ static void diff_file(char_u *tmp_orig, char_u *tmp_new, char_u *tmp_diff)
 | 
			
		||||
                 (diff_flags & DIFF_IWHITE) ? "-b " : "",
 | 
			
		||||
                 (diff_flags & DIFF_ICASE) ? "-i " : "",
 | 
			
		||||
                 tmp_orig, tmp_new);
 | 
			
		||||
    append_redir(cmd, (int)len, p_srr, tmp_diff);
 | 
			
		||||
    block_autocmds(); /* Avoid ShellCmdPost stuff */
 | 
			
		||||
    append_redir(cmd, len, p_srr, tmp_diff);
 | 
			
		||||
    block_autocmds();  // Avoid ShellCmdPost stuff
 | 
			
		||||
    (void)call_shell(
 | 
			
		||||
        cmd,
 | 
			
		||||
        kShellOptFilter | kShellOptSilent | kShellOptDoOut,
 | 
			
		||||
 
 | 
			
		||||
@@ -1377,9 +1377,9 @@ char_u *make_filter_cmd(char_u *cmd, char_u *itmp, char_u *otmp)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
  if (otmp != NULL)
 | 
			
		||||
    append_redir(buf, (int)len, p_srr, otmp);
 | 
			
		||||
 | 
			
		||||
  if (otmp != NULL) {
 | 
			
		||||
    append_redir(buf, len, p_srr, otmp);
 | 
			
		||||
  }
 | 
			
		||||
  return buf;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1390,7 +1390,7 @@ char_u *make_filter_cmd(char_u *cmd, char_u *itmp, char_u *otmp)
 | 
			
		||||
 * The caller should make sure that there is enough room:
 | 
			
		||||
 *	STRLEN(opt) + STRLEN(fname) + 3
 | 
			
		||||
 */
 | 
			
		||||
void append_redir(char_u *buf, int buflen, char_u *opt, char_u *fname)
 | 
			
		||||
void append_redir(char_u *buf, size_t buflen, char_u *opt, char_u *fname)
 | 
			
		||||
{
 | 
			
		||||
  char_u      *p;
 | 
			
		||||
  char_u      *end;
 | 
			
		||||
 
 | 
			
		||||
@@ -200,9 +200,8 @@ qf_init_ext (
 | 
			
		||||
  char_u          *pattern;
 | 
			
		||||
  char_u          *fmtstr = NULL;
 | 
			
		||||
  int col = 0;
 | 
			
		||||
  char_u use_viscol = FALSE;
 | 
			
		||||
  int type = 0;
 | 
			
		||||
  int valid;
 | 
			
		||||
  bool use_viscol = false;
 | 
			
		||||
  char_u type = 0;
 | 
			
		||||
  linenr_T buflnum = lnumfirst;
 | 
			
		||||
  long lnum = 0L;
 | 
			
		||||
  int enr = 0;
 | 
			
		||||
@@ -220,16 +219,16 @@ qf_init_ext (
 | 
			
		||||
  int i;
 | 
			
		||||
  int round;
 | 
			
		||||
  int idx = 0;
 | 
			
		||||
  int multiline = FALSE;
 | 
			
		||||
  int multiignore = FALSE;
 | 
			
		||||
  int multiscan = FALSE;
 | 
			
		||||
  int retval = -1;                      /* default: return error flag */
 | 
			
		||||
  char_u          *directory = NULL;
 | 
			
		||||
  char_u          *currfile = NULL;
 | 
			
		||||
  char_u          *tail = NULL;
 | 
			
		||||
  char_u          *p_str = NULL;
 | 
			
		||||
  listitem_T      *p_li = NULL;
 | 
			
		||||
  struct dir_stack_T  *file_stack = NULL;
 | 
			
		||||
  bool multiline = false;
 | 
			
		||||
  bool multiignore = false;
 | 
			
		||||
  bool multiscan = false;
 | 
			
		||||
  int retval = -1;                      // default: return error flag
 | 
			
		||||
  char_u *directory = NULL;
 | 
			
		||||
  char_u *currfile = NULL;
 | 
			
		||||
  char_u *tail = NULL;
 | 
			
		||||
  char_u *p_str = NULL;
 | 
			
		||||
  listitem_T *p_li = NULL;
 | 
			
		||||
  struct dir_stack_T *file_stack = NULL;
 | 
			
		||||
  regmatch_T regmatch;
 | 
			
		||||
  static struct fmtpattern {
 | 
			
		||||
    char_u convchar;
 | 
			
		||||
@@ -278,15 +277,16 @@ qf_init_ext (
 | 
			
		||||
  /*
 | 
			
		||||
   * Get some space to modify the format string into.
 | 
			
		||||
   */
 | 
			
		||||
  i = 3 * FMT_PATTERNS + 4 * (int)STRLEN(efm);
 | 
			
		||||
  for (round = FMT_PATTERNS; round > 0; )
 | 
			
		||||
    i += (int)STRLEN(fmt_pat[--round].pattern);
 | 
			
		||||
  size_t fmtstr_size = 3 * FMT_PATTERNS + 4 * STRLEN(efm);
 | 
			
		||||
  for (round = FMT_PATTERNS; round > 0; ) {
 | 
			
		||||
    fmtstr_size += STRLEN(fmt_pat[--round].pattern);
 | 
			
		||||
  }
 | 
			
		||||
#ifdef COLON_IN_FILENAME
 | 
			
		||||
  i += 12;   /* "%f" can become twelve chars longer */
 | 
			
		||||
  fmtstr_size += 12;  // "%f" can become twelve chars longer
 | 
			
		||||
#else
 | 
			
		||||
  i += 2;   /* "%f" can become two chars longer */
 | 
			
		||||
  fmtstr_size += 2;   // "%f" can become two chars longer
 | 
			
		||||
#endif
 | 
			
		||||
  fmtstr = xmalloc(i);
 | 
			
		||||
  fmtstr = xmalloc(fmtstr_size);
 | 
			
		||||
 | 
			
		||||
  while (efm[0] != NUL) {
 | 
			
		||||
    /*
 | 
			
		||||
@@ -530,11 +530,9 @@ qf_init_ext (
 | 
			
		||||
      fmt_start = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Try to match each part of 'errorformat' until we find a complete
 | 
			
		||||
     * match or no match.
 | 
			
		||||
     */
 | 
			
		||||
    valid = TRUE;
 | 
			
		||||
    // Try to match each part of 'errorformat' until we find a complete
 | 
			
		||||
    // match or no match.
 | 
			
		||||
    bool valid = true;
 | 
			
		||||
restofline:
 | 
			
		||||
    for (; fmt_ptr != NULL; fmt_ptr = fmt_ptr->next) {
 | 
			
		||||
      idx = fmt_ptr->prefix;
 | 
			
		||||
@@ -546,7 +544,7 @@ restofline:
 | 
			
		||||
        errmsg[0] = NUL;
 | 
			
		||||
      lnum = 0;
 | 
			
		||||
      col = 0;
 | 
			
		||||
      use_viscol = FALSE;
 | 
			
		||||
      use_viscol = false;
 | 
			
		||||
      enr = -1;
 | 
			
		||||
      type = 0;
 | 
			
		||||
      tail = NULL;
 | 
			
		||||
@@ -555,25 +553,23 @@ restofline:
 | 
			
		||||
      int r = vim_regexec(®match, IObuff, (colnr_T)0);
 | 
			
		||||
      fmt_ptr->prog = regmatch.regprog;
 | 
			
		||||
      if (r) {
 | 
			
		||||
        if ((idx == 'C' || idx == 'Z') && !multiline)
 | 
			
		||||
        if ((idx == 'C' || idx == 'Z') && !multiline) {
 | 
			
		||||
          continue;
 | 
			
		||||
        if (vim_strchr((char_u *)"EWI", idx) != NULL)
 | 
			
		||||
          type = idx;
 | 
			
		||||
        else
 | 
			
		||||
        }
 | 
			
		||||
        if (vim_strchr((char_u *)"EWI", idx) != NULL) {
 | 
			
		||||
          type = (char_u)idx;
 | 
			
		||||
        } else {
 | 
			
		||||
          type = 0;
 | 
			
		||||
        /*
 | 
			
		||||
         * 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;
 | 
			
		||||
 | 
			
		||||
          if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
 | 
			
		||||
        }
 | 
			
		||||
        // 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
 | 
			
		||||
          if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL) {
 | 
			
		||||
            continue;
 | 
			
		||||
 | 
			
		||||
          /* Expand ~/file and $HOME/file to full path. */
 | 
			
		||||
          c = *regmatch.endp[i];
 | 
			
		||||
          }
 | 
			
		||||
          // Expand ~/file and $HOME/file to full path.
 | 
			
		||||
          char_u c = *regmatch.endp[i];
 | 
			
		||||
          *regmatch.endp[i] = NUL;
 | 
			
		||||
          expand_env(regmatch.startp[i], namebuf, CMDBUFFSIZE);
 | 
			
		||||
          *regmatch.endp[i] = c;
 | 
			
		||||
@@ -629,14 +625,14 @@ restofline:
 | 
			
		||||
              col -= col % 8;
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          ++col;
 | 
			
		||||
          use_viscol = TRUE;
 | 
			
		||||
          col++;
 | 
			
		||||
          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;
 | 
			
		||||
          use_viscol = true;
 | 
			
		||||
        }
 | 
			
		||||
        if ((i = (int)fmt_ptr->addr[9]) > 0) {                  /* %s */
 | 
			
		||||
          if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
 | 
			
		||||
@@ -653,7 +649,7 @@ restofline:
 | 
			
		||||
        break;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    multiscan = FALSE;
 | 
			
		||||
    multiscan = false;
 | 
			
		||||
 | 
			
		||||
    if (fmt_ptr == NULL || idx == 'D' || idx == 'X') {
 | 
			
		||||
      if (fmt_ptr != NULL) {
 | 
			
		||||
@@ -667,20 +663,21 @@ restofline:
 | 
			
		||||
        } else if (idx == 'X')                          /* leave directory */
 | 
			
		||||
          directory = qf_pop_dir(&dir_stack);
 | 
			
		||||
      }
 | 
			
		||||
      namebuf[0] = NUL;                 /* no match found, remove file name */
 | 
			
		||||
      lnum = 0;                         /* don't jump to this line */
 | 
			
		||||
      valid = FALSE;
 | 
			
		||||
      STRCPY(errmsg, IObuff);           /* copy whole line to error message */
 | 
			
		||||
      if (fmt_ptr == NULL)
 | 
			
		||||
        multiline = multiignore = FALSE;
 | 
			
		||||
      namebuf[0] = NUL;                 // no match found, remove file name
 | 
			
		||||
      lnum = 0;                         // don't jump to this line
 | 
			
		||||
      valid = false;
 | 
			
		||||
      STRCPY(errmsg, IObuff);           // copy whole line to error message
 | 
			
		||||
      if (fmt_ptr == NULL) {
 | 
			
		||||
        multiline = multiignore = false;
 | 
			
		||||
      }
 | 
			
		||||
    } else if (fmt_ptr != NULL) {
 | 
			
		||||
      /* honor %> item */
 | 
			
		||||
      if (fmt_ptr->conthere)
 | 
			
		||||
        fmt_start = fmt_ptr;
 | 
			
		||||
 | 
			
		||||
      if (vim_strchr((char_u *)"AEWI", idx) != NULL) {
 | 
			
		||||
        multiline = TRUE;    /* start of a multi-line message */
 | 
			
		||||
        multiignore = FALSE; /* reset continuation */
 | 
			
		||||
        multiline = true;     // start of a multi-line message
 | 
			
		||||
        multiignore = false;  // reset continuation
 | 
			
		||||
      } else if (vim_strchr((char_u *)"CZ", idx)
 | 
			
		||||
                 != NULL) { /* continuation of multi-line msg */
 | 
			
		||||
        if (qfprev == NULL)
 | 
			
		||||
@@ -702,15 +699,17 @@ restofline:
 | 
			
		||||
        qfprev->qf_viscol = use_viscol;
 | 
			
		||||
        if (!qfprev->qf_fnum)
 | 
			
		||||
          qfprev->qf_fnum = qf_get_fnum(directory,
 | 
			
		||||
              *namebuf || directory ? namebuf
 | 
			
		||||
              : currfile && valid ? currfile : 0);
 | 
			
		||||
        if (idx == 'Z')
 | 
			
		||||
          multiline = multiignore = FALSE;
 | 
			
		||||
                                        *namebuf
 | 
			
		||||
                                        || directory ? namebuf : currfile
 | 
			
		||||
                                        && valid ? currfile : 0);
 | 
			
		||||
        if (idx == 'Z') {
 | 
			
		||||
          multiline = multiignore = false;
 | 
			
		||||
        }
 | 
			
		||||
        line_breakcheck();
 | 
			
		||||
        continue;
 | 
			
		||||
      } else if (vim_strchr((char_u *)"OPQ", idx) != NULL) {
 | 
			
		||||
        /* global file names */
 | 
			
		||||
        valid = FALSE;
 | 
			
		||||
        // global file names
 | 
			
		||||
        valid = false;
 | 
			
		||||
        if (*namebuf == NUL || os_file_exists(namebuf)) {
 | 
			
		||||
          if (*namebuf && idx == 'P')
 | 
			
		||||
            currfile = qf_push_dir(namebuf, &file_stack);
 | 
			
		||||
@@ -719,14 +718,15 @@ restofline:
 | 
			
		||||
          *namebuf = NUL;
 | 
			
		||||
          if (tail && *tail) {
 | 
			
		||||
            STRMOVE(IObuff, skipwhite(tail));
 | 
			
		||||
            multiscan = TRUE;
 | 
			
		||||
            multiscan = true;
 | 
			
		||||
            goto restofline;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      if (fmt_ptr->flags == '-') {      /* generally exclude this line */
 | 
			
		||||
        if (multiline)
 | 
			
		||||
          multiignore = TRUE;           /* also exclude continuation lines */
 | 
			
		||||
      if (fmt_ptr->flags == '-') {  // generally exclude this line
 | 
			
		||||
        if (multiline) {
 | 
			
		||||
          multiignore = true;       // also exclude continuation lines
 | 
			
		||||
        }
 | 
			
		||||
        continue;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
@@ -867,26 +867,27 @@ void qf_free_all(win_T *wp)
 | 
			
		||||
      qf_free(qi, i);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Add an entry to the end of the list of errors.
 | 
			
		||||
 * Returns OK or FAIL.
 | 
			
		||||
 */
 | 
			
		||||
static int 
 | 
			
		||||
qf_add_entry (
 | 
			
		||||
    qf_info_T *qi,                /* quickfix list */
 | 
			
		||||
    qfline_T **prevp,            /* nonnull pointer (to previously added entry or NULL) */
 | 
			
		||||
    char_u *dir,               /* optional directory name */
 | 
			
		||||
    char_u *fname,             /* file name or NULL */
 | 
			
		||||
    int bufnum,                     /* buffer number or zero */
 | 
			
		||||
    char_u *mesg,              /* message */
 | 
			
		||||
    long lnum,                      /* line number */
 | 
			
		||||
    int col,                        /* column */
 | 
			
		||||
    int vis_col,                    /* using visual column */
 | 
			
		||||
    char_u *pattern,           /* search pattern */
 | 
			
		||||
    int nr,                         /* error number */
 | 
			
		||||
    int type,                       /* type character */
 | 
			
		||||
    int valid                      /* valid entry */
 | 
			
		||||
)
 | 
			
		||||
/// Add an entry to the end of the list of errors.
 | 
			
		||||
///
 | 
			
		||||
/// @param  qi       quickfix list
 | 
			
		||||
/// @param  prevp    nonnull pointer (to previously added entry or NULL)
 | 
			
		||||
/// @param  dir      optional directory name
 | 
			
		||||
/// @param  fname    file name or NULL
 | 
			
		||||
/// @param  bufnum   buffer number or zero
 | 
			
		||||
/// @param  mesg     message
 | 
			
		||||
/// @param  lnum     line number
 | 
			
		||||
/// @param  col      column
 | 
			
		||||
/// @param  vis_col  using visual column
 | 
			
		||||
/// @param  pattern  search pattern
 | 
			
		||||
/// @param  nr       error number
 | 
			
		||||
/// @param  type     type character
 | 
			
		||||
/// @param  valid    valid entry
 | 
			
		||||
///
 | 
			
		||||
/// @returns OK or FAIL.
 | 
			
		||||
static int qf_add_entry(qf_info_T *qi, qfline_T **prevp, char_u *dir,
 | 
			
		||||
                        char_u *fname, int bufnum, char_u *mesg, long lnum,
 | 
			
		||||
                        int col, char_u vis_col, char_u *pattern, int nr,
 | 
			
		||||
                        char_u type, char_u valid)
 | 
			
		||||
{
 | 
			
		||||
  qfline_T *qfp = xmalloc(sizeof(qfline_T));
 | 
			
		||||
 | 
			
		||||
@@ -1657,12 +1658,13 @@ win_found:
 | 
			
		||||
       * flag is present in 'shortmess'; But when not jumping, print the
 | 
			
		||||
       * whole message. */
 | 
			
		||||
      i = msg_scroll;
 | 
			
		||||
      if (curbuf == old_curbuf && curwin->w_cursor.lnum == old_lnum)
 | 
			
		||||
        msg_scroll = TRUE;
 | 
			
		||||
      else if (!msg_scrolled && shortmess(SHM_OVERALL))
 | 
			
		||||
        msg_scroll = FALSE;
 | 
			
		||||
      msg_attr_keep(IObuff, 0, TRUE);
 | 
			
		||||
      msg_scroll = i;
 | 
			
		||||
      if (curbuf == old_curbuf && curwin->w_cursor.lnum == old_lnum) {
 | 
			
		||||
        msg_scroll = true;
 | 
			
		||||
      } else if (!msg_scrolled && shortmess(SHM_OVERALL)) {
 | 
			
		||||
        msg_scroll = false;
 | 
			
		||||
      }
 | 
			
		||||
      msg_attr_keep(IObuff, 0, true);
 | 
			
		||||
      msg_scroll = (int)i;
 | 
			
		||||
    }
 | 
			
		||||
  } else {
 | 
			
		||||
    if (opened_window)
 | 
			
		||||
@@ -1827,10 +1829,12 @@ void qf_age(exarg_T *eap)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (eap->addr_count != 0)
 | 
			
		||||
    count = eap->line2;
 | 
			
		||||
  else
 | 
			
		||||
  if (eap->addr_count != 0) {
 | 
			
		||||
    assert(eap->line2 <= INT_MAX);
 | 
			
		||||
    count = (int)eap->line2;
 | 
			
		||||
  } else {
 | 
			
		||||
    count = 1;
 | 
			
		||||
  }
 | 
			
		||||
  while (count--) {
 | 
			
		||||
    if (eap->cmdidx == CMD_colder || eap->cmdidx == CMD_lolder) {
 | 
			
		||||
      if (qi->qf_curlist == 0) {
 | 
			
		||||
@@ -1948,7 +1952,7 @@ static char_u *qf_types(int c, int nr)
 | 
			
		||||
    p = (char_u *)"";
 | 
			
		||||
  else {
 | 
			
		||||
    cc[0] = ' ';
 | 
			
		||||
    cc[1] = c;
 | 
			
		||||
    cc[1] = (char_u)c;
 | 
			
		||||
    cc[2] = NUL;
 | 
			
		||||
    p = cc;
 | 
			
		||||
  }
 | 
			
		||||
@@ -2036,12 +2040,13 @@ void ex_copen(exarg_T *eap)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (eap->addr_count != 0)
 | 
			
		||||
    height = eap->line2;
 | 
			
		||||
  else
 | 
			
		||||
  if (eap->addr_count != 0) {
 | 
			
		||||
    assert(eap->line2 <= INT_MAX);
 | 
			
		||||
    height = (int)eap->line2;
 | 
			
		||||
  } else {
 | 
			
		||||
    height = QF_WINHEIGHT;
 | 
			
		||||
 | 
			
		||||
  reset_VIsual_and_resel();                     /* stop Visual mode */
 | 
			
		||||
  }
 | 
			
		||||
  reset_VIsual_and_resel();  // stop Visual mode
 | 
			
		||||
 | 
			
		||||
  /*
 | 
			
		||||
   * Find existing quickfix window, or open a new one.
 | 
			
		||||
@@ -2434,7 +2439,7 @@ void ex_make(exarg_T *eap)
 | 
			
		||||
{
 | 
			
		||||
  char_u      *fname;
 | 
			
		||||
  char_u      *cmd;
 | 
			
		||||
  unsigned len;
 | 
			
		||||
  size_t len;
 | 
			
		||||
  win_T       *wp = NULL;
 | 
			
		||||
  qf_info_T   *qi = &ql_info;
 | 
			
		||||
  int res;
 | 
			
		||||
@@ -2475,9 +2480,10 @@ void ex_make(exarg_T *eap)
 | 
			
		||||
  /*
 | 
			
		||||
   * If 'shellpipe' empty: don't redirect to 'errorfile'.
 | 
			
		||||
   */
 | 
			
		||||
  len = (unsigned)STRLEN(p_shq) * 2 + (unsigned)STRLEN(eap->arg) + 1;
 | 
			
		||||
  if (*p_sp != NUL)
 | 
			
		||||
    len += (unsigned)STRLEN(p_sp) + (unsigned)STRLEN(fname) + 3;
 | 
			
		||||
  len = STRLEN(p_shq) * 2 + STRLEN(eap->arg) + 1;
 | 
			
		||||
  if (*p_sp != NUL) {
 | 
			
		||||
    len += STRLEN(p_sp) + STRLEN(fname) + 3;
 | 
			
		||||
  }
 | 
			
		||||
  cmd = xmalloc(len);
 | 
			
		||||
  sprintf((char *)cmd, "%s%s%s", (char *)p_shq, (char *)eap->arg,
 | 
			
		||||
      (char *)p_shq);
 | 
			
		||||
@@ -2548,11 +2554,11 @@ static char_u *get_mef_name(void)
 | 
			
		||||
 | 
			
		||||
  /* Keep trying until the name doesn't exist yet. */
 | 
			
		||||
  for (;; ) {
 | 
			
		||||
    if (start == -1)
 | 
			
		||||
      start = os_get_pid();
 | 
			
		||||
    else
 | 
			
		||||
    if (start == -1) {
 | 
			
		||||
      start = (int)os_get_pid();
 | 
			
		||||
    } else {
 | 
			
		||||
      off += 19;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    name = xmalloc(STRLEN(p_mef) + 30);
 | 
			
		||||
    STRCPY(name, p_mef);
 | 
			
		||||
    sprintf((char *)name + (p - p_mef), "%d%d", start, off);
 | 
			
		||||
@@ -2899,7 +2905,7 @@ void ex_vimgrep(exarg_T *eap)
 | 
			
		||||
  int found_match;
 | 
			
		||||
  buf_T       *first_match_buf = NULL;
 | 
			
		||||
  time_t seconds = 0;
 | 
			
		||||
  int save_mls;
 | 
			
		||||
  long save_mls;
 | 
			
		||||
  char_u      *save_ei = NULL;
 | 
			
		||||
  aco_save_T aco;
 | 
			
		||||
  int flags = 0;
 | 
			
		||||
@@ -3456,18 +3462,12 @@ int get_errorlist(win_T *wp, list_T *list)
 | 
			
		||||
 */
 | 
			
		||||
int set_errorlist(win_T *wp, list_T *list, int action, char_u *title)
 | 
			
		||||
{
 | 
			
		||||
  listitem_T  *li;
 | 
			
		||||
  dict_T      *d;
 | 
			
		||||
  char_u      *filename, *pattern, *text, *type;
 | 
			
		||||
  int bufnum;
 | 
			
		||||
  long lnum;
 | 
			
		||||
  int col, nr;
 | 
			
		||||
  int vcol;
 | 
			
		||||
  qfline_T    *prevp = NULL;
 | 
			
		||||
  int valid, status;
 | 
			
		||||
  listitem_T *li;
 | 
			
		||||
  dict_T *d;
 | 
			
		||||
  qfline_T *prevp = NULL;
 | 
			
		||||
  int retval = OK;
 | 
			
		||||
  qf_info_T   *qi = &ql_info;
 | 
			
		||||
  int did_bufnr_emsg = FALSE;
 | 
			
		||||
  qf_info_T *qi = &ql_info;
 | 
			
		||||
  bool did_bufnr_emsg = false;
 | 
			
		||||
 | 
			
		||||
  if (wp != NULL) {
 | 
			
		||||
    qi = ll_get_or_alloc_list(wp);
 | 
			
		||||
@@ -3494,21 +3494,22 @@ int set_errorlist(win_T *wp, list_T *list, int action, char_u *title)
 | 
			
		||||
    if (d == NULL)
 | 
			
		||||
      continue;
 | 
			
		||||
 | 
			
		||||
    filename = get_dict_string(d, (char_u *)"filename", TRUE);
 | 
			
		||||
    bufnum = get_dict_number(d, (char_u *)"bufnr");
 | 
			
		||||
    lnum = get_dict_number(d, (char_u *)"lnum");
 | 
			
		||||
    col = get_dict_number(d, (char_u *)"col");
 | 
			
		||||
    vcol = get_dict_number(d, (char_u *)"vcol");
 | 
			
		||||
    nr = get_dict_number(d, (char_u *)"nr");
 | 
			
		||||
    type = get_dict_string(d, (char_u *)"type", TRUE);
 | 
			
		||||
    pattern = get_dict_string(d, (char_u *)"pattern", TRUE);
 | 
			
		||||
    text = get_dict_string(d, (char_u *)"text", TRUE);
 | 
			
		||||
    if (text == NULL)
 | 
			
		||||
    char_u *filename = get_dict_string(d, (char_u *)"filename", true);
 | 
			
		||||
    int bufnum = (int)get_dict_number(d, (char_u *)"bufnr");
 | 
			
		||||
    long lnum = get_dict_number(d, (char_u *)"lnum");
 | 
			
		||||
    int col = (int)get_dict_number(d, (char_u *)"col");
 | 
			
		||||
    char_u vcol = (char_u)get_dict_number(d, (char_u *)"vcol");
 | 
			
		||||
    int nr = (int)get_dict_number(d, (char_u *)"nr");
 | 
			
		||||
    char_u *type = get_dict_string(d, (char_u *)"type", true);
 | 
			
		||||
    char_u *pattern = get_dict_string(d, (char_u *)"pattern", true);
 | 
			
		||||
    char_u *text = get_dict_string(d, (char_u *)"text", true);
 | 
			
		||||
    if (text == NULL) {
 | 
			
		||||
      text = vim_strsave((char_u *)"");
 | 
			
		||||
 | 
			
		||||
    valid = TRUE;
 | 
			
		||||
    if ((filename == NULL && bufnum == 0) || (lnum == 0 && pattern == NULL))
 | 
			
		||||
      valid = FALSE;
 | 
			
		||||
    }
 | 
			
		||||
    bool valid = true;
 | 
			
		||||
    if ((filename == NULL && bufnum == 0) || (lnum == 0 && pattern == NULL)) {
 | 
			
		||||
      valid = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Mark entries with non-existing buffer number as not valid. Give the
 | 
			
		||||
     * error message only once. */
 | 
			
		||||
@@ -3517,22 +3518,23 @@ int set_errorlist(win_T *wp, list_T *list, int action, char_u *title)
 | 
			
		||||
        did_bufnr_emsg = TRUE;
 | 
			
		||||
        EMSGN(_("E92: Buffer %" PRId64 " not found"), bufnum);
 | 
			
		||||
      }
 | 
			
		||||
      valid = FALSE;
 | 
			
		||||
      valid = false;
 | 
			
		||||
      bufnum = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    status =  qf_add_entry(qi, &prevp,
 | 
			
		||||
        NULL,                               /* dir */
 | 
			
		||||
        filename,
 | 
			
		||||
        bufnum,
 | 
			
		||||
        text,
 | 
			
		||||
        lnum,
 | 
			
		||||
        col,
 | 
			
		||||
        vcol,                               /* vis_col */
 | 
			
		||||
        pattern,                            /* search pattern */
 | 
			
		||||
        nr,
 | 
			
		||||
        type == NULL ? NUL : *type,
 | 
			
		||||
        valid);
 | 
			
		||||
    int status = qf_add_entry(qi,
 | 
			
		||||
                              &prevp,
 | 
			
		||||
                              NULL,      // dir
 | 
			
		||||
                              filename,
 | 
			
		||||
                              bufnum,
 | 
			
		||||
                              text,
 | 
			
		||||
                              lnum,
 | 
			
		||||
                              col,
 | 
			
		||||
                              vcol,      // vis_col
 | 
			
		||||
                              pattern,   // search pattern
 | 
			
		||||
                              nr,
 | 
			
		||||
                              (char_u)(type == NULL ? NUL : *type),
 | 
			
		||||
                              valid);
 | 
			
		||||
 | 
			
		||||
    xfree(filename);
 | 
			
		||||
    xfree(pattern);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user