Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/text/qtextformat.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    266266};
    267267
    268 // this is only safe if sizeof(int) == sizeof(float)
     268// this is only safe because sizeof(int) == sizeof(float)
    269269static inline uint hash(float d)
    270270{
     271#ifdef Q_CC_GNU
     272    // this is a GCC extension and isn't guaranteed to work in other compilers
     273    // the reinterpret_cast below generates a strict-aliasing warning with GCC
     274    union { float f; uint u; } cvt;
     275    cvt.f = d;
     276    return cvt.u;
     277#else
    271278    return reinterpret_cast<uint&>(d);
     279#endif
    272280}
    273281
     
    901909int QTextFormat::intProperty(int propertyId) const
    902910{
     911    // required, since the default layout direction has to be LayoutDirectionAuto, which is not integer 0
     912    int def = (propertyId == QTextFormat::LayoutDirection) ? int(Qt::LayoutDirectionAuto) : 0;
     913
    903914    if (!d)
    904         return 0;
     915        return def;
    905916    const QVariant prop = d->property(propertyId);
    906917    if (prop.userType() != QVariant::Int)
    907         return 0;
     918        return def;
    908919    return prop.toInt();
    909920}
Note: See TracChangeset for help on using the changeset viewer.