Changeset 419


Ignore:
Timestamp:
Dec 11, 2009, 6:51:58 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

Use UniStrcoll for QString::localeAwareCompare() (closes #115).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/tools/qstring.cpp

    r2 r419  
    6060#endif
    6161
     62#ifdef Q_OS_OS2
     63#include "qatomic.h"
     64#include <unidef.h>
     65#endif
     66
    6267#include <private/qfunctions_p.h>
    6368
     
    33313336}
    33323337
    3333 #ifndef Q_WS_MAC
     3338#if !defined(Q_WS_MAC) && !defined(Q_OS_OS2)
    33343339static QByteArray toLocal8Bit_helper(const QChar *data, int length)
    33353340{
     
    45694574    default:
    45704575        return 0;
     4576    }
     4577#elif defined(Q_OS_OS2)
     4578    static QAtomicPointer<void> localeObj;
     4579    if (!localeObj) {
     4580        LocaleObject lo = 0;
     4581        UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &lo);
     4582        if (!localeObj.testAndSetRelaxed(0, lo))
     4583            UniFreeLocaleObject(lo); // we are too late
     4584    }
     4585    if (localeObj) {
     4586        // note: we assume that data1 and data2 are zero-terminated (to avoid
     4587        // creation of dumb deep copies) which is at least true for 4.5.1.
     4588#if QT_VERSION == 0x040501
     4589        return UniStrcoll(localeObj, (UniChar*)data1, (UniChar *)data2);
     4590#else
     4591# error "Check me!"
     4592#endif
     4593    } else {
     4594        return ucstrcmp(data1, length1, data2, length2);
    45714595    }
    45724596#elif defined (Q_OS_MAC)
Note: See TracChangeset for help on using the changeset viewer.