Fossil

Check-in [dacc2bad]
Login

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

Overview
Comment:Fix binary blob detection in the new break_into_lines() algorithm.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | binDiffFix
Files: files | file ages | folders
SHA1: dacc2bad82d0073a133c77616f3f8f336ec7a4b9
User & Date: mistachkin 2016-10-03 19:22:25
Context
2016-10-03
21:59
Initial tests for the diff-binary-detection fixes. check-in: 5db0eb52 user: mistachkin tags: binDiffFix
19:22
Fix binary blob detection in the new break_into_lines() algorithm. check-in: dacc2bad user: mistachkin tags: binDiffFix
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.

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
...
175
176
177
178
179
180
181




182
183
184
185
186
187
188
189
190
191




192
193
194
195
196
197
198
  if( nLine==0 ){
    *pnLine = 0;
    return a;
  }
  i = 0;
  do{
    zNL = strchr(z,'\n');
    if( zNL==0 ) zNL = z+strlen(z);
    nn = (int)(zNL - z);
    if( nn>LENGTH_MASK ){
      fossil_free(a);
      return 0;
    }
    a[i].z = z;
    k = nn;
................................................................................
    if( diffFlags & DIFF_IGNORE_EOLWS ){
      while( k>0 && fossil_isspace(z[k-1]) ){ k--; }
    }
    if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
      int numws = 0;
      while( s<k && fossil_isspace(z[s]) ){ s++; }
      for(h=0, x=s; x<k; x++){




        if( fossil_isspace(z[x]) ){
          ++numws;
        }else{
          h += z[x];
          h *= 0x9e3779b1;
        }
      }
      k -= numws;
    }else{
      for(h=0, x=s; x<k; x++){




        h += z[x];
        h *= 0x9e3779b1;
      }
    }
    a[i].indent = s;
    a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s);
    h2 = h % nLine;







|







 







>
>
>
>










>
>
>
>







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
...
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
  if( nLine==0 ){
    *pnLine = 0;
    return a;
  }
  i = 0;
  do{
    zNL = strchr(z,'\n');
    if( zNL==0 ) zNL = z+n;
    nn = (int)(zNL - z);
    if( nn>LENGTH_MASK ){
      fossil_free(a);
      return 0;
    }
    a[i].z = z;
    k = nn;
................................................................................
    if( diffFlags & DIFF_IGNORE_EOLWS ){
      while( k>0 && fossil_isspace(z[k-1]) ){ k--; }
    }
    if( (diffFlags & DIFF_IGNORE_ALLWS)==DIFF_IGNORE_ALLWS ){
      int numws = 0;
      while( s<k && fossil_isspace(z[s]) ){ s++; }
      for(h=0, x=s; x<k; x++){
        if( z[x]==0 ){
          fossil_free(a);
          return 0;
        }
        if( fossil_isspace(z[x]) ){
          ++numws;
        }else{
          h += z[x];
          h *= 0x9e3779b1;
        }
      }
      k -= numws;
    }else{
      for(h=0, x=s; x<k; x++){
        if( z[x]==0 ){
          fossil_free(a);
          return 0;
        }
        h += z[x];
        h *= 0x9e3779b1;
      }
    }
    a[i].indent = s;
    a[i].h = h = (h<<LENGTH_MASK_SZ) | (k-s);
    h2 = h % nLine;