Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Improvements to the way binary files are detected. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
8a1c80fb34958c4757605c1a8412b667 |
| User & Date: | drh 2012-10-26 01:38:47.107 |
Context
|
2012-10-26
| ||
| 02:35 | Improvements to side-by-side diff alignment. ... (check-in: 511405f426 user: drh tags: trunk) | |
| 01:38 | Improvements to the way binary files are detected. ... (check-in: 8a1c80fb34 user: drh tags: trunk) | |
|
2012-10-25
| ||
| 14:50 | diff.c:looks_like_binary(): No need to make the blob null-terminated. <p>checkin.c: Make limits the same as in looks_like_binary(), preparation to move the function to diff.c ... (Closed-Leaf check-in: c3ec6309fd user: jan.nijtmans tags: improve_looks_like_binary) | |
| 13:59 | Allow the deletion of multiple stash entries using "fossil stash rm" with multiple arguments. Multi-stash deletion is undoable. ... (check-in: f41308d780 user: drh tags: trunk) | |
Changes
Changes to src/checkin.c.
| ︙ | ︙ | |||
899 900 901 902 903 904 905 |
z = (unsigned char*)blob_buffer(p);
n = blob_size(p);
for(i=0; i<n-1; i++){
unsigned char c = z[i];
if( c==0 ) return; /* It's binary */
if( c=='\n' ){
if( i>0 && z[i-1]=='\r' ){
| | | | > | 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 |
z = (unsigned char*)blob_buffer(p);
n = blob_size(p);
for(i=0; i<n-1; i++){
unsigned char c = z[i];
if( c==0 ) return; /* It's binary */
if( c=='\n' ){
if( i>0 && z[i-1]=='\r' ){
nCrNl = 1;
if( i>8191 ) break;
}
lastNl = 0;
}else{
lastNl++;
/* Binary if any line longer than 8191, see looks_like_binary() */
if( lastNl>8191 ) return;
}
}
if( nCrNl ){
char c;
file_relative_name(zFilename, &fname, 0);
blob_zero(&ans);
zMsg = mprintf(
|
| ︙ | ︙ |
Changes to src/diff.c.
| ︙ | ︙ | |||
170 171 172 173 174 175 176 | return a; } /* ** Returns non-zero if the specified content appears to be binary or ** contains a line that is too long. */ | | | | | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
return a;
}
/*
** Returns non-zero if the specified content appears to be binary or
** contains a line that is too long.
*/
int looks_like_binary(const Blob *pContent){
const char *z = blob_buffer(pContent);
int n = blob_size(pContent);
int i, j;
/* Count the number of lines. Allocate space to hold
** the returned array.
*/
for(i=j=0; i<n; i++, j++){
int c = z[i];
if( c==0 ) return 1; /* \000 byte in a file -> binary */
if( c=='\n' ){
if( j>LENGTH_MASK ){
return 1; /* Very long line -> binary */
}
j = 0;
}
}
if( j>LENGTH_MASK ){
|
| ︙ | ︙ |