~ubuntu-branches/ubuntu/gutsy/firefox/gutsy

« back to all changes in this revision

Viewing changes to layout/generic/nsTextTransformer.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ian Jackson
  • Date: 2006-10-10 18:49:32 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20061010184932-da75izt7y0e59afq
Tags: 1.99+2.0rc2+dfsg-0ubuntu1
* New upstream version 2.0rc2.
* Fix/workaround for epiphany GtkSocket lifetype crash:
  apply patch id=241087 from Mozilla Bugzilla #241535 to fix LP #63814.
* Change application name to `Firefox', as requested by mdz.
  Files changed:
    - browser/locales/en-US/chrome/branding/brand.dtd
    - browser/locales/en-US/chrome/branding/brand.properties;
  New values:
    - brandShortName and brandFullName: `Bon Echo' => `Firefox'
    - vendorShortName: `Mozilla' => `Ubuntu'
* Make preferences dialogue fit again (bah!).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1495
1495
    aTextLength = newLen;
1496
1496
  } else {
1497
1497
    // Increasing |aTextLength| would cause a buffer overflow on |aText|
1498
 
    // by |StripZeroWidthJoinControls()| below.
 
1498
    // by the memcpy() below.
1499
1499
    NS_ERROR("ArabicShaping should not have increased the text length");
1500
1500
  }
1501
1501
  *aWasTransformed = PR_TRUE;
1502
1502
 
1503
 
  StripZeroWidthJoinControls(buffer, aText, aTextLength, aWasTransformed);
 
1503
  memcpy(aText, buffer, aTextLength * sizeof(PRUnichar));
1504
1504
}
1505
1505
 
1506
1506
void
1555
1555
  }
1556
1556
}
1557
1557
 
1558
 
void
1559
 
nsTextTransformer::StripZeroWidthJoinControls(PRUnichar* aSource,
1560
 
                                              PRUnichar* aTarget,
1561
 
                                              PRInt32& aTextLength, 
1562
 
                                              PRBool* aWasTransformed)
1563
 
{
1564
 
  if (aTextLength < 0) {
1565
 
    NS_ERROR("negative text length");
1566
 
    aTextLength = 0;
1567
 
    return;
1568
 
  }
1569
 
 
1570
 
  const PRUnichar* src = aSource;
1571
 
  const PRUnichar* const end = aSource + aTextLength;
1572
 
  PRUnichar* dest = aTarget;
1573
 
 
1574
 
  while (src != end) {
1575
 
    if (*src == CH_ZWNJ || *src == CH_ZWJ) {
1576
 
      ++src;
1577
 
      *aWasTransformed = PR_TRUE;
1578
 
      continue;
1579
 
    }
1580
 
    *dest++ = *src++;
1581
 
  }
1582
 
 
1583
 
  aTextLength = dest - aTarget;
1584
 
}
1585
 
 
1586
1558
//----------------------------------------------------------------------
1587
1559
// Self test logic for this class. This will (hopefully) make sure
1588
1560
// that the forward and backward word iterator methods continue to