~ubuntu-branches/ubuntu/wily/wxwidgets3.0/wily-proposed

« back to all changes in this revision

Viewing changes to src/common/strconv.cpp

  • Committer: Package Import Robot
  • Author(s): Olly Betts
  • Date: 2014-06-18 12:42:22 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140618124222-y7t2vpsije1cesxy
Tags: 3.0.1-1
* New upstream release
  + Incorporates most of the patches we were carrying - only one left is:
    wx-config-conditionalise-webview-in-std.patch
* Drop versioning of dependencies from run-time libraries to wx-common -
  this will make the transition to the next wx version harder, and also
  makes backporting to wheezy more work.
* Mark -dbg packages as "Multi-Arch: same".
* Correct short descriptions of the webview packages to not just be
  copies of the corresponding media package's short description.
* Wrap 81 character line in package description.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1272
1272
                wxUint32 res = cc & (0x3f >> cnt);
1273
1273
                while (cnt--)
1274
1274
                {
 
1275
                    if (!isNulTerminated && !srcLen)
 
1276
                    {
 
1277
                        // invalid UTF-8 sequence ending before the end of code
 
1278
                        // point.
 
1279
                        invalid = true;
 
1280
                        break;
 
1281
                    }
 
1282
 
1275
1283
                    cc = *psz;
1276
1284
                    if ((cc & 0xC0) != 0x80)
1277
1285
                    {
1281
1289
                    }
1282
1290
 
1283
1291
                    psz++;
 
1292
                    if (!isNulTerminated)
 
1293
                        srcLen--;
1284
1294
                    res = (res << 6) | (cc & 0x3f);
1285
1295
                }
1286
1296
 
1628
1638
        return wxCONV_FAILED;
1629
1639
 
1630
1640
    const size_t inLen = srcLen / BYTES_PER_CHAR;
1631
 
    if ( !dst )
1632
 
    {
1633
 
        // optimization: return maximal space which could be needed for this
1634
 
        // string even if the real size could be smaller if the buffer contains
1635
 
        // any surrogates
1636
 
        return inLen;
1637
 
    }
1638
 
 
1639
1641
    size_t outLen = 0;
1640
1642
    const wxUint16 *inBuff = reinterpret_cast<const wxUint16 *>(src);
1641
1643
    for ( const wxUint16 * const inEnd = inBuff + inLen; inBuff < inEnd; )
1644
1646
        if ( !inBuff )
1645
1647
            return wxCONV_FAILED;
1646
1648
 
1647
 
        if ( ++outLen > dstLen )
1648
 
            return wxCONV_FAILED;
1649
 
 
1650
 
        *dst++ = ch;
 
1649
        outLen++;
 
1650
 
 
1651
        if ( dst )
 
1652
        {
 
1653
            if ( outLen > dstLen )
 
1654
                return wxCONV_FAILED;
 
1655
 
 
1656
            *dst++ = ch;
 
1657
        }
1651
1658
    }
1652
1659
 
1653
1660
 
1701
1708
        return wxCONV_FAILED;
1702
1709
 
1703
1710
    const size_t inLen = srcLen / BYTES_PER_CHAR;
1704
 
    if ( !dst )
1705
 
    {
1706
 
        // optimization: return maximal space which could be needed for this
1707
 
        // string even if the real size could be smaller if the buffer contains
1708
 
        // any surrogates
1709
 
        return inLen;
1710
 
    }
1711
 
 
1712
1711
    size_t outLen = 0;
1713
1712
    const wxUint16 *inBuff = reinterpret_cast<const wxUint16 *>(src);
1714
1713
    for ( const wxUint16 * const inEnd = inBuff + inLen; inBuff < inEnd; )
1727
1726
        if ( numChars == 2 )
1728
1727
            inBuff++;
1729
1728
 
1730
 
        if ( ++outLen > dstLen )
1731
 
            return wxCONV_FAILED;
1732
 
 
1733
 
        *dst++ = ch;
 
1729
        outLen++;
 
1730
 
 
1731
        if ( dst )
 
1732
        {
 
1733
            if ( outLen > dstLen )
 
1734
                return wxCONV_FAILED;
 
1735
 
 
1736
            *dst++ = ch;
 
1737
        }
1734
1738
    }
1735
1739
 
1736
1740