Fossil

Check-in [5963c2dd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Correct wrong manual merge.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | improve_looks_like_binary
Files: files | file ages | folders
SHA1: 5963c2dde8801d5f88dcde24e95302cf63f3fd11
User & Date: jan.nijtmans 2012-11-01 15:38:24
Context
2012-11-01
15:38
Correct wrong manual merge. Closed-Leaf check-in: 5963c2dd user: jan.nijtmans tags: improve_looks_like_binary
14:49
Add back checks for FFFE and FFFF in looks_like_text:
- FFFE is a reversed BOM. It could arise when an UTF-16LE and an UTF-16BE file are concatenated. This is always a fatal error, so diff should bail out early.
- FFFF is a permanently unassigned character as well, which doesn't exist in any font. Sometimes uninitialized variables are either initialized with 0000 or FFFF, so this makes it much more likely that binary files are detected early.

The earlier check for FEFF was not sensible: A BOM in the middle of an UTF-16 file could easily arise when two UTF-16LE or twe UTF-16BE files are concatenated. Nothing goes wrong in that case, the BOM should just be displayed a zero-width-space. Therefore, diff should not bail out.

check-in: 64868f2b user: jan.nijtmans tags: improve_looks_like_binary
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diff.c.

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
*/
#define DIFF_CANNOT_COMPUTE_BINARY \
    "cannot compute difference between binary files\n"

#define DIFF_CANNOT_COMPUTE_SYMLINK \
    "cannot compute difference between symlink and regular file\n"

#define looks_like_binary(blob) ((looks_like_text(blob)&3) == 1)
#endif /* INTERFACE */

/*
** Maximum length of a line in a text file.  (8192)
*/
#define LENGTH_MASK_SZ  13
#define LENGTH_MASK     ((1<<LENGTH_MASK_SZ)-1)







|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
*/
#define DIFF_CANNOT_COMPUTE_BINARY \
    "cannot compute difference between binary files\n"

#define DIFF_CANNOT_COMPUTE_SYMLINK \
    "cannot compute difference between symlink and regular file\n"

#define looks_like_binary(blob) ((looks_like_text(blob)&3) != 1)
#endif /* INTERFACE */

/*
** Maximum length of a line in a text file.  (8192)
*/
#define LENGTH_MASK_SZ  13
#define LENGTH_MASK     ((1<<LENGTH_MASK_SZ)-1)