Fossil

Check-in [1274c97d]
Login

Check-in [1274c97d]

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

Overview
Comment:Fix function same_dline_ignore_allws(), for the case where one side of the diff was an empty line. Example where it went wrong: /fdiff?v1=d5e0c2dc93&v2=7ee7dd0a42&sbs=1&w
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1274c97d700ed05fbb60d327fa758562824bc280
User & Date: jan.nijtmans 2014-04-28 11:00:28
Context
2014-04-28
12:24
Remove unneeded variable: Since could_be_utf16() calls starts_with_utf16_bom() it can be deduced that for Unicode text, bRevUnicode always has the same value as bRevUtf16. The comments on the variables already suggested that. ... (check-in: 09f23863 user: jan.nijtmans tags: trunk)
11:00
Fix function same_dline_ignore_allws(), for the case where one side of the diff was an empty line. Example where it went wrong: /fdiff?v1=d5e0c2dc93&v2=7ee7dd0a42&sbs=1&w ... (check-in: 1274c97d user: jan.nijtmans tags: trunk)
10:26
Use file_access(..., F_OK) in stead of file_access(..., 0) everywhere, in case some platforms exist where F_OK != 0. Remove a few end-of-line spaces. ... (check-in: 9df71fe3 user: jan.nijtmans tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/diff.c.

218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
** all whitespace. The indent field of pA/pB already points
** to the first non-space character in the string.
*/

static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){
  int a = pA->indent, b = pB->indent;
  if( pA->h==pB->h ){
    while( a<pA->n && b<pB->n ){
      if( pA->z[a++] != pB->z[b++] ) return 0;
      while( a<pA->n && fossil_isspace(pA->z[a])) ++a;
      while( b<pB->n && fossil_isspace(pB->z[b])) ++b;
    }
    return pA->n-a == pB->n-b;
  }
  return 0;
}







|
|







218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
** all whitespace. The indent field of pA/pB already points
** to the first non-space character in the string.
*/

static int same_dline_ignore_allws(const DLine *pA, const DLine *pB){
  int a = pA->indent, b = pB->indent;
  if( pA->h==pB->h ){
    while( a<pA->n || b<pB->n ){
      if( a<pA->n && b<pB->n && pA->z[a++] != pB->z[b++] ) return 0;
      while( a<pA->n && fossil_isspace(pA->z[a])) ++a;
      while( b<pB->n && fossil_isspace(pB->z[b])) ++b;
    }
    return pA->n-a == pB->n-b;
  }
  return 0;
}