drop an obsolete QChar::NoCategory enum value

there is no such category in the Unicode specs. the QChar::NoCategory
was a subject of bugs since it was introduced. int 4.6 it's meaning was
limited to mention ucs4 > UNICODE_LAST_CODEPOINT only (which is useless anyways)
in order to preserve the old (wrong) behavior.
fix it now for qtbase

Change-Id: I630534824e071090b39772881e747c1fdb758719
Reviewed-on: http://codereview.qt.nokia.com/1584
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Ritt Konstantin 2011-07-08 18:24:57 +04:00 committed by Qt by Nokia
parent 4a8d8055b4
commit d17c76feee
7 changed files with 8 additions and 16 deletions

2
dist/changes-5.0.0 vendored
View File

@ -38,6 +38,8 @@ Third party components
QtCore
------
* drop a bogus QChar::NoCategory enum value; the proper QChar::Other_NotAssigned
value is returned for an unassigned codepoints now.
QtGui
-----

View File

@ -120,7 +120,7 @@ void CharacterWidget::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
lastKey = (event->y()/squareSize)*columns + event->x()/squareSize;
if (QChar(lastKey).category() != QChar::NoCategory)
if (QChar(lastKey).category() != QChar::Other_NotAssigned)
emit characterSelected(QString(QChar(lastKey)));
update();
}

View File

@ -52,8 +52,6 @@ typedef enum {
typedef enum
{
HB_NoCategory,
HB_Mark_NonSpacing, /* Mn */
HB_Mark_SpacingCombining, /* Mc */
HB_Mark_Enclosing, /* Me */

View File

@ -259,8 +259,6 @@ QT_BEGIN_NAMESPACE
\value Symbol_Other Unicode class name So
\value NoCategory Qt cannot find an appropriate category for the character.
\omitvalue Punctuation_Dask
\sa category()
@ -764,7 +762,7 @@ QChar::Category QChar::category() const
QChar::Category QChar::category(uint ucs4)
{
if (ucs4 > UNICODE_LAST_CODEPOINT)
return QChar::NoCategory;
return QChar::Other_NotAssigned;
return (QChar::Category) qGetProp(ucs4)->category;
}

View File

@ -93,8 +93,6 @@ public:
enum Category
{
NoCategory, // ### Qt 5: replace with Other_NotAssigned
Mark_NonSpacing, // Mn
Mark_SpacingCombining, // Mc
Mark_Enclosing, // Me

View File

@ -289,11 +289,10 @@ void tst_QChar::category()
QVERIFY(QChar::category(0xdc00u) == QChar::Other_Surrogate);
QVERIFY(QChar::category(0xdc01u) == QChar::Other_Surrogate);
QVERIFY(QChar::category((uint)0x10fffdu) == QChar::Other_PrivateUse);
QVERIFY(QChar::category((uint)0x110000u) == QChar::NoCategory);
QVERIFY(QChar::category((uint)0x1aff) == QChar::Other_NotAssigned);
QVERIFY(QChar::category((uint)0x10fffdu) == QChar::Other_PrivateUse);
QVERIFY(QChar::category((uint)0x10ffffu) == QChar::Other_NotAssigned);
QVERIFY(QChar::category((uint)0x110000u) == QChar::Other_NotAssigned);
}
void tst_QChar::direction()

View File

@ -615,7 +615,7 @@ static void initCategoryMap()
{ QChar::Symbol_Currency, "Sc" },
{ QChar::Symbol_Modifier, "Sk" },
{ QChar::Symbol_Other, "So" },
{ QChar::NoCategory, 0 }
{ QChar::Other_NotAssigned, 0 }
};
Cat *c = categories;
while (c->name) {
@ -763,10 +763,7 @@ static void readUnicodeData()
}
UnicodeData data(codepoint);
data.p.category = categoryMap.value(properties[UD_Category], QChar::NoCategory);
if (data.p.category == QChar::NoCategory)
qFatal("unassigned char category: %s", properties[UD_Category].constData());
data.p.category = categoryMap.value(properties[UD_Category], QChar::Other_NotAssigned);
data.p.combiningClass = properties[UD_CombiningClass].toInt();
if (!combiningClassUsage.contains(data.p.combiningClass))
combiningClassUsage[data.p.combiningClass] = 1;