OSDN Git Service

xutils.c: Under the following conditions
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Mon, 8 Jul 2019 22:42:47 +0000 (07:42 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Mon, 8 Jul 2019 22:42:47 +0000 (07:42 +0900)
- Select diff algorithm other than 'default'
- Enable 'Ignore changes' or 'Ignore all' in 'Whitespace' group (XDF_IGNORE_WHITESPACE_CHANGE or XDF_IGNORE_WHITESPACE)
- EOL on the last line of the file does not exist on the other side but has the same content
libxdiff assumes that the last line is not different. However, it is not compatible with WinMerge. So I correct as there is a difference.

Externals/xdiff/xutils.c

index ba19400..8eef86c 100644 (file)
@@ -258,6 +258,10 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
         * ignore-whitespace-at-eol case may break out of the loop
         * while there still are characters remaining on both lines.
         */
+       int has_eol1 = s1 > 0 && is_eol(l1 + s1 - 1, l1 + s1);
+       int has_eol2 = s2 > 0 && is_eol(l2 + s2 - 1, l2 + s2);
+       if (!((has_eol1 && has_eol2) || (!has_eol1 && !has_eol2)))
+               return 0;
        if (i1 < s1) {
                while (i1 < s1 && XDL_ISSPACE(l1[i1]))
                        i1++;