summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/tools/qchar.cpp28
-rw-r--r--src/corelib/tools/qstring.cpp4
-rw-r--r--util/unicode/main.cpp5
3 files changed, 18 insertions, 19 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 3d55a58..2bc5347 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -57,8 +57,6 @@
QT_BEGIN_NAMESPACE
-#define LAST_UNICODE_CHAR 0x10ffff
-
#ifndef QT_NO_CODEC_FOR_C_STRINGS
# ifdef QT_NO_TEXTCODEC
# define QT_NO_CODEC_FOR_C_STRINGS
@@ -714,7 +712,7 @@ int QChar::digitValue(ushort ucs2)
*/
int QChar::digitValue(uint ucs4)
{
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return 0;
return qGetProp(ucs4)->digitValue;
}
@@ -734,7 +732,7 @@ QChar::Category QChar::category() const
*/
QChar::Category QChar::category(uint ucs4)
{
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return QChar::NoCategory;
return (QChar::Category) qGetProp(ucs4)->category;
}
@@ -763,7 +761,7 @@ QChar::Direction QChar::direction() const
*/
QChar::Direction QChar::direction(uint ucs4)
{
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return QChar::DirL;
return (QChar::Direction) qGetProp(ucs4)->direction;
}
@@ -794,7 +792,7 @@ QChar::Joining QChar::joining() const
*/
QChar::Joining QChar::joining(uint ucs4)
{
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return QChar::OtherJoining;
return (QChar::Joining) qGetProp(ucs4)->joining;
}
@@ -872,7 +870,7 @@ QChar QChar::mirroredChar() const
*/
uint QChar::mirroredChar(uint ucs4)
{
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return ucs4;
return ucs4 + qGetProp(ucs4)->mirrorDiff;
}
@@ -907,7 +905,7 @@ static const unsigned short * QT_FASTCALL decompositionHelper
(uint ucs4, int *length, int *tag, unsigned short *buffer)
{
*length = 0;
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return 0;
if (ucs4 >= Hangul_SBase && ucs4 < Hangul_SBase + Hangul_SCount) {
int SIndex = ucs4 - Hangul_SBase;
@@ -967,7 +965,7 @@ QChar::Decomposition QChar::decompositionTag() const
*/
QChar::Decomposition QChar::decompositionTag(uint ucs4)
{
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return QChar::NoDecomposition;
const unsigned short index = GET_DECOMPOSITION_INDEX(ucs4);
if (index == 0xffff)
@@ -995,7 +993,7 @@ unsigned char QChar::combiningClass() const
*/
unsigned char QChar::combiningClass(uint ucs4)
{
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return 0;
return (unsigned char) qGetProp(ucs4)->combiningClass;
}
@@ -1025,7 +1023,7 @@ QChar::UnicodeVersion QChar::unicodeVersion() const
*/
QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4)
{
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return QChar::Unicode_Unassigned;
return (QChar::UnicodeVersion) qGetProp(ucs4)->unicodeVersion;
}
@@ -1061,7 +1059,7 @@ QChar QChar::toLower() const
*/
uint QChar::toLower(uint ucs4)
{
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return ucs4;
const QUnicodeTables::Properties *p = qGetProp(ucs4);
if (!p->lowerCaseSpecial)
@@ -1103,7 +1101,7 @@ QChar QChar::toUpper() const
*/
uint QChar::toUpper(uint ucs4)
{
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return ucs4;
const QUnicodeTables::Properties *p = qGetProp(ucs4);
if (!p->upperCaseSpecial)
@@ -1145,7 +1143,7 @@ QChar QChar::toTitleCase() const
*/
uint QChar::toTitleCase(uint ucs4)
{
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return ucs4;
const QUnicodeTables::Properties *p = qGetProp(ucs4);
if (!p->titleCaseSpecial)
@@ -1206,7 +1204,7 @@ QChar QChar::toCaseFolded() const
*/
uint QChar::toCaseFolded(uint ucs4)
{
- if (ucs4 > LAST_UNICODE_CHAR)
+ if (ucs4 > UNICODE_LAST_CODEPOINT)
return ucs4;
return ucs4 + qGetProp(ucs4)->caseFoldDiff;
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 703ec67..9ab0970 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -6191,7 +6191,7 @@ QStringList QString::split(const QRegExp &rx, SplitBehavior behavior) const
*/
QString QString::normalized(QString::NormalizationForm mode) const
{
- return normalized(mode, CURRENT_VERSION);
+ return normalized(mode, UNICODE_DATA_VERSION);
}
/*!
@@ -6273,7 +6273,7 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::
return;
QString &s = *data;
- if (version != CURRENT_VERSION) {
+ if (version != UNICODE_DATA_VERSION) {
for (int i = 0; i < NumNormalizationCorrections; ++i) {
const NormalizationCorrection &n = uc_normalization_corrections[i];
if (n.version > version) {
diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp
index 5a2f45e..521dcb0 100644
--- a/util/unicode/main.cpp
+++ b/util/unicode/main.cpp
@@ -55,6 +55,7 @@
#define DATA_VERSION_STR "QChar::Unicode_5_0"
#define LAST_CODEPOINT 0x10ffff
+#define LAST_CODEPOINT_STR "0x10ffff"
static QHash<QByteArray, QChar::UnicodeVersion> age_map;
@@ -2167,8 +2168,6 @@ static QByteArray createPropertyInfo()
" return uc_properties + index;\n"
"}\n\n";
- out += "#define CURRENT_VERSION "DATA_VERSION_STR"\n\n";
-
out += "static const ushort specialCaseMap[] = {\n ";
for (int i = 0; i < specialCaseMap.size(); ++i) {
out += QByteArray(" 0x") + QByteArray::number(specialCaseMap.at(i), 16);
@@ -2644,6 +2643,8 @@ int main(int, char **)
"#define QUNICODETABLES_P_H\n\n"
"#include <QtCore/qchar.h>\n\n"
"QT_BEGIN_NAMESPACE\n\n");
+ f.write("#define UNICODE_DATA_VERSION "DATA_VERSION_STR"\n\n");
+ f.write("#define UNICODE_LAST_CODEPOINT "LAST_CODEPOINT_STR"\n\n");
f.write("namespace QUnicodeTables {\n\n");
f.write(property_string);
f.write("\n");