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

Overview
Comment:The previous check-in was interpreting any file that did not end in \n as binary. This check-in should fix the problem.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:47d1256cd8fee0cdb11eb374a2b2437a8bf2588a
User & Date: drh 2016-10-04 02:02:51
Context
2016-10-04
02:16
Detect binary files that look like text but end with a sequence of zeros. check-in: 0e0e29ae user: drh tags: trunk
02:02
The previous check-in was interpreting any file that did not end in \n as binary. This check-in should fix the problem. check-in: 47d1256c user: drh tags: trunk
01:53
If a file to be diffed contains an 0x00 character, consider it to be binary and do not attempt the diff. check-in: 334ab152 user: drh tags: trunk
Changes

Changes to src/diff.c.

144
145
146
147
148
149
150
151


152

153
154
155
156
157
158
159
  DLine *a;
  const char *zNL, *z2;

  /* Count the number of lines in the input file.  Include the last line
  ** in the count even if it lacks the \n terminator
  */
  for(nLine=0, z2=z; (zNL = strchr(z2,'\n'))!=0; z2=zNL+1, nLine++){}
  if( z2[0]!=0 ) nLine++;


  if( n!=(int)(z2-z) ) return 0;


  a = fossil_malloc( sizeof(a[0])*nLine );
  memset(a, 0, sizeof(a[0])*nLine);
  if( nLine==0 ){
    *pnLine = 0;
    return a;
  }







|
>
>
|
>







144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
  DLine *a;
  const char *zNL, *z2;

  /* Count the number of lines in the input file.  Include the last line
  ** in the count even if it lacks the \n terminator
  */
  for(nLine=0, z2=z; (zNL = strchr(z2,'\n'))!=0; z2=zNL+1, nLine++){}
  if( z2[0]!=0 ){
    nLine++;
    do{ z2++; }while( z2[0] );
    if( n!=(int)(z2-z) ) return 0;
  }

  a = fossil_malloc( sizeof(a[0])*nLine );
  memset(a, 0, sizeof(a[0])*nLine);
  if( nLine==0 ){
    *pnLine = 0;
    return a;
  }