Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/tools/qmap.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtCore module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5454    &shared_null,
    5555    { &shared_null, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    56     Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true
     56    Q_BASIC_ATOMIC_INITIALIZER(1), 0, 0, 0, false, true
    5757};
    5858
    5959QMapData *QMapData::createData()
    6060{
     61
     62
     63
     64
     65
    6166    QMapData *d = new QMapData;
     67
    6268    Node *e = reinterpret_cast<Node *>(d);
    6369    e->backward = e;
     
    6975    d->insertInOrder = false;
    7076    d->sharable = true;
     77
     78
    7179    return d;
    7280}
     
    8088        prev = cur;
    8189        cur = cur->forward[0];
    82         qFree(reinterpret_cast<char *>(prev) - offset);
     90        if (strictAlignment)
     91            qFreeAligned(reinterpret_cast<char *>(prev) - offset);
     92        else
     93            qFree(reinterpret_cast<char *>(prev) - offset);
    8394    }
    8495    delete this;
     
    8697
    8798QMapData::Node *QMapData::node_create(Node *update[], int offset)
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
    88118{
    89119    int level = 0;
     
    94124        mask <<= Sparseness;
    95125    }
    96 
    97     ++randomBits;
    98     if (level == 3 && !insertInOrder)
    99         randomBits = qrand();
    100126
    101127    if (level > topLevel) {
     
    106132    }
    107133
    108     void *concreteNode = qMalloc(offset + sizeof(Node) + level * sizeof(Node *));
     134    ++randomBits;
     135    if (level == 3 && !insertInOrder)
     136        randomBits = qrand();
     137
     138    void *concreteNode = strictAlignment ?
     139                         qMallocAligned(offset + sizeof(Node) + level * sizeof(Node *), alignment) :
     140                         qMalloc(offset + sizeof(Node) + level * sizeof(Node *));
     141    Q_CHECK_PTR(concreteNode);
     142
    109143    Node *abstractNode = reinterpret_cast<Node *>(reinterpret_cast<char *>(concreteNode) + offset);
    110144
     
    131165    }
    132166    --size;
    133     qFree(reinterpret_cast<char *>(node) - offset);
     167    if (strictAlignment)
     168        qFreeAligned(reinterpret_cast<char *>(node) - offset);
     169    else
     170        qFree(reinterpret_cast<char *>(node) - offset);
    134171}
    135172
     
    147184void QMapData::dump()
    148185{
    149     qDebug("Map data (ref = %d, size = %d, randomBits = %#.8x)", ref.atomic, size, randomBits);
     186    qDebug("Map data (ref = %d, size = %d, randomBits = %#.8x)", , size, randomBits);
    150187
    151188    QString preOutput;
     
    159196    Node *update[LastLevel + 1];
    160197    for (int i = 0; i <= topLevel; ++i) {
    161         str.sprintf("%d: [%.8x] -", i, adjust_ptr(forward[i]));
     198        str.sprintf("%d: [%.8x] -", i, adjust_ptr());
    162199        output[i] += str;
    163         update[i] = forward[i];
     200        update[i] = ;
    164201    }
    165202
    166     Node *node = forward[0];
     203    Node *node = ;
    167204    while (node != e) {
    168205        int level = 0;
     
    179216        }
    180217        for (int j = level + 1; j <= topLevel; ++j)
    181             output[j] += "---------------";
     218            output[j] += ;
    182219        node = node->forward[0];
    183220    }
    184221
    185     qDebug(preOutput.ascii());
     222    qDebug(preOutput.ascii());
    186223    for (int i = 0; i <= topLevel; ++i)
    187         qDebug(output[i].ascii());
     224        qDebug(output[i].ascii());
    188225}
    189226#endif
     
    195232    \ingroup tools
    196233    \ingroup shared
    197     \mainclass
     234
    198235    \reentrant
    199236
     
    903940/*! \typedef QMap::iterator::iterator_category
    904941
    905     \internal
     942  A synonym for \e {std::bidirectional_iterator_tag} indicating
     943  this iterator is a bidirectional iterator.
    906944*/
    907945
     
    11241162/*! \typedef QMap::const_iterator::iterator_category
    11251163
    1126     \internal
     1164  A synonym for \e {std::bidirectional_iterator_tag} indicating
     1165  this iterator is a bidirectional iterator.
    11271166*/
    11281167
     
    13161355    \ingroup tools
    13171356    \ingroup shared
    1318     \mainclass
     1357
    13191358    \reentrant
    13201359
Note: See TracChangeset for help on using the changeset viewer.