~ubuntu-branches/ubuntu/precise/konversation/precise-security

« back to all changes in this revision

Viewing changes to src/common.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2010-02-12 08:15:45 UTC
  • Revision ID: james.westby@ubuntu.com-20100212081545-nzob6du9r7wahcfo
Tags: 1.2.3-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
329
329
        for (int i = 0; i < s.length(); ++i)
330
330
        {
331
331
            QChar c(s.at(i));
332
 
            if (c.category() == QChar::Other_Surrogate)
333
 
            {
334
 
                if (!c.isHighSurrogate() || (!(i+1 < s.length()) && !s.at(i+1).isLowSurrogate()))
335
 
                    Q_ASSERT("something let a bad surrogate pair through! send the backtrace, tell us how it happened");
336
 
 
337
 
                QChar next = s.at(i+1);
338
 
                if ((next.unicode()&0x3FE) == 0x3FE && (c.unicode()&0x3F) == 0x3F)
339
 
                    s.replace(i, 2, QChar(0xFFFD)); //its one of the last two of the plane, replace it
340
 
 
341
 
                ++i; // skip the high surrogate now, the loop takes care of the low
342
 
            }
343
 
            else if ((c.category() == QChar::Other_NotAssigned) //perhaps Qt will use QChar::Other_NotAssigned some day
 
332
            if ((c.category() == QChar::Other_NotAssigned) //perhaps Qt will use QChar::Other_NotAssigned some day
344
333
                || (c.unicode() >= 0xFDD0 && c.unicode() <= 0xFDEF) //Unicode class Cn on BMP only
345
334
                || (c.unicode() == 0xFFFE || (c.unicode() == 0xFFFF)) //Unicode class Cn on all planes
 
335
                || (c.category() == QChar::Other_Surrogate)
346
336
                )
347
337
            {
348
338
                s.replace(i, 1, QChar(0xFFFD));