OSDN Git Service

xutils.c: Under the following conditions
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Tue, 2 Jul 2019 23:09:30 +0000 (08:09 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Tue, 2 Jul 2019 23:09:30 +0000 (08:09 +0900)
- Select diff algorithm other than 'default'
- Enable 'Ignore carriage return differences' (XDF_IGNORE_CR_AT_EOL)
- 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 da48bca..ba19400 100644 (file)
@@ -245,8 +245,11 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
                        i1++;
                        i2++;
                }
+               int has_eol1 = s1 > 0 && is_eol(l1 + s1 - 1, l1 + s1);
+               int has_eol2 = s2 > 0 && is_eol(l2 + s2 - 1, l2 + s2);
                return (ends_with_optional_cr(l1, s1, i1) &&
-                       ends_with_optional_cr(l2, s2, i2));
+                       ends_with_optional_cr(l2, s2, i2)) && 
+                       ((has_eol1 && has_eol2) || (!has_eol1 && !has_eol2));
        }
 
        /*