Changes On Branch utf16Bom
Not logged in

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

Changes In Branch utf16Bom Excluding Merge-Ins

This is equivalent to a diff from a98467b661 to 1e70f211f9

2013-02-18
13:46
Fixed ticket [5df2715635b99bd46a] (check-in count mismatch). check-in: b27c0d6d3f user: stephan tags: trunk
10:03
New function fossil_utf8_to_filename, such that fossil_unicode_to_utf8/fossil_utf8_to_unicode/fossil_unicode_free are not used on UNIX/MAC any more: On UNIX those 3 functions were only no-ops, but this allows to re-implement then for real unicode <-> utf-8 conversions. There is an "#ifdef _WIN32" around those 3 functions and 2 more (fossil_mbcs_to... Leaf check-in: cc3976fd30 user: jan.nijtmans tags: fossil_utf8_to_filename
08:30
merge trunk Leaf check-in: fdd51b617c user: jan.nijtmans tags: ticket-d17d6e5b17
2013-02-17
21:37
merge trunk Leaf check-in: fdf9050c4b user: jan.nijtmans tags: improve_commit_warning
14:47
More simplification in UTF-16 bom detection Leaf check-in: 1e70f211f9 user: jan.nijtmans tags: utf16Bom
14:43
Remove two unused variables check-in: a98467b661 user: jan.nijtmans tags: trunk
2013-02-16
14:12
Limit the complexity of the diff display on check-in information pages. check-in: 4f95ea8c56 user: drh tags: trunk

Changes to src/diff.c.

368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385

386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
** or in reversed byte order.
*/
int starts_with_utf16_bom(
  const Blob *pContent, /* IN: Blob content to perform BOM detection on. */
  int *pnByte,          /* OUT: The number of bytes used for the BOM. */
  int *pbReverse        /* OUT: Non-zero for BOM in reverse byte-order. */
){
  const char *z = blob_buffer(pContent);
  int bomSize = 2;
  static const unsigned short bom = 0xfeff;
  static const unsigned short bom_reversed = 0xfffe;
  static const unsigned short null = 0;
  int size;

  if( pnByte ) *pnByte = bomSize;
  if( pbReverse ) *pbReverse = -1; /* Unknown. */
  size = blob_size(pContent);
  if( (size<bomSize) || (size%2) ) return 0;

  if( memcmp(z, &bom_reversed, bomSize)==0 ){
    if( pbReverse ) *pbReverse = 1;
    if( size<(2*bomSize) ) return 1;
    if( memcmp(z+bomSize, &null, bomSize)!=0 ) return 1;
  }else if( memcmp(z, &bom, bomSize)==0 ){
    if( pbReverse ) *pbReverse = 0;
    if( size<(2*bomSize) ) return 1;
    if( memcmp(z+bomSize, &null, bomSize)!=0 ) return 1;
  }
  return 0;
}

/*
** Return true if two DLine elements are identical.
*/






|
|


<
|



<
|
>
|

|
<
<

<
<







368
369
370
371
372
373
374
375
376
377
378

379
380
381
382

383
384
385
386
387


388


389
390
391
392
393
394
395
** or in reversed byte order.
*/
int starts_with_utf16_bom(
  const Blob *pContent, /* IN: Blob content to perform BOM detection on. */
  int *pnByte,          /* OUT: The number of bytes used for the BOM. */
  int *pbReverse        /* OUT: Non-zero for BOM in reverse byte-order. */
){
  const unsigned short *z = (unsigned short *)blob_buffer(pContent);
  const int bomSize = 2;
  static const unsigned short bom = 0xfeff;
  static const unsigned short bom_reversed = 0xfffe;

  int size = blob_size(pContent);

  if( pnByte ) *pnByte = bomSize;
  if( pbReverse ) *pbReverse = -1; /* Unknown. */

  if( (size<bomSize) || (size%2)
    || (size>=(2*bomSize) && z[1]==0) ) return 0;
  if( z[0] == bom_reversed ){
    if( pbReverse ) *pbReverse = 1;
  }else if( z[0] == bom ){


    if( pbReverse ) *pbReverse = 0;


  }
  return 0;
}

/*
** Return true if two DLine elements are identical.
*/