Fossil

Check-in [334ab152]
Login

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

Overview
Comment:If a file to be diffed contains an 0x00 character, consider it to be binary and do not attempt the diff.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:334ab15270b814ac259b5787298f1e6b80edd81f
User & Date: drh 2016-10-04 01:53:58
Context
2016-10-04
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
2016-10-02
01:26
Update custom MinGW makefile. check-in: 903af996 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diff.c.

145
146
147
148
149
150
151

152
153
154
155
156
157
158
  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++;


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







>







145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
  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;
  }