vim/vim-7.3-diff_check.patch
Ismail Dönmez d0af643bdf - Updated to revision 843, fixes the following problems
* Xxd doesn't have a license notice.
  * The ruler shows "Bot" even when there are only filler lines missing. (Gary Johnson)
  * CTRL-A in Visual mode doesn't work properly with "alpha" in 'nrformat'.
  * After CTRL-V CTRL-A mode isn't updated. (Hirohito Higashi)
  * With a sequence of commands using buffers in diff mode E749 is given. (itchyny)
  * Invalid memory access when using "exe 'sc'".
  * Gcc sanitizer complains about using a NULL pointer to memmove().
  * It is not possible to save and restore character search state.
  * Illegal memory access with "sy match a fold".
  * Invalid memory access when doing ":call g:".
  * Invalid memory access when doing ":fun X(".
  * Invalid memory access in file_pat_to_reg_pat().
  * 'linebreak' breaks c% if the last Visual selection was block. (Chris Morganiser, Issue 389)
  * Invalid memory access in file_pat_to_reg_pat.
  * Cursor moves after CTRL-A on alphabetic character.
  * Invalid memory access for ":syn keyword x a[".
  * Crash when using "syn keyword x c". (Dominique Pelle)
  * Crash when clicking in beval balloon. (Travis Lebsock)
  * Resetting 'encoding' when doing ":set all&" causes problems. (Bjorn Linse) Display is not updated.
  * When expanding `=expr` on the command line and encountering an error, the command is executed anyway.
  * $HOME in `=$HOME . '/.vimrc'` is expanded too early.
  * More side effects of ":set all&" are missing. (Björn Linse)
  * gettabvar() doesn't work after Vim start. (Szymon Wrozynski)
  * Comparing utf-8 sequences does not handle different byte sizes correctly.
  * Can't compile without the crypt feature. (John Marriott)

OBS-URL: https://build.opensuse.org/package/show/editors/vim?expand=0&rev=282
2015-09-01 09:14:52 +00:00

94 lines
2.7 KiB
Diff

Index: vim-7.4.843/src/diff.c
===================================================================
--- vim-7.4.843.orig/src/diff.c
+++ vim-7.4.843/src/diff.c
@@ -42,7 +42,7 @@ static void diff_check_unchanged __ARGS(
static int diff_check_sanity __ARGS((tabpage_T *tp, diff_T *dp));
static void diff_redraw __ARGS((int dofold));
static int diff_write __ARGS((buf_T *buf, char_u *fname));
-static void diff_file __ARGS((char_u *tmp_orig, char_u *tmp_new, char_u *tmp_diff));
+static int diff_file __ARGS((char_u *tmp_orig, char_u *tmp_new, char_u *tmp_diff));
static int diff_equal_entry __ARGS((diff_T *dp, int idx1, int idx2));
static int diff_cmp __ARGS((char_u *s1, char_u *s2));
#ifdef FEAT_FOLDING
@@ -667,6 +667,7 @@ ex_diffupdate(eap)
char_u *tmp_diff;
FILE *fd;
int ok;
+ int retval = 0;
int io_error = FALSE;
/* Delete all diffblocks. */
@@ -719,7 +720,7 @@ ex_diffupdate(eap)
if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1)
io_error = TRUE;
fclose(fd);
- diff_file(tmp_orig, tmp_new, tmp_diff);
+ retval = diff_file(tmp_orig, tmp_new, tmp_diff);
fd = mch_fopen((char *)tmp_diff, "r");
if (fd == NULL)
io_error = TRUE;
@@ -765,6 +766,12 @@ ex_diffupdate(eap)
}
#endif
+ /* diff returned an error */
+ if (retval == 2) {
+ ok = FALSE;
+ break;
+ }
+
/* If we checked if "-a" works already, break here. */
if (diff_a_works != MAYBE)
break;
@@ -808,10 +815,13 @@ ex_diffupdate(eap)
continue; /* skip buffer that isn't loaded */
if (diff_write(buf, tmp_new) == FAIL)
continue;
- diff_file(tmp_orig, tmp_new, tmp_diff);
-
- /* Read the diff output and add each entry to the diff list. */
- diff_read(idx_orig, idx_new, tmp_diff);
+ retval = diff_file(tmp_orig, tmp_new, tmp_diff);
+ if(retval == 2)
+ EMSG(_("E97: Cannot create diffs"));
+ else {
+ /* Read the diff output and add each entry to the diff list. */
+ diff_read(idx_orig, idx_new, tmp_diff);
+ }
mch_remove(tmp_diff);
mch_remove(tmp_new);
}
@@ -831,13 +841,14 @@ theend:
/*
* Make a diff between files "tmp_orig" and "tmp_new", results in "tmp_diff".
*/
- static void
+ static int
diff_file(tmp_orig, tmp_new, tmp_diff)
char_u *tmp_orig;
char_u *tmp_new;
char_u *tmp_diff;
{
char_u *cmd;
+ int retval=0;
size_t len;
#ifdef FEAT_EVAL
@@ -873,13 +884,14 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
#ifdef FEAT_AUTOCMD
block_autocmds(); /* Avoid ShellCmdPost stuff */
#endif
- (void)call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT);
+ retval = call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT);
#ifdef FEAT_AUTOCMD
unblock_autocmds();
#endif
vim_free(cmd);
}
}
+ return retval;
}
/*