summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-04-17 12:58:41 +0200
committerLars Knoll <lars.knoll@nokia.com>2012-04-17 12:58:52 +0200
commit64255ef6502b1144f7b0aa4b2bf62803e0d4788b (patch)
tree29bf116bfda2ccf61057115690d14f85cc9b085b /src/corelib/io
parent4a9fb41a7947d0bb7a47a9625603a436df288b24 (diff)
parent7e0beba891cb963a1d535bd45b0be78b43b8d07f (diff)
Merge remote-tracking branch 'origin/api_changes'
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/io.pri10
-rw-r--r--src/corelib/io/qdatastream.h4
-rw-r--r--src/corelib/io/qdataurl.cpp7
-rw-r--r--src/corelib/io/qdir.h2
-rw-r--r--src/corelib/io/qdiriterator.cpp4
-rw-r--r--src/corelib/io/qdiriterator.h2
-rw-r--r--src/corelib/io/qfile.cpp635
-rw-r--r--src/corelib/io/qfile.h62
-rw-r--r--src/corelib/io/qfile_p.h20
-rw-r--r--src/corelib/io/qfiledevice.cpp736
-rw-r--r--src/corelib/io/qfiledevice.h147
-rw-r--r--src/corelib/io/qfiledevice_p.h104
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp1
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp2
-rw-r--r--src/corelib/io/qipaddress.cpp344
-rw-r--r--src/corelib/io/qipaddress_p.h74
-rw-r--r--src/corelib/io/qresource.cpp2
-rw-r--r--src/corelib/io/qstandardpaths.cpp21
-rw-r--r--src/corelib/io/qstandardpaths.h2
-rw-r--r--src/corelib/io/qstandardpaths_json.cpp42
-rw-r--r--src/corelib/io/qstandardpaths_mac.cpp50
-rw-r--r--src/corelib/io/qstandardpaths_unix.cpp15
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp9
-rw-r--r--src/corelib/io/qtextstream.cpp2
-rw-r--r--src/corelib/io/qtldurl.cpp3
-rw-r--r--src/corelib/io/qurl.cpp6017
-rw-r--r--src/corelib/io/qurl.h298
-rw-r--r--src/corelib/io/qurl_p.h189
-rw-r--r--src/corelib/io/qurlidna.cpp2592
-rw-r--r--src/corelib/io/qurlquery.cpp729
-rw-r--r--src/corelib/io/qurlquery.h179
-rw-r--r--src/corelib/io/qurlrecode.cpp644
32 files changed, 7322 insertions, 5626 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 533938c057..d6379bf0fe 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -11,8 +11,11 @@ HEADERS += \
io/qdir_p.h \
io/qdiriterator.h \
io/qfile.h \
+ io/qfiledevice.h \
+ io/qfiledevice_p.h \
io/qfileinfo.h \
io/qfileinfo_p.h \
+ io/qipaddress_p.h \
io/qiodevice.h \
io/qiodevice_p.h \
io/qnoncontiguousbytedevice_p.h \
@@ -25,6 +28,8 @@ HEADERS += \
io/qresource_iterator_p.h \
io/qstandardpaths.h \
io/qurl.h \
+ io/qurl_p.h \
+ io/qurlquery.h \
io/qurltlds_p.h \
io/qtldurl_p.h \
io/qsettings.h \
@@ -49,7 +54,9 @@ SOURCES += \
io/qdir.cpp \
io/qdiriterator.cpp \
io/qfile.cpp \
+ io/qfiledevice.cpp \
io/qfileinfo.cpp \
+ io/qipaddress.cpp \
io/qiodevice.cpp \
io/qnoncontiguousbytedevice.cpp \
io/qprocess.cpp \
@@ -60,6 +67,9 @@ SOURCES += \
io/qresource_iterator.cpp \
io/qstandardpaths.cpp \
io/qurl.cpp \
+ io/qurlidna.cpp \
+ io/qurlquery.cpp \
+ io/qurlrecode.cpp \
io/qsettings.cpp \
io/qfsfileengine.cpp \
io/qfsfileengine_iterator.cpp \
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index 752246a543..533911974a 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -114,7 +114,7 @@ public:
explicit QDataStream(QIODevice *);
QDataStream(QByteArray *, QIODevice::OpenMode flags);
QDataStream(const QByteArray &);
- virtual ~QDataStream();
+ ~QDataStream();
QIODevice *device() const;
void setDevice(QIODevice *);
@@ -385,7 +385,6 @@ Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QMap<aKey, aT> &ma
in >> n;
map.detach();
- map.setInsertInOrder(true);
for (quint32 i = 0; i < n; ++i) {
if (in.status() != QDataStream::Ok)
break;
@@ -395,7 +394,6 @@ Q_OUTOFLINE_TEMPLATE QDataStream &operator>>(QDataStream &in, QMap<aKey, aT> &ma
in >> key >> value;
map.insertMulti(key, value);
}
- map.setInsertInOrder(false);
if (in.status() != QDataStream::Ok)
map.clear();
if (oldStatus != QDataStream::Ok)
diff --git a/src/corelib/io/qdataurl.cpp b/src/corelib/io/qdataurl.cpp
index 8002f10889..600f650bb5 100644
--- a/src/corelib/io/qdataurl.cpp
+++ b/src/corelib/io/qdataurl.cpp
@@ -61,11 +61,8 @@ Q_CORE_EXPORT bool qDecodeDataUrl(const QUrl &uri, QString &mimeType, QByteArray
// the following would have been the correct thing, but
// reality often differs from the specification. People have
// data: URIs with ? and #
- //QByteArray data = QByteArray::fromPercentEncoding(uri.encodedPath());
- QByteArray data = QByteArray::fromPercentEncoding(uri.toEncoded());
-
- // remove the data: scheme
- data.remove(0, 5);
+ //QByteArray data = QByteArray::fromPercentEncoding(uri.path(QUrl::PrettyDecoded).toLatin1());
+ QByteArray data = QByteArray::fromPercentEncoding(uri.url(QUrl::PrettyDecoded | QUrl::RemoveScheme).toLatin1());
// parse it:
int pos = data.indexOf(',');
diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h
index 5551ecd2fb..a5105fe2fb 100644
--- a/src/corelib/io/qdir.h
+++ b/src/corelib/io/qdir.h
@@ -52,6 +52,7 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+class QDirIterator;
class QDirPrivate;
class Q_CORE_EXPORT QDir
@@ -210,6 +211,7 @@ protected:
QSharedDataPointer<QDirPrivate> d_ptr;
private:
+ friend class QDirIterator;
// Q_DECLARE_PRIVATE equivalent for shared data pointers
QDirPrivate* d_func();
inline const QDirPrivate* d_func() const
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index b8536a8dce..56912e8706 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -410,9 +410,7 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf
*/
QDirIterator::QDirIterator(const QDir &dir, IteratorFlags flags)
{
- // little trick to get hold of the QDirPrivate while there is no API on QDir to give it to us
- class MyQDir : public QDir { public: const QDirPrivate *priv() const { return d_ptr.constData(); } };
- const QDirPrivate *other = static_cast<const MyQDir*>(&dir)->priv();
+ const QDirPrivate *other = dir.d_ptr.constData();
d.reset(new QDirIteratorPrivate(other->dirEntry, other->nameFilters, other->filters, flags, !other->fileEngine.isNull()));
}
diff --git a/src/corelib/io/qdiriterator.h b/src/corelib/io/qdiriterator.h
index 27189e2efd..d2d0645916 100644
--- a/src/corelib/io/qdiriterator.h
+++ b/src/corelib/io/qdiriterator.h
@@ -70,7 +70,7 @@ public:
QDir::Filters filters = QDir::NoFilter,
IteratorFlags flags = NoIteratorFlags);
- virtual ~QDirIterator();
+ ~QDirIterator();
QString next();
bool hasNext() const;
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index 6e7b39fcf4..120c5a8c23 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -59,8 +59,6 @@
QT_BEGIN_NAMESPACE
-static const int QFILE_WRITEBUFFER_SIZE = 16384;
-
static QByteArray locale_encode(const QString &f)
{
#if defined(Q_OS_DARWIN)
@@ -86,16 +84,11 @@ QFile::EncoderFn QFilePrivate::encoder = locale_encode;
QFile::DecoderFn QFilePrivate::decoder = locale_decode;
QFilePrivate::QFilePrivate()
- : fileEngine(0), lastWasWrite(false),
- writeBuffer(QFILE_WRITEBUFFER_SIZE), error(QFile::NoError),
- cachedSize(0)
{
}
QFilePrivate::~QFilePrivate()
{
- delete fileEngine;
- fileEngine = 0;
}
bool
@@ -137,39 +130,6 @@ QAbstractFileEngine *QFilePrivate::engine() const
return fileEngine;
}
-inline bool QFilePrivate::ensureFlushed() const
-{
- // This function ensures that the write buffer has been flushed (const
- // because certain const functions need to call it.
- if (lastWasWrite) {
- const_cast<QFilePrivate *>(this)->lastWasWrite = false;
- if (!const_cast<QFile *>(q_func())->flush())
- return false;
- }
- return true;
-}
-
-void
-QFilePrivate::setError(QFile::FileError err)
-{
- error = err;
- errorString.clear();
-}
-
-void
-QFilePrivate::setError(QFile::FileError err, const QString &errStr)
-{
- error = err;
- errorString = errStr;
-}
-
-void
-QFilePrivate::setError(QFile::FileError err, int errNum)
-{
- error = err;
- errorString = qt_error_string(errNum);
-}
-
//************* QFile
/*!
@@ -278,98 +238,18 @@ QFilePrivate::setError(QFile::FileError err, int errNum)
\sa QTextStream, QDataStream, QFileInfo, QDir, {The Qt Resource System}
*/
-/*!
- \enum QFile::FileError
-
- This enum describes the errors that may be returned by the error()
- function.
-
- \value NoError No error occurred.
- \value ReadError An error occurred when reading from the file.
- \value WriteError An error occurred when writing to the file.
- \value FatalError A fatal error occurred.
- \value ResourceError
- \value OpenError The file could not be opened.
- \value AbortError The operation was aborted.
- \value TimeOutError A timeout occurred.
- \value UnspecifiedError An unspecified error occurred.
- \value RemoveError The file could not be removed.
- \value RenameError The file could not be renamed.
- \value PositionError The position in the file could not be changed.
- \value ResizeError The file could not be resized.
- \value PermissionsError The file could not be accessed.
- \value CopyError The file could not be copied.
-
- \omitvalue ConnectError
-*/
-
-/*!
- \enum QFile::Permission
-
- This enum is used by the permission() function to report the
- permissions and ownership of a file. The values may be OR-ed
- together to test multiple permissions and ownership values.
-
- \value ReadOwner The file is readable by the owner of the file.
- \value WriteOwner The file is writable by the owner of the file.
- \value ExeOwner The file is executable by the owner of the file.
- \value ReadUser The file is readable by the user.
- \value WriteUser The file is writable by the user.
- \value ExeUser The file is executable by the user.
- \value ReadGroup The file is readable by the group.
- \value WriteGroup The file is writable by the group.
- \value ExeGroup The file is executable by the group.
- \value ReadOther The file is readable by anyone.
- \value WriteOther The file is writable by anyone.
- \value ExeOther The file is executable by anyone.
-
- \warning Because of differences in the platforms supported by Qt,
- the semantics of ReadUser, WriteUser and ExeUser are
- platform-dependent: On Unix, the rights of the owner of the file
- are returned and on Windows the rights of the current user are
- returned. This behavior might change in a future Qt version.
-
- Note that Qt does not by default check for permissions on NTFS
- file systems, as this may decrease the performance of file
- handling considerably. It is possible to force permission checking
- on NTFS by including the following code in your source:
-
- \snippet doc/src/snippets/ntfsp.cpp 0
-
- Permission checking is then turned on and off by incrementing and
- decrementing \c qt_ntfs_permission_lookup by 1.
-
- \snippet doc/src/snippets/ntfsp.cpp 1
-*/
-
-/*!
- \enum QFile::FileHandleFlag
-
- This enum is used when opening a file to specify additional
- options which only apply to files and not to a generic
- QIODevice.
-
- \value AutoCloseHandle The file handle passed into open() should be
- closed by close(), the default behavior is that close just flushes
- the file and the application is responsible for closing the file handle.
- When opening a file by name, this flag is ignored as Qt always owns the
- file handle and must close it.
- \value DontCloseHandle If not explicitly closed, the underlying file
- handle is left open when the QFile object is destroyed.
- */
-
#ifdef QT_NO_QOBJECT
QFile::QFile()
- : QIODevice(*new QFilePrivate)
+ : QFileDevice(*new QFilePrivate)
{
}
QFile::QFile(const QString &name)
- : QIODevice(*new QFilePrivate)
+ : QFileDevice(*new QFilePrivate)
{
d_func()->fileName = name;
}
QFile::QFile(QFilePrivate &dd)
- : QIODevice(dd)
+ : QFileDevice(dd)
{
}
#else
@@ -377,21 +257,21 @@ QFile::QFile(QFilePrivate &dd)
\internal
*/
QFile::QFile()
- : QIODevice(*new QFilePrivate, 0)
+ : QFileDevice(*new QFilePrivate, 0)
{
}
/*!
Constructs a new file object with the given \a parent.
*/
QFile::QFile(QObject *parent)
- : QIODevice(*new QFilePrivate, parent)
+ : QFileDevice(*new QFilePrivate, parent)
{
}
/*!
Constructs a new file object to represent the file with the given \a name.
*/
QFile::QFile(const QString &name)
- : QIODevice(*new QFilePrivate, 0)
+ : QFileDevice(*new QFilePrivate, 0)
{
Q_D(QFile);
d->fileName = name;
@@ -401,7 +281,7 @@ QFile::QFile(const QString &name)
file with the specified \a name.
*/
QFile::QFile(const QString &name, QObject *parent)
- : QIODevice(*new QFilePrivate, parent)
+ : QFileDevice(*new QFilePrivate, parent)
{
Q_D(QFile);
d->fileName = name;
@@ -410,7 +290,7 @@ QFile::QFile(const QString &name, QObject *parent)
\internal
*/
QFile::QFile(QFilePrivate &dd, QObject *parent)
- : QIODevice(dd, parent)
+ : QFileDevice(dd, parent)
{
}
#endif
@@ -420,7 +300,6 @@ QFile::QFile(QFilePrivate &dd, QObject *parent)
*/
QFile::~QFile()
{
- close();
}
/*!
@@ -967,20 +846,6 @@ QFile::copy(const QString &fileName, const QString &newName)
}
/*!
- Returns true if the file can only be manipulated sequentially;
- otherwise returns false.
-
- Most files support random-access, but some special files may not.
-
- \sa QIODevice::isSequential()
-*/
-bool QFile::isSequential() const
-{
- Q_D(const QFile);
- return d->fileEngine && d->fileEngine->isSequential();
-}
-
-/*!
Opens the file using OpenMode \a mode, returning true if successful;
otherwise false.
@@ -1154,119 +1019,11 @@ bool QFile::open(int fd, OpenMode mode, FileHandleFlags handleFlags)
}
/*!
- Returns the file handle of the file.
-
- This is a small positive integer, suitable for use with C library
- functions such as fdopen() and fcntl(). On systems that use file
- descriptors for sockets (i.e. Unix systems, but not Windows) the handle
- can be used with QSocketNotifier as well.
-
- If the file is not open, or there is an error, handle() returns -1.
-
- This function is not supported on Windows CE.
-
- \sa QSocketNotifier
-*/
-
-int
-QFile::handle() const
-{
- Q_D(const QFile);
- if (!isOpen() || !d->fileEngine)
- return -1;
-
- return d->fileEngine->handle();
-}
-
-/*!
- \enum QFile::MemoryMapFlags
- \since 4.4
-
- This enum describes special options that may be used by the map()
- function.
-
- \value NoOptions No options.
-*/
-
-/*!
- \since 4.4
- Maps \a size bytes of the file into memory starting at \a offset. A file
- should be open for a map to succeed but the file does not need to stay
- open after the memory has been mapped. When the QFile is destroyed
- or a new file is opened with this object, any maps that have not been
- unmapped will automatically be unmapped.
-
- Any mapping options can be passed through \a flags.
-
- Returns a pointer to the memory or 0 if there is an error.
-
- \note On Windows CE 5.0 the file will be closed before mapping occurs.
-
- \sa unmap()
- */
-uchar *QFile::map(qint64 offset, qint64 size, MemoryMapFlags flags)
-{
- Q_D(QFile);
- if (d->engine()
- && d->fileEngine->supportsExtension(QAbstractFileEngine::MapExtension)) {
- unsetError();
- uchar *address = d->fileEngine->map(offset, size, flags);
- if (address == 0)
- d->setError(d->fileEngine->error(), d->fileEngine->errorString());
- return address;
- }
- return 0;
-}
-
-/*!
- \since 4.4
- Unmaps the memory \a address.
-
- Returns true if the unmap succeeds; false otherwise.
-
- \sa map()
- */
-bool QFile::unmap(uchar *address)
-{
- Q_D(QFile);
- if (d->engine()
- && d->fileEngine->supportsExtension(QAbstractFileEngine::UnMapExtension)) {
- unsetError();
- bool success = d->fileEngine->unmap(address);
- if (!success)
- d->setError(d->fileEngine->error(), d->fileEngine->errorString());
- return success;
- }
- d->setError(PermissionsError, tr("No file engine available or engine does not support UnMapExtension"));
- return false;
-}
-
-/*!
- Sets the file size (in bytes) \a sz. Returns true if the file if the
- resize succeeds; false otherwise. If \a sz is larger than the file
- currently is the new bytes will be set to 0, if \a sz is smaller the
- file is simply truncated.
-
- \sa size(), setFileName()
+ \reimp
*/
-
-bool
-QFile::resize(qint64 sz)
+bool QFile::resize(qint64 sz)
{
- Q_D(QFile);
- if (!d->ensureFlushed())
- return false;
- d->engine();
- if (isOpen() && d->fileEngine->pos() > sz)
- seek(sz);
- if(d->fileEngine->setSize(sz)) {
- unsetError();
- d->cachedSize = sz;
- return true;
- }
- d->cachedSize = 0;
- d->setError(QFile::ResizeError, d->fileEngine->errorString());
- return false;
+ return QFileDevice::resize(sz); // for now
}
/*!
@@ -1287,18 +1044,11 @@ QFile::resize(const QString &fileName, qint64 sz)
}
/*!
- Returns the complete OR-ed together combination of
- QFile::Permission for the file.
-
- \sa setPermissions(), setFileName()
+ \reimp
*/
-
-QFile::Permissions
-QFile::permissions() const
+QFile::Permissions QFile::permissions() const
{
- Q_D(const QFile);
- QAbstractFileEngine::FileFlags perms = d->engine()->fileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask;
- return QFile::Permissions((int)perms); //ewww
+ return QFileDevice::permissions(); // for now
}
/*!
@@ -1322,16 +1072,9 @@ QFile::permissions(const QString &fileName)
\sa permissions(), setFileName()
*/
-bool
-QFile::setPermissions(Permissions permissions)
+bool QFile::setPermissions(Permissions permissions)
{
- Q_D(QFile);
- if (d->engine()->setPermissions(permissions)) {
- unsetError();
- return true;
- }
- d->setError(QFile::PermissionsError, d->fileEngine->errorString());
- return false;
+ return QFileDevice::setPermissions(permissions); // for now
}
/*!
@@ -1346,354 +1089,12 @@ QFile::setPermissions(const QString &fileName, Permissions permissions)
return QFile(fileName).setPermissions(permissions);
}
-static inline qint64 _qfile_writeData(QAbstractFileEngine *engine, QRingBuffer *buffer)
-{
- qint64 ret = engine->write(buffer->readPointer(), buffer->nextDataBlockSize());
- if (ret > 0)
- buffer->free(ret);
- return ret;
-}
-
-/*!
- Flushes any buffered data to the file. Returns true if successful;
- otherwise returns false.
-*/
-
-bool
-QFile::flush()
-{
- Q_D(QFile);
- if (!d->fileEngine) {
- qWarning("QFile::flush: No file engine. Is IODevice open?");
- return false;
- }
-
- if (!d->writeBuffer.isEmpty()) {
- qint64 size = d->writeBuffer.size();
- if (_qfile_writeData(d->fileEngine, &d->writeBuffer) != size) {
- QFile::FileError err = d->fileEngine->error();
- if(err == QFile::UnspecifiedError)
- err = QFile::WriteError;
- d->setError(err, d->fileEngine->errorString());
- return false;
- }
- }
-
- if (!d->fileEngine->flush()) {
- QFile::FileError err = d->fileEngine->error();
- if(err == QFile::UnspecifiedError)
- err = QFile::WriteError;
- d->setError(err, d->fileEngine->errorString());
- return false;
- }
- return true;
-}
-
-/*!
- Calls QFile::flush() and closes the file. Errors from flush are ignored.
-
- \sa QIODevice::close()
-*/
-void
-QFile::close()
-{
- Q_D(QFile);
- if(!isOpen())
- return;
- bool flushed = flush();
- QIODevice::close();
-
- // reset write buffer
- d->lastWasWrite = false;
- d->writeBuffer.clear();
-
- // keep earlier error from flush
- if (d->fileEngine->close() && flushed)
- unsetError();
- else if (flushed)
- d->setError(d->fileEngine->error(), d->fileEngine->errorString());
-}
-
-/*!
- Returns the size of the file.
-
- For regular empty files on Unix (e.g. those in \c /proc), this function
- returns 0; the contents of such a file are generated on demand in response
- to you calling read().
-*/
-
-qint64 QFile::size() const
-{
- Q_D(const QFile);
- if (!d->ensureFlushed())
- return 0;
- d->cachedSize = d->engine()->size();
- return d->cachedSize;
-}
-
-/*!
- \reimp
-*/
-
-qint64 QFile::pos() const
-{
- return QIODevice::pos();
-}
-
-/*!
- Returns true if the end of the file has been reached; otherwise returns
- false.
-
- For regular empty files on Unix (e.g. those in \c /proc), this function
- returns true, since the file system reports that the size of such a file is
- 0. Therefore, you should not depend on atEnd() when reading data from such a
- file, but rather call read() until no more data can be read.
-*/
-
-bool QFile::atEnd() const
-{
- Q_D(const QFile);
-
- // If there's buffered data left, we're not at the end.
- if (!d->buffer.isEmpty())
- return false;
-
- if (!isOpen())
- return true;
-
- if (!d->ensureFlushed())
- return false;
-
- // If the file engine knows best, say what it says.
- if (d->fileEngine->supportsExtension(QAbstractFileEngine::AtEndExtension)) {
- // Check if the file engine supports AtEndExtension, and if it does,
- // check if the file engine claims to be at the end.
- return d->fileEngine->atEnd();
- }
-
- // if it looks like we are at the end, or if size is not cached,
- // fall through to bytesAvailable() to make sure.
- if (pos() < d->cachedSize)
- return false;
-
- // Fall back to checking how much is available (will stat files).
- return bytesAvailable() == 0;
-}
-
-/*!
- \fn bool QFile::seek(qint64 pos)
-
- For random-access devices, this function sets the current position
- to \a pos, returning true on success, or false if an error occurred.
- For sequential devices, the default behavior is to do nothing and
- return false.
-
- Seeking beyond the end of a file:
- If the position is beyond the end of a file, then seek() shall not
- immediately extend the file. If a write is performed at this position,
- then the file shall be extended. The content of the file between the
- previous end of file and the newly written data is UNDEFINED and
- varies between platforms and file systems.
-*/
-
-bool QFile::seek(qint64 off)
-{
- Q_D(QFile);
- if (!isOpen()) {
- qWarning("QFile::seek: IODevice is not open");
- return false;
- }
-
- if (!d->ensureFlushed())
- return false;
-
- if (!d->fileEngine->seek(off) || !QIODevice::seek(off)) {
- QFile::FileError err = d->fileEngine->error();
- if(err == QFile::UnspecifiedError)
- err = QFile::PositionError;
- d->setError(err, d->fileEngine->errorString());
- return false;
- }
- unsetError();
- return true;
-}
-
-/*!
- \reimp
-*/
-qint64 QFile::readLineData(char *data, qint64 maxlen)
-{
- Q_D(QFile);
- if (!d->ensureFlushed())
- return -1;
-
- qint64 read;
- if (d->fileEngine->supportsExtension(QAbstractFileEngine::FastReadLineExtension)) {
- read = d->fileEngine->readLine(data, maxlen);
- } else {
- // Fall back to QIODevice's readLine implementation if the engine
- // cannot do it faster.
- read = QIODevice::readLineData(data, maxlen);
- }
-
- if (read < maxlen) {
- // failed to read all requested, may be at the end of file, stop caching size so that it's rechecked
- d->cachedSize = 0;
- }
-
- return read;
-}
-
-/*!
- \reimp
-*/
-
-qint64 QFile::readData(char *data, qint64 len)
-{
- Q_D(QFile);
- unsetError();
- if (!d->ensureFlushed())
- return -1;
-
- qint64 read = d->fileEngine->read(data, len);
- if(read < 0) {
- QFile::FileError err = d->fileEngine->error();
- if(err == QFile::UnspecifiedError)
- err = QFile::ReadError;
- d->setError(err, d->fileEngine->errorString());
- }
-
- if (read < len) {
- // failed to read all requested, may be at the end of file, stop caching size so that it's rechecked
- d->cachedSize = 0;
- }
-
- return read;
-}
-
-/*!
- \internal
-*/
-bool QFilePrivate::putCharHelper(char c)
-{
-#ifdef QT_NO_QOBJECT
- return QIODevicePrivate::putCharHelper(c);
-#else
-
- // Cutoff for code that doesn't only touch the buffer.
- int writeBufferSize = writeBuffer.size();
- if ((openMode & QIODevice::Unbuffered) || writeBufferSize + 1 >= QFILE_WRITEBUFFER_SIZE
-#ifdef Q_OS_WIN
- || ((openMode & QIODevice::Text) && c == '\n' && writeBufferSize + 2 >= QFILE_WRITEBUFFER_SIZE)
-#endif
- ) {
- return QIODevicePrivate::putCharHelper(c);
- }
-
- if (!(openMode & QIODevice::WriteOnly)) {
- if (openMode == QIODevice::NotOpen)
- qWarning("QIODevice::putChar: Closed device");
- else
- qWarning("QIODevice::putChar: ReadOnly device");
- return false;
- }
-
- // Make sure the device is positioned correctly.
- const bool sequential = isSequential();
- if (pos != devicePos && !sequential && !q_func()->seek(pos))
- return false;
-
- lastWasWrite = true;
-
- int len = 1;
-#ifdef Q_OS_WIN
- if ((openMode & QIODevice::Text) && c == '\n') {
- ++len;
- *writeBuffer.reserve(1) = '\r';
- }
-#endif
-
- // Write to buffer.
- *writeBuffer.reserve(1) = c;
-
- if (!sequential) {
- pos += len;
- devicePos += len;
- if (!buffer.isEmpty())
- buffer.skip(len);
- }
-
- return true;
-#endif
-}
-
/*!
\reimp
*/
-
-qint64
-QFile::writeData(const char *data, qint64 len)
-{
- Q_D(QFile);
- unsetError();
- d->lastWasWrite = true;
- bool buffered = !(d->openMode & Unbuffered);
-
- // Flush buffered data if this read will overflow.
- if (buffered && (d->writeBuffer.size() + len) > QFILE_WRITEBUFFER_SIZE) {
- if (!flush())
- return -1;
- }
-
- // Write directly to the engine if the block size is larger than
- // the write buffer size.
- if (!buffered || len > QFILE_WRITEBUFFER_SIZE) {
- qint64 ret = d->fileEngine->write(data, len);
- if(ret < 0) {
- QFile::FileError err = d->fileEngine->error();
- if(err == QFile::UnspecifiedError)
- err = QFile::WriteError;
- d->setError(err, d->fileEngine->errorString());
- }
- return ret;
- }
-
- // Write to the buffer.
- char *writePointer = d->writeBuffer.reserve(len);
- if (len == 1)
- *writePointer = *data;
- else
- ::memcpy(writePointer, data, len);
- return len;
-}
-
-/*!
- Returns the file error status.
-
- The I/O device status returns an error code. For example, if open()
- returns false, or a read/write operation returns -1, this function can
- be called to find out the reason why the operation failed.
-
- \sa unsetError()
-*/
-
-QFile::FileError
-QFile::error() const
-{
- Q_D(const QFile);
- return d->error;
-}
-
-/*!
- Sets the file's error to QFile::NoError.
-
- \sa error()
-*/
-void
-QFile::unsetError()
+qint64 QFile::size() const
{
- Q_D(QFile);
- d->setError(QFile::NoError);
+ return QFileDevice::size(); // for now
}
QT_END_NAMESPACE
diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h
index 7f370d4214..0ee8f39d95 100644
--- a/src/corelib/io/qfile.h
+++ b/src/corelib/io/qfile.h
@@ -42,7 +42,7 @@
#ifndef QFILE_H
#define QFILE_H
-#include <QtCore/qiodevice.h>
+#include <QtCore/qfiledevice.h>
#include <QtCore/qstring.h>
#include <stdio.h>
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
class QTemporaryFile;
class QFilePrivate;
-class Q_CORE_EXPORT QFile : public QIODevice
+class Q_CORE_EXPORT QFile : public QFileDevice
{
#ifndef QT_NO_QOBJECT
Q_OBJECT
@@ -65,39 +65,6 @@ class Q_CORE_EXPORT QFile : public QIODevice
Q_DECLARE_PRIVATE(QFile)
public:
-
- enum FileError {
- NoError = 0,
- ReadError = 1,
- WriteError = 2,
- FatalError = 3,
- ResourceError = 4,
- OpenError = 5,
- AbortError = 6,
- TimeOutError = 7,
- UnspecifiedError = 8,
- RemoveError = 9,
- RenameError = 10,
- PositionError = 11,
- ResizeError = 12,
- PermissionsError = 13,
- CopyError = 14
- };
-
- enum Permission {
- ReadOwner = 0x4000, WriteOwner = 0x2000, ExeOwner = 0x1000,
- ReadUser = 0x0400, WriteUser = 0x0200, ExeUser = 0x0100,
- ReadGroup = 0x0040, WriteGroup = 0x0020, ExeGroup = 0x0010,
- ReadOther = 0x0004, WriteOther = 0x0002, ExeOther = 0x0001
- };
- Q_DECLARE_FLAGS(Permissions, Permission)
-
- enum FileHandleFlag {
- AutoCloseHandle = 0x0001,
- DontCloseHandle = 0
- };
- Q_DECLARE_FLAGS(FileHandleFlags, FileHandleFlag)
-
QFile();
QFile(const QString &name);
#ifndef QT_NO_QOBJECT
@@ -106,9 +73,6 @@ public:
#endif
~QFile();
- FileError error() const;
- void unsetError();
-
QString fileName() const;
void setFileName(const QString &name);
@@ -141,18 +105,11 @@ public:
bool copy(const QString &newName);
static bool copy(const QString &fileName, const QString &newName);
- bool isSequential() const;
-
bool open(OpenMode flags);
bool open(FILE *f, OpenMode ioFlags, FileHandleFlags handleFlags=DontCloseHandle);
bool open(int fd, OpenMode ioFlags, FileHandleFlags handleFlags=DontCloseHandle);
- virtual void close();
qint64 size() const;
- qint64 pos() const;
- bool seek(qint64 offset);
- bool atEnd() const;
- bool flush();
bool resize(qint64 sz);
static bool resize(const QString &filename, qint64 sz);
@@ -162,15 +119,6 @@ public:
bool setPermissions(Permissions permissionSpec);
static bool setPermissions(const QString &filename, Permissions permissionSpec);
- int handle() const;
-
- enum MemoryMapFlags {
- NoOptions = 0
- };
-
- uchar *map(qint64 offset, qint64 size, MemoryMapFlags flags = NoOptions);
- bool unmap(uchar *address);
-
protected:
#ifdef QT_NO_QOBJECT
QFile(QFilePrivate &dd);
@@ -178,17 +126,11 @@ protected:
QFile(QFilePrivate &dd, QObject *parent = 0);
#endif
- qint64 readData(char *data, qint64 maxlen);
- qint64 writeData(const char *data, qint64 len);
- qint64 readLineData(char *data, qint64 maxlen);
-
private:
friend class QTemporaryFile;
Q_DISABLE_COPY(QFile)
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QFile::Permissions)
-
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/io/qfile_p.h b/src/corelib/io/qfile_p.h
index 3d2d3d678b..575d7d14b9 100644
--- a/src/corelib/io/qfile_p.h
+++ b/src/corelib/io/qfile_p.h
@@ -53,15 +53,13 @@
// We mean it.
//
-#include "private/qabstractfileengine_p.h"
-#include "private/qiodevice_p.h"
-#include "private/qringbuffer_p.h"
+#include "private/qfiledevice_p.h"
QT_BEGIN_NAMESPACE
class QTemporaryFile;
-class QFilePrivate : public QIODevicePrivate
+class QFilePrivate : public QFileDevicePrivate
{
Q_DECLARE_PUBLIC(QFile)
friend class QTemporaryFile;
@@ -76,20 +74,6 @@ protected:
virtual QAbstractFileEngine *engine() const;
QString fileName;
- mutable QAbstractFileEngine *fileEngine;
-
- bool lastWasWrite;
- QRingBuffer writeBuffer;
- inline bool ensureFlushed() const;
-
- bool putCharHelper(char c);
-
- QFile::FileError error;
- void setError(QFile::FileError err);
- void setError(QFile::FileError err, const QString &errorString);
- void setError(QFile::FileError err, int errNum);
-
- mutable qint64 cachedSize;
private:
static QFile::EncoderFn encoder;
diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp
new file mode 100644
index 0000000000..17eedb0bdd
--- /dev/null
+++ b/src/corelib/io/qfiledevice.cpp
@@ -0,0 +1,736 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qplatformdefs.h"
+#include "qfiledevice.h"
+#include "qfiledevice_p.h"
+#include "qfsfileengine_p.h"
+
+#ifdef QT_NO_QOBJECT
+#define tr(X) QString::fromLatin1(X)
+#endif
+
+QT_BEGIN_NAMESPACE
+
+static const int QFILE_WRITEBUFFER_SIZE = 16384;
+
+QFileDevicePrivate::QFileDevicePrivate()
+ : fileEngine(0), lastWasWrite(false),
+ writeBuffer(QFILE_WRITEBUFFER_SIZE), error(QFile::NoError),
+ cachedSize(0)
+{
+}
+
+QFileDevicePrivate::~QFileDevicePrivate()
+{
+ delete fileEngine;
+ fileEngine = 0;
+}
+
+QAbstractFileEngine * QFileDevicePrivate::engine() const
+{
+ if (!fileEngine)
+ fileEngine = new QFSFileEngine;
+ return fileEngine;
+}
+
+void QFileDevicePrivate::setError(QFileDevice::FileError err)
+{
+ error = err;
+ errorString.clear();
+}
+
+void QFileDevicePrivate::setError(QFileDevice::FileError err, const QString &errStr)
+{
+ error = err;
+ errorString = errStr;
+}
+
+void QFileDevicePrivate::setError(QFileDevice::FileError err, int errNum)
+{
+ error = err;
+ errorString = qt_error_string(errNum);
+}
+
+/*!
+ \enum QFileDevice::FileError
+
+ This enum describes the errors that may be returned by the error()
+ function.
+
+ \value NoError No error occurred.
+ \value ReadError An error occurred when reading from the file.
+ \value WriteError An error occurred when writing to the file.
+ \value FatalError A fatal error occurred.
+ \value ResourceError
+ \value OpenError The file could not be opened.
+ \value AbortError The operation was aborted.
+ \value TimeOutError A timeout occurred.
+ \value UnspecifiedError An unspecified error occurred.
+ \value RemoveError The file could not be removed.
+ \value RenameError The file could not be renamed.
+ \value PositionError The position in the file could not be changed.
+ \value ResizeError The file could not be resized.
+ \value PermissionsError The file could not be accessed.
+ \value CopyError The file could not be copied.
+
+ \omitvalue ConnectError
+*/
+
+/*!
+ \enum QFileDevice::Permission
+
+ This enum is used by the permission() function to report the
+ permissions and ownership of a file. The values may be OR-ed
+ together to test multiple permissions and ownership values.
+
+ \value ReadOwner The file is readable by the owner of the file.
+ \value WriteOwner The file is writable by the owner of the file.
+ \value ExeOwner The file is executable by the owner of the file.
+ \value ReadUser The file is readable by the user.
+ \value WriteUser The file is writable by the user.
+ \value ExeUser The file is executable by the user.
+ \value ReadGroup The file is readable by the group.
+ \value WriteGroup The file is writable by the group.
+ \value ExeGroup The file is executable by the group.
+ \value ReadOther The file is readable by anyone.
+ \value WriteOther The file is writable by anyone.
+ \value ExeOther The file is executable by anyone.
+
+ \warning Because of differences in the platforms supported by Qt,
+ the semantics of ReadUser, WriteUser and ExeUser are
+ platform-dependent: On Unix, the rights of the owner of the file
+ are returned and on Windows the rights of the current user are
+ returned. This behavior might change in a future Qt version.
+
+ Note that Qt does not by default check for permissions on NTFS
+ file systems, as this may decrease the performance of file
+ handling considerably. It is possible to force permission checking
+ on NTFS by including the following code in your source:
+
+ \snippet doc/src/snippets/ntfsp.cpp 0
+
+ Permission checking is then turned on and off by incrementing and
+ decrementing \c qt_ntfs_permission_lookup by 1.
+
+ \snippet doc/src/snippets/ntfsp.cpp 1
+*/
+
+//************* QFileDevice
+
+/*!
+ \class QFileDevice
+ \since 5.0
+
+ \brief The QFileDevice class provides an interface for reading from and writing to open files.
+
+ \ingroup io
+
+ \reentrant
+
+ QFileDevice is the base class for I/O devices that can read and write text and binary files
+ and \l{The Qt Resource System}{resources}. QFile offers the main functionality,
+ QFileDevice serves as a base class for sharing functionality with other file devices such
+ as QTemporaryFile, by providing all the operations that can be done on files that have
+ been opened by QFile or QTemporaryFile.
+
+ \sa QFile, QTemporaryFile
+*/
+
+/*!
+ \enum QFileDevice::FileHandleFlag
+
+ This enum is used when opening a file to specify additional
+ options which only apply to files and not to a generic
+ QIODevice.
+
+ \value AutoCloseHandle The file handle passed into open() should be
+ closed by close(), the default behavior is that close just flushes
+ the file and the application is responsible for closing the file handle.
+ When opening a file by name, this flag is ignored as Qt always owns the
+ file handle and must close it.
+ \value DontCloseHandle If not explicitly closed, the underlying file
+ handle is left open when the QFile object is destroyed.
+ */
+
+#ifdef QT_NO_QOBJECT
+QFileDevice::QFileDevice()
+ : QIODevice(*new QFileDevicePrivate)
+{
+}
+QFileDevice::QFileDevice(QFileDevicePrivate &dd)
+ : QIODevice(dd)
+{
+}
+#else
+/*!
+ \internal
+*/
+QFileDevice::QFileDevice()
+ : QIODevice(*new QFileDevicePrivate, 0)
+{
+}
+/*!
+ \internal
+*/
+QFileDevice::QFileDevice(QObject *parent)
+ : QIODevice(*new QFileDevicePrivate, parent)
+{
+}
+/*!
+ \internal
+*/
+QFileDevice::QFileDevice(QFileDevicePrivate &dd, QObject *parent)
+ : QIODevice(dd, parent)
+{
+}
+#endif
+
+/*!
+ Destroys the file device, closing it if necessary.
+*/
+QFileDevice::~QFileDevice()
+{
+ close();
+}
+
+/*!
+ Returns true if the file can only be manipulated sequentially;
+ otherwise returns false.
+
+ Most files support random-access, but some special files may not.
+
+ \sa QIODevice::isSequential()
+*/
+bool QFileDevice::isSequential() const
+{
+ Q_D(const QFileDevice);
+ return d->fileEngine && d->fileEngine->isSequential();
+}
+
+/*!
+ Returns the file handle of the file.
+
+ This is a small positive integer, suitable for use with C library
+ functions such as fdopen() and fcntl(). On systems that use file
+ descriptors for sockets (i.e. Unix systems, but not Windows) the handle
+ can be used with QSocketNotifier as well.
+
+ If the file is not open, or there is an error, handle() returns -1.
+
+ This function is not supported on Windows CE.
+
+ \sa QSocketNotifier
+*/
+int QFileDevice::handle() const
+{
+ Q_D(const QFileDevice);
+ if (!isOpen() || !d->fileEngine)
+ return -1;
+
+ return d->fileEngine->handle();
+}
+
+/*!
+ Returns the name of the file.
+ The default implementation in QFileDevice returns QString().
+*/
+QString QFileDevice::fileName() const
+{
+ return QString();
+}
+
+static inline qint64 _qfile_writeData(QAbstractFileEngine *engine, QRingBuffer *buffer)
+{
+ qint64 ret = engine->write(buffer->readPointer(), buffer->nextDataBlockSize());
+ if (ret > 0)
+ buffer->free(ret);
+ return ret;
+}
+
+/*!
+ Flushes any buffered data to the file. Returns true if successful;
+ otherwise returns false.
+*/
+bool QFileDevice::flush()
+{
+ Q_D(QFileDevice);
+ if (!d->fileEngine) {
+ qWarning("QFileDevice::flush: No file engine. Is IODevice open?");
+ return false;
+ }
+
+ if (!d->writeBuffer.isEmpty()) {
+ qint64 size = d->writeBuffer.size();
+ if (_qfile_writeData(d->fileEngine, &d->writeBuffer) != size) {
+ QFileDevice::FileError err = d->fileEngine->error();
+ if (err == QFileDevice::UnspecifiedError)
+ err = QFileDevice::WriteError;
+ d->setError(err, d->fileEngine->errorString());
+ return false;
+ }
+ }
+
+ if (!d->fileEngine->flush()) {
+ QFileDevice::FileError err = d->fileEngine->error();
+ if (err == QFileDevice::UnspecifiedError)
+ err = QFileDevice::WriteError;
+ d->setError(err, d->fileEngine->errorString());
+ return false;
+ }
+ return true;
+}
+
+/*!
+ Calls QFileDevice::flush() and closes the file. Errors from flush are ignored.
+
+ \sa QIODevice::close()
+*/
+void QFileDevice::close()
+{
+ Q_D(QFileDevice);
+ if (!isOpen())
+ return;
+ bool flushed = flush();
+ QIODevice::close();
+
+ // reset write buffer
+ d->lastWasWrite = false;
+ d->writeBuffer.clear();
+
+ // keep earlier error from flush
+ if (d->fileEngine->close() && flushed)
+ unsetError();
+ else if (flushed)
+ d->setError(d->fileEngine->error(), d->fileEngine->errorString());
+}
+
+/*!
+ \reimp
+*/
+qint64 QFileDevice::pos() const
+{
+ return QIODevice::pos();
+}
+
+/*!
+ Returns true if the end of the file has been reached; otherwise returns
+ false.
+
+ For regular empty files on Unix (e.g. those in \c /proc), this function
+ returns true, since the file system reports that the size of such a file is
+ 0. Therefore, you should not depend on atEnd() when reading data from such a
+ file, but rather call read() until no more data can be read.
+*/
+bool QFileDevice::atEnd() const
+{
+ Q_D(const QFileDevice);
+
+ // If there's buffered data left, we're not at the end.
+ if (!d->buffer.isEmpty())
+ return false;
+
+ if (!isOpen())
+ return true;
+
+ if (!d->ensureFlushed())
+ return false;
+
+ // If the file engine knows best, say what it says.
+ if (d->fileEngine->supportsExtension(QAbstractFileEngine::AtEndExtension)) {
+ // Check if the file engine supports AtEndExtension, and if it does,
+ // check if the file engine claims to be at the end.
+ return d->fileEngine->atEnd();
+ }
+
+ // if it looks like we are at the end, or if size is not cached,
+ // fall through to bytesAvailable() to make sure.
+ if (pos() < d->cachedSize)
+ return false;
+
+ // Fall back to checking how much is available (will stat files).
+ return bytesAvailable() == 0;
+}
+
+/*!
+ \fn bool QFileDevice::seek(qint64 pos)
+
+ For random-access devices, this function sets the current position
+ to \a pos, returning true on success, or false if an error occurred.
+ For sequential devices, the default behavior is to do nothing and
+ return false.
+
+ Seeking beyond the end of a file:
+ If the position is beyond the end of a file, then seek() shall not
+ immediately extend the file. If a write is performed at this position,
+ then the file shall be extended. The content of the file between the
+ previous end of file and the newly written data is UNDEFINED and
+ varies between platforms and file systems.
+*/
+bool QFileDevice::seek(qint64 off)
+{
+ Q_D(QFileDevice);
+ if (!isOpen()) {
+ qWarning("QFileDevice::seek: IODevice is not open");
+ return false;
+ }
+
+ if (!d->ensureFlushed())
+ return false;
+
+ if (!d->fileEngine->seek(off) || !QIODevice::seek(off)) {
+ QFileDevice::FileError err = d->fileEngine->error();
+ if (err == QFileDevice::UnspecifiedError)
+ err = QFileDevice::PositionError;
+ d->setError(err, d->fileEngine->errorString());
+ return false;
+ }
+ unsetError();
+ return true;
+}
+
+/*!
+ \reimp
+*/
+qint64 QFileDevice::readLineData(char *data, qint64 maxlen)
+{
+ Q_D(QFileDevice);
+ if (!d->ensureFlushed())
+ return -1;
+
+ qint64 read;
+ if (d->fileEngine->supportsExtension(QAbstractFileEngine::FastReadLineExtension)) {
+ read = d->fileEngine->readLine(data, maxlen);
+ } else {
+ // Fall back to QIODevice's readLine implementation if the engine
+ // cannot do it faster.
+ read = QIODevice::readLineData(data, maxlen);
+ }
+
+ if (read < maxlen) {
+ // failed to read all requested, may be at the end of file, stop caching size so that it's rechecked
+ d->cachedSize = 0;
+ }
+
+ return read;
+}
+
+/*!
+ \reimp
+*/
+qint64 QFileDevice::readData(char *data, qint64 len)
+{
+ Q_D(QFileDevice);
+ unsetError();
+ if (!d->ensureFlushed())
+ return -1;
+
+ const qint64 read = d->fileEngine->read(data, len);
+ if (read < 0) {
+ QFileDevice::FileError err = d->fileEngine->error();
+ if (err == QFileDevice::UnspecifiedError)
+ err = QFileDevice::ReadError;
+ d->setError(err, d->fileEngine->errorString());
+ }
+
+ if (read < len) {
+ // failed to read all requested, may be at the end of file, stop caching size so that it's rechecked
+ d->cachedSize = 0;
+ }
+
+ return read;
+}
+
+/*!
+ \internal
+*/
+bool QFileDevicePrivate::putCharHelper(char c)
+{
+#ifdef QT_NO_QOBJECT
+ return QIODevicePrivate::putCharHelper(c);
+#else
+
+ // Cutoff for code that doesn't only touch the buffer.
+ int writeBufferSize = writeBuffer.size();
+ if ((openMode & QIODevice::Unbuffered) || writeBufferSize + 1 >= QFILE_WRITEBUFFER_SIZE
+#ifdef Q_OS_WIN
+ || ((openMode & QIODevice::Text) && c == '\n' && writeBufferSize + 2 >= QFILE_WRITEBUFFER_SIZE)
+#endif
+ ) {
+ return QIODevicePrivate::putCharHelper(c);
+ }
+
+ if (!(openMode & QIODevice::WriteOnly)) {
+ if (openMode == QIODevice::NotOpen)
+ qWarning("QIODevice::putChar: Closed device");
+ else
+ qWarning("QIODevice::putChar: ReadOnly device");
+ return false;
+ }
+
+ // Make sure the device is positioned correctly.
+ const bool sequential = isSequential();
+ if (pos != devicePos && !sequential && !q_func()->seek(pos))
+ return false;
+
+ lastWasWrite = true;
+
+ int len = 1;
+#ifdef Q_OS_WIN
+ if ((openMode & QIODevice::Text) && c == '\n') {
+ ++len;
+ *writeBuffer.reserve(1) = '\r';
+ }
+#endif
+
+ // Write to buffer.
+ *writeBuffer.reserve(1) = c;
+
+ if (!sequential) {
+ pos += len;
+ devicePos += len;
+ if (!buffer.isEmpty())
+ buffer.skip(len);
+ }
+
+ return true;
+#endif
+}
+
+/*!
+ \reimp
+*/
+qint64 QFileDevice::writeData(const char *data, qint64 len)
+{
+ Q_D(QFileDevice);
+ unsetError();
+ d->lastWasWrite = true;
+ bool buffered = !(d->openMode & Unbuffered);
+
+ // Flush buffered data if this read will overflow.
+ if (buffered && (d->writeBuffer.size() + len) > QFILE_WRITEBUFFER_SIZE) {
+ if (!flush())
+ return -1;
+ }
+
+ // Write directly to the engine if the block size is larger than
+ // the write buffer size.
+ if (!buffered || len > QFILE_WRITEBUFFER_SIZE) {
+ const qint64 ret = d->fileEngine->write(data, len);
+ if (ret < 0) {
+ QFileDevice::FileError err = d->fileEngine->error();
+ if (err == QFileDevice::UnspecifiedError)
+ err = QFileDevice::WriteError;
+ d->setError(err, d->fileEngine->errorString());
+ }
+ return ret;
+ }
+
+ // Write to the buffer.
+ char *writePointer = d->writeBuffer.reserve(len);
+ if (len == 1)
+ *writePointer = *data;
+ else
+ ::memcpy(writePointer, data, len);
+ return len;
+}
+
+/*!
+ Returns the file error status.
+
+ The I/O device status returns an error code. For example, if open()
+ returns false, or a read/write operation returns -1, this function can
+ be called to find out the reason why the operation failed.
+
+ \sa unsetError()
+*/
+QFileDevice::FileError QFileDevice::error() const
+{
+ Q_D(const QFileDevice);
+ return d->error;
+}
+
+/*!
+ Sets the file's error to QFileDevice::NoError.
+
+ \sa error()
+*/
+void QFileDevice::unsetError()
+{
+ Q_D(QFileDevice);
+ d->setError(QFileDevice::NoError);
+}
+
+/*!
+ Returns the size of the file.
+
+ For regular empty files on Unix (e.g. those in \c /proc), this function
+ returns 0; the contents of such a file are generated on demand in response
+ to you calling read().
+*/
+qint64 QFileDevice::size() const
+{
+ Q_D(const QFileDevice);
+ if (!d->ensureFlushed())
+ return 0;
+ d->cachedSize = d->engine()->size();
+ return d->cachedSize;
+}
+
+/*!
+ Sets the file size (in bytes) \a sz. Returns true if the file if the
+ resize succeeds; false otherwise. If \a sz is larger than the file
+ currently is the new bytes will be set to 0, if \a sz is smaller the
+ file is simply truncated.
+
+ \sa size()
+*/
+bool QFileDevice::resize(qint64 sz)
+{
+ Q_D(QFileDevice);
+ if (!d->ensureFlushed())
+ return false;
+ d->engine();
+ if (isOpen() && d->fileEngine->pos() > sz)
+ seek(sz);
+ if (d->fileEngine->setSize(sz)) {
+ unsetError();
+ d->cachedSize = sz;
+ return true;
+ }
+ d->cachedSize = 0;
+ d->setError(QFile::ResizeError, d->fileEngine->errorString());
+ return false;
+}
+
+/*!
+ Returns the complete OR-ed together combination of
+ QFile::Permission for the file.
+
+ \sa setPermissions()
+*/
+QFile::Permissions QFileDevice::permissions() const
+{
+ Q_D(const QFileDevice);
+ QAbstractFileEngine::FileFlags perms = d->engine()->fileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask;
+ return QFile::Permissions((int)perms); //ewww
+}
+
+/*!
+ Sets the permissions for the file to the \a permissions specified.
+ Returns true if successful, or false if the permissions cannot be
+ modified.
+
+ \sa permissions()
+*/
+bool QFileDevice::setPermissions(Permissions permissions)
+{
+ Q_D(QFileDevice);
+ if (d->engine()->setPermissions(permissions)) {
+ unsetError();
+ return true;
+ }
+ d->setError(QFile::PermissionsError, d->fileEngine->errorString());
+ return false;
+}
+
+/*!
+ \enum QFileDevice::MemoryMapFlags
+ \since 4.4
+
+ This enum describes special options that may be used by the map()
+ function.
+
+ \value NoOptions No options.
+*/
+
+/*!
+ Maps \a size bytes of the file into memory starting at \a offset. A file
+ should be open for a map to succeed but the file does not need to stay
+ open after the memory has been mapped. When the QFile is destroyed
+ or a new file is opened with this object, any maps that have not been
+ unmapped will automatically be unmapped.
+
+ Any mapping options can be passed through \a flags.
+
+ Returns a pointer to the memory or 0 if there is an error.
+
+ \note On Windows CE 5.0 the file will be closed before mapping occurs.
+
+ \sa unmap()
+ */
+uchar *QFileDevice::map(qint64 offset, qint64 size, MemoryMapFlags flags)
+{
+ Q_D(QFileDevice);
+ if (d->engine()
+ && d->fileEngine->supportsExtension(QAbstractFileEngine::MapExtension)) {
+ unsetError();
+ uchar *address = d->fileEngine->map(offset, size, flags);
+ if (address == 0)
+ d->setError(d->fileEngine->error(), d->fileEngine->errorString());
+ return address;
+ }
+ return 0;
+}
+
+/*!
+ Unmaps the memory \a address.
+
+ Returns true if the unmap succeeds; false otherwise.
+
+ \sa map()
+ */
+bool QFileDevice::unmap(uchar *address)
+{
+ Q_D(QFileDevice);
+ if (d->engine()
+ && d->fileEngine->supportsExtension(QAbstractFileEngine::UnMapExtension)) {
+ unsetError();
+ bool success = d->fileEngine->unmap(address);
+ if (!success)
+ d->setError(d->fileEngine->error(), d->fileEngine->errorString());
+ return success;
+ }
+ d->setError(PermissionsError, tr("No file engine available or engine does not support UnMapExtension"));
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/corelib/io/qfiledevice.h b/src/corelib/io/qfiledevice.h
new file mode 100644
index 0000000000..bbde91842c
--- /dev/null
+++ b/src/corelib/io/qfiledevice.h
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QFILEDEVICE_H
+#define QFILEDEVICE_H
+
+#include <QtCore/qiodevice.h>
+#include <QtCore/qstring.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QFileDevicePrivate;
+
+class Q_CORE_EXPORT QFileDevice : public QIODevice
+{
+#ifndef QT_NO_QOBJECT
+ Q_OBJECT
+#endif
+ Q_DECLARE_PRIVATE(QFileDevice)
+
+public:
+ enum FileError {
+ NoError = 0,
+ ReadError = 1,
+ WriteError = 2,
+ FatalError = 3,
+ ResourceError = 4,
+ OpenError = 5,
+ AbortError = 6,
+ TimeOutError = 7,
+ UnspecifiedError = 8,
+ RemoveError = 9,
+ RenameError = 10,
+ PositionError = 11,
+ ResizeError = 12,
+ PermissionsError = 13,
+ CopyError = 14
+ };
+
+ enum Permission {
+ ReadOwner = 0x4000, WriteOwner = 0x2000, ExeOwner = 0x1000,
+ ReadUser = 0x0400, WriteUser = 0x0200, ExeUser = 0x0100,
+ ReadGroup = 0x0040, WriteGroup = 0x0020, ExeGroup = 0x0010,
+ ReadOther = 0x0004, WriteOther = 0x0002, ExeOther = 0x0001
+ };
+ Q_DECLARE_FLAGS(Permissions, Permission)
+
+ enum FileHandleFlag {
+ AutoCloseHandle = 0x0001,
+ DontCloseHandle = 0
+ };
+ Q_DECLARE_FLAGS(FileHandleFlags, FileHandleFlag)
+
+ ~QFileDevice();
+
+ FileError error() const;
+ void unsetError();
+
+ virtual void close();
+
+ bool isSequential() const;
+
+ int handle() const;
+ virtual QString fileName() const;
+
+ qint64 pos() const;
+ bool seek(qint64 offset);
+ bool atEnd() const;
+ bool flush();
+
+ qint64 size() const;
+
+ virtual bool resize(qint64 sz);
+ virtual Permissions permissions() const;
+ virtual bool setPermissions(Permissions permissionSpec);
+
+ enum MemoryMapFlags {
+ NoOptions = 0
+ };
+
+ uchar *map(qint64 offset, qint64 size, MemoryMapFlags flags = NoOptions);
+ bool unmap(uchar *address);
+
+protected:
+ QFileDevice();
+#ifdef QT_NO_QOBJECT
+ QFileDevice(QFileDevicePrivate &dd);
+#else
+ explicit QFileDevice(QObject *parent);
+ QFileDevice(QFileDevicePrivate &dd, QObject *parent = 0);
+#endif
+
+ qint64 readData(char *data, qint64 maxlen);
+ qint64 writeData(const char *data, qint64 len);
+ qint64 readLineData(char *data, qint64 maxlen);
+
+private:
+ Q_DISABLE_COPY(QFileDevice)
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDevice::Permissions)
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QFILEDEVICE_H
diff --git a/src/corelib/io/qfiledevice_p.h b/src/corelib/io/qfiledevice_p.h
new file mode 100644
index 0000000000..2550cd73a2
--- /dev/null
+++ b/src/corelib/io/qfiledevice_p.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QFILEDEVICE_P_H
+#define QFILEDEVICE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "private/qiodevice_p.h"
+#include "private/qringbuffer_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QAbstractFileEngine;
+class QFSFileEngine;
+
+class QFileDevicePrivate : public QIODevicePrivate
+{
+ Q_DECLARE_PUBLIC(QFileDevice)
+protected:
+ QFileDevicePrivate();
+ ~QFileDevicePrivate();
+
+ virtual QAbstractFileEngine *engine() const;
+
+ QFileDevice::FileHandleFlags handleFlags;
+
+ mutable QAbstractFileEngine *fileEngine;
+ bool lastWasWrite;
+ QRingBuffer writeBuffer;
+ inline bool ensureFlushed() const;
+
+ bool putCharHelper(char c);
+
+ QFileDevice::FileError error;
+ void setError(QFileDevice::FileError err);
+ void setError(QFileDevice::FileError err, const QString &errorString);
+ void setError(QFileDevice::FileError err, int errNum);
+
+ mutable qint64 cachedSize;
+};
+
+inline bool QFileDevicePrivate::ensureFlushed() const
+{
+ // This function ensures that the write buffer has been flushed (const
+ // because certain const functions need to call it.
+ if (lastWasWrite) {
+ const_cast<QFileDevicePrivate *>(this)->lastWasWrite = false;
+ if (!const_cast<QFileDevice *>(q_func())->flush())
+ return false;
+ }
+ return true;
+}
+
+QT_END_NAMESPACE
+
+#endif // QFILEDEVICE_P_H
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 294affce53..3e7e34d90b 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -41,7 +41,6 @@
#include "qfilesystemengine_p.h"
-#define _POSIX_
#include "qplatformdefs.h"
#include "private/qabstractfileengine_p.h"
#include "private/qfsfileengine_p.h"
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 347ce8429e..e80365f5c8 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -39,7 +39,6 @@
**
****************************************************************************/
-#define _POSIX_
#include "qplatformdefs.h"
#include "private/qabstractfileengine_p.h"
#include "private/qfsfileengine_p.h"
@@ -66,6 +65,7 @@
#include <accctrl.h>
#include <ctype.h>
#include <limits.h>
+#include <stdio.h>
#define SECURITY_WIN32
#include <security.h>
diff --git a/src/corelib/io/qipaddress.cpp b/src/corelib/io/qipaddress.cpp
new file mode 100644
index 0000000000..c8857263cd
--- /dev/null
+++ b/src/corelib/io/qipaddress.cpp
@@ -0,0 +1,344 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Intel Corporation
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qipaddress_p.h"
+#include "private/qlocale_tools_p.h"
+#include "qvarlengtharray.h"
+
+QT_BEGIN_NAMESPACE
+namespace QIPAddressUtils {
+
+static QString number(quint8 val, int base = 10)
+{
+ QChar zero(0x30);
+ return val ? qulltoa(val, base, zero) : zero;
+}
+
+typedef QVarLengthArray<char, 64> Buffer;
+static bool checkedToAscii(Buffer &buffer, const QChar *begin, const QChar *end)
+{
+ const ushort *const ubegin = reinterpret_cast<const ushort *>(begin);
+ const ushort *const uend = reinterpret_cast<const ushort *>(end);
+ const ushort *src = ubegin;
+
+ buffer.resize(uend - ubegin + 1);
+ char *dst = buffer.data();
+
+ while (src != uend) {
+ if (*src >= 0x7f)
+ return false;
+ *dst++ = *src++;
+ }
+ *dst = '\0';
+ return true;
+}
+
+static bool parseIp4Internal(IPv4Address &address, const char *ptr, bool acceptLeadingZero);
+bool parseIp4(IPv4Address &address, const QChar *begin, const QChar *end)
+{
+ Q_ASSERT(begin != end);
+ Buffer buffer;
+ if (!checkedToAscii(buffer, begin, end))
+ return false;
+
+ const char *ptr = buffer.data();
+ return parseIp4Internal(address, ptr, true);
+}
+
+static bool parseIp4Internal(IPv4Address &address, const char *ptr, bool acceptLeadingZero)
+{
+ address = 0;
+ int dotCount = 0;
+ while (dotCount < 4) {
+ if (!acceptLeadingZero && *ptr == '0' &&
+ ptr[1] != '.' && ptr[1] != '\0')
+ return false;
+
+ const char *endptr;
+ bool ok;
+ quint64 ll = qstrtoull(ptr, &endptr, 0, &ok);
+ quint32 x = ll;
+ if (!ok || endptr == ptr || ll != x)
+ return false;
+
+ if (*endptr == '.' || dotCount == 3) {
+ if (x & ~0xff)
+ return false;
+ address <<= 8;
+ } else if (dotCount == 2) {
+ if (x & ~0xffff)
+ return false;
+ address <<= 16;
+ } else if (dotCount == 1) {
+ if (x & ~0xffffff)
+ return false;
+ address <<= 24;
+ }
+ address |= x;
+
+ if (dotCount == 3 && *endptr != '\0')
+ return false;
+ else if (dotCount == 3 || *endptr == '\0')
+ return true;
+ ++dotCount;
+ ptr = endptr + 1;
+ }
+ return false;
+}
+
+void toString(QString &appendTo, IPv4Address address)
+{
+ // reconstructing is easy
+ // use the fast operator% that pre-calculates the size
+ appendTo += number(address >> 24)
+ % QLatin1Char('.')
+ % number(address >> 16)
+ % QLatin1Char('.')
+ % number(address >> 8)
+ % QLatin1Char('.')
+ % number(address);
+}
+
+bool parseIp6(IPv6Address &address, const QChar *begin, const QChar *end)
+{
+ Q_ASSERT(begin != end);
+ Buffer buffer;
+ if (!checkedToAscii(buffer, begin, end))
+ return false;
+
+ const char *ptr = buffer.data();
+
+ // count the colons
+ int colonCount = 0;
+ int dotCount = 0;
+ while (*ptr) {
+ if (*ptr == ':')
+ ++colonCount;
+ if (*ptr == '.')
+ ++dotCount;
+ ++ptr;
+ }
+ // IPv4-in-IPv6 addresses are stricter in what they accept
+ if (dotCount != 0 && dotCount != 3)
+ return false;
+
+ memset(address, 0, sizeof address);
+ if (colonCount == 2 && end - begin == 2) // "::"
+ return true;
+
+ // if there's a double colon ("::"), this is how many zeroes it means
+ int zeroWordsToFill;
+ ptr = buffer.data();
+
+ // there are two cases where 8 colons are allowed: at the ends
+ // so test that before the colon-count test
+ if ((ptr[0] == ':' && ptr[1] == ':') ||
+ (ptr[end - begin - 2] == ':' && ptr[end - begin - 1] == ':')) {
+ zeroWordsToFill = 9 - colonCount;
+ } else if (colonCount < 2 || colonCount > 7) {
+ return false;
+ } else {
+ zeroWordsToFill = 8 - colonCount;
+ }
+ if (dotCount)
+ --zeroWordsToFill;
+
+ int pos = 0;
+ while (pos < 15) {
+ const char *endptr;
+ bool ok;
+ quint64 ll = qstrtoull(ptr, &endptr, 16, &ok);
+ quint16 x = ll;
+
+ if (ptr == endptr) {
+ // empty field, we hope it's "::"
+ if (zeroWordsToFill < 1)
+ return false;
+ if (pos == 0 || pos == colonCount * 2) {
+ if (ptr[0] == '\0' || ptr[1] != ':')
+ return false;
+ ++ptr;
+ }
+ pos += zeroWordsToFill * 2;
+ zeroWordsToFill = 0;
+ ++ptr;
+ continue;
+ }
+ if (!ok || ll != x)
+ return false;
+
+ if (*endptr == '.') {
+ // this could be an IPv4 address
+ // it's only valid in the last element
+ if (pos != 12)
+ return false;
+
+ IPv4Address ip4;
+ if (!parseIp4Internal(ip4, ptr, false))
+ return false;
+
+ address[12] = ip4 >> 24;
+ address[13] = ip4 >> 16;
+ address[14] = ip4 >> 8;
+ address[15] = ip4;
+ return true;
+ }
+
+ address[pos++] = x >> 8;
+ address[pos++] = x & 0xff;
+
+ if (*endptr == '\0')
+ break;
+ if (*endptr != ':')
+ return false;
+ ptr = endptr + 1;
+ }
+ return pos == 16;
+}
+
+static inline QChar toHex(uchar c)
+{
+ return ushort(c > 9 ? c + 'a' - 0xA : c + '0');
+}
+
+void toString(QString &appendTo, IPv6Address address)
+{
+ // the longest IPv6 address possible is:
+ // "1111:2222:3333:4444:5555:6666:255.255.255.255"
+ // however, this function never generates that. The longest it does
+ // generate without an IPv4 address is:
+ // "1111:2222:3333:4444:5555:6666:7777:8888"
+ // and the longest with an IPv4 address is:
+ // "::ffff:255.255.255.255"
+ static const int Ip6AddressMaxLen = sizeof "1111:2222:3333:4444:5555:6666:7777:8888";
+ static const int Ip6WithIp4AddressMaxLen = sizeof "::ffff:255.255.255.255";
+
+ // check for the special cases
+ const quint64 zeroes[] = { 0, 0 };
+ bool embeddedIp4 = false;
+
+ // we consider embedded IPv4 for:
+ // ::ffff:x.x.x.x
+ // ::x.x.x.y except if the x are 0 too
+ if (memcmp(address, zeroes, 10) == 0) {
+ if (address[10] == 0xff && address[11] == 0xff) {
+ embeddedIp4 = true;
+ } else if (address[10] == 0 && address[11] == 0) {
+ if (address[12] != 0 || address[13] != 0 || address[14] != 0) {
+ embeddedIp4 = true;
+ } else if (address[15] == 0) {
+ appendTo.append(QLatin1String("::"));
+ return;
+ }
+ }
+ }
+
+ // QString::reserve doesn't shrink, so it's fine to us
+ appendTo.reserve(appendTo.size() +
+ (embeddedIp4 ? Ip6WithIp4AddressMaxLen : Ip6AddressMaxLen));
+
+ // for finding where to place the "::"
+ int zeroRunLength = 0; // in octets
+ int zeroRunOffset = 0; // in octets
+ for (int i = 0; i < 16; i += 2) {
+ if (address[i] == 0 && address[i + 1] == 0) {
+ // found a zero, scan forward to see how many more there are
+ int j;
+ for (j = i; j < 16; j += 2) {
+ if (address[j] != 0 || address[j+1] != 0)
+ break;
+ }
+
+ if (j - i > zeroRunLength) {
+ zeroRunLength = j - i;
+ zeroRunOffset = i;
+ i = j;
+ }
+ }
+ }
+
+ const QChar colon = ushort(':');
+ if (zeroRunLength < 4)
+ zeroRunOffset = -1;
+ else if (zeroRunOffset == 0)
+ appendTo.append(colon);
+
+ for (int i = 0; i < 16; i += 2) {
+ if (i == zeroRunOffset) {
+ appendTo.append(colon);
+ i += zeroRunLength - 2;
+ continue;
+ }
+
+ if (i == 12 && embeddedIp4) {
+ IPv4Address ip4 = address[12] << 24 |
+ address[13] << 16 |
+ address[14] << 8 |
+ address[15];
+ toString(appendTo, ip4);
+ return;
+ }
+
+ if (address[i]) {
+ if (address[i] >> 4) {
+ appendTo.append(toHex(address[i] >> 4));
+ appendTo.append(toHex(address[i] & 0xf));
+ appendTo.append(toHex(address[i + 1] >> 4));
+ appendTo.append(toHex(address[i + 1] & 0xf));
+ } else if (address[i] & 0xf) {
+ appendTo.append(toHex(address[i] & 0xf));
+ appendTo.append(toHex(address[i + 1] >> 4));
+ appendTo.append(toHex(address[i + 1] & 0xf));
+ }
+ } else if (address[i + 1] >> 4) {
+ appendTo.append(toHex(address[i + 1] >> 4));
+ appendTo.append(toHex(address[i + 1] & 0xf));
+ } else {
+ appendTo.append(toHex(address[i + 1] & 0xf));
+ }
+
+ if (i != 14)
+ appendTo.append(colon);
+ }
+}
+
+}
+QT_END_NAMESPACE
diff --git a/src/corelib/io/qipaddress_p.h b/src/corelib/io/qipaddress_p.h
new file mode 100644
index 0000000000..834f9557f3
--- /dev/null
+++ b/src/corelib/io/qipaddress_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Intel Corporation
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QIPADDRESS_P_H
+#define QIPADDRESS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience of
+// qurl*.cpp This header file may change from version to version without
+// notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qstring.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QIPAddressUtils {
+
+typedef quint32 IPv4Address;
+typedef quint8 IPv6Address[16];
+
+Q_CORE_EXPORT bool parseIp4(IPv4Address &address, const QChar *begin, const QChar *end);
+Q_CORE_EXPORT bool parseIp6(IPv6Address &address, const QChar *begin, const QChar *end);
+Q_CORE_EXPORT void toString(QString &appendTo, IPv4Address address);
+Q_CORE_EXPORT void toString(QString &appendTo, IPv6Address address);
+
+} // namespace
+
+QT_END_NAMESPACE
+
+#endif // QIPADDRESS_P_H
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index fb3a24b940..4a0211c00a 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -673,7 +673,7 @@ int QResourceRoot::findNode(const QString &_path, const QLocale &locale) const
qDebug() << " " << child+j << " :: " << name(child+j);
}
#endif
- const uint h = qHash(segment);
+ const uint h = qt_hash(segment.toString());
//do the binary search for the hash
int l = 0, r = child_count-1;
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 55f824cdeb..c6103b3f2f 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -309,6 +309,27 @@ QString QStandardPaths::displayName(StandardLocation type)
}
#endif
+/*!
+ \fn void QStandardPaths::enableTestMode(bool testMode)
+
+ Enables "test mode" in QStandardPaths, which changes writable locations
+ to point to test directories, in order to prevent auto tests from reading from
+ or writing to the current user's configuration.
+
+ This affects the locations into which test programs might write files:
+ GenericDataLocation, DataLocation, ConfigLocation,
+ GenericCacheLocation, CacheLocation.
+ Other locations are not affected.
+
+ On Unix, XDG_DATA_HOME is set to ~/.qttest/share, XDG_CONFIG_HOME is
+ set to ~/.qttest/config, and XDG_CACHE_HOME is set to ~/.qttest/cache.
+
+ On Mac, data goes to "~/.qttest/Application Support", cache goes to
+ ~/.qttest/Cache, and config goes to ~/.qttest/Preferences.
+
+ On Windows, everything goes to a "qttest" directory under Application Data.
+*/
+
QT_END_NAMESPACE
#endif // QT_NO_STANDARDPATHS
diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h
index e647f46f18..e393809431 100644
--- a/src/corelib/io/qstandardpaths.h
+++ b/src/corelib/io/qstandardpaths.h
@@ -91,6 +91,8 @@ public:
static QString findExecutable(const QString &executableName, const QStringList &paths = QStringList());
+ static void enableTestMode(bool testMode);
+
private:
// prevent construction
QStandardPaths();
diff --git a/src/corelib/io/qstandardpaths_json.cpp b/src/corelib/io/qstandardpaths_json.cpp
index 7d7a0a9f28..c7cb858f0f 100644
--- a/src/corelib/io/qstandardpaths_json.cpp
+++ b/src/corelib/io/qstandardpaths_json.cpp
@@ -48,6 +48,7 @@
#include <QFile>
#include <QDir>
#include <QAtomicPointer>
+#include <QCoreApplication>
#ifndef QT_NO_STANDARDPATHS
@@ -62,6 +63,23 @@ public:
Q_GLOBAL_STATIC(QStandardPathsPrivate, configCache);
+static bool qsp_testMode = false;
+
+void QStandardPaths::enableTestMode(bool testMode)
+{
+ qsp_testMode = testMode;
+}
+
+static void appendOrganizationAndApp(QString &path)
+{
+ const QString org = QCoreApplication::organizationName();
+ if (!org.isEmpty())
+ path += QLatin1Char('/') + org;
+ const QString appName = QCoreApplication::applicationName();
+ if (!appName.isEmpty())
+ path += QLatin1Char('/') + appName;
+}
+
QString QStandardPaths::writableLocation(StandardLocation type)
{
switch (type) {
@@ -73,6 +91,30 @@ QString QStandardPaths::writableLocation(StandardLocation type)
break;
}
+ if (qsp_testMode) {
+ const QString qttestDir = QDir::homePath() + QLatin1String("/.qttest");
+ QString path;
+ switch (type) {
+ case GenericDataLocation:
+ case DataLocation:
+ path = qttestDir + QLatin1String("/share");
+ if (type == DataLocation)
+ appendOrganizationAndApp(path);
+ return path;
+ case GenericCacheLocation:
+ case CacheLocation:
+ path = qttestDir + QLatin1String("/cache");
+ if (type == CacheLocation)
+ appendOrganizationAndApp(path);
+ return path;
+ case ConfigLocation:
+ return qttestDir + QLatin1String("/config");
+ default:
+ break;
+ }
+ }
+
+
QJsonObject * localConfigObject = configCache()->object.loadAcquire();
if (localConfigObject == 0) {
QString configHome = QFile::decodeName(qgetenv("PATH_CONFIG_HOME"));
diff --git a/src/corelib/io/qstandardpaths_mac.cpp b/src/corelib/io/qstandardpaths_mac.cpp
index 2890ead48a..53dfdaa392 100644
--- a/src/corelib/io/qstandardpaths_mac.cpp
+++ b/src/corelib/io/qstandardpaths_mac.cpp
@@ -90,6 +90,13 @@ OSType translateLocation(QStandardPaths::StandardLocation type)
}
}
+static bool qsp_testMode = false;
+
+void QStandardPaths::enableTestMode(bool testMode)
+{
+ qsp_testMode = testMode;
+}
+
/*
Constructs a full unicode path from a FSRef.
*/
@@ -101,6 +108,16 @@ static QString getFullPath(const FSRef &ref)
return QString();
}
+static void appendOrganizationAndApp(QString &path)
+{
+ const QString org = QCoreApplication::organizationName();
+ if (!org.isEmpty())
+ path += QLatin1Char('/') + org;
+ const QString appName = QCoreApplication::applicationName();
+ if (!appName.isEmpty())
+ path += QLatin1Char('/') + appName;
+}
+
static QString macLocation(QStandardPaths::StandardLocation type, short domain)
{
// http://developer.apple.com/documentation/Carbon/Reference/Folder_Manager/Reference/reference.html
@@ -111,17 +128,36 @@ static QString macLocation(QStandardPaths::StandardLocation type, short domain)
QString path = getFullPath(ref);
- if (type == QStandardPaths::DataLocation || type == QStandardPaths::CacheLocation) {
- if (!QCoreApplication::organizationName().isEmpty())
- path += QLatin1Char('/') + QCoreApplication::organizationName();
- if (!QCoreApplication::applicationName().isEmpty())
- path += QLatin1Char('/') + QCoreApplication::applicationName();
- }
- return path;
+ if (type == QStandardPaths::DataLocation || type == QStandardPaths::CacheLocation)
+ appendOrganizationAndApp(path);
+ return path;
}
QString QStandardPaths::writableLocation(StandardLocation type)
{
+ if (qsp_testMode) {
+ const QString qttestDir = QDir::homePath() + QLatin1String("/.qttest");
+ QString path;
+ switch (type) {
+ case GenericDataLocation:
+ case DataLocation:
+ path = qttestDir + QLatin1String("/Application Support");
+ if (type == DataLocation)
+ appendOrganizationAndApp(path);
+ return path;
+ case GenericCacheLocation:
+ case CacheLocation:
+ path = qttestDir + QLatin1String("/Cache");
+ if (type == CacheLocation)
+ appendOrganizationAndApp(path);
+ return path;
+ case ConfigLocation:
+ return qttestDir + QLatin1String("/Preferences");
+ default:
+ break;
+ }
+ }
+
switch (type) {
case HomeLocation:
return QDir::homePath();
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp
index 1a2ae96edb..3ccac09990 100644
--- a/src/corelib/io/qstandardpaths_unix.cpp
+++ b/src/corelib/io/qstandardpaths_unix.cpp
@@ -63,6 +63,13 @@ static void appendOrganizationAndApp(QString &path)
path += QLatin1Char('/') + appName;
}
+static bool qsp_testMode = false;
+
+void QStandardPaths::enableTestMode(bool testMode)
+{
+ qsp_testMode = testMode;
+}
+
QString QStandardPaths::writableLocation(StandardLocation type)
{
switch (type) {
@@ -75,6 +82,8 @@ QString QStandardPaths::writableLocation(StandardLocation type)
{
// http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
QString xdgCacheHome = QFile::decodeName(qgetenv("XDG_CACHE_HOME"));
+ if (qsp_testMode)
+ xdgCacheHome = QDir::homePath() + QLatin1String("/.qttest/cache");
if (xdgCacheHome.isEmpty())
xdgCacheHome = QDir::homePath() + QLatin1String("/.cache");
if (type == QStandardPaths::CacheLocation)
@@ -85,6 +94,8 @@ QString QStandardPaths::writableLocation(StandardLocation type)
case GenericDataLocation:
{
QString xdgDataHome = QFile::decodeName(qgetenv("XDG_DATA_HOME"));
+ if (qsp_testMode)
+ xdgDataHome = QDir::homePath() + QLatin1String("/.qttest/share");
if (xdgDataHome.isEmpty())
xdgDataHome = QDir::homePath() + QLatin1String("/.local/share");
if (type == QStandardPaths::DataLocation)
@@ -95,6 +106,8 @@ QString QStandardPaths::writableLocation(StandardLocation type)
{
// http://standards.freedesktop.org/basedir-spec/latest/
QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME"));
+ if (qsp_testMode)
+ xdgConfigHome = QDir::homePath() + QLatin1String("/.qttest/config");
if (xdgConfigHome.isEmpty())
xdgConfigHome = QDir::homePath() + QLatin1String("/.config");
return xdgConfigHome;
@@ -140,7 +153,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
if (xdgConfigHome.isEmpty())
xdgConfigHome = QDir::homePath() + QLatin1String("/.config");
QFile file(xdgConfigHome + QLatin1String("/user-dirs.dirs"));
- if (file.open(QIODevice::ReadOnly)) {
+ if (!qsp_testMode && file.open(QIODevice::ReadOnly)) {
QHash<QString, QString> lines;
QTextStream stream(&file);
// Only look for lines like: XDG_DESKTOP_DIR="$HOME/Desktop"
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index 8bd32eb1d4..a2c53a4b4d 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -85,6 +85,13 @@ static QString convertCharArray(const wchar_t *path)
return QDir::fromNativeSeparators(QString::fromWCharArray(path));
}
+static bool qsp_testMode = false;
+
+void QStandardPaths::enableTestMode(bool testMode)
+{
+ qsp_testMode = testMode;
+}
+
QString QStandardPaths::writableLocation(StandardLocation type)
{
QString result;
@@ -105,6 +112,8 @@ QString QStandardPaths::writableLocation(StandardLocation type)
if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE))
#endif
result = convertCharArray(path);
+ if (qsp_testMode)
+ result += QLatin1String("/qttest");
if (type != GenericDataLocation) {
if (!QCoreApplication::organizationName().isEmpty())
result += QLatin1Char('/') + QCoreApplication::organizationName();
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index cb703df8c6..0411b463b3 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -696,7 +696,7 @@ void QTextStreamPrivate::flushWriteBuffer()
// flush the file
#ifndef QT_NO_QOBJECT
- QFile *file = qobject_cast<QFile *>(device);
+ QFileDevice *file = qobject_cast<QFileDevice *>(device);
bool flushed = !file || file->flush();
#else
bool flushed = true;
diff --git a/src/corelib/io/qtldurl.cpp b/src/corelib/io/qtldurl.cpp
index 7adb40261b..efd663b09a 100644
--- a/src/corelib/io/qtldurl.cpp
+++ b/src/corelib/io/qtldurl.cpp
@@ -44,12 +44,13 @@
#include "private/qurltlds_p.h"
#include "private/qtldurl_p.h"
#include "QtCore/qstringlist.h"
+#include "QtCore/qhash.h"
QT_BEGIN_NAMESPACE
static bool containsTLDEntry(const QString &entry)
{
- int index = qHash(entry) % tldCount;
+ int index = qt_hash(entry) % tldCount;
int currentDomainIndex = tldIndices[index];
while (currentDomainIndex < tldIndices[index+1]) {
QString currentEntry = QString::fromUtf8(tldData + currentDomainIndex);
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index c6b5ea63eb..fbc8d761c2 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Intel Corporation.
** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -170,6 +171,8 @@
\value RemoveQuery The query part of the URL (following a '?' character)
is removed.
\value RemoveFragment
+ \value PreferLocalFile If the URL is a local file according to isLocalFile()
+ and contains no query or fragment, a local file path is returned.
\value StripTrailingSlash The trailing slash is removed if one is present.
Note that the case folding rules in \l{RFC 3491}{Nameprep}, which QUrl
@@ -177,3474 +180,963 @@
regardless of the Qt::FormattingOptions used.
*/
-/*!
- \fn uint qHash(const QUrl &url)
- \since 4.7
- \relates QUrl
-
- Computes a hash key from the normalized version of \a url.
- */
-#include "qplatformdefs.h"
#include "qurl.h"
-#include "qatomic.h"
-#include "qbytearray.h"
-#include "qdir.h"
-#include "qfile.h"
-#include "qlist.h"
-#ifndef QT_NO_REGEXP
-#include "qregexp.h"
-#endif
+#include "qurl_p.h"
+#include "qplatformdefs.h"
#include "qstring.h"
#include "qstringlist.h"
-#include "qstack.h"
-#include "qvarlengtharray.h"
#include "qdebug.h"
-#ifndef QT_BOOTSTRAPPED
+#include "qhash.h"
+#include "qdir.h" // for QDir::fromNativeSeparators
#include "qtldurl_p.h"
-#endif
+#include "private/qipaddress_p.h"
+#include "qurlquery.h"
#if defined(Q_OS_WINCE_WM)
#pragma optimize("g", off)
#endif
QT_BEGIN_NAMESPACE
-extern void q_normalizePercentEncoding(QByteArray *ba, const char *exclude);
-extern void q_toPercentEncoding(QByteArray *ba, const char *exclude, const char *include = 0);
-extern void q_fromPercentEncoding(QByteArray *ba);
+inline static bool isHex(char c)
+{
+ c |= 0x20;
+ return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
+}
-static QByteArray toPercentEncodingHelper(const QString &s, const char *exclude, const char *include = 0)
+static inline char toHex(quint8 c)
{
- if (s.isNull())
- return QByteArray(); // null
- QByteArray ba = s.toUtf8();
- q_toPercentEncoding(&ba, exclude, include);
- return ba;
+ return c > 9 ? c - 10 + 'A' : c + '0';
}
-static QString fromPercentEncodingHelper(const QByteArray &ba)
+static inline QString ftpScheme()
{
- if (ba.isNull())
- return QString(); // null
- QByteArray copy = ba;
- q_fromPercentEncoding(&copy);
- return QString::fromUtf8(copy.constData(), copy.length());
+ return QStringLiteral("ftp");
}
-static QString fromPercentEncodingMutable(QByteArray *ba)
+static inline QString httpScheme()
{
- if (ba->isNull())
- return QString(); // null
- q_fromPercentEncoding(ba);
- return QString::fromUtf8(ba->constData(), ba->length());
+ return QStringLiteral("http");
}
-// ### Qt 5: Consider accepting empty strings as valid. See task 144227.
+static inline QString fileScheme()
+{
+ return QStringLiteral("file");
+}
-//#define QURL_DEBUG
+QUrlPrivate::QUrlPrivate()
+ : ref(1), port(-1),
+ errorCode(NoError), errorSupplement(0),
+ sectionIsPresent(0), sectionHasError(0)
+{
+}
-// implemented in qvsnprintf.cpp
-Q_CORE_EXPORT int qsnprintf(char *str, size_t n, const char *fmt, ...);
+QUrlPrivate::QUrlPrivate(const QUrlPrivate &copy)
+ : ref(1), port(copy.port),
+ scheme(copy.scheme),
+ userName(copy.userName),
+ password(copy.password),
+ host(copy.host),
+ path(copy.path),
+ query(copy.query),
+ fragment(copy.fragment),
+ errorCode(copy.errorCode),
+ errorSupplement(copy.errorSupplement),
+ sectionIsPresent(copy.sectionIsPresent),
+ sectionHasError(copy.sectionHasError)
+{
+}
-// needed by the punycode encoder/decoder
-#define Q_MAXINT ((uint)((uint)(-1)>>1))
-static const uint base = 36;
-static const uint tmin = 1;
-static const uint tmax = 26;
-static const uint skew = 38;
-static const uint damp = 700;
-static const uint initial_bias = 72;
-static const uint initial_n = 128;
+void QUrlPrivate::clear()
+{
+ scheme.clear();
+ userName.clear();
+ password.clear();
+ host.clear();
+ port = -1;
+ path.clear();
+ query.clear();
+ fragment.clear();
-#define QURL_SETFLAG(a, b) { (a) |= (b); }
-#define QURL_UNSETFLAG(a, b) { (a) &= ~(b); }
-#define QURL_HASFLAG(a, b) (((a) & (b)) == (b))
+ errorCode = NoError;
+ errorSupplement = 0;
+ sectionIsPresent = 0;
+ sectionHasError = 0;
+}
-struct QUrlErrorInfo {
- inline QUrlErrorInfo() : _source(0), _message(0), _expected(0), _found(0)
- { }
- const char *_source;
- const char *_message;
- char _expected;
- char _found;
+// From RFC 3896, Appendix A Collected ABNF for URI
+// URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
+//[...]
+// scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
+//
+// authority = [ userinfo "@" ] host [ ":" port ]
+// userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
+// host = IP-literal / IPv4address / reg-name
+// port = *DIGIT
+//[...]
+// reg-name = *( unreserved / pct-encoded / sub-delims )
+//[..]
+// pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+//
+// query = *( pchar / "/" / "?" )
+//
+// fragment = *( pchar / "/" / "?" )
+//
+// pct-encoded = "%" HEXDIG HEXDIG
+//
+// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+// reserved = gen-delims / sub-delims
+// gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
+// sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+// / "*" / "+" / "," / ";" / "="
+// the path component has a complex ABNF that basically boils down to
+// slash-separated segments of "pchar"
- inline void setParams(const char *source, const char *message, char expected, char found)
- {
- _source = source;
- _message = message;
- _expected = expected;
- _found = found;
- }
+// The above is the strict definition of the URL components and it is what we
+// return encoded as FullyEncoded. However, we store the equivalent to
+// PrettyDecoded internally, as that is the default formatting mode and most
+// likely to be used. PrettyDecoded decodes spaces, unicode sequences and
+// unambiguous delimiters.
+//
+// An ambiguous delimiter is a delimiter that, if appeared decoded, would be
+// interpreted as the beginning of a new component. The exact delimiters that
+// match that definition change according to the use. When each field is
+// considered in isolation from the rest, there are no ambiguities. In other
+// words, we always store the most decoded form (except for the query, see
+// below).
+//
+// The ambiguities arise when components are put together. From last to first
+// component of a full URL, the ambiguities are:
+// - fragment: none, since it's the last.
+// - query: the "#" character is ambiguous, as it starts the fragment. In
+// addition, the "+" character is treated specially, as should be both
+// intra-query delimiters. Since we don't know which ones they are, we
+// keep all reserved characters untouched.
+// - path: the "#" and "?" characters are ambigous. In addition to them,
+// the slash itself is considered special.
+// - host: completely special but never ambiguous, see setHost() below.
+// - password: the "#", "?", "/", "[", "]" and "@" characters are ambiguous
+// - username: the "#", "?", "/", "[", "]", "@", and ":" characters are ambiguous
+// - scheme: doesn't accept any delimiter, see setScheme() below.
+//
+// When the authority component is considered in isolation, the ambiguities of
+// its components are:
+// - host: special, never ambiguous
+// - password: "[", "]", "@" are ambiguous
+// - username: "[", "]", "@", ":" are ambiguous
+//
+// Finally, when the userinfo is considered in isolation, the ambiguities of its
+// components are:
+// - password: none, since it's the last
+// - username: ":" is ambiguous
+
+// list the recoding table modifications to be used with the recodeFromUser and
+// appendToUser functions, according to the rules above.
+// the encodedXXX tables are run with the delimiters set to "leave" by default;
+// the decodedXXX tables are run with the delimiters set to "decode" by default
+// (except for the query, which doesn't use these functions)
+
+#define decode(x) ushort(x)
+#define leave(x) ushort(0x100 | (x))
+#define encode(x) ushort(0x200 | (x))
+
+static const ushort encodedUserNameActions[] = {
+ // first field, everything must be encoded, including the ":"
+ // userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
+ encode('/'), // 0
+ encode('?'), // 1
+ encode('#'), // 2
+ encode('['), // 3
+ encode(']'), // 4
+ encode('@'), // 5
+ encode(':'), // 6
+ 0
};
-
-struct QUrlParseData
-{
- const char *scheme;
- int schemeLength;
-
- const char *userInfo;
- int userInfoDelimIndex;
- int userInfoLength;
-
- const char *host;
- int hostLength;
- int port;
-
- const char *path;
- int pathLength;
- const char *query;
- int queryLength;
- const char *fragment;
- int fragmentLength;
+static const ushort * const decodedUserNameInAuthorityActions = encodedUserNameActions + 3;
+static const ushort * const decodedUserNameInUserInfoActions = encodedUserNameActions + 6;
+static const ushort * const decodedUserNameInUrlActions = encodedUserNameActions;
+static const ushort * const decodedUserNameInIsolationActions = 0;
+
+static const ushort encodedPasswordActions[] = {
+ // same as encodedUserNameActions, but decode ":"
+ // userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
+ encode('/'), // 0
+ encode('?'), // 1
+ encode('#'), // 2
+ encode('['), // 3
+ encode(']'), // 4
+ encode('@'), // 5
+ 0
};
-
-
-class QUrlPrivate
-{
-public:
- QUrlPrivate();
- QUrlPrivate(const QUrlPrivate &other);
-
- bool setUrl(const QString &url);
-
- QString canonicalHost() const;
- void ensureEncodedParts() const;
- QString authority(QUrl::FormattingOptions options = QUrl::None) const;
- void setAuthority(const QString &auth);
- void setUserInfo(const QString &userInfo);
- QString userInfo(QUrl::FormattingOptions options = QUrl::None) const;
- void setEncodedAuthority(const QByteArray &authority);
- void setEncodedUserInfo(const QUrlParseData *parseData);
- void setEncodedUrl(const QByteArray&, QUrl::ParsingMode);
-
- QByteArray mergePaths(const QByteArray &relativePath) const;
-
- void queryItem(int pos, int *value, int *end);
-
- enum ParseOptions {
- ParseAndSet,
- ParseOnly
- };
-
- void validate() const;
- void parse(ParseOptions parseOptions = ParseAndSet) const;
- void clear();
-
- QByteArray toEncoded(QUrl::FormattingOptions options = QUrl::None) const;
-
- QAtomicInt ref;
-
- QString scheme;
- QString userName;
- QString password;
- QString host;
- QString path;
- QByteArray query;
- QString fragment;
-
- QByteArray encodedOriginal;
- QByteArray encodedUserName;
- QByteArray encodedPassword;
- QByteArray encodedPath;
- QByteArray encodedFragment;
-
- int port;
- QUrl::ParsingMode parsingMode;
-
- bool hasQuery;
- bool hasFragment;
- bool isValid;
- bool isHostValid;
-
- char valueDelimiter;
- char pairDelimiter;
-
- enum State {
- Parsed = 0x1,
- Validated = 0x2,
- Normalized = 0x4,
- HostCanonicalized = 0x8
- };
- int stateFlags;
-
- mutable QByteArray encodedNormalized;
- const QByteArray & normalized() const;
-
- mutable QUrlErrorInfo errorInfo;
- QString createErrorString();
+static const ushort * const decodedPasswordInAuthorityActions = encodedPasswordActions + 3;
+static const ushort * const decodedPasswordInUserInfoActions = 0;
+static const ushort * const decodedPasswordInUrlActions = encodedPasswordActions;
+static const ushort * const decodedPasswordInIsolationActions = 0;
+
+static const ushort encodedPathActions[] = {
+ // pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ encode('['), // 0
+ encode(']'), // 1
+ encode('?'), // 2
+ encode('#'), // 3
+ leave('/'), // 4
+ 0
+};
+static const ushort decodedPathInUrlActions[] = {
+ decode('{'), // 0
+ decode('}'), // 1
+ encode('?'), // 2
+ encode('#'), // 3
+ leave('/'), // 4
+ 0
+};
+static const ushort * const decodedPathInIsolationActions = encodedPathActions + 4; // leave('/')
+
+static const ushort encodedFragmentActions[] = {
+ // fragment = *( pchar / "/" / "?" )
+ // gen-delims permitted: ":" / "@" / "/" / "?"
+ // -> must encode: "[" / "]" / "#"
+ // HOWEVER: we allow "#" to remain decoded
+ decode('#'), // 0
+ decode(':'), // 1
+ decode('@'), // 2
+ decode('/'), // 3
+ decode('?'), // 4
+ encode('['), // 5
+ encode(']'), // 6
+ 0
+};
+static const ushort * const decodedFragmentInUrlActions = 0;
+static const ushort * const decodedFragmentInIsolationActions = 0;
+
+// the query is handled specially: the decodedQueryXXX tables are run with
+// the delimiters set to "leave" by default and the others set to "encode"
+static const ushort encodedQueryActions[] = {
+ // query = *( pchar / "/" / "?" )
+ // gen-delims permitted: ":" / "@" / "/" / "?"
+ // HOWEVER: we leave alone them alone, plus "[" and "]"
+ // -> must encode: "#"
+ encode('#'), // 0
+ 0
+};
+static const ushort decodedQueryInIsolationActions[] = {
+ decode('"'), // 0
+ decode('<'), // 1
+ decode('>'), // 2
+ decode('^'), // 3
+ decode('\\'),// 4
+ decode('|'), // 5
+ decode('{'), // 6
+ decode('}'), // 7
+ decode('#'), // 8
+ 0
+};
+static const ushort decodedQueryInUrlActions[] = {
+ decode('{'), // 6
+ decode('}'), // 7
+ encode('#'), // 8
+ 0
};
-static bool QT_FASTCALL _HEXDIG(const char **ptr)
+static inline QString
+recodeFromUser(const QString &input, const ushort *actions, int from, int to)
{
- char ch = **ptr;
- if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F')) {
- ++(*ptr);
- return true;
+ QString output;
+ const QChar *begin = input.constData() + from;
+ const QChar *end = input.constData() + to;
+ if (qt_urlRecode(output, begin, end,
+ QUrl::MostDecoded, actions))
+ return output;
+
+ return input.mid(from, to - from);
+}
+
+// appendXXXX functions:
+// the internal value is stored in its most decoded form, so that case is easy.
+// DecodeUnicode and DecodeSpaces are handled by qt_urlRecode.
+// That leaves these functions to handle two cases related to delimiters:
+// 1) encoded encodedXXXX tables
+// 2) decoded decodedXXXX tables
+static inline void appendToUser(QString &appendTo, const QString &value, QUrl::FormattingOptions options,
+ const ushort *encodedActions, const ushort *decodedActions)
+{
+ if (options == QUrl::PrettyDecoded) {
+ appendTo += value;
+ return;
}
- return false;
+ const ushort *actions = 0;
+ if (options & QUrl::EncodeDelimiters)
+ actions = encodedActions;
+ else
+ actions = decodedActions;
+
+ if (!qt_urlRecode(appendTo, value.constData(), value.constEnd(), options, actions))
+ appendTo += value;
}
-// pct-encoded = "%" HEXDIG HEXDIG
-static bool QT_FASTCALL _pctEncoded(const char **ptr)
+inline void QUrlPrivate::appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const
{
- const char *ptrBackup = *ptr;
+ if ((options & QUrl::RemoveUserInfo) != QUrl::RemoveUserInfo) {
+ appendUserInfo(appendTo, options, appendingTo);
- if (**ptr != '%')
- return false;
- ++(*ptr);
-
- if (!_HEXDIG(ptr)) {
- *ptr = ptrBackup;
- return false;
- }
- if (!_HEXDIG(ptr)) {
- *ptr = ptrBackup;
- return false;
+ // add '@' only if we added anything
+ if (hasUserName() || (hasPassword() && (options & QUrl::RemovePassword) == 0))
+ appendTo += QLatin1Char('@');
}
-
- return true;
+ appendHost(appendTo, options);
+ if (!(options & QUrl::RemovePort) && port != -1)
+ appendTo += QLatin1Char(':') + QString::number(port);
}
-#if 0
-// gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
-static bool QT_FASTCALL _genDelims(const char **ptr, char *c)
+inline void QUrlPrivate::appendUserInfo(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const
{
- char ch = **ptr;
- switch (ch) {
- case ':': case '/': case '?': case '#':
- case '[': case ']': case '@':
- *c = ch;
- ++(*ptr);
- return true;
- default:
- return false;
- }
-}
-#endif
+ if (Q_LIKELY(userName.isEmpty() && password.isEmpty()))
+ return;
-// sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
-// / "*" / "+" / "," / ";" / "="
-static bool QT_FASTCALL _subDelims(const char **ptr)
-{
- char ch = **ptr;
- switch (ch) {
- case '!': case '$': case '&': case '\'':
- case '(': case ')': case '*': case '+':
- case ',': case ';': case '=':
- ++(*ptr);
- return true;
- default:
- return false;
- }
-}
+ const ushort *userNameActions;
+ const ushort *passwordActions;
+ if (options & QUrl::EncodeDelimiters) {
+ userNameActions = encodedUserNameActions;
+ passwordActions = encodedPasswordActions;
+ } else {
+ switch (appendingTo) {
+ case UserInfo:
+ userNameActions = decodedUserNameInUserInfoActions;
+ passwordActions = decodedPasswordInUserInfoActions;
+ break;
-// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
-static bool QT_FASTCALL _unreserved(const char **ptr)
-{
- char ch = **ptr;
- if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
- || (ch >= '0' && ch <= '9')
- || ch == '-' || ch == '.' || ch == '_' || ch == '~') {
- ++(*ptr);
- return true;
- }
- return false;
-}
+ case Authority:
+ userNameActions = decodedUserNameInAuthorityActions;
+ passwordActions = decodedPasswordInAuthorityActions;
+ break;
-// scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
-static bool QT_FASTCALL _scheme(const char **ptr, QUrlParseData *parseData)
-{
- bool first = true;
- bool isSchemeValid = true;
-
- parseData->scheme = *ptr;
- for (;;) {
- char ch = **ptr;
- if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
- ;
- } else if ((ch >= '0' && ch <= '9') || ch == '+' || ch == '-' || ch == '.') {
- if (first)
- isSchemeValid = false;
- } else {
+ case FullUrl:
+ default:
+ userNameActions = decodedUserNameInUrlActions;
+ passwordActions = decodedPasswordInUrlActions;
break;
}
-
- ++(*ptr);
- first = false;
}
- if (**ptr != ':') {
- isSchemeValid = true;
- *ptr = parseData->scheme;
+ if ((options & QUrl::EncodeReserved) == 0)
+ options |= QUrl::DecodeReserved;
+
+ if (!qt_urlRecode(appendTo, userName.constData(), userName.constEnd(), options, userNameActions))
+ appendTo += userName;
+ if (options & QUrl::RemovePassword || !hasPassword()) {
+ return;
} else {
- parseData->schemeLength = *ptr - parseData->scheme;
- ++(*ptr); // skip ':'
+ appendTo += QLatin1Char(':');
+ if (!qt_urlRecode(appendTo, password.constData(), password.constEnd(), options, passwordActions))
+ appendTo += password;
}
-
- return isSchemeValid;
}
-// IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
-static bool QT_FASTCALL _IPvFuture(const char **ptr)
+inline void QUrlPrivate::appendUserName(QString &appendTo, QUrl::FormattingOptions options) const
{
- if (**ptr != 'v')
- return false;
-
- const char *ptrBackup = *ptr;
- ++(*ptr);
-
- if (!_HEXDIG(ptr)) {
- *ptr = ptrBackup;
- return false;
- }
-
- while (_HEXDIG(ptr))
- ;
-
- if (**ptr != '.') {
- *ptr = ptrBackup;
- return false;
- }
- ++(*ptr);
-
- if (!_unreserved(ptr) && !_subDelims(ptr) && *((*ptr)++) != ':') {
- *ptr = ptrBackup;
- return false;
- }
-
-
- while (_unreserved(ptr) || _subDelims(ptr) || *((*ptr)++) == ':')
- ;
-
- return true;
+ appendToUser(appendTo, userName, options, encodedUserNameActions, decodedUserNameInIsolationActions);
}
-// h16 = 1*4HEXDIG
-// ; 16 bits of address represented in hexadecimal
-static bool QT_FASTCALL _h16(const char **ptr)
+inline void QUrlPrivate::appendPassword(QString &appendTo, QUrl::FormattingOptions options) const
{
- int i = 0;
- for (; i < 4; ++i) {
- if (!_HEXDIG(ptr))
- break;
- }
- return (i != 0);
+ appendToUser(appendTo, password, options, encodedPasswordActions, decodedPasswordInIsolationActions);
}
-// dec-octet = DIGIT ; 0-9
-// / %x31-39 DIGIT ; 10-99
-// / "1" 2DIGIT ; 100-199
-// / "2" %x30-34 DIGIT ; 200-249
-// / "25" %x30-35 ; 250-255
-static bool QT_FASTCALL _decOctet(const char **ptr)
+inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const
{
- const char *ptrBackup = *ptr;
- char c1 = **ptr;
-
- if (c1 < '0' || c1 > '9')
- return false;
+ if (appendingTo != Path && !(options & QUrl::EncodeDelimiters)) {
+ if (!qt_urlRecode(appendTo, path.constData(), path.constEnd(), options, decodedPathInUrlActions))
+ appendTo += path;
- ++(*ptr);
-
- if (c1 == '0')
- return true;
-
- char c2 = **ptr;
-
- if (c2 < '0' || c2 > '9')
- return true;
-
- ++(*ptr);
-
- char c3 = **ptr;
- if (c3 < '0' || c3 > '9')
- return true;
-
- // If there is a three digit number larger than 255, reject the
- // whole token.
- if (c1 >= '2' && c2 >= '5' && c3 > '5') {
- *ptr = ptrBackup;
- return false;
+ } else {
+ appendToUser(appendTo, path, options, encodedPathActions, decodedPathInIsolationActions);
}
-
- ++(*ptr);
-
- return true;
}
-// IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
-static bool QT_FASTCALL _IPv4Address(const char **ptr)
+inline void QUrlPrivate::appendFragment(QString &appendTo, QUrl::FormattingOptions options) const
{
- const char *ptrBackup = *ptr;
+ appendToUser(appendTo, fragment, options, encodedFragmentActions, decodedFragmentInIsolationActions);
+}
- if (!_decOctet(ptr)) {
- *ptr = ptrBackup;
- return false;
+inline void QUrlPrivate::appendQuery(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const
+{
+ // almost the same code as the previous functions
+ // except we prefer not to touch the delimiters
+ if (options == QUrl::PrettyDecoded && appendingTo == Query) {
+ appendTo += query;
+ return;
}
- for (int i = 0; i < 3; ++i) {
- char ch = *((*ptr)++);
- if (ch != '.') {
- *ptr = ptrBackup;
- return false;
- }
-
- if (!_decOctet(ptr)) {
- *ptr = ptrBackup;
- return false;
- }
+ const ushort *actions = 0;
+ if (options & QUrl::EncodeDelimiters) {
+ actions = encodedQueryActions;
+ } else {
+ // reset to default qt_urlRecode behaviour (leave delimiters alone)
+ options |= QUrl::EncodeDelimiters;
+ actions = appendingTo == Query ? decodedQueryInIsolationActions : decodedQueryInUrlActions;
}
- return true;
+ if (!qt_urlRecode(appendTo, query.constData(), query.constData() + query.length(),
+ options, actions))
+ appendTo += query;
}
-// ls32 = ( h16 ":" h16 ) / IPv4address
-// ; least-significant 32 bits of address
-static bool QT_FASTCALL _ls32(const char **ptr)
-{
- const char *ptrBackup = *ptr;
- if (_h16(ptr) && *((*ptr)++) == ':' && _h16(ptr))
- return true;
+// setXXX functions
- *ptr = ptrBackup;
- return _IPv4Address(ptr);
-}
-
-// IPv6address = 6( h16 ":" ) ls32 // case 1
-// / "::" 5( h16 ":" ) ls32 // case 2
-// / [ h16 ] "::" 4( h16 ":" ) ls32 // case 3
-// / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 // case 4
-// / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 // case 5
-// / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 // case 6
-// / [ *4( h16 ":" ) h16 ] "::" ls32 // case 7
-// / [ *5( h16 ":" ) h16 ] "::" h16 // case 8
-// / [ *6( h16 ":" ) h16 ] "::" // case 9
-static bool QT_FASTCALL _IPv6Address(const char **ptr)
+bool QUrlPrivate::setScheme(const QString &value, int len, bool decoded)
{
- const char *ptrBackup = *ptr;
-
- // count of (h16 ":") to the left of and including ::
- int leftHexColons = 0;
- // count of (h16 ":") to the right of ::
- int rightHexColons = 0;
+ // schemes are strictly RFC-compliant:
+ // scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
+ // but we need to decode any percent-encoding sequences that fall on
+ // those characters
+ // we also lowercase the scheme
- // first count the number of (h16 ":") on the left of ::
- while (_h16(ptr)) {
+ scheme.clear();
+ sectionIsPresent |= Scheme;
+ sectionHasError |= Scheme; // assume it has errors, we'll clear before returning true
+ errorCode = SchemeEmptyError;
+ if (len == 0)
+ return false;
- // an h16 not followed by a colon is considered an
- // error.
- if (**ptr != ':') {
- *ptr = ptrBackup;
- return false;
+ // validate it:
+ errorCode = InvalidSchemeError;
+ int needsLowercasing = -1;
+ const ushort *p = reinterpret_cast<const ushort *>(value.constData());
+ for (int i = 0; i < len; ++i) {
+ if (p[i] >= 'a' && p[i] <= 'z')
+ continue;
+ if (p[i] >= 'A' && p[i] <= 'Z') {
+ needsLowercasing = i;
+ continue;
}
- ++(*ptr);
- ++leftHexColons;
+ if (p[i] >= '0' && p[i] <= '9' && i > 0)
+ continue;
+ if (p[i] == '+' || p[i] == '-' || p[i] == '.')
+ continue;
- // check for case 1, the only time when there can be no ::
- if (leftHexColons == 6 && _ls32(ptr)) {
- return true;
+ if (p[i] == '%') {
+ // found a percent-encoded sign
+ // if we haven't decoded yet, decode and try again
+ errorSupplement = '%';
+ if (decoded)
+ return false;
+
+ QString decodedScheme;
+ if (qt_urlRecode(decodedScheme, value.constData(), value.constData() + len, 0, 0) == 0)
+ return false;
+ return setScheme(decodedScheme, decodedScheme.length(), true);
}
- }
-
- // check for case 2 where the address starts with a :
- if (leftHexColons == 0 && *((*ptr)++) != ':') {
- *ptr = ptrBackup;
- return false;
- }
- // check for the second colon in ::
- if (*((*ptr)++) != ':') {
- *ptr = ptrBackup;
+ // found something else
+ errorSupplement = p[i];
return false;
}
- int canBeCase = -1;
- bool ls32WasRead = false;
-
- const char *tmpBackup = *ptr;
+ scheme = value.left(len);
+ sectionHasError &= ~Scheme;
+ errorCode = NoError;
- // count the number of (h16 ":") on the right of ::
- for (;;) {
- tmpBackup = *ptr;
- if (!_h16(ptr)) {
- if (!_ls32(ptr)) {
- if (rightHexColons != 0) {
- *ptr = ptrBackup;
- return false;
- }
-
- // the address ended with :: (case 9)
- // only valid if 1 <= leftHexColons <= 7
- canBeCase = 9;
- } else {
- ls32WasRead = true;
- }
- break;
+ if (needsLowercasing != -1) {
+ // schemes are ASCII only, so we don't need the full Unicode toLower
+ QChar *schemeData = scheme.data(); // force detaching here
+ for (int i = needsLowercasing; i >= 0; --i) {
+ register ushort c = schemeData[i].unicode();
+ if (c >= 'A' && c <= 'Z')
+ schemeData[i] = c + 0x20;
}
- ++rightHexColons;
- if (**ptr != ':') {
- // no colon could mean that what was read as an h16
- // was in fact the first part of an ls32. we backtrack
- // and retry.
- const char *pb = *ptr;
- *ptr = tmpBackup;
- if (_ls32(ptr)) {
- ls32WasRead = true;
- --rightHexColons;
- } else {
- *ptr = pb;
- // address ends with only 1 h16 after :: (case 8)
- if (rightHexColons == 1)
- canBeCase = 8;
- }
- break;
- }
- ++(*ptr);
}
-
- // determine which case it is based on the number of rightHexColons
- if (canBeCase == -1) {
-
- // check if a ls32 was read. If it wasn't and rightHexColons >= 2 then the
- // last 2 HexColons are in fact a ls32
- if (!ls32WasRead && rightHexColons >= 2)
- rightHexColons -= 2;
-
- canBeCase = 7 - rightHexColons;
- }
-
- // based on the case we need to check that the number of leftHexColons is valid
- if (leftHexColons > (canBeCase - 2)) {
- *ptr = ptrBackup;
- return false;
- }
-
return true;
}
-// IP-literal = "[" ( IPv6address / IPvFuture ) "]"
-static bool QT_FASTCALL _IPLiteral(const char **ptr)
+bool QUrlPrivate::setAuthority(const QString &auth, int from, int end)
{
- const char *ptrBackup = *ptr;
- if (**ptr != '[')
- return false;
- ++(*ptr);
-
- if (!_IPv6Address(ptr) && !_IPvFuture(ptr)) {
- *ptr = ptrBackup;
- return false;
+ sectionHasError &= ~Authority;
+ sectionIsPresent &= ~Authority;
+ sectionIsPresent |= Host;
+ if (from == end) {
+ userName.clear();
+ password.clear();
+ host.clear();
+ port = -1;
+ return true;
}
- if (**ptr != ']') {
- *ptr = ptrBackup;
- return false;
+ int userInfoIndex = auth.indexOf(QLatin1Char('@'), from);
+ if (uint(userInfoIndex) < uint(end)) {
+ setUserInfo(auth, from, userInfoIndex);
+ from = userInfoIndex + 1;
}
- ++(*ptr);
- return true;
-}
+ int colonIndex = auth.lastIndexOf(QLatin1Char(':'), end - 1);
+ if (colonIndex < from)
+ colonIndex = -1;
-// reg-name = *( unreserved / pct-encoded / sub-delims )
-static void QT_FASTCALL _regName(const char **ptr)
-{
- for (;;) {
- if (!_unreserved(ptr) && !_subDelims(ptr)) {
- if (!_pctEncoded(ptr))
- break;
+ if (uint(colonIndex) < uint(end)) {
+ if (auth.at(from).unicode() == '[') {
+ // check if colonIndex isn't inside the "[...]" part
+ int closingBracket = auth.indexOf(QLatin1Char(']'), from);
+ if (uint(closingBracket) > uint(colonIndex))
+ colonIndex = -1;
}
}
-}
-// host = IP-literal / IPv4address / reg-name
-static void QT_FASTCALL _host(const char **ptr, QUrlParseData *parseData)
-{
- parseData->host = *ptr;
- if (!_IPLiteral(ptr)) {
- if (_IPv4Address(ptr)) {
- char ch = **ptr;
- if (ch && ch != ':' && ch != '/') {
- // reset
- *ptr = parseData->host;
- _regName(ptr);
- }
- } else {
- _regName(ptr);
- }
- }
- parseData->hostLength = *ptr - parseData->host;
-}
-
-// userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
-static void QT_FASTCALL _userInfo(const char **ptr, QUrlParseData *parseData)
-{
- parseData->userInfo = *ptr;
- for (;;) {
- if (_unreserved(ptr) || _subDelims(ptr)) {
- ;
- } else {
- if (_pctEncoded(ptr)) {
- ;
- } else if (**ptr == ':') {
- parseData->userInfoDelimIndex = *ptr - parseData->userInfo;
- ++(*ptr);
+ if (colonIndex == end - 1) {
+ // found a colon but no digits after it
+ sectionHasError |= Port;
+ errorCode = PortEmptyError;
+ } else if (uint(colonIndex) < uint(end)) {
+ unsigned long x = 0;
+ for (int i = colonIndex + 1; i < end; ++i) {
+ ushort c = auth.at(i).unicode();
+ if (c >= '0' && c <= '9') {
+ x *= 10;
+ x += c - '0';
} else {
+ sectionHasError |= Port;
+ errorCode = InvalidPortError;
+ x = ulong(-1); // x != ushort(x)
break;
}
}
- }
- if (**ptr != '@') {
- *ptr = parseData->userInfo;
- parseData->userInfoDelimIndex = -1;
- return;
- }
- parseData->userInfoLength = *ptr - parseData->userInfo;
- ++(*ptr);
-}
-
-// port = *DIGIT
-static void QT_FASTCALL _port(const char **ptr, int *port)
-{
- bool first = true;
-
- for (;;) {
- const char *ptrBackup = *ptr;
- char ch = *((*ptr)++);
- if (ch < '0' || ch > '9') {
- *ptr = ptrBackup;
- break;
- }
-
- if (first) {
- first = false;
- *port = 0;
+ if (x == ushort(x)) {
+ port = ushort(x);
+ } else {
+ sectionHasError |= Port;
+ errorCode = InvalidPortError;
}
-
- *port *= 10;
- *port += ch - '0';
+ } else {
+ port = -1;
}
-}
-
-// authority = [ userinfo "@" ] host [ ":" port ]
-static void QT_FASTCALL _authority(const char **ptr, QUrlParseData *parseData)
-{
- _userInfo(ptr, parseData);
- _host(ptr, parseData);
-
- if (**ptr != ':')
- return;
- ++(*ptr);
- _port(ptr, &parseData->port);
+ return setHost(auth, from, qMin<uint>(end, colonIndex)) && !(sectionHasError & Port);
}
-// pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
-static bool QT_FASTCALL _pchar(const char **ptr)
+void QUrlPrivate::setUserInfo(const QString &userInfo, int from, int end)
{
- char c = *(*ptr);
+ int delimIndex = userInfo.indexOf(QLatin1Char(':'), from);
+ setUserName(userInfo, from, qMin<uint>(delimIndex, end));
- switch (c) {
- case '!': case '$': case '&': case '\'': case '(': case ')': case '*':
- case '+': case ',': case ';': case '=': case ':': case '@':
- case '-': case '.': case '_': case '~':
- ++(*ptr);
- return true;
- default:
- break;
- };
-
- if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) {
- ++(*ptr);
- return true;
+ if (delimIndex == -1) {
+ password.clear();
+ sectionIsPresent &= ~Password;
+ sectionHasError &= ~Password;
+ } else {
+ setPassword(userInfo, delimIndex + 1, end);
}
-
- if (_pctEncoded(ptr))
- return true;
-
- return false;
}
-// segment = *pchar
-static bool QT_FASTCALL _segmentNZ(const char **ptr)
+inline void QUrlPrivate::setUserName(const QString &value, int from, int end)
{
- if (!_pchar(ptr))
- return false;
-
- while(_pchar(ptr))
- ;
-
- return true;
+ sectionIsPresent |= UserName;
+ sectionHasError &= ~UserName;
+ userName = recodeFromUser(value, decodedUserNameInIsolationActions, from, end);
}
-// path-abempty = *( "/" segment )
-static void QT_FASTCALL _pathAbEmpty(const char **ptr)
+inline void QUrlPrivate::setPassword(const QString &value, int from, int end)
{
- for (;;) {
- if (**ptr != '/')
- break;
- ++(*ptr);
-
- while (_pchar(ptr))
- ;
- }
+ sectionIsPresent |= Password;
+ sectionHasError &= ~Password;
+ password = recodeFromUser(value, decodedPasswordInIsolationActions, from, end);
}
-// path-abs = "/" [ segment-nz *( "/" segment ) ]
-static bool QT_FASTCALL _pathAbs(const char **ptr)
+inline void QUrlPrivate::setPath(const QString &value, int from, int end)
{
- // **ptr == '/' already checked in caller
- ++(*ptr);
-
- // we might be able to unnest this to gain some performance.
- if (!_segmentNZ(ptr))
- return true;
+ // sectionIsPresent |= Path; // not used, save some cycles
+ sectionHasError &= ~Path;
+ path = recodeFromUser(value, decodedPathInIsolationActions, from, end);
- _pathAbEmpty(ptr);
+ // ### FIXME?
+ // check for the "path-noscheme" case
+ // if the path contains a ":" before the first "/", it could be misinterpreted
+ // as a scheme
+}
- return true;
+inline void QUrlPrivate::setFragment(const QString &value, int from, int end)
+{
+ sectionIsPresent |= Fragment;
+ sectionHasError &= ~Fragment;
+ fragment = recodeFromUser(value, decodedFragmentInIsolationActions, from, end);
}
-// path-rootless = segment-nz *( "/" segment )
-static bool QT_FASTCALL _pathRootless(const char **ptr)
+inline void QUrlPrivate::setQuery(const QString &value, int from, int iend)
{
- // we might be able to unnest this to gain some performance.
- if (!_segmentNZ(ptr))
- return false;
+ sectionIsPresent |= Query;
+ sectionHasError &= ~Query;
- _pathAbEmpty(ptr);
+ // use the default actions for the query (don't set QUrl::DecodeAllDelimiters)
+ QString output;
+ const QChar *begin = value.constData() + from;
+ const QChar *end = value.constData() + iend;
- return true;
+ // leave delimiters alone but decode the rest
+ if (qt_urlRecode(output, begin, end, QUrl::EncodeDelimiters,
+ decodedQueryInIsolationActions))
+ query = output;
+ else
+ query = value.mid(from, iend - from);
}
-
-// hier-part = "//" authority path-abempty
-// / path-abs
-// / path-rootless
-// / path-empty
-static void QT_FASTCALL _hierPart(const char **ptr, QUrlParseData *parseData)
-{
- const char *ptrBackup = *ptr;
- const char *pathStart = 0;
- if (*((*ptr)++) == '/' && *((*ptr)++) == '/') {
- _authority(ptr, parseData);
- pathStart = *ptr;
- _pathAbEmpty(ptr);
+// Host handling
+// The RFC says the host is:
+// host = IP-literal / IPv4address / reg-name
+// IP-literal = "[" ( IPv6address / IPvFuture ) "]"
+// IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
+// [a strict definition of IPv6Address and IPv4Address]
+// reg-name = *( unreserved / pct-encoded / sub-delims )
+//
+// We deviate from the standard in all but IPvFuture. For IPvFuture we accept
+// and store only exactly what the RFC says we should. No percent-encoding is
+// permitted in this field, so Unicode characters and space aren't either.
+//
+// For IPv4 addresses, we accept broken addresses like inet_aton does (that is,
+// less than three dots). However, we correct the address to the proper form
+// and store the corrected address. After correction, we comply to the RFC and
+// it's exclusively composed of unreserved characters.
+//
+// For IPv6 addresses, we accept addresses including trailing (embedded) IPv4
+// addresses, the so-called v4-compat and v4-mapped addresses. We also store
+// those addresses like that in the hostname field, which violates the spec.
+// IPv6 hosts are stored with the square brackets in the QString. It also
+// requires no transformation in any way.
+//
+// As for registered names, it's the other way around: we accept only valid
+// hostnames as specified by STD 3 and IDNA. That means everything we accept is
+// valid in the RFC definition above, but there are many valid reg-names
+// according to the RFC that we do not accept in the name of security. Since we
+// do accept IDNA, reg-names are subject to ACE encoding and decoding, which is
+// specified by the DecodeUnicode flag. The hostname is stored in its Unicode form.
+
+inline void QUrlPrivate::appendHost(QString &appendTo, QUrl::FormattingOptions options) const
+{
+ // this is the only flag that matters
+ options &= QUrl::EncodeUnicode;
+ if (host.isEmpty())
+ return;
+ if (host.at(0).unicode() == '[') {
+ // IPv6Address and IPvFuture address never require any transformation
+ appendTo += host;
} else {
- *ptr = ptrBackup;
- pathStart = *ptr;
- if (**ptr == '/')
- _pathAbs(ptr);
+ // this is either an IPv4Address or a reg-name
+ // if it is a reg-name, it is already stored in Unicode form
+ if (options == QUrl::EncodeUnicode)
+ appendTo += qt_ACE_do(host, ToAceOnly);
else
- _pathRootless(ptr);
- }
- parseData->path = pathStart;
- parseData->pathLength = *ptr - pathStart;
-}
-
-// query = *( pchar / "/" / "?" )
-static void QT_FASTCALL _query(const char **ptr, QUrlParseData *parseData)
-{
- parseData->query = *ptr;
- for (;;) {
- if (_pchar(ptr)) {
- ;
- } else if (**ptr == '/' || **ptr == '?') {
- ++(*ptr);
- } else {
- break;
+ appendTo += host;
+ }
+}
+
+// the whole IPvFuture is passed and parsed here, including brackets
+static int parseIpFuture(QString &host, const QChar *begin, const QChar *end)
+{
+ // IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )
+ static const char acceptable[] =
+ "!$&'()*+,;=" // sub-delims
+ ":" // ":"
+ "-._~"; // unreserved
+
+ // the brackets and the "v" have been checked
+ if (begin[3].unicode() != '.')
+ return begin[3].unicode();
+ if ((begin[2].unicode() >= 'A' && begin[2].unicode() >= 'F') ||
+ (begin[2].unicode() >= 'a' && begin[2].unicode() <= 'f') ||
+ (begin[2].unicode() >= '0' && begin[2].unicode() <= '9')) {
+ // this is so unlikely that we'll just go down the slow path
+ // decode the whole string, skipping the "[vH." and "]" which we already know to be there
+ host += QString::fromRawData(begin, 4);
+ begin += 4;
+ --end;
+
+ QString decoded;
+ if (qt_urlRecode(decoded, begin, end, QUrl::FullyEncoded, 0)) {
+ begin = decoded.constBegin();
+ end = decoded.constEnd();
}
- }
- parseData->queryLength = *ptr - parseData->query;
-}
-// fragment = *( pchar / "/" / "?" )
-static void QT_FASTCALL _fragment(const char **ptr, QUrlParseData *parseData)
-{
- parseData->fragment = *ptr;
- for (;;) {
- if (_pchar(ptr)) {
- ;
- } else if (**ptr == '/' || **ptr == '?' || **ptr == '#') {
- ++(*ptr);
- } else {
- break;
+ for ( ; begin != end; ++begin) {
+ if (begin->unicode() >= 'A' && begin->unicode() <= 'Z')
+ host += *begin;
+ else if (begin->unicode() >= 'a' && begin->unicode() <= 'z')
+ host += *begin;
+ else if (begin->unicode() >= '0' && begin->unicode() <= '9')
+ host += *begin;
+ else if (begin->unicode() < 0x80 && strchr(acceptable, begin->unicode()) != 0)
+ host += *begin;
+ else
+ return begin->unicode();
}
+ host += QLatin1Char(']');
+ return -1;
}
- parseData->fragmentLength = *ptr - parseData->fragment;
+ return begin[2].unicode();
}
-struct NameprepCaseFoldingEntry {
- uint uc;
- ushort mapping[4];
-};
-
-inline bool operator<(uint one, const NameprepCaseFoldingEntry &other)
-{ return one < other.uc; }
-
-inline bool operator<(const NameprepCaseFoldingEntry &one, uint other)
-{ return one.uc < other; }
-
-static const NameprepCaseFoldingEntry NameprepCaseFolding[] = {
-/* { 0x0041, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x0042, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x0043, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x0044, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x0045, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x0046, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x0047, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x0048, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x0049, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x004A, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x004B, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x004C, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x004D, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x004E, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x004F, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x0050, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x0051, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x0052, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x0053, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x0054, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x0055, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x0056, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x0057, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x0058, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x0059, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x005A, { 0x007A, 0x0000, 0x0000, 0x0000 } },*/
- { 0x00B5, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
- { 0x00C0, { 0x00E0, 0x0000, 0x0000, 0x0000 } },
- { 0x00C1, { 0x00E1, 0x0000, 0x0000, 0x0000 } },
- { 0x00C2, { 0x00E2, 0x0000, 0x0000, 0x0000 } },
- { 0x00C3, { 0x00E3, 0x0000, 0x0000, 0x0000 } },
- { 0x00C4, { 0x00E4, 0x0000, 0x0000, 0x0000 } },
- { 0x00C5, { 0x00E5, 0x0000, 0x0000, 0x0000 } },
- { 0x00C6, { 0x00E6, 0x0000, 0x0000, 0x0000 } },
- { 0x00C7, { 0x00E7, 0x0000, 0x0000, 0x0000 } },
- { 0x00C8, { 0x00E8, 0x0000, 0x0000, 0x0000 } },
- { 0x00C9, { 0x00E9, 0x0000, 0x0000, 0x0000 } },
- { 0x00CA, { 0x00EA, 0x0000, 0x0000, 0x0000 } },
- { 0x00CB, { 0x00EB, 0x0000, 0x0000, 0x0000 } },
- { 0x00CC, { 0x00EC, 0x0000, 0x0000, 0x0000 } },
- { 0x00CD, { 0x00ED, 0x0000, 0x0000, 0x0000 } },
- { 0x00CE, { 0x00EE, 0x0000, 0x0000, 0x0000 } },
- { 0x00CF, { 0x00EF, 0x0000, 0x0000, 0x0000 } },
- { 0x00D0, { 0x00F0, 0x0000, 0x0000, 0x0000 } },
- { 0x00D1, { 0x00F1, 0x0000, 0x0000, 0x0000 } },
- { 0x00D2, { 0x00F2, 0x0000, 0x0000, 0x0000 } },
- { 0x00D3, { 0x00F3, 0x0000, 0x0000, 0x0000 } },
- { 0x00D4, { 0x00F4, 0x0000, 0x0000, 0x0000 } },
- { 0x00D5, { 0x00F5, 0x0000, 0x0000, 0x0000 } },
- { 0x00D6, { 0x00F6, 0x0000, 0x0000, 0x0000 } },
- { 0x00D8, { 0x00F8, 0x0000, 0x0000, 0x0000 } },
- { 0x00D9, { 0x00F9, 0x0000, 0x0000, 0x0000 } },
- { 0x00DA, { 0x00FA, 0x0000, 0x0000, 0x0000 } },
- { 0x00DB, { 0x00FB, 0x0000, 0x0000, 0x0000 } },
- { 0x00DC, { 0x00FC, 0x0000, 0x0000, 0x0000 } },
- { 0x00DD, { 0x00FD, 0x0000, 0x0000, 0x0000 } },
- { 0x00DE, { 0x00FE, 0x0000, 0x0000, 0x0000 } },
- { 0x00DF, { 0x0073, 0x0073, 0x0000, 0x0000 } },
- { 0x0100, { 0x0101, 0x0000, 0x0000, 0x0000 } },
- { 0x0102, { 0x0103, 0x0000, 0x0000, 0x0000 } },
- { 0x0104, { 0x0105, 0x0000, 0x0000, 0x0000 } },
- { 0x0106, { 0x0107, 0x0000, 0x0000, 0x0000 } },
- { 0x0108, { 0x0109, 0x0000, 0x0000, 0x0000 } },
- { 0x010A, { 0x010B, 0x0000, 0x0000, 0x0000 } },
- { 0x010C, { 0x010D, 0x0000, 0x0000, 0x0000 } },
- { 0x010E, { 0x010F, 0x0000, 0x0000, 0x0000 } },
- { 0x0110, { 0x0111, 0x0000, 0x0000, 0x0000 } },
- { 0x0112, { 0x0113, 0x0000, 0x0000, 0x0000 } },
- { 0x0114, { 0x0115, 0x0000, 0x0000, 0x0000 } },
- { 0x0116, { 0x0117, 0x0000, 0x0000, 0x0000 } },
- { 0x0118, { 0x0119, 0x0000, 0x0000, 0x0000 } },
- { 0x011A, { 0x011B, 0x0000, 0x0000, 0x0000 } },
- { 0x011C, { 0x011D, 0x0000, 0x0000, 0x0000 } },
- { 0x011E, { 0x011F, 0x0000, 0x0000, 0x0000 } },
- { 0x0120, { 0x0121, 0x0000, 0x0000, 0x0000 } },
- { 0x0122, { 0x0123, 0x0000, 0x0000, 0x0000 } },
- { 0x0124, { 0x0125, 0x0000, 0x0000, 0x0000 } },
- { 0x0126, { 0x0127, 0x0000, 0x0000, 0x0000 } },
- { 0x0128, { 0x0129, 0x0000, 0x0000, 0x0000 } },
- { 0x012A, { 0x012B, 0x0000, 0x0000, 0x0000 } },
- { 0x012C, { 0x012D, 0x0000, 0x0000, 0x0000 } },
- { 0x012E, { 0x012F, 0x0000, 0x0000, 0x0000 } },
- { 0x0130, { 0x0069, 0x0307, 0x0000, 0x0000 } },
- { 0x0132, { 0x0133, 0x0000, 0x0000, 0x0000 } },
- { 0x0134, { 0x0135, 0x0000, 0x0000, 0x0000 } },
- { 0x0136, { 0x0137, 0x0000, 0x0000, 0x0000 } },
- { 0x0139, { 0x013A, 0x0000, 0x0000, 0x0000 } },
- { 0x013B, { 0x013C, 0x0000, 0x0000, 0x0000 } },
- { 0x013D, { 0x013E, 0x0000, 0x0000, 0x0000 } },
- { 0x013F, { 0x0140, 0x0000, 0x0000, 0x0000 } },
- { 0x0141, { 0x0142, 0x0000, 0x0000, 0x0000 } },
- { 0x0143, { 0x0144, 0x0000, 0x0000, 0x0000 } },
- { 0x0145, { 0x0146, 0x0000, 0x0000, 0x0000 } },
- { 0x0147, { 0x0148, 0x0000, 0x0000, 0x0000 } },
- { 0x0149, { 0x02BC, 0x006E, 0x0000, 0x0000 } },
- { 0x014A, { 0x014B, 0x0000, 0x0000, 0x0000 } },
- { 0x014C, { 0x014D, 0x0000, 0x0000, 0x0000 } },
- { 0x014E, { 0x014F, 0x0000, 0x0000, 0x0000 } },
- { 0x0150, { 0x0151, 0x0000, 0x0000, 0x0000 } },
- { 0x0152, { 0x0153, 0x0000, 0x0000, 0x0000 } },
- { 0x0154, { 0x0155, 0x0000, 0x0000, 0x0000 } },
- { 0x0156, { 0x0157, 0x0000, 0x0000, 0x0000 } },
- { 0x0158, { 0x0159, 0x0000, 0x0000, 0x0000 } },
- { 0x015A, { 0x015B, 0x0000, 0x0000, 0x0000 } },
- { 0x015C, { 0x015D, 0x0000, 0x0000, 0x0000 } },
- { 0x015E, { 0x015F, 0x0000, 0x0000, 0x0000 } },
- { 0x0160, { 0x0161, 0x0000, 0x0000, 0x0000 } },
- { 0x0162, { 0x0163, 0x0000, 0x0000, 0x0000 } },
- { 0x0164, { 0x0165, 0x0000, 0x0000, 0x0000 } },
- { 0x0166, { 0x0167, 0x0000, 0x0000, 0x0000 } },
- { 0x0168, { 0x0169, 0x0000, 0x0000, 0x0000 } },
- { 0x016A, { 0x016B, 0x0000, 0x0000, 0x0000 } },
- { 0x016C, { 0x016D, 0x0000, 0x0000, 0x0000 } },
- { 0x016E, { 0x016F, 0x0000, 0x0000, 0x0000 } },
- { 0x0170, { 0x0171, 0x0000, 0x0000, 0x0000 } },
- { 0x0172, { 0x0173, 0x0000, 0x0000, 0x0000 } },
- { 0x0174, { 0x0175, 0x0000, 0x0000, 0x0000 } },
- { 0x0176, { 0x0177, 0x0000, 0x0000, 0x0000 } },
- { 0x0178, { 0x00FF, 0x0000, 0x0000, 0x0000 } },
- { 0x0179, { 0x017A, 0x0000, 0x0000, 0x0000 } },
- { 0x017B, { 0x017C, 0x0000, 0x0000, 0x0000 } },
- { 0x017D, { 0x017E, 0x0000, 0x0000, 0x0000 } },
- { 0x017F, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x0181, { 0x0253, 0x0000, 0x0000, 0x0000 } },
- { 0x0182, { 0x0183, 0x0000, 0x0000, 0x0000 } },
- { 0x0184, { 0x0185, 0x0000, 0x0000, 0x0000 } },
- { 0x0186, { 0x0254, 0x0000, 0x0000, 0x0000 } },
- { 0x0187, { 0x0188, 0x0000, 0x0000, 0x0000 } },
- { 0x0189, { 0x0256, 0x0000, 0x0000, 0x0000 } },
- { 0x018A, { 0x0257, 0x0000, 0x0000, 0x0000 } },
- { 0x018B, { 0x018C, 0x0000, 0x0000, 0x0000 } },
- { 0x018E, { 0x01DD, 0x0000, 0x0000, 0x0000 } },
- { 0x018F, { 0x0259, 0x0000, 0x0000, 0x0000 } },
- { 0x0190, { 0x025B, 0x0000, 0x0000, 0x0000 } },
- { 0x0191, { 0x0192, 0x0000, 0x0000, 0x0000 } },
- { 0x0193, { 0x0260, 0x0000, 0x0000, 0x0000 } },
- { 0x0194, { 0x0263, 0x0000, 0x0000, 0x0000 } },
- { 0x0196, { 0x0269, 0x0000, 0x0000, 0x0000 } },
- { 0x0197, { 0x0268, 0x0000, 0x0000, 0x0000 } },
- { 0x0198, { 0x0199, 0x0000, 0x0000, 0x0000 } },
- { 0x019C, { 0x026F, 0x0000, 0x0000, 0x0000 } },
- { 0x019D, { 0x0272, 0x0000, 0x0000, 0x0000 } },
- { 0x019F, { 0x0275, 0x0000, 0x0000, 0x0000 } },
- { 0x01A0, { 0x01A1, 0x0000, 0x0000, 0x0000 } },
- { 0x01A2, { 0x01A3, 0x0000, 0x0000, 0x0000 } },
- { 0x01A4, { 0x01A5, 0x0000, 0x0000, 0x0000 } },
- { 0x01A6, { 0x0280, 0x0000, 0x0000, 0x0000 } },
- { 0x01A7, { 0x01A8, 0x0000, 0x0000, 0x0000 } },
- { 0x01A9, { 0x0283, 0x0000, 0x0000, 0x0000 } },
- { 0x01AC, { 0x01AD, 0x0000, 0x0000, 0x0000 } },
- { 0x01AE, { 0x0288, 0x0000, 0x0000, 0x0000 } },
- { 0x01AF, { 0x01B0, 0x0000, 0x0000, 0x0000 } },
- { 0x01B1, { 0x028A, 0x0000, 0x0000, 0x0000 } },
- { 0x01B2, { 0x028B, 0x0000, 0x0000, 0x0000 } },
- { 0x01B3, { 0x01B4, 0x0000, 0x0000, 0x0000 } },
- { 0x01B5, { 0x01B6, 0x0000, 0x0000, 0x0000 } },
- { 0x01B7, { 0x0292, 0x0000, 0x0000, 0x0000 } },
- { 0x01B8, { 0x01B9, 0x0000, 0x0000, 0x0000 } },
- { 0x01BC, { 0x01BD, 0x0000, 0x0000, 0x0000 } },
- { 0x01C4, { 0x01C6, 0x0000, 0x0000, 0x0000 } },
- { 0x01C5, { 0x01C6, 0x0000, 0x0000, 0x0000 } },
- { 0x01C7, { 0x01C9, 0x0000, 0x0000, 0x0000 } },
- { 0x01C8, { 0x01C9, 0x0000, 0x0000, 0x0000 } },
- { 0x01CA, { 0x01CC, 0x0000, 0x0000, 0x0000 } },
- { 0x01CB, { 0x01CC, 0x0000, 0x0000, 0x0000 } },
- { 0x01CD, { 0x01CE, 0x0000, 0x0000, 0x0000 } },
- { 0x01CF, { 0x01D0, 0x0000, 0x0000, 0x0000 } },
- { 0x01D1, { 0x01D2, 0x0000, 0x0000, 0x0000 } },
- { 0x01D3, { 0x01D4, 0x0000, 0x0000, 0x0000 } },
- { 0x01D5, { 0x01D6, 0x0000, 0x0000, 0x0000 } },
- { 0x01D7, { 0x01D8, 0x0000, 0x0000, 0x0000 } },
- { 0x01D9, { 0x01DA, 0x0000, 0x0000, 0x0000 } },
- { 0x01DB, { 0x01DC, 0x0000, 0x0000, 0x0000 } },
- { 0x01DE, { 0x01DF, 0x0000, 0x0000, 0x0000 } },
- { 0x01E0, { 0x01E1, 0x0000, 0x0000, 0x0000 } },
- { 0x01E2, { 0x01E3, 0x0000, 0x0000, 0x0000 } },
- { 0x01E4, { 0x01E5, 0x0000, 0x0000, 0x0000 } },
- { 0x01E6, { 0x01E7, 0x0000, 0x0000, 0x0000 } },
- { 0x01E8, { 0x01E9, 0x0000, 0x0000, 0x0000 } },
- { 0x01EA, { 0x01EB, 0x0000, 0x0000, 0x0000 } },
- { 0x01EC, { 0x01ED, 0x0000, 0x0000, 0x0000 } },
- { 0x01EE, { 0x01EF, 0x0000, 0x0000, 0x0000 } },
- { 0x01F0, { 0x006A, 0x030C, 0x0000, 0x0000 } },
- { 0x01F1, { 0x01F3, 0x0000, 0x0000, 0x0000 } },
- { 0x01F2, { 0x01F3, 0x0000, 0x0000, 0x0000 } },
- { 0x01F4, { 0x01F5, 0x0000, 0x0000, 0x0000 } },
- { 0x01F6, { 0x0195, 0x0000, 0x0000, 0x0000 } },
- { 0x01F7, { 0x01BF, 0x0000, 0x0000, 0x0000 } },
- { 0x01F8, { 0x01F9, 0x0000, 0x0000, 0x0000 } },
- { 0x01FA, { 0x01FB, 0x0000, 0x0000, 0x0000 } },
- { 0x01FC, { 0x01FD, 0x0000, 0x0000, 0x0000 } },
- { 0x01FE, { 0x01FF, 0x0000, 0x0000, 0x0000 } },
- { 0x0200, { 0x0201, 0x0000, 0x0000, 0x0000 } },
- { 0x0202, { 0x0203, 0x0000, 0x0000, 0x0000 } },
- { 0x0204, { 0x0205, 0x0000, 0x0000, 0x0000 } },
- { 0x0206, { 0x0207, 0x0000, 0x0000, 0x0000 } },
- { 0x0208, { 0x0209, 0x0000, 0x0000, 0x0000 } },
- { 0x020A, { 0x020B, 0x0000, 0x0000, 0x0000 } },
- { 0x020C, { 0x020D, 0x0000, 0x0000, 0x0000 } },
- { 0x020E, { 0x020F, 0x0000, 0x0000, 0x0000 } },
- { 0x0210, { 0x0211, 0x0000, 0x0000, 0x0000 } },
- { 0x0212, { 0x0213, 0x0000, 0x0000, 0x0000 } },
- { 0x0214, { 0x0215, 0x0000, 0x0000, 0x0000 } },
- { 0x0216, { 0x0217, 0x0000, 0x0000, 0x0000 } },
- { 0x0218, { 0x0219, 0x0000, 0x0000, 0x0000 } },
- { 0x021A, { 0x021B, 0x0000, 0x0000, 0x0000 } },
- { 0x021C, { 0x021D, 0x0000, 0x0000, 0x0000 } },
- { 0x021E, { 0x021F, 0x0000, 0x0000, 0x0000 } },
- { 0x0220, { 0x019E, 0x0000, 0x0000, 0x0000 } },
- { 0x0222, { 0x0223, 0x0000, 0x0000, 0x0000 } },
- { 0x0224, { 0x0225, 0x0000, 0x0000, 0x0000 } },
- { 0x0226, { 0x0227, 0x0000, 0x0000, 0x0000 } },
- { 0x0228, { 0x0229, 0x0000, 0x0000, 0x0000 } },
- { 0x022A, { 0x022B, 0x0000, 0x0000, 0x0000 } },
- { 0x022C, { 0x022D, 0x0000, 0x0000, 0x0000 } },
- { 0x022E, { 0x022F, 0x0000, 0x0000, 0x0000 } },
- { 0x0230, { 0x0231, 0x0000, 0x0000, 0x0000 } },
- { 0x0232, { 0x0233, 0x0000, 0x0000, 0x0000 } },
- { 0x0345, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
- { 0x037A, { 0x0020, 0x03B9, 0x0000, 0x0000 } },
- { 0x0386, { 0x03AC, 0x0000, 0x0000, 0x0000 } },
- { 0x0388, { 0x03AD, 0x0000, 0x0000, 0x0000 } },
- { 0x0389, { 0x03AE, 0x0000, 0x0000, 0x0000 } },
- { 0x038A, { 0x03AF, 0x0000, 0x0000, 0x0000 } },
- { 0x038C, { 0x03CC, 0x0000, 0x0000, 0x0000 } },
- { 0x038E, { 0x03CD, 0x0000, 0x0000, 0x0000 } },
- { 0x038F, { 0x03CE, 0x0000, 0x0000, 0x0000 } },
- { 0x0390, { 0x03B9, 0x0308, 0x0301, 0x0000 } },
- { 0x0391, { 0x03B1, 0x0000, 0x0000, 0x0000 } },
- { 0x0392, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
- { 0x0393, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
- { 0x0394, { 0x03B4, 0x0000, 0x0000, 0x0000 } },
- { 0x0395, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
- { 0x0396, { 0x03B6, 0x0000, 0x0000, 0x0000 } },
- { 0x0397, { 0x03B7, 0x0000, 0x0000, 0x0000 } },
- { 0x0398, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x0399, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
- { 0x039A, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
- { 0x039B, { 0x03BB, 0x0000, 0x0000, 0x0000 } },
- { 0x039C, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
- { 0x039D, { 0x03BD, 0x0000, 0x0000, 0x0000 } },
- { 0x039E, { 0x03BE, 0x0000, 0x0000, 0x0000 } },
- { 0x039F, { 0x03BF, 0x0000, 0x0000, 0x0000 } },
- { 0x03A0, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
- { 0x03A1, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
- { 0x03A3, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
- { 0x03A4, { 0x03C4, 0x0000, 0x0000, 0x0000 } },
- { 0x03A5, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
- { 0x03A6, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
- { 0x03A7, { 0x03C7, 0x0000, 0x0000, 0x0000 } },
- { 0x03A8, { 0x03C8, 0x0000, 0x0000, 0x0000 } },
- { 0x03A9, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
- { 0x03AA, { 0x03CA, 0x0000, 0x0000, 0x0000 } },
- { 0x03AB, { 0x03CB, 0x0000, 0x0000, 0x0000 } },
- { 0x03B0, { 0x03C5, 0x0308, 0x0301, 0x0000 } },
- { 0x03C2, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
- { 0x03D0, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
- { 0x03D1, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x03D2, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
- { 0x03D3, { 0x03CD, 0x0000, 0x0000, 0x0000 } },
- { 0x03D4, { 0x03CB, 0x0000, 0x0000, 0x0000 } },
- { 0x03D5, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
- { 0x03D6, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
- { 0x03D8, { 0x03D9, 0x0000, 0x0000, 0x0000 } },
- { 0x03DA, { 0x03DB, 0x0000, 0x0000, 0x0000 } },
- { 0x03DC, { 0x03DD, 0x0000, 0x0000, 0x0000 } },
- { 0x03DE, { 0x03DF, 0x0000, 0x0000, 0x0000 } },
- { 0x03E0, { 0x03E1, 0x0000, 0x0000, 0x0000 } },
- { 0x03E2, { 0x03E3, 0x0000, 0x0000, 0x0000 } },
- { 0x03E4, { 0x03E5, 0x0000, 0x0000, 0x0000 } },
- { 0x03E6, { 0x03E7, 0x0000, 0x0000, 0x0000 } },
- { 0x03E8, { 0x03E9, 0x0000, 0x0000, 0x0000 } },
- { 0x03EA, { 0x03EB, 0x0000, 0x0000, 0x0000 } },
- { 0x03EC, { 0x03ED, 0x0000, 0x0000, 0x0000 } },
- { 0x03EE, { 0x03EF, 0x0000, 0x0000, 0x0000 } },
- { 0x03F0, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
- { 0x03F1, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
- { 0x03F2, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
- { 0x03F4, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x03F5, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
- { 0x0400, { 0x0450, 0x0000, 0x0000, 0x0000 } },
- { 0x0401, { 0x0451, 0x0000, 0x0000, 0x0000 } },
- { 0x0402, { 0x0452, 0x0000, 0x0000, 0x0000 } },
- { 0x0403, { 0x0453, 0x0000, 0x0000, 0x0000 } },
- { 0x0404, { 0x0454, 0x0000, 0x0000, 0x0000 } },
- { 0x0405, { 0x0455, 0x0000, 0x0000, 0x0000 } },
- { 0x0406, { 0x0456, 0x0000, 0x0000, 0x0000 } },
- { 0x0407, { 0x0457, 0x0000, 0x0000, 0x0000 } },
- { 0x0408, { 0x0458, 0x0000, 0x0000, 0x0000 } },
- { 0x0409, { 0x0459, 0x0000, 0x0000, 0x0000 } },
- { 0x040A, { 0x045A, 0x0000, 0x0000, 0x0000 } },
- { 0x040B, { 0x045B, 0x0000, 0x0000, 0x0000 } },
- { 0x040C, { 0x045C, 0x0000, 0x0000, 0x0000 } },
- { 0x040D, { 0x045D, 0x0000, 0x0000, 0x0000 } },
- { 0x040E, { 0x045E, 0x0000, 0x0000, 0x0000 } },
- { 0x040F, { 0x045F, 0x0000, 0x0000, 0x0000 } },
- { 0x0410, { 0x0430, 0x0000, 0x0000, 0x0000 } },
- { 0x0411, { 0x0431, 0x0000, 0x0000, 0x0000 } },
- { 0x0412, { 0x0432, 0x0000, 0x0000, 0x0000 } },
- { 0x0413, { 0x0433, 0x0000, 0x0000, 0x0000 } },
- { 0x0414, { 0x0434, 0x0000, 0x0000, 0x0000 } },
- { 0x0415, { 0x0435, 0x0000, 0x0000, 0x0000 } },
- { 0x0416, { 0x0436, 0x0000, 0x0000, 0x0000 } },
- { 0x0417, { 0x0437, 0x0000, 0x0000, 0x0000 } },
- { 0x0418, { 0x0438, 0x0000, 0x0000, 0x0000 } },
- { 0x0419, { 0x0439, 0x0000, 0x0000, 0x0000 } },
- { 0x041A, { 0x043A, 0x0000, 0x0000, 0x0000 } },
- { 0x041B, { 0x043B, 0x0000, 0x0000, 0x0000 } },
- { 0x041C, { 0x043C, 0x0000, 0x0000, 0x0000 } },
- { 0x041D, { 0x043D, 0x0000, 0x0000, 0x0000 } },
- { 0x041E, { 0x043E, 0x0000, 0x0000, 0x0000 } },
- { 0x041F, { 0x043F, 0x0000, 0x0000, 0x0000 } },
- { 0x0420, { 0x0440, 0x0000, 0x0000, 0x0000 } },
- { 0x0421, { 0x0441, 0x0000, 0x0000, 0x0000 } },
- { 0x0422, { 0x0442, 0x0000, 0x0000, 0x0000 } },
- { 0x0423, { 0x0443, 0x0000, 0x0000, 0x0000 } },
- { 0x0424, { 0x0444, 0x0000, 0x0000, 0x0000 } },
- { 0x0425, { 0x0445, 0x0000, 0x0000, 0x0000 } },
- { 0x0426, { 0x0446, 0x0000, 0x0000, 0x0000 } },
- { 0x0427, { 0x0447, 0x0000, 0x0000, 0x0000 } },
- { 0x0428, { 0x0448, 0x0000, 0x0000, 0x0000 } },
- { 0x0429, { 0x0449, 0x0000, 0x0000, 0x0000 } },
- { 0x042A, { 0x044A, 0x0000, 0x0000, 0x0000 } },
- { 0x042B, { 0x044B, 0x0000, 0x0000, 0x0000 } },
- { 0x042C, { 0x044C, 0x0000, 0x0000, 0x0000 } },
- { 0x042D, { 0x044D, 0x0000, 0x0000, 0x0000 } },
- { 0x042E, { 0x044E, 0x0000, 0x0000, 0x0000 } },
- { 0x042F, { 0x044F, 0x0000, 0x0000, 0x0000 } },
- { 0x0460, { 0x0461, 0x0000, 0x0000, 0x0000 } },
- { 0x0462, { 0x0463, 0x0000, 0x0000, 0x0000 } },
- { 0x0464, { 0x0465, 0x0000, 0x0000, 0x0000 } },
- { 0x0466, { 0x0467, 0x0000, 0x0000, 0x0000 } },
- { 0x0468, { 0x0469, 0x0000, 0x0000, 0x0000 } },
- { 0x046A, { 0x046B, 0x0000, 0x0000, 0x0000 } },
- { 0x046C, { 0x046D, 0x0000, 0x0000, 0x0000 } },
- { 0x046E, { 0x046F, 0x0000, 0x0000, 0x0000 } },
- { 0x0470, { 0x0471, 0x0000, 0x0000, 0x0000 } },
- { 0x0472, { 0x0473, 0x0000, 0x0000, 0x0000 } },
- { 0x0474, { 0x0475, 0x0000, 0x0000, 0x0000 } },
- { 0x0476, { 0x0477, 0x0000, 0x0000, 0x0000 } },
- { 0x0478, { 0x0479, 0x0000, 0x0000, 0x0000 } },
- { 0x047A, { 0x047B, 0x0000, 0x0000, 0x0000 } },
- { 0x047C, { 0x047D, 0x0000, 0x0000, 0x0000 } },
- { 0x047E, { 0x047F, 0x0000, 0x0000, 0x0000 } },
- { 0x0480, { 0x0481, 0x0000, 0x0000, 0x0000 } },
- { 0x048A, { 0x048B, 0x0000, 0x0000, 0x0000 } },
- { 0x048C, { 0x048D, 0x0000, 0x0000, 0x0000 } },
- { 0x048E, { 0x048F, 0x0000, 0x0000, 0x0000 } },
- { 0x0490, { 0x0491, 0x0000, 0x0000, 0x0000 } },
- { 0x0492, { 0x0493, 0x0000, 0x0000, 0x0000 } },
- { 0x0494, { 0x0495, 0x0000, 0x0000, 0x0000 } },
- { 0x0496, { 0x0497, 0x0000, 0x0000, 0x0000 } },
- { 0x0498, { 0x0499, 0x0000, 0x0000, 0x0000 } },
- { 0x049A, { 0x049B, 0x0000, 0x0000, 0x0000 } },
- { 0x049C, { 0x049D, 0x0000, 0x0000, 0x0000 } },
- { 0x049E, { 0x049F, 0x0000, 0x0000, 0x0000 } },
- { 0x04A0, { 0x04A1, 0x0000, 0x0000, 0x0000 } },
- { 0x04A2, { 0x04A3, 0x0000, 0x0000, 0x0000 } },
- { 0x04A4, { 0x04A5, 0x0000, 0x0000, 0x0000 } },
- { 0x04A6, { 0x04A7, 0x0000, 0x0000, 0x0000 } },
- { 0x04A8, { 0x04A9, 0x0000, 0x0000, 0x0000 } },
- { 0x04AA, { 0x04AB, 0x0000, 0x0000, 0x0000 } },
- { 0x04AC, { 0x04AD, 0x0000, 0x0000, 0x0000 } },
- { 0x04AE, { 0x04AF, 0x0000, 0x0000, 0x0000 } },
- { 0x04B0, { 0x04B1, 0x0000, 0x0000, 0x0000 } },
- { 0x04B2, { 0x04B3, 0x0000, 0x0000, 0x0000 } },
- { 0x04B4, { 0x04B5, 0x0000, 0x0000, 0x0000 } },
- { 0x04B6, { 0x04B7, 0x0000, 0x0000, 0x0000 } },
- { 0x04B8, { 0x04B9, 0x0000, 0x0000, 0x0000 } },
- { 0x04BA, { 0x04BB, 0x0000, 0x0000, 0x0000 } },
- { 0x04BC, { 0x04BD, 0x0000, 0x0000, 0x0000 } },
- { 0x04BE, { 0x04BF, 0x0000, 0x0000, 0x0000 } },
- { 0x04C1, { 0x04C2, 0x0000, 0x0000, 0x0000 } },
- { 0x04C3, { 0x04C4, 0x0000, 0x0000, 0x0000 } },
- { 0x04C5, { 0x04C6, 0x0000, 0x0000, 0x0000 } },
- { 0x04C7, { 0x04C8, 0x0000, 0x0000, 0x0000 } },
- { 0x04C9, { 0x04CA, 0x0000, 0x0000, 0x0000 } },
- { 0x04CB, { 0x04CC, 0x0000, 0x0000, 0x0000 } },
- { 0x04CD, { 0x04CE, 0x0000, 0x0000, 0x0000 } },
- { 0x04D0, { 0x04D1, 0x0000, 0x0000, 0x0000 } },
- { 0x04D2, { 0x04D3, 0x0000, 0x0000, 0x0000 } },
- { 0x04D4, { 0x04D5, 0x0000, 0x0000, 0x0000 } },
- { 0x04D6, { 0x04D7, 0x0000, 0x0000, 0x0000 } },
- { 0x04D8, { 0x04D9, 0x0000, 0x0000, 0x0000 } },
- { 0x04DA, { 0x04DB, 0x0000, 0x0000, 0x0000 } },
- { 0x04DC, { 0x04DD, 0x0000, 0x0000, 0x0000 } },
- { 0x04DE, { 0x04DF, 0x0000, 0x0000, 0x0000 } },
- { 0x04E0, { 0x04E1, 0x0000, 0x0000, 0x0000 } },
- { 0x04E2, { 0x04E3, 0x0000, 0x0000, 0x0000 } },
- { 0x04E4, { 0x04E5, 0x0000, 0x0000, 0x0000 } },
- { 0x04E6, { 0x04E7, 0x0000, 0x0000, 0x0000 } },
- { 0x04E8, { 0x04E9, 0x0000, 0x0000, 0x0000 } },
- { 0x04EA, { 0x04EB, 0x0000, 0x0000, 0x0000 } },
- { 0x04EC, { 0x04ED, 0x0000, 0x0000, 0x0000 } },
- { 0x04EE, { 0x04EF, 0x0000, 0x0000, 0x0000 } },
- { 0x04F0, { 0x04F1, 0x0000, 0x0000, 0x0000 } },
- { 0x04F2, { 0x04F3, 0x0000, 0x0000, 0x0000 } },
- { 0x04F4, { 0x04F5, 0x0000, 0x0000, 0x0000 } },
- { 0x04F8, { 0x04F9, 0x0000, 0x0000, 0x0000 } },
- { 0x0500, { 0x0501, 0x0000, 0x0000, 0x0000 } },
- { 0x0502, { 0x0503, 0x0000, 0x0000, 0x0000 } },
- { 0x0504, { 0x0505, 0x0000, 0x0000, 0x0000 } },
- { 0x0506, { 0x0507, 0x0000, 0x0000, 0x0000 } },
- { 0x0508, { 0x0509, 0x0000, 0x0000, 0x0000 } },
- { 0x050A, { 0x050B, 0x0000, 0x0000, 0x0000 } },
- { 0x050C, { 0x050D, 0x0000, 0x0000, 0x0000 } },
- { 0x050E, { 0x050F, 0x0000, 0x0000, 0x0000 } },
- { 0x0531, { 0x0561, 0x0000, 0x0000, 0x0000 } },
- { 0x0532, { 0x0562, 0x0000, 0x0000, 0x0000 } },
- { 0x0533, { 0x0563, 0x0000, 0x0000, 0x0000 } },
- { 0x0534, { 0x0564, 0x0000, 0x0000, 0x0000 } },
- { 0x0535, { 0x0565, 0x0000, 0x0000, 0x0000 } },
- { 0x0536, { 0x0566, 0x0000, 0x0000, 0x0000 } },
- { 0x0537, { 0x0567, 0x0000, 0x0000, 0x0000 } },
- { 0x0538, { 0x0568, 0x0000, 0x0000, 0x0000 } },
- { 0x0539, { 0x0569, 0x0000, 0x0000, 0x0000 } },
- { 0x053A, { 0x056A, 0x0000, 0x0000, 0x0000 } },
- { 0x053B, { 0x056B, 0x0000, 0x0000, 0x0000 } },
- { 0x053C, { 0x056C, 0x0000, 0x0000, 0x0000 } },
- { 0x053D, { 0x056D, 0x0000, 0x0000, 0x0000 } },
- { 0x053E, { 0x056E, 0x0000, 0x0000, 0x0000 } },
- { 0x053F, { 0x056F, 0x0000, 0x0000, 0x0000 } },
- { 0x0540, { 0x0570, 0x0000, 0x0000, 0x0000 } },
- { 0x0541, { 0x0571, 0x0000, 0x0000, 0x0000 } },
- { 0x0542, { 0x0572, 0x0000, 0x0000, 0x0000 } },
- { 0x0543, { 0x0573, 0x0000, 0x0000, 0x0000 } },
- { 0x0544, { 0x0574, 0x0000, 0x0000, 0x0000 } },
- { 0x0545, { 0x0575, 0x0000, 0x0000, 0x0000 } },
- { 0x0546, { 0x0576, 0x0000, 0x0000, 0x0000 } },
- { 0x0547, { 0x0577, 0x0000, 0x0000, 0x0000 } },
- { 0x0548, { 0x0578, 0x0000, 0x0000, 0x0000 } },
- { 0x0549, { 0x0579, 0x0000, 0x0000, 0x0000 } },
- { 0x054A, { 0x057A, 0x0000, 0x0000, 0x0000 } },
- { 0x054B, { 0x057B, 0x0000, 0x0000, 0x0000 } },
- { 0x054C, { 0x057C, 0x0000, 0x0000, 0x0000 } },
- { 0x054D, { 0x057D, 0x0000, 0x0000, 0x0000 } },
- { 0x054E, { 0x057E, 0x0000, 0x0000, 0x0000 } },
- { 0x054F, { 0x057F, 0x0000, 0x0000, 0x0000 } },
- { 0x0550, { 0x0580, 0x0000, 0x0000, 0x0000 } },
- { 0x0551, { 0x0581, 0x0000, 0x0000, 0x0000 } },
- { 0x0552, { 0x0582, 0x0000, 0x0000, 0x0000 } },
- { 0x0553, { 0x0583, 0x0000, 0x0000, 0x0000 } },
- { 0x0554, { 0x0584, 0x0000, 0x0000, 0x0000 } },
- { 0x0555, { 0x0585, 0x0000, 0x0000, 0x0000 } },
- { 0x0556, { 0x0586, 0x0000, 0x0000, 0x0000 } },
- { 0x0587, { 0x0565, 0x0582, 0x0000, 0x0000 } },
- { 0x1E00, { 0x1E01, 0x0000, 0x0000, 0x0000 } },
- { 0x1E02, { 0x1E03, 0x0000, 0x0000, 0x0000 } },
- { 0x1E04, { 0x1E05, 0x0000, 0x0000, 0x0000 } },
- { 0x1E06, { 0x1E07, 0x0000, 0x0000, 0x0000 } },
- { 0x1E08, { 0x1E09, 0x0000, 0x0000, 0x0000 } },
- { 0x1E0A, { 0x1E0B, 0x0000, 0x0000, 0x0000 } },
- { 0x1E0C, { 0x1E0D, 0x0000, 0x0000, 0x0000 } },
- { 0x1E0E, { 0x1E0F, 0x0000, 0x0000, 0x0000 } },
- { 0x1E10, { 0x1E11, 0x0000, 0x0000, 0x0000 } },
- { 0x1E12, { 0x1E13, 0x0000, 0x0000, 0x0000 } },
- { 0x1E14, { 0x1E15, 0x0000, 0x0000, 0x0000 } },
- { 0x1E16, { 0x1E17, 0x0000, 0x0000, 0x0000 } },
- { 0x1E18, { 0x1E19, 0x0000, 0x0000, 0x0000 } },
- { 0x1E1A, { 0x1E1B, 0x0000, 0x0000, 0x0000 } },
- { 0x1E1C, { 0x1E1D, 0x0000, 0x0000, 0x0000 } },
- { 0x1E1E, { 0x1E1F, 0x0000, 0x0000, 0x0000 } },
- { 0x1E20, { 0x1E21, 0x0000, 0x0000, 0x0000 } },
- { 0x1E22, { 0x1E23, 0x0000, 0x0000, 0x0000 } },
- { 0x1E24, { 0x1E25, 0x0000, 0x0000, 0x0000 } },
- { 0x1E26, { 0x1E27, 0x0000, 0x0000, 0x0000 } },
- { 0x1E28, { 0x1E29, 0x0000, 0x0000, 0x0000 } },
- { 0x1E2A, { 0x1E2B, 0x0000, 0x0000, 0x0000 } },
- { 0x1E2C, { 0x1E2D, 0x0000, 0x0000, 0x0000 } },
- { 0x1E2E, { 0x1E2F, 0x0000, 0x0000, 0x0000 } },
- { 0x1E30, { 0x1E31, 0x0000, 0x0000, 0x0000 } },
- { 0x1E32, { 0x1E33, 0x0000, 0x0000, 0x0000 } },
- { 0x1E34, { 0x1E35, 0x0000, 0x0000, 0x0000 } },
- { 0x1E36, { 0x1E37, 0x0000, 0x0000, 0x0000 } },
- { 0x1E38, { 0x1E39, 0x0000, 0x0000, 0x0000 } },
- { 0x1E3A, { 0x1E3B, 0x0000, 0x0000, 0x0000 } },
- { 0x1E3C, { 0x1E3D, 0x0000, 0x0000, 0x0000 } },
- { 0x1E3E, { 0x1E3F, 0x0000, 0x0000, 0x0000 } },
- { 0x1E40, { 0x1E41, 0x0000, 0x0000, 0x0000 } },
- { 0x1E42, { 0x1E43, 0x0000, 0x0000, 0x0000 } },
- { 0x1E44, { 0x1E45, 0x0000, 0x0000, 0x0000 } },
- { 0x1E46, { 0x1E47, 0x0000, 0x0000, 0x0000 } },
- { 0x1E48, { 0x1E49, 0x0000, 0x0000, 0x0000 } },
- { 0x1E4A, { 0x1E4B, 0x0000, 0x0000, 0x0000 } },
- { 0x1E4C, { 0x1E4D, 0x0000, 0x0000, 0x0000 } },
- { 0x1E4E, { 0x1E4F, 0x0000, 0x0000, 0x0000 } },
- { 0x1E50, { 0x1E51, 0x0000, 0x0000, 0x0000 } },
- { 0x1E52, { 0x1E53, 0x0000, 0x0000, 0x0000 } },
- { 0x1E54, { 0x1E55, 0x0000, 0x0000, 0x0000 } },
- { 0x1E56, { 0x1E57, 0x0000, 0x0000, 0x0000 } },
- { 0x1E58, { 0x1E59, 0x0000, 0x0000, 0x0000 } },
- { 0x1E5A, { 0x1E5B, 0x0000, 0x0000, 0x0000 } },
- { 0x1E5C, { 0x1E5D, 0x0000, 0x0000, 0x0000 } },
- { 0x1E5E, { 0x1E5F, 0x0000, 0x0000, 0x0000 } },
- { 0x1E60, { 0x1E61, 0x0000, 0x0000, 0x0000 } },
- { 0x1E62, { 0x1E63, 0x0000, 0x0000, 0x0000 } },
- { 0x1E64, { 0x1E65, 0x0000, 0x0000, 0x0000 } },
- { 0x1E66, { 0x1E67, 0x0000, 0x0000, 0x0000 } },
- { 0x1E68, { 0x1E69, 0x0000, 0x0000, 0x0000 } },
- { 0x1E6A, { 0x1E6B, 0x0000, 0x0000, 0x0000 } },
- { 0x1E6C, { 0x1E6D, 0x0000, 0x0000, 0x0000 } },
- { 0x1E6E, { 0x1E6F, 0x0000, 0x0000, 0x0000 } },
- { 0x1E70, { 0x1E71, 0x0000, 0x0000, 0x0000 } },
- { 0x1E72, { 0x1E73, 0x0000, 0x0000, 0x0000 } },
- { 0x1E74, { 0x1E75, 0x0000, 0x0000, 0x0000 } },
- { 0x1E76, { 0x1E77, 0x0000, 0x0000, 0x0000 } },
- { 0x1E78, { 0x1E79, 0x0000, 0x0000, 0x0000 } },
- { 0x1E7A, { 0x1E7B, 0x0000, 0x0000, 0x0000 } },
- { 0x1E7C, { 0x1E7D, 0x0000, 0x0000, 0x0000 } },
- { 0x1E7E, { 0x1E7F, 0x0000, 0x0000, 0x0000 } },
- { 0x1E80, { 0x1E81, 0x0000, 0x0000, 0x0000 } },
- { 0x1E82, { 0x1E83, 0x0000, 0x0000, 0x0000 } },
- { 0x1E84, { 0x1E85, 0x0000, 0x0000, 0x0000 } },
- { 0x1E86, { 0x1E87, 0x0000, 0x0000, 0x0000 } },
- { 0x1E88, { 0x1E89, 0x0000, 0x0000, 0x0000 } },
- { 0x1E8A, { 0x1E8B, 0x0000, 0x0000, 0x0000 } },
- { 0x1E8C, { 0x1E8D, 0x0000, 0x0000, 0x0000 } },
- { 0x1E8E, { 0x1E8F, 0x0000, 0x0000, 0x0000 } },
- { 0x1E90, { 0x1E91, 0x0000, 0x0000, 0x0000 } },
- { 0x1E92, { 0x1E93, 0x0000, 0x0000, 0x0000 } },
- { 0x1E94, { 0x1E95, 0x0000, 0x0000, 0x0000 } },
- { 0x1E96, { 0x0068, 0x0331, 0x0000, 0x0000 } },
- { 0x1E97, { 0x0074, 0x0308, 0x0000, 0x0000 } },
- { 0x1E98, { 0x0077, 0x030A, 0x0000, 0x0000 } },
- { 0x1E99, { 0x0079, 0x030A, 0x0000, 0x0000 } },
- { 0x1E9A, { 0x0061, 0x02BE, 0x0000, 0x0000 } },
- { 0x1E9B, { 0x1E61, 0x0000, 0x0000, 0x0000 } },
- { 0x1EA0, { 0x1EA1, 0x0000, 0x0000, 0x0000 } },
- { 0x1EA2, { 0x1EA3, 0x0000, 0x0000, 0x0000 } },
- { 0x1EA4, { 0x1EA5, 0x0000, 0x0000, 0x0000 } },
- { 0x1EA6, { 0x1EA7, 0x0000, 0x0000, 0x0000 } },
- { 0x1EA8, { 0x1EA9, 0x0000, 0x0000, 0x0000 } },
- { 0x1EAA, { 0x1EAB, 0x0000, 0x0000, 0x0000 } },
- { 0x1EAC, { 0x1EAD, 0x0000, 0x0000, 0x0000 } },
- { 0x1EAE, { 0x1EAF, 0x0000, 0x0000, 0x0000 } },
- { 0x1EB0, { 0x1EB1, 0x0000, 0x0000, 0x0000 } },
- { 0x1EB2, { 0x1EB3, 0x0000, 0x0000, 0x0000 } },
- { 0x1EB4, { 0x1EB5, 0x0000, 0x0000, 0x0000 } },
- { 0x1EB6, { 0x1EB7, 0x0000, 0x0000, 0x0000 } },
- { 0x1EB8, { 0x1EB9, 0x0000, 0x0000, 0x0000 } },
- { 0x1EBA, { 0x1EBB, 0x0000, 0x0000, 0x0000 } },
- { 0x1EBC, { 0x1EBD, 0x0000, 0x0000, 0x0000 } },
- { 0x1EBE, { 0x1EBF, 0x0000, 0x0000, 0x0000 } },
- { 0x1EC0, { 0x1EC1, 0x0000, 0x0000, 0x0000 } },
- { 0x1EC2, { 0x1EC3, 0x0000, 0x0000, 0x0000 } },
- { 0x1EC4, { 0x1EC5, 0x0000, 0x0000, 0x0000 } },
- { 0x1EC6, { 0x1EC7, 0x0000, 0x0000, 0x0000 } },
- { 0x1EC8, { 0x1EC9, 0x0000, 0x0000, 0x0000 } },
- { 0x1ECA, { 0x1ECB, 0x0000, 0x0000, 0x0000 } },
- { 0x1ECC, { 0x1ECD, 0x0000, 0x0000, 0x0000 } },
- { 0x1ECE, { 0x1ECF, 0x0000, 0x0000, 0x0000 } },
- { 0x1ED0, { 0x1ED1, 0x0000, 0x0000, 0x0000 } },
- { 0x1ED2, { 0x1ED3, 0x0000, 0x0000, 0x0000 } },
- { 0x1ED4, { 0x1ED5, 0x0000, 0x0000, 0x0000 } },
- { 0x1ED6, { 0x1ED7, 0x0000, 0x0000, 0x0000 } },
- { 0x1ED8, { 0x1ED9, 0x0000, 0x0000, 0x0000 } },
- { 0x1EDA, { 0x1EDB, 0x0000, 0x0000, 0x0000 } },
- { 0x1EDC, { 0x1EDD, 0x0000, 0x0000, 0x0000 } },
- { 0x1EDE, { 0x1EDF, 0x0000, 0x0000, 0x0000 } },
- { 0x1EE0, { 0x1EE1, 0x0000, 0x0000, 0x0000 } },
- { 0x1EE2, { 0x1EE3, 0x0000, 0x0000, 0x0000 } },
- { 0x1EE4, { 0x1EE5, 0x0000, 0x0000, 0x0000 } },
- { 0x1EE6, { 0x1EE7, 0x0000, 0x0000, 0x0000 } },
- { 0x1EE8, { 0x1EE9, 0x0000, 0x0000, 0x0000 } },
- { 0x1EEA, { 0x1EEB, 0x0000, 0x0000, 0x0000 } },
- { 0x1EEC, { 0x1EED, 0x0000, 0x0000, 0x0000 } },
- { 0x1EEE, { 0x1EEF, 0x0000, 0x0000, 0x0000 } },
- { 0x1EF0, { 0x1EF1, 0x0000, 0x0000, 0x0000 } },
- { 0x1EF2, { 0x1EF3, 0x0000, 0x0000, 0x0000 } },
- { 0x1EF4, { 0x1EF5, 0x0000, 0x0000, 0x0000 } },
- { 0x1EF6, { 0x1EF7, 0x0000, 0x0000, 0x0000 } },
- { 0x1EF8, { 0x1EF9, 0x0000, 0x0000, 0x0000 } },
- { 0x1F08, { 0x1F00, 0x0000, 0x0000, 0x0000 } },
- { 0x1F09, { 0x1F01, 0x0000, 0x0000, 0x0000 } },
- { 0x1F0A, { 0x1F02, 0x0000, 0x0000, 0x0000 } },
- { 0x1F0B, { 0x1F03, 0x0000, 0x0000, 0x0000 } },
- { 0x1F0C, { 0x1F04, 0x0000, 0x0000, 0x0000 } },
- { 0x1F0D, { 0x1F05, 0x0000, 0x0000, 0x0000 } },
- { 0x1F0E, { 0x1F06, 0x0000, 0x0000, 0x0000 } },
- { 0x1F0F, { 0x1F07, 0x0000, 0x0000, 0x0000 } },
- { 0x1F18, { 0x1F10, 0x0000, 0x0000, 0x0000 } },
- { 0x1F19, { 0x1F11, 0x0000, 0x0000, 0x0000 } },
- { 0x1F1A, { 0x1F12, 0x0000, 0x0000, 0x0000 } },
- { 0x1F1B, { 0x1F13, 0x0000, 0x0000, 0x0000 } },
- { 0x1F1C, { 0x1F14, 0x0000, 0x0000, 0x0000 } },
- { 0x1F1D, { 0x1F15, 0x0000, 0x0000, 0x0000 } },
- { 0x1F28, { 0x1F20, 0x0000, 0x0000, 0x0000 } },
- { 0x1F29, { 0x1F21, 0x0000, 0x0000, 0x0000 } },
- { 0x1F2A, { 0x1F22, 0x0000, 0x0000, 0x0000 } },
- { 0x1F2B, { 0x1F23, 0x0000, 0x0000, 0x0000 } },
- { 0x1F2C, { 0x1F24, 0x0000, 0x0000, 0x0000 } },
- { 0x1F2D, { 0x1F25, 0x0000, 0x0000, 0x0000 } },
- { 0x1F2E, { 0x1F26, 0x0000, 0x0000, 0x0000 } },
- { 0x1F2F, { 0x1F27, 0x0000, 0x0000, 0x0000 } },
- { 0x1F38, { 0x1F30, 0x0000, 0x0000, 0x0000 } },
- { 0x1F39, { 0x1F31, 0x0000, 0x0000, 0x0000 } },
- { 0x1F3A, { 0x1F32, 0x0000, 0x0000, 0x0000 } },
- { 0x1F3B, { 0x1F33, 0x0000, 0x0000, 0x0000 } },
- { 0x1F3C, { 0x1F34, 0x0000, 0x0000, 0x0000 } },
- { 0x1F3D, { 0x1F35, 0x0000, 0x0000, 0x0000 } },
- { 0x1F3E, { 0x1F36, 0x0000, 0x0000, 0x0000 } },
- { 0x1F3F, { 0x1F37, 0x0000, 0x0000, 0x0000 } },
- { 0x1F48, { 0x1F40, 0x0000, 0x0000, 0x0000 } },
- { 0x1F49, { 0x1F41, 0x0000, 0x0000, 0x0000 } },
- { 0x1F4A, { 0x1F42, 0x0000, 0x0000, 0x0000 } },
- { 0x1F4B, { 0x1F43, 0x0000, 0x0000, 0x0000 } },
- { 0x1F4C, { 0x1F44, 0x0000, 0x0000, 0x0000 } },
- { 0x1F4D, { 0x1F45, 0x0000, 0x0000, 0x0000 } },
- { 0x1F50, { 0x03C5, 0x0313, 0x0000, 0x0000 } },
- { 0x1F52, { 0x03C5, 0x0313, 0x0300, 0x0000 } },
- { 0x1F54, { 0x03C5, 0x0313, 0x0301, 0x0000 } },
- { 0x1F56, { 0x03C5, 0x0313, 0x0342, 0x0000 } },
- { 0x1F59, { 0x1F51, 0x0000, 0x0000, 0x0000 } },
- { 0x1F5B, { 0x1F53, 0x0000, 0x0000, 0x0000 } },
- { 0x1F5D, { 0x1F55, 0x0000, 0x0000, 0x0000 } },
- { 0x1F5F, { 0x1F57, 0x0000, 0x0000, 0x0000 } },
- { 0x1F68, { 0x1F60, 0x0000, 0x0000, 0x0000 } },
- { 0x1F69, { 0x1F61, 0x0000, 0x0000, 0x0000 } },
- { 0x1F6A, { 0x1F62, 0x0000, 0x0000, 0x0000 } },
- { 0x1F6B, { 0x1F63, 0x0000, 0x0000, 0x0000 } },
- { 0x1F6C, { 0x1F64, 0x0000, 0x0000, 0x0000 } },
- { 0x1F6D, { 0x1F65, 0x0000, 0x0000, 0x0000 } },
- { 0x1F6E, { 0x1F66, 0x0000, 0x0000, 0x0000 } },
- { 0x1F6F, { 0x1F67, 0x0000, 0x0000, 0x0000 } },
- { 0x1F80, { 0x1F00, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F81, { 0x1F01, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F82, { 0x1F02, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F83, { 0x1F03, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F84, { 0x1F04, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F85, { 0x1F05, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F86, { 0x1F06, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F87, { 0x1F07, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F88, { 0x1F00, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F89, { 0x1F01, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F8A, { 0x1F02, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F8B, { 0x1F03, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F8C, { 0x1F04, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F8D, { 0x1F05, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F8E, { 0x1F06, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F8F, { 0x1F07, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F90, { 0x1F20, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F91, { 0x1F21, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F92, { 0x1F22, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F93, { 0x1F23, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F94, { 0x1F24, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F95, { 0x1F25, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F96, { 0x1F26, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F97, { 0x1F27, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F98, { 0x1F20, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F99, { 0x1F21, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F9A, { 0x1F22, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F9B, { 0x1F23, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F9C, { 0x1F24, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F9D, { 0x1F25, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F9E, { 0x1F26, 0x03B9, 0x0000, 0x0000 } },
- { 0x1F9F, { 0x1F27, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FA0, { 0x1F60, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FA1, { 0x1F61, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FA2, { 0x1F62, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FA3, { 0x1F63, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FA4, { 0x1F64, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FA5, { 0x1F65, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FA6, { 0x1F66, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FA7, { 0x1F67, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FA8, { 0x1F60, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FA9, { 0x1F61, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FAA, { 0x1F62, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FAB, { 0x1F63, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FAC, { 0x1F64, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FAD, { 0x1F65, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FAE, { 0x1F66, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FAF, { 0x1F67, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FB2, { 0x1F70, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FB3, { 0x03B1, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FB4, { 0x03AC, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FB6, { 0x03B1, 0x0342, 0x0000, 0x0000 } },
- { 0x1FB7, { 0x03B1, 0x0342, 0x03B9, 0x0000 } },
- { 0x1FB8, { 0x1FB0, 0x0000, 0x0000, 0x0000 } },
- { 0x1FB9, { 0x1FB1, 0x0000, 0x0000, 0x0000 } },
- { 0x1FBA, { 0x1F70, 0x0000, 0x0000, 0x0000 } },
- { 0x1FBB, { 0x1F71, 0x0000, 0x0000, 0x0000 } },
- { 0x1FBC, { 0x03B1, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FBE, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
- { 0x1FC2, { 0x1F74, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FC3, { 0x03B7, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FC4, { 0x03AE, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FC6, { 0x03B7, 0x0342, 0x0000, 0x0000 } },
- { 0x1FC7, { 0x03B7, 0x0342, 0x03B9, 0x0000 } },
- { 0x1FC8, { 0x1F72, 0x0000, 0x0000, 0x0000 } },
- { 0x1FC9, { 0x1F73, 0x0000, 0x0000, 0x0000 } },
- { 0x1FCA, { 0x1F74, 0x0000, 0x0000, 0x0000 } },
- { 0x1FCB, { 0x1F75, 0x0000, 0x0000, 0x0000 } },
- { 0x1FCC, { 0x03B7, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FD2, { 0x03B9, 0x0308, 0x0300, 0x0000 } },
- { 0x1FD3, { 0x03B9, 0x0308, 0x0301, 0x0000 } },
- { 0x1FD6, { 0x03B9, 0x0342, 0x0000, 0x0000 } },
- { 0x1FD7, { 0x03B9, 0x0308, 0x0342, 0x0000 } },
- { 0x1FD8, { 0x1FD0, 0x0000, 0x0000, 0x0000 } },
- { 0x1FD9, { 0x1FD1, 0x0000, 0x0000, 0x0000 } },
- { 0x1FDA, { 0x1F76, 0x0000, 0x0000, 0x0000 } },
- { 0x1FDB, { 0x1F77, 0x0000, 0x0000, 0x0000 } },
- { 0x1FE2, { 0x03C5, 0x0308, 0x0300, 0x0000 } },
- { 0x1FE3, { 0x03C5, 0x0308, 0x0301, 0x0000 } },
- { 0x1FE4, { 0x03C1, 0x0313, 0x0000, 0x0000 } },
- { 0x1FE6, { 0x03C5, 0x0342, 0x0000, 0x0000 } },
- { 0x1FE7, { 0x03C5, 0x0308, 0x0342, 0x0000 } },
- { 0x1FE8, { 0x1FE0, 0x0000, 0x0000, 0x0000 } },
- { 0x1FE9, { 0x1FE1, 0x0000, 0x0000, 0x0000 } },
- { 0x1FEA, { 0x1F7A, 0x0000, 0x0000, 0x0000 } },
- { 0x1FEB, { 0x1F7B, 0x0000, 0x0000, 0x0000 } },
- { 0x1FEC, { 0x1FE5, 0x0000, 0x0000, 0x0000 } },
- { 0x1FF2, { 0x1F7C, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FF3, { 0x03C9, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FF4, { 0x03CE, 0x03B9, 0x0000, 0x0000 } },
- { 0x1FF6, { 0x03C9, 0x0342, 0x0000, 0x0000 } },
- { 0x1FF7, { 0x03C9, 0x0342, 0x03B9, 0x0000 } },
- { 0x1FF8, { 0x1F78, 0x0000, 0x0000, 0x0000 } },
- { 0x1FF9, { 0x1F79, 0x0000, 0x0000, 0x0000 } },
- { 0x1FFA, { 0x1F7C, 0x0000, 0x0000, 0x0000 } },
- { 0x1FFB, { 0x1F7D, 0x0000, 0x0000, 0x0000 } },
- { 0x1FFC, { 0x03C9, 0x03B9, 0x0000, 0x0000 } },
- { 0x20A8, { 0x0072, 0x0073, 0x0000, 0x0000 } },
- { 0x2102, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x2103, { 0x00B0, 0x0063, 0x0000, 0x0000 } },
- { 0x2107, { 0x025B, 0x0000, 0x0000, 0x0000 } },
- { 0x2109, { 0x00B0, 0x0066, 0x0000, 0x0000 } },
- { 0x210B, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x210C, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x210D, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x2110, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x2111, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x2112, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x2115, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x2116, { 0x006E, 0x006F, 0x0000, 0x0000 } },
- { 0x2119, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x211A, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x211B, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x211C, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x211D, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x2120, { 0x0073, 0x006D, 0x0000, 0x0000 } },
- { 0x2121, { 0x0074, 0x0065, 0x006C, 0x0000 } },
- { 0x2122, { 0x0074, 0x006D, 0x0000, 0x0000 } },
- { 0x2124, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x2126, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
- { 0x2128, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x212A, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x212B, { 0x00E5, 0x0000, 0x0000, 0x0000 } },
- { 0x212C, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x212D, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x2130, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x2131, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x2133, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x213E, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
- { 0x213F, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
- { 0x2145, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x2160, { 0x2170, 0x0000, 0x0000, 0x0000 } },
- { 0x2161, { 0x2171, 0x0000, 0x0000, 0x0000 } },
- { 0x2162, { 0x2172, 0x0000, 0x0000, 0x0000 } },
- { 0x2163, { 0x2173, 0x0000, 0x0000, 0x0000 } },
- { 0x2164, { 0x2174, 0x0000, 0x0000, 0x0000 } },
- { 0x2165, { 0x2175, 0x0000, 0x0000, 0x0000 } },
- { 0x2166, { 0x2176, 0x0000, 0x0000, 0x0000 } },
- { 0x2167, { 0x2177, 0x0000, 0x0000, 0x0000 } },
- { 0x2168, { 0x2178, 0x0000, 0x0000, 0x0000 } },
- { 0x2169, { 0x2179, 0x0000, 0x0000, 0x0000 } },
- { 0x216A, { 0x217A, 0x0000, 0x0000, 0x0000 } },
- { 0x216B, { 0x217B, 0x0000, 0x0000, 0x0000 } },
- { 0x216C, { 0x217C, 0x0000, 0x0000, 0x0000 } },
- { 0x216D, { 0x217D, 0x0000, 0x0000, 0x0000 } },
- { 0x216E, { 0x217E, 0x0000, 0x0000, 0x0000 } },
- { 0x216F, { 0x217F, 0x0000, 0x0000, 0x0000 } },
- { 0x24B6, { 0x24D0, 0x0000, 0x0000, 0x0000 } },
- { 0x24B7, { 0x24D1, 0x0000, 0x0000, 0x0000 } },
- { 0x24B8, { 0x24D2, 0x0000, 0x0000, 0x0000 } },
- { 0x24B9, { 0x24D3, 0x0000, 0x0000, 0x0000 } },
- { 0x24BA, { 0x24D4, 0x0000, 0x0000, 0x0000 } },
- { 0x24BB, { 0x24D5, 0x0000, 0x0000, 0x0000 } },
- { 0x24BC, { 0x24D6, 0x0000, 0x0000, 0x0000 } },
- { 0x24BD, { 0x24D7, 0x0000, 0x0000, 0x0000 } },
- { 0x24BE, { 0x24D8, 0x0000, 0x0000, 0x0000 } },
- { 0x24BF, { 0x24D9, 0x0000, 0x0000, 0x0000 } },
- { 0x24C0, { 0x24DA, 0x0000, 0x0000, 0x0000 } },
- { 0x24C1, { 0x24DB, 0x0000, 0x0000, 0x0000 } },
- { 0x24C2, { 0x24DC, 0x0000, 0x0000, 0x0000 } },
- { 0x24C3, { 0x24DD, 0x0000, 0x0000, 0x0000 } },
- { 0x24C4, { 0x24DE, 0x0000, 0x0000, 0x0000 } },
- { 0x24C5, { 0x24DF, 0x0000, 0x0000, 0x0000 } },
- { 0x24C6, { 0x24E0, 0x0000, 0x0000, 0x0000 } },
- { 0x24C7, { 0x24E1, 0x0000, 0x0000, 0x0000 } },
- { 0x24C8, { 0x24E2, 0x0000, 0x0000, 0x0000 } },
- { 0x24C9, { 0x24E3, 0x0000, 0x0000, 0x0000 } },
- { 0x24CA, { 0x24E4, 0x0000, 0x0000, 0x0000 } },
- { 0x24CB, { 0x24E5, 0x0000, 0x0000, 0x0000 } },
- { 0x24CC, { 0x24E6, 0x0000, 0x0000, 0x0000 } },
- { 0x24CD, { 0x24E7, 0x0000, 0x0000, 0x0000 } },
- { 0x24CE, { 0x24E8, 0x0000, 0x0000, 0x0000 } },
- { 0x24CF, { 0x24E9, 0x0000, 0x0000, 0x0000 } },
- { 0x3371, { 0x0068, 0x0070, 0x0061, 0x0000 } },
- { 0x3373, { 0x0061, 0x0075, 0x0000, 0x0000 } },
- { 0x3375, { 0x006F, 0x0076, 0x0000, 0x0000 } },
- { 0x3380, { 0x0070, 0x0061, 0x0000, 0x0000 } },
- { 0x3381, { 0x006E, 0x0061, 0x0000, 0x0000 } },
- { 0x3382, { 0x03BC, 0x0061, 0x0000, 0x0000 } },
- { 0x3383, { 0x006D, 0x0061, 0x0000, 0x0000 } },
- { 0x3384, { 0x006B, 0x0061, 0x0000, 0x0000 } },
- { 0x3385, { 0x006B, 0x0062, 0x0000, 0x0000 } },
- { 0x3386, { 0x006D, 0x0062, 0x0000, 0x0000 } },
- { 0x3387, { 0x0067, 0x0062, 0x0000, 0x0000 } },
- { 0x338A, { 0x0070, 0x0066, 0x0000, 0x0000 } },
- { 0x338B, { 0x006E, 0x0066, 0x0000, 0x0000 } },
- { 0x338C, { 0x03BC, 0x0066, 0x0000, 0x0000 } },
- { 0x3390, { 0x0068, 0x007A, 0x0000, 0x0000 } },
- { 0x3391, { 0x006B, 0x0068, 0x007A, 0x0000 } },
- { 0x3392, { 0x006D, 0x0068, 0x007A, 0x0000 } },
- { 0x3393, { 0x0067, 0x0068, 0x007A, 0x0000 } },
- { 0x3394, { 0x0074, 0x0068, 0x007A, 0x0000 } },
- { 0x33A9, { 0x0070, 0x0061, 0x0000, 0x0000 } },
- { 0x33AA, { 0x006B, 0x0070, 0x0061, 0x0000 } },
- { 0x33AB, { 0x006D, 0x0070, 0x0061, 0x0000 } },
- { 0x33AC, { 0x0067, 0x0070, 0x0061, 0x0000 } },
- { 0x33B4, { 0x0070, 0x0076, 0x0000, 0x0000 } },
- { 0x33B5, { 0x006E, 0x0076, 0x0000, 0x0000 } },
- { 0x33B6, { 0x03BC, 0x0076, 0x0000, 0x0000 } },
- { 0x33B7, { 0x006D, 0x0076, 0x0000, 0x0000 } },
- { 0x33B8, { 0x006B, 0x0076, 0x0000, 0x0000 } },
- { 0x33B9, { 0x006D, 0x0076, 0x0000, 0x0000 } },
- { 0x33BA, { 0x0070, 0x0077, 0x0000, 0x0000 } },
- { 0x33BB, { 0x006E, 0x0077, 0x0000, 0x0000 } },
- { 0x33BC, { 0x03BC, 0x0077, 0x0000, 0x0000 } },
- { 0x33BD, { 0x006D, 0x0077, 0x0000, 0x0000 } },
- { 0x33BE, { 0x006B, 0x0077, 0x0000, 0x0000 } },
- { 0x33BF, { 0x006D, 0x0077, 0x0000, 0x0000 } },
- { 0x33C0, { 0x006B, 0x03C9, 0x0000, 0x0000 } },
- { 0x33C1, { 0x006D, 0x03C9, 0x0000, 0x0000 } },
- { 0x33C3, { 0x0062, 0x0071, 0x0000, 0x0000 } },
- { 0x33C6, { 0x0063, 0x2215, 0x006B, 0x0067 } },
- { 0x33C7, { 0x0063, 0x006F, 0x002E, 0x0000 } },
- { 0x33C8, { 0x0064, 0x0062, 0x0000, 0x0000 } },
- { 0x33C9, { 0x0067, 0x0079, 0x0000, 0x0000 } },
- { 0x33CB, { 0x0068, 0x0070, 0x0000, 0x0000 } },
- { 0x33CD, { 0x006B, 0x006B, 0x0000, 0x0000 } },
- { 0x33CE, { 0x006B, 0x006D, 0x0000, 0x0000 } },
- { 0x33D7, { 0x0070, 0x0068, 0x0000, 0x0000 } },
- { 0x33D9, { 0x0070, 0x0070, 0x006D, 0x0000 } },
- { 0x33DA, { 0x0070, 0x0072, 0x0000, 0x0000 } },
- { 0x33DC, { 0x0073, 0x0076, 0x0000, 0x0000 } },
- { 0x33DD, { 0x0077, 0x0062, 0x0000, 0x0000 } },
- { 0xFB00, { 0x0066, 0x0066, 0x0000, 0x0000 } },
- { 0xFB01, { 0x0066, 0x0069, 0x0000, 0x0000 } },
- { 0xFB02, { 0x0066, 0x006C, 0x0000, 0x0000 } },
- { 0xFB03, { 0x0066, 0x0066, 0x0069, 0x0000 } },
- { 0xFB04, { 0x0066, 0x0066, 0x006C, 0x0000 } },
- { 0xFB05, { 0x0073, 0x0074, 0x0000, 0x0000 } },
- { 0xFB06, { 0x0073, 0x0074, 0x0000, 0x0000 } },
- { 0xFB13, { 0x0574, 0x0576, 0x0000, 0x0000 } },
- { 0xFB14, { 0x0574, 0x0565, 0x0000, 0x0000 } },
- { 0xFB15, { 0x0574, 0x056B, 0x0000, 0x0000 } },
- { 0xFB16, { 0x057E, 0x0576, 0x0000, 0x0000 } },
- { 0xFB17, { 0x0574, 0x056D, 0x0000, 0x0000 } },
- { 0xFF21, { 0xFF41, 0x0000, 0x0000, 0x0000 } },
- { 0xFF22, { 0xFF42, 0x0000, 0x0000, 0x0000 } },
- { 0xFF23, { 0xFF43, 0x0000, 0x0000, 0x0000 } },
- { 0xFF24, { 0xFF44, 0x0000, 0x0000, 0x0000 } },
- { 0xFF25, { 0xFF45, 0x0000, 0x0000, 0x0000 } },
- { 0xFF26, { 0xFF46, 0x0000, 0x0000, 0x0000 } },
- { 0xFF27, { 0xFF47, 0x0000, 0x0000, 0x0000 } },
- { 0xFF28, { 0xFF48, 0x0000, 0x0000, 0x0000 } },
- { 0xFF29, { 0xFF49, 0x0000, 0x0000, 0x0000 } },
- { 0xFF2A, { 0xFF4A, 0x0000, 0x0000, 0x0000 } },
- { 0xFF2B, { 0xFF4B, 0x0000, 0x0000, 0x0000 } },
- { 0xFF2C, { 0xFF4C, 0x0000, 0x0000, 0x0000 } },
- { 0xFF2D, { 0xFF4D, 0x0000, 0x0000, 0x0000 } },
- { 0xFF2E, { 0xFF4E, 0x0000, 0x0000, 0x0000 } },
- { 0xFF2F, { 0xFF4F, 0x0000, 0x0000, 0x0000 } },
- { 0xFF30, { 0xFF50, 0x0000, 0x0000, 0x0000 } },
- { 0xFF31, { 0xFF51, 0x0000, 0x0000, 0x0000 } },
- { 0xFF32, { 0xFF52, 0x0000, 0x0000, 0x0000 } },
- { 0xFF33, { 0xFF53, 0x0000, 0x0000, 0x0000 } },
- { 0xFF34, { 0xFF54, 0x0000, 0x0000, 0x0000 } },
- { 0xFF35, { 0xFF55, 0x0000, 0x0000, 0x0000 } },
- { 0xFF36, { 0xFF56, 0x0000, 0x0000, 0x0000 } },
- { 0xFF37, { 0xFF57, 0x0000, 0x0000, 0x0000 } },
- { 0xFF38, { 0xFF58, 0x0000, 0x0000, 0x0000 } },
- { 0xFF39, { 0xFF59, 0x0000, 0x0000, 0x0000 } },
- { 0xFF3A, { 0xFF5A, 0x0000, 0x0000, 0x0000 } },
- { 0x10400, { 0xd801, 0xdc28, 0x0000, 0x0000 } },
- { 0x10401, { 0xd801, 0xdc29, 0x0000, 0x0000 } },
- { 0x10402, { 0xd801, 0xdc2A, 0x0000, 0x0000 } },
- { 0x10403, { 0xd801, 0xdc2B, 0x0000, 0x0000 } },
- { 0x10404, { 0xd801, 0xdc2C, 0x0000, 0x0000 } },
- { 0x10405, { 0xd801, 0xdc2D, 0x0000, 0x0000 } },
- { 0x10406, { 0xd801, 0xdc2E, 0x0000, 0x0000 } },
- { 0x10407, { 0xd801, 0xdc2F, 0x0000, 0x0000 } },
- { 0x10408, { 0xd801, 0xdc30, 0x0000, 0x0000 } },
- { 0x10409, { 0xd801, 0xdc31, 0x0000, 0x0000 } },
- { 0x1040A, { 0xd801, 0xdc32, 0x0000, 0x0000 } },
- { 0x1040B, { 0xd801, 0xdc33, 0x0000, 0x0000 } },
- { 0x1040C, { 0xd801, 0xdc34, 0x0000, 0x0000 } },
- { 0x1040D, { 0xd801, 0xdc35, 0x0000, 0x0000 } },
- { 0x1040E, { 0xd801, 0xdc36, 0x0000, 0x0000 } },
- { 0x1040F, { 0xd801, 0xdc37, 0x0000, 0x0000 } },
- { 0x10410, { 0xd801, 0xdc38, 0x0000, 0x0000 } },
- { 0x10411, { 0xd801, 0xdc39, 0x0000, 0x0000 } },
- { 0x10412, { 0xd801, 0xdc3A, 0x0000, 0x0000 } },
- { 0x10413, { 0xd801, 0xdc3B, 0x0000, 0x0000 } },
- { 0x10414, { 0xd801, 0xdc3C, 0x0000, 0x0000 } },
- { 0x10415, { 0xd801, 0xdc3D, 0x0000, 0x0000 } },
- { 0x10416, { 0xd801, 0xdc3E, 0x0000, 0x0000 } },
- { 0x10417, { 0xd801, 0xdc3F, 0x0000, 0x0000 } },
- { 0x10418, { 0xd801, 0xdc40, 0x0000, 0x0000 } },
- { 0x10419, { 0xd801, 0xdc41, 0x0000, 0x0000 } },
- { 0x1041A, { 0xd801, 0xdc42, 0x0000, 0x0000 } },
- { 0x1041B, { 0xd801, 0xdc43, 0x0000, 0x0000 } },
- { 0x1041C, { 0xd801, 0xdc44, 0x0000, 0x0000 } },
- { 0x1041D, { 0xd801, 0xdc45, 0x0000, 0x0000 } },
- { 0x1041E, { 0xd801, 0xdc46, 0x0000, 0x0000 } },
- { 0x1041F, { 0xd801, 0xdc47, 0x0000, 0x0000 } },
- { 0x10420, { 0xd801, 0xdc48, 0x0000, 0x0000 } },
- { 0x10421, { 0xd801, 0xdc49, 0x0000, 0x0000 } },
- { 0x10422, { 0xd801, 0xdc4A, 0x0000, 0x0000 } },
- { 0x10423, { 0xd801, 0xdc4B, 0x0000, 0x0000 } },
- { 0x10424, { 0xd801, 0xdc4C, 0x0000, 0x0000 } },
- { 0x10425, { 0xd801, 0xdc4D, 0x0000, 0x0000 } },
- { 0x1D400, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D401, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x1D402, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x1D403, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D404, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x1D405, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x1D406, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D407, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x1D408, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x1D409, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D40A, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D40B, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x1D40C, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x1D40D, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x1D40E, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D40F, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x1D410, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x1D411, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x1D412, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D413, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D414, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D415, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D416, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D417, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D418, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D419, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D434, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D435, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x1D436, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x1D437, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D438, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x1D439, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x1D43A, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D43B, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x1D43C, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x1D43D, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D43E, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D43F, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x1D440, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x1D441, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x1D442, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D443, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x1D444, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x1D445, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x1D446, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D447, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D448, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D449, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D44A, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D44B, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D44C, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D44D, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D468, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D469, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x1D46A, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x1D46B, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D46C, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x1D46D, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x1D46E, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D46F, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x1D470, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x1D471, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D472, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D473, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x1D474, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x1D475, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x1D476, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D477, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x1D478, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x1D479, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x1D47A, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D47B, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D47C, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D47D, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D47E, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D47F, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D480, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D481, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D49C, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D49E, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x1D49F, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4A2, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4A5, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4A6, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4A9, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4AA, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4AB, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4AC, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4AE, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4AF, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4B0, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4B1, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4B2, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4B3, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4B4, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4B5, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4D0, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4D1, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4D2, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4D3, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4D4, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4D5, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4D6, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4D7, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4D8, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4D9, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4DA, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4DB, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4DC, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4DD, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4DE, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4DF, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4E0, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4E1, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4E2, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4E3, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4E4, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4E5, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4E6, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4E7, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4E8, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D4E9, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D504, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D505, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x1D507, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D508, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x1D509, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x1D50A, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D50D, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D50E, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D50F, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x1D510, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x1D511, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x1D512, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D513, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x1D514, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x1D516, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D517, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D518, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D519, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D51A, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D51B, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D51C, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D538, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D539, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x1D53B, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D53C, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x1D53D, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x1D53E, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D540, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x1D541, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D542, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D543, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x1D544, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x1D546, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D54A, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D54B, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D54C, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D54D, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D54E, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D54F, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D550, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D56C, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D56D, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x1D56E, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x1D56F, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D570, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x1D571, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x1D572, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D573, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x1D574, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x1D575, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D576, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D577, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x1D578, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x1D579, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x1D57A, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D57B, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x1D57C, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x1D57D, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x1D57E, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D57F, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D580, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D581, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D582, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D583, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D584, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D585, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5A0, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5A1, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5A2, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5A3, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5A4, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5A5, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5A6, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5A7, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5A8, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5A9, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5AA, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5AB, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5AC, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5AD, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5AE, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5AF, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5B0, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5B1, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5B2, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5B3, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5B4, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5B5, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5B6, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5B7, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5B8, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5B9, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5D4, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5D5, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5D6, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5D7, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5D8, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5D9, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5DA, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5DB, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5DC, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5DD, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5DE, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5DF, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5E0, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5E1, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5E2, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5E3, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5E4, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5E5, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5E6, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5E7, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5E8, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5E9, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5EA, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5EB, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5EC, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D5ED, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D608, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D609, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x1D60A, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x1D60B, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D60C, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x1D60D, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x1D60E, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D60F, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x1D610, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x1D611, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D612, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D613, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x1D614, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x1D615, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x1D616, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D617, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x1D618, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x1D619, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x1D61A, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D61B, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D61C, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D61D, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D61E, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D61F, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D620, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D621, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D63C, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D63D, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x1D63E, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x1D63F, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D640, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x1D641, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x1D642, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D643, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x1D644, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x1D645, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D646, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D647, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x1D648, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x1D649, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x1D64A, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D64B, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x1D64C, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x1D64D, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x1D64E, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D64F, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D650, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D651, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D652, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D653, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D654, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D655, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D670, { 0x0061, 0x0000, 0x0000, 0x0000 } },
- { 0x1D671, { 0x0062, 0x0000, 0x0000, 0x0000 } },
- { 0x1D672, { 0x0063, 0x0000, 0x0000, 0x0000 } },
- { 0x1D673, { 0x0064, 0x0000, 0x0000, 0x0000 } },
- { 0x1D674, { 0x0065, 0x0000, 0x0000, 0x0000 } },
- { 0x1D675, { 0x0066, 0x0000, 0x0000, 0x0000 } },
- { 0x1D676, { 0x0067, 0x0000, 0x0000, 0x0000 } },
- { 0x1D677, { 0x0068, 0x0000, 0x0000, 0x0000 } },
- { 0x1D678, { 0x0069, 0x0000, 0x0000, 0x0000 } },
- { 0x1D679, { 0x006A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D67A, { 0x006B, 0x0000, 0x0000, 0x0000 } },
- { 0x1D67B, { 0x006C, 0x0000, 0x0000, 0x0000 } },
- { 0x1D67C, { 0x006D, 0x0000, 0x0000, 0x0000 } },
- { 0x1D67D, { 0x006E, 0x0000, 0x0000, 0x0000 } },
- { 0x1D67E, { 0x006F, 0x0000, 0x0000, 0x0000 } },
- { 0x1D67F, { 0x0070, 0x0000, 0x0000, 0x0000 } },
- { 0x1D680, { 0x0071, 0x0000, 0x0000, 0x0000 } },
- { 0x1D681, { 0x0072, 0x0000, 0x0000, 0x0000 } },
- { 0x1D682, { 0x0073, 0x0000, 0x0000, 0x0000 } },
- { 0x1D683, { 0x0074, 0x0000, 0x0000, 0x0000 } },
- { 0x1D684, { 0x0075, 0x0000, 0x0000, 0x0000 } },
- { 0x1D685, { 0x0076, 0x0000, 0x0000, 0x0000 } },
- { 0x1D686, { 0x0077, 0x0000, 0x0000, 0x0000 } },
- { 0x1D687, { 0x0078, 0x0000, 0x0000, 0x0000 } },
- { 0x1D688, { 0x0079, 0x0000, 0x0000, 0x0000 } },
- { 0x1D689, { 0x007A, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6A8, { 0x03B1, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6A9, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6AA, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6AB, { 0x03B4, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6AC, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6AD, { 0x03B6, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6AE, { 0x03B7, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6AF, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6B0, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6B1, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6B2, { 0x03BB, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6B3, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6B4, { 0x03BD, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6B5, { 0x03BE, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6B6, { 0x03BF, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6B7, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6B8, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6B9, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6BA, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6BB, { 0x03C4, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6BC, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6BD, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6BE, { 0x03C7, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6BF, { 0x03C8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6C0, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6D3, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6E2, { 0x03B1, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6E3, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6E4, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6E5, { 0x03B4, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6E6, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6E7, { 0x03B6, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6E8, { 0x03B7, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6E9, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6EA, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6EB, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6EC, { 0x03BB, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6ED, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6EE, { 0x03BD, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6EF, { 0x03BE, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6F0, { 0x03BF, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6F1, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6F2, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6F3, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6F4, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6F5, { 0x03C4, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6F6, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6F7, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6F8, { 0x03C7, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6F9, { 0x03C8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D6FA, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
- { 0x1D70D, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D71C, { 0x03B1, 0x0000, 0x0000, 0x0000 } },
- { 0x1D71D, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
- { 0x1D71E, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D71F, { 0x03B4, 0x0000, 0x0000, 0x0000 } },
- { 0x1D720, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
- { 0x1D721, { 0x03B6, 0x0000, 0x0000, 0x0000 } },
- { 0x1D722, { 0x03B7, 0x0000, 0x0000, 0x0000 } },
- { 0x1D723, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D724, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
- { 0x1D725, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
- { 0x1D726, { 0x03BB, 0x0000, 0x0000, 0x0000 } },
- { 0x1D727, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
- { 0x1D728, { 0x03BD, 0x0000, 0x0000, 0x0000 } },
- { 0x1D729, { 0x03BE, 0x0000, 0x0000, 0x0000 } },
- { 0x1D72A, { 0x03BF, 0x0000, 0x0000, 0x0000 } },
- { 0x1D72B, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
- { 0x1D72C, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
- { 0x1D72D, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D72E, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D72F, { 0x03C4, 0x0000, 0x0000, 0x0000 } },
- { 0x1D730, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
- { 0x1D731, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
- { 0x1D732, { 0x03C7, 0x0000, 0x0000, 0x0000 } },
- { 0x1D733, { 0x03C8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D734, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
- { 0x1D747, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D756, { 0x03B1, 0x0000, 0x0000, 0x0000 } },
- { 0x1D757, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
- { 0x1D758, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D759, { 0x03B4, 0x0000, 0x0000, 0x0000 } },
- { 0x1D75A, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
- { 0x1D75B, { 0x03B6, 0x0000, 0x0000, 0x0000 } },
- { 0x1D75C, { 0x03B7, 0x0000, 0x0000, 0x0000 } },
- { 0x1D75D, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D75E, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
- { 0x1D75F, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
- { 0x1D760, { 0x03BB, 0x0000, 0x0000, 0x0000 } },
- { 0x1D761, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
- { 0x1D762, { 0x03BD, 0x0000, 0x0000, 0x0000 } },
- { 0x1D763, { 0x03BE, 0x0000, 0x0000, 0x0000 } },
- { 0x1D764, { 0x03BF, 0x0000, 0x0000, 0x0000 } },
- { 0x1D765, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
- { 0x1D766, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
- { 0x1D767, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D768, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D769, { 0x03C4, 0x0000, 0x0000, 0x0000 } },
- { 0x1D76A, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
- { 0x1D76B, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
- { 0x1D76C, { 0x03C7, 0x0000, 0x0000, 0x0000 } },
- { 0x1D76D, { 0x03C8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D76E, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
- { 0x1D781, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D790, { 0x03B1, 0x0000, 0x0000, 0x0000 } },
- { 0x1D791, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
- { 0x1D792, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D793, { 0x03B4, 0x0000, 0x0000, 0x0000 } },
- { 0x1D794, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
- { 0x1D795, { 0x03B6, 0x0000, 0x0000, 0x0000 } },
- { 0x1D796, { 0x03B7, 0x0000, 0x0000, 0x0000 } },
- { 0x1D797, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D798, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
- { 0x1D799, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
- { 0x1D79A, { 0x03BB, 0x0000, 0x0000, 0x0000 } },
- { 0x1D79B, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
- { 0x1D79C, { 0x03BD, 0x0000, 0x0000, 0x0000 } },
- { 0x1D79D, { 0x03BE, 0x0000, 0x0000, 0x0000 } },
- { 0x1D79E, { 0x03BF, 0x0000, 0x0000, 0x0000 } },
- { 0x1D79F, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
- { 0x1D7A0, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
- { 0x1D7A1, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D7A2, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
- { 0x1D7A3, { 0x03C4, 0x0000, 0x0000, 0x0000 } },
- { 0x1D7A4, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
- { 0x1D7A5, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
- { 0x1D7A6, { 0x03C7, 0x0000, 0x0000, 0x0000 } },
- { 0x1D7A7, { 0x03C8, 0x0000, 0x0000, 0x0000 } },
- { 0x1D7A8, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
- { 0x1D7BB, { 0x03C3, 0x0000, 0x0000, 0x0000 } }
-};
-
-static void mapToLowerCase(QString *str, int from)
+// ONLY the IPv6 address is parsed here, WITHOUT the brackets
+static bool parseIp6(QString &host, const QChar *begin, const QChar *end)
{
- int N = sizeof(NameprepCaseFolding) / sizeof(NameprepCaseFolding[0]);
-
- ushort *d = 0;
- for (int i = from; i < str->size(); ++i) {
- uint uc = str->at(i).unicode();
- if (uc < 0x80) {
- if (uc <= 'Z' && uc >= 'A') {
- if (!d)
- d = reinterpret_cast<ushort *>(str->data());
- d[i] = (uc | 0x20);
- }
- } else {
- if (QChar(uc).isHighSurrogate() && i < str->size() - 1) {
- ushort low = str->at(i + 1).unicode();
- if (QChar(low).isLowSurrogate()) {
- uc = QChar::surrogateToUcs4(uc, low);
- ++i;
- }
- }
- const NameprepCaseFoldingEntry *entry = qBinaryFind(NameprepCaseFolding,
- NameprepCaseFolding + N,
- uc);
- if ((entry - NameprepCaseFolding) != N) {
- int l = 1;
- while (l < 4 && entry->mapping[l])
- ++l;
- if (l > 1) {
- if (!QChar::requiresSurrogates(uc))
- str->replace(i, 1, reinterpret_cast<const QChar *>(&entry->mapping[0]), l);
- else
- str->replace(i-1, 2, reinterpret_cast<const QChar *>(&entry->mapping[0]), l);
- d = 0;
- } else {
- if (!d)
- d = reinterpret_cast<ushort *>(str->data());
- d[i] = entry->mapping[0];
- }
- }
+ QIPAddressUtils::IPv6Address address;
+ if (!QIPAddressUtils::parseIp6(address, begin, end)) {
+ // IPv6 failed parsing, check if it was a percent-encoded character in
+ // the middle and try again
+ QString decoded;
+ if (!qt_urlRecode(decoded, begin, end, QUrl::FullyEncoded, 0)) {
+ // no transformation, nothing to re-parse
+ return false;
}
- }
-}
-static bool isMappedToNothing(uint uc)
-{
- if (uc < 0xad)
- return false;
- switch (uc) {
- case 0x00AD: case 0x034F: case 0x1806: case 0x180B: case 0x180C: case 0x180D:
- case 0x200B: case 0x200C: case 0x200D: case 0x2060: case 0xFE00: case 0xFE01:
- case 0xFE02: case 0xFE03: case 0xFE04: case 0xFE05: case 0xFE06: case 0xFE07:
- case 0xFE08: case 0xFE09: case 0xFE0A: case 0xFE0B: case 0xFE0C: case 0xFE0D:
- case 0xFE0E: case 0xFE0F: case 0xFEFF:
- return true;
- default:
- return false;
+ // recurse
+ // if the parsing fails again, the qt_urlRecode above will return 0
+ return parseIp6(host, decoded.constBegin(), decoded.constEnd());
}
-}
-
-static void stripProhibitedOutput(QString *str, int from)
-{
- ushort *out = (ushort *)str->data() + from;
- const ushort *in = out;
- const ushort *end = (ushort *)str->data() + str->size();
- while (in < end) {
- uint uc = *in;
- if (QChar(uc).isHighSurrogate() && in < end - 1) {
- ushort low = *(in + 1);
- if (QChar(low).isLowSurrogate()) {
- ++in;
- uc = QChar::surrogateToUcs4(uc, low);
- }
- }
- if (!QChar::requiresSurrogates(uc)) {
- if (uc < 0x80 ||
- !(uc <= 0x009F
- || uc == 0x00A0
- || uc == 0x0340
- || uc == 0x0341
- || uc == 0x06DD
- || uc == 0x070F
- || uc == 0x1680
- || uc == 0x180E
- || (uc >= 0x2000 && uc <= 0x200F)
- || (uc >= 0x2028 && uc <= 0x202F)
- || uc == 0x205F
- || (uc >= 0x2060 && uc <= 0x2063)
- || (uc >= 0x206A && uc <= 0x206F)
- || (uc >= 0x2FF0 && uc <= 0x2FFB)
- || uc == 0x3000
- || (uc >= 0xD800 && uc <= 0xDFFF)
- || (uc >= 0xE000 && uc <= 0xF8FF)
- || (uc >= 0xFDD0 && uc <= 0xFDEF)
- || uc == 0xFEFF
- || (uc >= 0xFFF9 && uc <= 0xFFFF))) {
- *out++ = *in;
- }
- } else {
- if (!((uc >= 0x1D173 && uc <= 0x1D17A)
- || (uc >= 0x1FFFE && uc <= 0x1FFFF)
- || (uc >= 0x2FFFE && uc <= 0x2FFFF)
- || (uc >= 0x3FFFE && uc <= 0x3FFFF)
- || (uc >= 0x4FFFE && uc <= 0x4FFFF)
- || (uc >= 0x5FFFE && uc <= 0x5FFFF)
- || (uc >= 0x6FFFE && uc <= 0x6FFFF)
- || (uc >= 0x7FFFE && uc <= 0x7FFFF)
- || (uc >= 0x8FFFE && uc <= 0x8FFFF)
- || (uc >= 0x9FFFE && uc <= 0x9FFFF)
- || (uc >= 0xAFFFE && uc <= 0xAFFFF)
- || (uc >= 0xBFFFE && uc <= 0xBFFFF)
- || (uc >= 0xCFFFE && uc <= 0xCFFFF)
- || (uc >= 0xDFFFE && uc <= 0xDFFFF)
- || uc == 0xE0001
- || (uc >= 0xE0020 && uc <= 0xE007F)
- || (uc >= 0xEFFFE && uc <= 0xEFFFF)
- || (uc >= 0xF0000 && uc <= 0xFFFFD)
- || (uc >= 0xFFFFE && uc <= 0xFFFFF)
- || (uc >= 0x100000 && uc <= 0x10FFFD)
- || (uc >= 0x10FFFE && uc <= 0x10FFFF))) {
- *out++ = QChar::highSurrogate(uc);
- *out++ = QChar::lowSurrogate(uc);
- }
- }
- ++in;
- }
- if (in != out)
- str->truncate(out - str->utf16());
-}
-
-static bool isBidirectionalRorAL(uint uc)
-{
- if (uc < 0x5b0)
- return false;
- return uc == 0x05BE
- || uc == 0x05C0
- || uc == 0x05C3
- || (uc >= 0x05D0 && uc <= 0x05EA)
- || (uc >= 0x05F0 && uc <= 0x05F4)
- || uc == 0x061B
- || uc == 0x061F
- || (uc >= 0x0621 && uc <= 0x063A)
- || (uc >= 0x0640 && uc <= 0x064A)
- || (uc >= 0x066D && uc <= 0x066F)
- || (uc >= 0x0671 && uc <= 0x06D5)
- || uc == 0x06DD
- || (uc >= 0x06E5 && uc <= 0x06E6)
- || (uc >= 0x06FA && uc <= 0x06FE)
- || (uc >= 0x0700 && uc <= 0x070D)
- || uc == 0x0710
- || (uc >= 0x0712 && uc <= 0x072C)
- || (uc >= 0x0780 && uc <= 0x07A5)
- || uc == 0x07B1
- || uc == 0x200F
- || uc == 0xFB1D
- || (uc >= 0xFB1F && uc <= 0xFB28)
- || (uc >= 0xFB2A && uc <= 0xFB36)
- || (uc >= 0xFB38 && uc <= 0xFB3C)
- || uc == 0xFB3E
- || (uc >= 0xFB40 && uc <= 0xFB41)
- || (uc >= 0xFB43 && uc <= 0xFB44)
- || (uc >= 0xFB46 && uc <= 0xFBB1)
- || (uc >= 0xFBD3 && uc <= 0xFD3D)
- || (uc >= 0xFD50 && uc <= 0xFD8F)
- || (uc >= 0xFD92 && uc <= 0xFDC7)
- || (uc >= 0xFDF0 && uc <= 0xFDFC)
- || (uc >= 0xFE70 && uc <= 0xFE74)
- || (uc >= 0xFE76 && uc <= 0xFEFC);
+ host.reserve(host.size() + (end - begin));
+ host += QLatin1Char('[');
+ QIPAddressUtils::toString(host, address);
+ host += QLatin1Char(']');
+ return true;
}
-static bool isBidirectionalL(uint uc)
+bool QUrlPrivate::setHost(const QString &value, int from, int iend, bool maybePercentEncoded)
{
- if (uc < 0xaa)
- return (uc >= 0x0041 && uc <= 0x005A)
- || (uc >= 0x0061 && uc <= 0x007A);
-
- if (uc == 0x00AA
- || uc == 0x00B5
- || uc == 0x00BA
- || (uc >= 0x00C0 && uc <= 0x00D6)
- || (uc >= 0x00D8 && uc <= 0x00F6)
- || (uc >= 0x00F8 && uc <= 0x0220)
- || (uc >= 0x0222 && uc <= 0x0233)
- || (uc >= 0x0250 && uc <= 0x02AD)
- || (uc >= 0x02B0 && uc <= 0x02B8)
- || (uc >= 0x02BB && uc <= 0x02C1)
- || (uc >= 0x02D0 && uc <= 0x02D1)
- || (uc >= 0x02E0 && uc <= 0x02E4)
- || uc == 0x02EE
- || uc == 0x037A
- || uc == 0x0386
- || (uc >= 0x0388 && uc <= 0x038A)) {
- return true;
- }
-
- if (uc == 0x038C
- || (uc >= 0x038E && uc <= 0x03A1)
- || (uc >= 0x03A3 && uc <= 0x03CE)
- || (uc >= 0x03D0 && uc <= 0x03F5)
- || (uc >= 0x0400 && uc <= 0x0482)
- || (uc >= 0x048A && uc <= 0x04CE)
- || (uc >= 0x04D0 && uc <= 0x04F5)
- || (uc >= 0x04F8 && uc <= 0x04F9)
- || (uc >= 0x0500 && uc <= 0x050F)
- || (uc >= 0x0531 && uc <= 0x0556)
- || (uc >= 0x0559 && uc <= 0x055F)
- || (uc >= 0x0561 && uc <= 0x0587)
- || uc == 0x0589
- || uc == 0x0903
- || (uc >= 0x0905 && uc <= 0x0939)
- || (uc >= 0x093D && uc <= 0x0940)
- || (uc >= 0x0949 && uc <= 0x094C)
- || uc == 0x0950) {
- return true;
- }
-
- if ((uc >= 0x0958 && uc <= 0x0961)
- || (uc >= 0x0964 && uc <= 0x0970)
- || (uc >= 0x0982 && uc <= 0x0983)
- || (uc >= 0x0985 && uc <= 0x098C)
- || (uc >= 0x098F && uc <= 0x0990)
- || (uc >= 0x0993 && uc <= 0x09A8)
- || (uc >= 0x09AA && uc <= 0x09B0)
- || uc == 0x09B2
- || (uc >= 0x09B6 && uc <= 0x09B9)
- || (uc >= 0x09BE && uc <= 0x09C0)
- || (uc >= 0x09C7 && uc <= 0x09C8)
- || (uc >= 0x09CB && uc <= 0x09CC)
- || uc == 0x09D7
- || (uc >= 0x09DC && uc <= 0x09DD)
- || (uc >= 0x09DF && uc <= 0x09E1)
- || (uc >= 0x09E6 && uc <= 0x09F1)
- || (uc >= 0x09F4 && uc <= 0x09FA)
- || (uc >= 0x0A05 && uc <= 0x0A0A)
- || (uc >= 0x0A0F && uc <= 0x0A10)
- || (uc >= 0x0A13 && uc <= 0x0A28)
- || (uc >= 0x0A2A && uc <= 0x0A30)
- || (uc >= 0x0A32 && uc <= 0x0A33)) {
- return true;
- }
-
- if ((uc >= 0x0A35 && uc <= 0x0A36)
- || (uc >= 0x0A38 && uc <= 0x0A39)
- || (uc >= 0x0A3E && uc <= 0x0A40)
- || (uc >= 0x0A59 && uc <= 0x0A5C)
- || uc == 0x0A5E
- || (uc >= 0x0A66 && uc <= 0x0A6F)
- || (uc >= 0x0A72 && uc <= 0x0A74)
- || uc == 0x0A83
- || (uc >= 0x0A85 && uc <= 0x0A8B)
- || uc == 0x0A8D
- || (uc >= 0x0A8F && uc <= 0x0A91)
- || (uc >= 0x0A93 && uc <= 0x0AA8)
- || (uc >= 0x0AAA && uc <= 0x0AB0)
- || (uc >= 0x0AB2 && uc <= 0x0AB3)
- || (uc >= 0x0AB5 && uc <= 0x0AB9)
- || (uc >= 0x0ABD && uc <= 0x0AC0)
- || uc == 0x0AC9
- || (uc >= 0x0ACB && uc <= 0x0ACC)
- || uc == 0x0AD0
- || uc == 0x0AE0
- || (uc >= 0x0AE6 && uc <= 0x0AEF)
- || (uc >= 0x0B02 && uc <= 0x0B03)
- || (uc >= 0x0B05 && uc <= 0x0B0C)
- || (uc >= 0x0B0F && uc <= 0x0B10)
- || (uc >= 0x0B13 && uc <= 0x0B28)
- || (uc >= 0x0B2A && uc <= 0x0B30)) {
- return true;
- }
-
- if ((uc >= 0x0B32 && uc <= 0x0B33)
- || (uc >= 0x0B36 && uc <= 0x0B39)
- || (uc >= 0x0B3D && uc <= 0x0B3E)
- || uc == 0x0B40
- || (uc >= 0x0B47 && uc <= 0x0B48)
- || (uc >= 0x0B4B && uc <= 0x0B4C)
- || uc == 0x0B57
- || (uc >= 0x0B5C && uc <= 0x0B5D)
- || (uc >= 0x0B5F && uc <= 0x0B61)
- || (uc >= 0x0B66 && uc <= 0x0B70)
- || uc == 0x0B83
- || (uc >= 0x0B85 && uc <= 0x0B8A)
- || (uc >= 0x0B8E && uc <= 0x0B90)
- || (uc >= 0x0B92 && uc <= 0x0B95)
- || (uc >= 0x0B99 && uc <= 0x0B9A)
- || uc == 0x0B9C
- || (uc >= 0x0B9E && uc <= 0x0B9F)
- || (uc >= 0x0BA3 && uc <= 0x0BA4)
- || (uc >= 0x0BA8 && uc <= 0x0BAA)
- || (uc >= 0x0BAE && uc <= 0x0BB5)
- || (uc >= 0x0BB7 && uc <= 0x0BB9)
- || (uc >= 0x0BBE && uc <= 0x0BBF)
- || (uc >= 0x0BC1 && uc <= 0x0BC2)
- || (uc >= 0x0BC6 && uc <= 0x0BC8)
- || (uc >= 0x0BCA && uc <= 0x0BCC)
- || uc == 0x0BD7
- || (uc >= 0x0BE7 && uc <= 0x0BF2)
- || (uc >= 0x0C01 && uc <= 0x0C03)
- || (uc >= 0x0C05 && uc <= 0x0C0C)
- || (uc >= 0x0C0E && uc <= 0x0C10)
- || (uc >= 0x0C12 && uc <= 0x0C28)
- || (uc >= 0x0C2A && uc <= 0x0C33)
- || (uc >= 0x0C35 && uc <= 0x0C39)) {
- return true;
- }
- if ((uc >= 0x0C41 && uc <= 0x0C44)
- || (uc >= 0x0C60 && uc <= 0x0C61)
- || (uc >= 0x0C66 && uc <= 0x0C6F)
- || (uc >= 0x0C82 && uc <= 0x0C83)
- || (uc >= 0x0C85 && uc <= 0x0C8C)
- || (uc >= 0x0C8E && uc <= 0x0C90)
- || (uc >= 0x0C92 && uc <= 0x0CA8)
- || (uc >= 0x0CAA && uc <= 0x0CB3)
- || (uc >= 0x0CB5 && uc <= 0x0CB9)
- || uc == 0x0CBE
- || (uc >= 0x0CC0 && uc <= 0x0CC4)
- || (uc >= 0x0CC7 && uc <= 0x0CC8)
- || (uc >= 0x0CCA && uc <= 0x0CCB)
- || (uc >= 0x0CD5 && uc <= 0x0CD6)
- || uc == 0x0CDE
- || (uc >= 0x0CE0 && uc <= 0x0CE1)
- || (uc >= 0x0CE6 && uc <= 0x0CEF)
- || (uc >= 0x0D02 && uc <= 0x0D03)
- || (uc >= 0x0D05 && uc <= 0x0D0C)
- || (uc >= 0x0D0E && uc <= 0x0D10)
- || (uc >= 0x0D12 && uc <= 0x0D28)
- || (uc >= 0x0D2A && uc <= 0x0D39)
- || (uc >= 0x0D3E && uc <= 0x0D40)
- || (uc >= 0x0D46 && uc <= 0x0D48)
- || (uc >= 0x0D4A && uc <= 0x0D4C)
- || uc == 0x0D57
- || (uc >= 0x0D60 && uc <= 0x0D61)
- || (uc >= 0x0D66 && uc <= 0x0D6F)
- || (uc >= 0x0D82 && uc <= 0x0D83)
- || (uc >= 0x0D85 && uc <= 0x0D96)
- || (uc >= 0x0D9A && uc <= 0x0DB1)
- || (uc >= 0x0DB3 && uc <= 0x0DBB)
- || uc == 0x0DBD) {
- return true;
- }
- if ((uc >= 0x0DC0 && uc <= 0x0DC6)
- || (uc >= 0x0DCF && uc <= 0x0DD1)
- || (uc >= 0x0DD8 && uc <= 0x0DDF)
- || (uc >= 0x0DF2 && uc <= 0x0DF4)
- || (uc >= 0x0E01 && uc <= 0x0E30)
- || (uc >= 0x0E32 && uc <= 0x0E33)
- || (uc >= 0x0E40 && uc <= 0x0E46)
- || (uc >= 0x0E4F && uc <= 0x0E5B)
- || (uc >= 0x0E81 && uc <= 0x0E82)
- || uc == 0x0E84
- || (uc >= 0x0E87 && uc <= 0x0E88)
- || uc == 0x0E8A
- || uc == 0x0E8D
- || (uc >= 0x0E94 && uc <= 0x0E97)
- || (uc >= 0x0E99 && uc <= 0x0E9F)
- || (uc >= 0x0EA1 && uc <= 0x0EA3)
- || uc == 0x0EA5
- || uc == 0x0EA7
- || (uc >= 0x0EAA && uc <= 0x0EAB)
- || (uc >= 0x0EAD && uc <= 0x0EB0)
- || (uc >= 0x0EB2 && uc <= 0x0EB3)
- || uc == 0x0EBD
- || (uc >= 0x0EC0 && uc <= 0x0EC4)
- || uc == 0x0EC6
- || (uc >= 0x0ED0 && uc <= 0x0ED9)
- || (uc >= 0x0EDC && uc <= 0x0EDD)
- || (uc >= 0x0F00 && uc <= 0x0F17)
- || (uc >= 0x0F1A && uc <= 0x0F34)
- || uc == 0x0F36
- || uc == 0x0F38
- || (uc >= 0x0F3E && uc <= 0x0F47)
- || (uc >= 0x0F49 && uc <= 0x0F6A)
- || uc == 0x0F7F
- || uc == 0x0F85
- || (uc >= 0x0F88 && uc <= 0x0F8B)
- || (uc >= 0x0FBE && uc <= 0x0FC5)
- || (uc >= 0x0FC7 && uc <= 0x0FCC)
- || uc == 0x0FCF) {
- return true;
- }
-
- if ((uc >= 0x1000 && uc <= 0x1021)
- || (uc >= 0x1023 && uc <= 0x1027)
- || (uc >= 0x1029 && uc <= 0x102A)
- || uc == 0x102C
- || uc == 0x1031
- || uc == 0x1038
- || (uc >= 0x1040 && uc <= 0x1057)
- || (uc >= 0x10A0 && uc <= 0x10C5)
- || (uc >= 0x10D0 && uc <= 0x10F8)
- || uc == 0x10FB
- || (uc >= 0x1100 && uc <= 0x1159)
- || (uc >= 0x115F && uc <= 0x11A2)
- || (uc >= 0x11A8 && uc <= 0x11F9)
- || (uc >= 0x1200 && uc <= 0x1206)
- || (uc >= 0x1208 && uc <= 0x1246)
- || uc == 0x1248
- || (uc >= 0x124A && uc <= 0x124D)
- || (uc >= 0x1250 && uc <= 0x1256)
- || uc == 0x1258
- || (uc >= 0x125A && uc <= 0x125D)
- || (uc >= 0x1260 && uc <= 0x1286)
- || uc == 0x1288
- || (uc >= 0x128A && uc <= 0x128D)
- || (uc >= 0x1290 && uc <= 0x12AE)
- || uc == 0x12B0
- || (uc >= 0x12B2 && uc <= 0x12B5)
- || (uc >= 0x12B8 && uc <= 0x12BE)
- || uc == 0x12C0
- || (uc >= 0x12C2 && uc <= 0x12C5)
- || (uc >= 0x12C8 && uc <= 0x12CE)
- || (uc >= 0x12D0 && uc <= 0x12D6)
- || (uc >= 0x12D8 && uc <= 0x12EE)
- || (uc >= 0x12F0 && uc <= 0x130E)
- || uc == 0x1310) {
- return true;
- }
+ const QChar *begin = value.constData() + from;
+ const QChar *end = value.constData() + iend;
- if ((uc >= 0x1312 && uc <= 0x1315)
- || (uc >= 0x1318 && uc <= 0x131E)
- || (uc >= 0x1320 && uc <= 0x1346)
- || (uc >= 0x1348 && uc <= 0x135A)
- || (uc >= 0x1361 && uc <= 0x137C)
- || (uc >= 0x13A0 && uc <= 0x13F4)
- || (uc >= 0x1401 && uc <= 0x1676)
- || (uc >= 0x1681 && uc <= 0x169A)
- || (uc >= 0x16A0 && uc <= 0x16F0)
- || (uc >= 0x1700 && uc <= 0x170C)
- || (uc >= 0x170E && uc <= 0x1711)
- || (uc >= 0x1720 && uc <= 0x1731)
- || (uc >= 0x1735 && uc <= 0x1736)
- || (uc >= 0x1740 && uc <= 0x1751)
- || (uc >= 0x1760 && uc <= 0x176C)
- || (uc >= 0x176E && uc <= 0x1770)
- || (uc >= 0x1780 && uc <= 0x17B6)
- || (uc >= 0x17BE && uc <= 0x17C5)
- || (uc >= 0x17C7 && uc <= 0x17C8)
- || (uc >= 0x17D4 && uc <= 0x17DA)
- || uc == 0x17DC
- || (uc >= 0x17E0 && uc <= 0x17E9)
- || (uc >= 0x1810 && uc <= 0x1819)
- || (uc >= 0x1820 && uc <= 0x1877)
- || (uc >= 0x1880 && uc <= 0x18A8)
- || (uc >= 0x1E00 && uc <= 0x1E9B)
- || (uc >= 0x1EA0 && uc <= 0x1EF9)
- || (uc >= 0x1F00 && uc <= 0x1F15)
- || (uc >= 0x1F18 && uc <= 0x1F1D)
- || (uc >= 0x1F20 && uc <= 0x1F45)
- || (uc >= 0x1F48 && uc <= 0x1F4D)
- || (uc >= 0x1F50 && uc <= 0x1F57)
- || uc == 0x1F59
- || uc == 0x1F5B
- || uc == 0x1F5D) {
- return true;
- }
-
- if ((uc >= 0x1F5F && uc <= 0x1F7D)
- || (uc >= 0x1F80 && uc <= 0x1FB4)
- || (uc >= 0x1FB6 && uc <= 0x1FBC)
- || uc == 0x1FBE
- || (uc >= 0x1FC2 && uc <= 0x1FC4)
- || (uc >= 0x1FC6 && uc <= 0x1FCC)
- || (uc >= 0x1FD0 && uc <= 0x1FD3)
- || (uc >= 0x1FD6 && uc <= 0x1FDB)
- || (uc >= 0x1FE0 && uc <= 0x1FEC)
- || (uc >= 0x1FF2 && uc <= 0x1FF4)
- || (uc >= 0x1FF6 && uc <= 0x1FFC)
- || uc == 0x200E
- || uc == 0x2071
- || uc == 0x207F
- || uc == 0x2102
- || uc == 0x2107
- || (uc >= 0x210A && uc <= 0x2113)
- || uc == 0x2115
- || (uc >= 0x2119 && uc <= 0x211D)) {
- return true;
- }
-
- if (uc == 0x2124
- || uc == 0x2126
- || uc == 0x2128
- || (uc >= 0x212A && uc <= 0x212D)
- || (uc >= 0x212F && uc <= 0x2131)
- || (uc >= 0x2133 && uc <= 0x2139)
- || (uc >= 0x213D && uc <= 0x213F)
- || (uc >= 0x2145 && uc <= 0x2149)
- || (uc >= 0x2160 && uc <= 0x2183)
- || (uc >= 0x2336 && uc <= 0x237A)
- || uc == 0x2395
- || (uc >= 0x249C && uc <= 0x24E9)
- || (uc >= 0x3005 && uc <= 0x3007)
- || (uc >= 0x3021 && uc <= 0x3029)
- || (uc >= 0x3031 && uc <= 0x3035)
- || (uc >= 0x3038 && uc <= 0x303C)
- || (uc >= 0x3041 && uc <= 0x3096)
- || (uc >= 0x309D && uc <= 0x309F)
- || (uc >= 0x30A1 && uc <= 0x30FA)) {
- return true;
- }
-
- if ((uc >= 0x30FC && uc <= 0x30FF)
- || (uc >= 0x3105 && uc <= 0x312C)
- || (uc >= 0x3131 && uc <= 0x318E)
- || (uc >= 0x3190 && uc <= 0x31B7)
- || (uc >= 0x31F0 && uc <= 0x321C)
- || (uc >= 0x3220 && uc <= 0x3243)) {
- return true;
- }
-
- if ((uc >= 0x3260 && uc <= 0x327B)
- || (uc >= 0x327F && uc <= 0x32B0)
- || (uc >= 0x32C0 && uc <= 0x32CB)
- || (uc >= 0x32D0 && uc <= 0x32FE)
- || (uc >= 0x3300 && uc <= 0x3376)
- || (uc >= 0x337B && uc <= 0x33DD)) {
- return true;
- }
- if ((uc >= 0x33E0 && uc <= 0x33FE)
- || (uc >= 0x3400 && uc <= 0x4DB5)
- || (uc >= 0x4E00 && uc <= 0x9FA5)
- || (uc >= 0xA000 && uc <= 0xA48C)
- || (uc >= 0xAC00 && uc <= 0xD7A3)
- || (uc >= 0xD800 && uc <= 0xFA2D)
- || (uc >= 0xFA30 && uc <= 0xFA6A)
- || (uc >= 0xFB00 && uc <= 0xFB06)
- || (uc >= 0xFB13 && uc <= 0xFB17)
- || (uc >= 0xFF21 && uc <= 0xFF3A)
- || (uc >= 0xFF41 && uc <= 0xFF5A)
- || (uc >= 0xFF66 && uc <= 0xFFBE)
- || (uc >= 0xFFC2 && uc <= 0xFFC7)
- || (uc >= 0xFFCA && uc <= 0xFFCF)
- || (uc >= 0xFFD2 && uc <= 0xFFD7)
- || (uc >= 0xFFDA && uc <= 0xFFDC)) {
- return true;
- }
-
- if ((uc >= 0x10300 && uc <= 0x1031E)
- || (uc >= 0x10320 && uc <= 0x10323)
- || (uc >= 0x10330 && uc <= 0x1034A)
- || (uc >= 0x10400 && uc <= 0x10425)
- || (uc >= 0x10428 && uc <= 0x1044D)
- || (uc >= 0x1D000 && uc <= 0x1D0F5)
- || (uc >= 0x1D100 && uc <= 0x1D126)
- || (uc >= 0x1D12A && uc <= 0x1D166)
- || (uc >= 0x1D16A && uc <= 0x1D172)
- || (uc >= 0x1D183 && uc <= 0x1D184)
- || (uc >= 0x1D18C && uc <= 0x1D1A9)
- || (uc >= 0x1D1AE && uc <= 0x1D1DD)
- || (uc >= 0x1D400 && uc <= 0x1D454)
- || (uc >= 0x1D456 && uc <= 0x1D49C)
- || (uc >= 0x1D49E && uc <= 0x1D49F)
- || uc == 0x1D4A2
- || (uc >= 0x1D4A5 && uc <= 0x1D4A6)
- || (uc >= 0x1D4A9 && uc <= 0x1D4AC)
- || (uc >= 0x1D4AE && uc <= 0x1D4B9)
- || uc == 0x1D4BB
- || (uc >= 0x1D4BD && uc <= 0x1D4C0)
- || (uc >= 0x1D4C2 && uc <= 0x1D4C3)
- || (uc >= 0x1D4C5 && uc <= 0x1D505)
- || (uc >= 0x1D507 && uc <= 0x1D50A)
- || (uc >= 0x1D50D && uc <= 0x1D514)
- || (uc >= 0x1D516 && uc <= 0x1D51C)
- || (uc >= 0x1D51E && uc <= 0x1D539)
- || (uc >= 0x1D53B && uc <= 0x1D53E)
- || (uc >= 0x1D540 && uc <= 0x1D544)
- || uc == 0x1D546
- || (uc >= 0x1D54A && uc <= 0x1D550)
- || (uc >= 0x1D552 && uc <= 0x1D6A3)
- || (uc >= 0x1D6A8 && uc <= 0x1D7C9)
- || (uc >= 0x20000 && uc <= 0x2A6D6)
- || (uc >= 0x2F800 && uc <= 0x2FA1D)
- || (uc >= 0xF0000 && uc <= 0xFFFFD)
- || (uc >= 0x100000 && uc <= 0x10FFFD)) {
+ const int len = end - begin;
+ host.clear();
+ sectionIsPresent |= Host;
+ sectionHasError &= ~Host;
+ if (len == 0)
return true;
- }
- return false;
-}
-
-#ifdef QT_BUILD_INTERNAL
-// export for tst_qurl.cpp
-Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from);
-Q_AUTOTEST_EXPORT bool qt_check_std3rules(const QChar *uc, int len);
-#else
-// non-test build, keep the symbols for ourselves
-static void qt_nameprep(QString *source, int from);
-static bool qt_check_std3rules(const QChar *uc, int len);
-#endif
-
-void qt_nameprep(QString *source, int from)
-{
- QChar *src = source->data(); // causes a detach, so we're sure the only one using it
- QChar *out = src + from;
- const QChar *e = src + source->size();
-
- for ( ; out < e; ++out) {
- register ushort uc = out->unicode();
- if (uc > 0x80) {
- break;
- } else if (uc >= 'A' && uc <= 'Z') {
- *out = QChar(uc | 0x20);
- }
- }
- if (out == e)
- return; // everything was mapped easily (lowercased, actually)
- int firstNonAscii = out - src;
-
- // Characters unassigned in Unicode 3.2 are not allowed in "stored string" scheme
- // but allowed in "query" scheme
- // (Table A.1)
- const bool isUnassignedAllowed = false; // ###
- // Characters commonly mapped to nothing are simply removed
- // (Table B.1)
- const QChar *in = out;
- for ( ; in < e; ++in) {
- uint uc = in->unicode();
- if (QChar(uc).isHighSurrogate() && in < e - 1) {
- ushort low = in[1].unicode();
- if (QChar(low).isLowSurrogate()) {
- ++in;
- uc = QChar::surrogateToUcs4(uc, low);
- }
- }
- if (!isUnassignedAllowed) {
- QChar::UnicodeVersion version = QChar::unicodeVersion(uc);
- if (version == QChar::Unicode_Unassigned || version > QChar::Unicode_3_2) {
- source->resize(from); // not allowed, clear the label
- return;
- }
- }
- if (!isMappedToNothing(uc)) {
- if (!QChar::requiresSurrogates(uc)) {
- *out++ = *in;
- } else {
- *out++ = QChar::highSurrogate(uc);
- *out++ = QChar::lowSurrogate(uc);
- }
+ if (begin[0].unicode() == '[') {
+ // IPv6Address or IPvFuture
+ // smallest IPv6 address is "[::]" (len = 4)
+ // smallest IPvFuture address is "[v7.X]" (len = 6)
+ if (end[-1].unicode() != ']') {
+ sectionHasError |= Host;
+ errorCode = HostMissingEndBracket;
+ return false;
}
- }
- if (out != in)
- source->truncate(out - src);
-
- // Map to lowercase (Table B.2)
- mapToLowerCase(source, firstNonAscii);
-
- // Normalize to Unicode 3.2 form KC
- extern void qt_string_normalize(QString *data, QString::NormalizationForm mode,
- QChar::UnicodeVersion version, int from);
- qt_string_normalize(source, QString::NormalizationForm_KC, QChar::Unicode_3_2,
- firstNonAscii > from ? firstNonAscii - 1 : from);
-
- // Strip prohibited output
- stripProhibitedOutput(source, firstNonAscii);
-
- // Check for valid bidirectional characters
- bool containsLCat = false;
- bool containsRandALCat = false;
- src = source->data();
- e = src + source->size();
- for (in = src + from; in < e && (!containsLCat || !containsRandALCat); ++in) {
- uint uc = in->unicode();
- if (QChar(uc).isHighSurrogate() && in < e - 1) {
- ushort low = in[1].unicode();
- if (QChar(low).isLowSurrogate()) {
- ++in;
- uc = QChar::surrogateToUcs4(uc, low);
+
+ if (len > 5 && begin[1].unicode() == 'v') {
+ int c = parseIpFuture(host, begin, end);
+ if (c != -1) {
+ sectionHasError |= Host;
+ errorCode = InvalidIPvFutureError;
+ errorSupplement = short(c);
}
+ return c == -1;
}
- if (isBidirectionalL(uc))
- containsLCat = true;
- else if (isBidirectionalRorAL(uc))
- containsRandALCat = true;
- }
- if (containsRandALCat) {
- if (containsLCat || (!isBidirectionalRorAL(src[from].unicode())
- || !isBidirectionalRorAL(e[-1].unicode())))
- source->resize(from); // not allowed, clear the label
- }
-}
-bool qt_check_std3rules(const QChar *uc, int len)
-{
- if (len > 63)
- return false;
-
- for (int i = 0; i < len; ++i) {
- register ushort c = uc[i].unicode();
- if (c == '-' && (i == 0 || i == len - 1))
- return false;
-
- // verifying the absence of LDH is the same as verifying that
- // only LDH is present
- if (c == '-' || (c >= '0' && c <= '9')
- || (c >= 'A' && c <= 'Z')
- || (c >= 'a' && c <= 'z')
- //underscore is not supposed to be allowed, but other browser accept it (QTBUG-7434)
- || c == '_')
- continue;
+ if (parseIp6(host, begin + 1, end - 1))
+ return true;
+ sectionHasError |= Host;
+ errorCode = begin[1].unicode() == 'v' ?
+ InvalidIPvFutureError : InvalidIPv6AddressError;
return false;
}
- return true;
-}
-
-
-static inline uint encodeDigit(uint digit)
-{
- return digit + 22 + 75 * (digit < 26);
-}
-
-static inline uint adapt(uint delta, uint numpoints, bool firsttime)
-{
- delta /= (firsttime ? damp : 2);
- delta += (delta / numpoints);
-
- uint k = 0;
- for (; delta > ((base - tmin) * tmax) / 2; k += base)
- delta /= (base - tmin);
-
- return k + (((base - tmin + 1) * delta) / (delta + skew));
-}
-
-static inline void appendEncode(QString* output, uint& delta, uint& bias, uint& b, uint& h)
-{
- uint qq;
- uint k;
- uint t;
-
- // insert the variable length delta integer; fail on
- // overflow.
- for (qq = delta, k = base;; k += base) {
- // stop generating digits when the threshold is
- // detected.
- t = (k <= bias) ? tmin : (k >= bias + tmax) ? tmax : k - bias;
- if (qq < t) break;
-
- *output += QChar(encodeDigit(t + (qq - t) % (base - t)));
- qq = (qq - t) / (base - t);
- }
-
- *output += QChar(encodeDigit(qq));
- bias = adapt(delta, h + 1, h == b);
- delta = 0;
- ++h;
-}
-
-static void toPunycodeHelper(const QChar *s, int ucLength, QString *output)
-{
- uint n = initial_n;
- uint delta = 0;
- uint bias = initial_bias;
-
- int outLen = output->length();
- output->resize(outLen + ucLength);
-
- QChar *d = output->data() + outLen;
- bool skipped = false;
- // copy all basic code points verbatim to output.
- for (uint j = 0; j < (uint) ucLength; ++j) {
- ushort js = s[j].unicode();
- if (js < 0x80)
- *d++ = js;
- else
- skipped = true;
+ // check if it's an IPv4 address
+ QIPAddressUtils::IPv4Address ip4;
+ if (QIPAddressUtils::parseIp4(ip4, begin, end)) {
+ // yes, it was
+ QIPAddressUtils::toString(host, ip4);
+ sectionHasError &= ~Host;
+ return true;
}
- // if there were only basic code points, just return them
- // directly; don't do any encoding.
- if (!skipped)
- return;
-
- output->truncate(d - output->constData());
- int copied = output->size() - outLen;
-
- // h and b now contain the number of basic code points in input.
- uint b = copied;
- uint h = copied;
-
- // if basic code points were copied, add the delimiter character.
- if (h > 0)
- *output += QChar(0x2d);
-
- // while there are still unprocessed non-basic code points left in
- // the input string...
- while (h < (uint) ucLength) {
- // find the character in the input string with the lowest
- // unicode value.
- uint m = Q_MAXINT;
- uint j;
- for (j = 0; j < (uint) ucLength; ++j) {
- if (s[j].unicode() >= n && s[j].unicode() < m)
- m = (uint) s[j].unicode();
- }
-
- // reject out-of-bounds unicode characters
- if (m - n > (Q_MAXINT - delta) / (h + 1)) {
- output->truncate(outLen);
- return; // punycode_overflow
- }
-
- delta += (m - n) * (h + 1);
- n = m;
-
- // for each code point in the input string
- for (j = 0; j < (uint) ucLength; ++j) {
-
- // increase delta until we reach the character with the
- // lowest unicode code. fail if delta overflows.
- if (s[j].unicode() < n) {
- ++delta;
- if (!delta) {
- output->truncate(outLen);
- return; // punycode_overflow
- }
- }
-
- // if j is the index of the character with the lowest
- // unicode code...
- if (s[j].unicode() == n) {
- appendEncode(output, delta, bias, b, h);
- }
+ // This is probably a reg-name.
+ // But it can also be an encoded string that, when decoded becomes one
+ // of the types above.
+ //
+ // Two types of encoding are possible:
+ // percent encoding (e.g., "%31%30%2E%30%2E%30%2E%31" -> "10.0.0.1")
+ // Unicode encoding (some non-ASCII characters case-fold to digits
+ // when nameprepping is done)
+ //
+ // The qt_ACE_do function below applies nameprepping and the STD3 check.
+ // That means a Unicode string may become an IPv4 address, but it cannot
+ // produce a '[' or a '%'.
+
+ // check for percent-encoding first
+ QString s;
+ if (maybePercentEncoded && qt_urlRecode(s, begin, end, QUrl::MostDecoded, 0)) {
+ // something was decoded
+ // anything encoded left?
+ if (s.contains(QChar(0x25))) { // '%'
+ sectionHasError |= Host;
+ errorCode = InvalidRegNameError;
+ return false;
}
- ++delta;
- ++n;
+ // recurse
+ return setHost(s, 0, s.length(), false);
}
- // prepend ACE prefix
- output->insert(outLen, QLatin1String("xn--"));
- return;
-}
-
-
-static const char * const idn_whitelist[] = {
- "ac", "ar", "at",
- "biz", "br",
- "cat", "ch", "cl", "cn",
- "de", "dk",
- "es",
- "fi",
- "gr",
- "hu",
- "info", "io", "is",
- "jp",
- "kr",
- "li", "lt",
- "museum",
- "no",
- "org",
- "se", "sh",
- "th", "tm", "tw",
- "vn",
- "xn--mgbaam7a8h", // UAE
- "xn--mgberp4a5d4ar", // Saudi Arabia
- "xn--wgbh1c" // Egypt
-};
-
-static QStringList *user_idn_whitelist = 0;
-
-static bool lessThan(const QChar *a, int l, const char *c)
-{
- const ushort *uc = (const ushort *)a;
- const ushort *e = uc + l;
-
- if (!c || *c == 0)
+ s = qt_ACE_do(QString::fromRawData(begin, len), NormalizeAce);
+ if (s.isEmpty()) {
+ sectionHasError |= Host;
+ errorCode = InvalidRegNameError;
return false;
-
- while (*c) {
- if (uc == e || *uc != *c)
- break;
- ++uc;
- ++c;
}
- return (uc == e ? *c : *uc < *c);
-}
-static bool equal(const QChar *a, int l, const char *b)
-{
- while (l && a->unicode() && *b) {
- if (*a != QLatin1Char(*b))
- return false;
- ++a;
- ++b;
- --l;
+ // check IPv4 again
+ if (QIPAddressUtils::parseIp4(ip4, s.constBegin(), s.constEnd())) {
+ QIPAddressUtils::toString(host, ip4);
+ } else {
+ host = s;
}
- return l == 0;
+ return true;
}
-static bool qt_is_idn_enabled(const QString &domain)
+void QUrlPrivate::parse(const QString &url, QUrl::ParsingMode parsingMode)
{
- int idx = domain.lastIndexOf(QLatin1Char('.'));
- if (idx == -1)
- return false;
-
- int len = domain.size() - idx - 1;
- QString tldString(domain.constData() + idx + 1, len);
- qt_nameprep(&tldString, 0);
-
- const QChar *tld = tldString.constData();
+ // URI-reference = URI / relative-ref
+ // URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
+ // relative-ref = relative-part [ "?" query ] [ "#" fragment ]
+ // hier-part = "//" authority path-abempty
+ // / other path types
+ // relative-part = "//" authority path-abempty
+ // / other path types here
- if (user_idn_whitelist)
- return user_idn_whitelist->contains(tldString);
+ sectionIsPresent = 0;
+ sectionHasError = 0;
- int l = 0;
- int r = sizeof(idn_whitelist)/sizeof(const char *) - 1;
- int i = (l + r + 1) / 2;
+ // find the important delimiters
+ int colon = -1;
+ int question = -1;
+ int hash = -1;
+ const int len = url.length();
+ const QChar *const begin = url.constData();
+ const ushort *const data = reinterpret_cast<const ushort *>(begin);
- while (r != l) {
- if (lessThan(tld, len, idn_whitelist[i]))
- r = i - 1;
- else
- l = i;
- i = (l + r + 1) / 2;
- }
- return equal(tld, len, idn_whitelist[i]);
-}
-
-static inline bool isDotDelimiter(ushort uc)
-{
- // IDNA / rfc3490 describes these four delimiters used for
- // separating labels in unicode international domain
- // names.
- return uc == 0x2e || uc == 0x3002 || uc == 0xff0e || uc == 0xff61;
-}
+ for (int i = 0; i < len; ++i) {
+ register uint uc = data[i];
+ if (uc == '#' && hash == -1) {
+ hash = i;
-static int nextDotDelimiter(const QString &domain, int from = 0)
-{
- const QChar *b = domain.unicode();
- const QChar *ch = b + from;
- const QChar *e = b + domain.length();
- while (ch < e) {
- if (isDotDelimiter(ch->unicode()))
+ // nothing more to be found
break;
- else
- ++ch;
- }
- return ch - b;
-}
-
-enum AceOperation { ToAceOnly, NormalizeAce };
-static QString qt_ACE_do(const QString &domain, AceOperation op)
-{
- if (domain.isEmpty())
- return domain;
-
- QString result;
- result.reserve(domain.length());
-
- const bool isIdnEnabled = op == NormalizeAce ? qt_is_idn_enabled(domain) : false;
- int lastIdx = 0;
- QString aceForm; // this variable is here for caching
-
- while (1) {
- int idx = nextDotDelimiter(domain, lastIdx);
- int labelLength = idx - lastIdx;
- if (labelLength == 0) {
- if (idx == domain.length())
- break;
- return QString(); // two delimiters in a row -- empty label not allowed
}
- // RFC 3490 says, about the ToASCII operation:
- // 3. If the UseSTD3ASCIIRules flag is set, then perform these checks:
- //
- // (a) Verify the absence of non-LDH ASCII code points; that is, the
- // absence of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F.
- //
- // (b) Verify the absence of leading and trailing hyphen-minus; that
- // is, the absence of U+002D at the beginning and end of the
- // sequence.
- // and:
- // 8. Verify that the number of code points is in the range 1 to 63
- // inclusive.
-
- // copy the label to the destination, which also serves as our scratch area, lowercasing it
- int prevLen = result.size();
- bool simple = true;
- result.resize(prevLen + labelLength);
- {
- QChar *out = result.data() + prevLen;
- const QChar *in = domain.constData() + lastIdx;
- const QChar *e = in + labelLength;
- for (; in < e; ++in, ++out) {
- register ushort uc = in->unicode();
- if (uc > 0x7f)
- simple = false;
- if (uc >= 'A' && uc <= 'Z')
- *out = QChar(uc | 0x20);
- else
- *out = *in;
- }
- }
-
- if (simple && labelLength > 6) {
- // ACE form domains contain only ASCII characters, but we can't consider them simple
- // is this an ACE form?
- // the shortest valid ACE domain is 6 characters long (U+0080 would be 1, but it's not allowed)
- static const ushort acePrefixUtf16[] = { 'x', 'n', '-', '-' };
- if (memcmp(result.constData() + prevLen, acePrefixUtf16, sizeof acePrefixUtf16) == 0)
- simple = false;
- }
-
- if (simple) {
- // fastest case: this is the common case (non IDN-domains)
- // so we're done
- if (!qt_check_std3rules(result.constData() + prevLen, labelLength))
- return QString();
- } else {
- // Punycode encoding and decoding cannot be done in-place
- // That means we need one or two temporaries
- qt_nameprep(&result, prevLen);
- labelLength = result.length() - prevLen;
- register int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes
- aceForm.resize(0);
- if (toReserve > aceForm.capacity())
- aceForm.reserve(toReserve);
- toPunycodeHelper(result.constData() + prevLen, result.size() - prevLen, &aceForm);
-
- // We use resize()+memcpy() here because we're overwriting the data we've copied
- if (isIdnEnabled) {
- QString tmp = QUrl::fromPunycode(aceForm.toLatin1());
- if (tmp.isEmpty())
- return QString(); // shouldn't happen, since we've just punycode-encoded it
- result.resize(prevLen + tmp.size());
- memcpy(result.data() + prevLen, tmp.constData(), tmp.size() * sizeof(QChar));
- } else {
- result.resize(prevLen + aceForm.size());
- memcpy(result.data() + prevLen, aceForm.constData(), aceForm.size() * sizeof(QChar));
- }
-
- if (!qt_check_std3rules(aceForm.constData(), aceForm.size()))
- return QString();
- }
-
-
- lastIdx = idx + 1;
- if (lastIdx < domain.size() + 1)
- result += QLatin1Char('.');
- else
- break;
- }
- return result;
-}
-
-QUrlPrivate::QUrlPrivate() : ref(1), port(-1), parsingMode(QUrl::TolerantMode),
- hasQuery(false), hasFragment(false), isValid(false), isHostValid(true),
- valueDelimiter('='), pairDelimiter('&'),
- stateFlags(0)
-{
-}
-
-QUrlPrivate::QUrlPrivate(const QUrlPrivate &copy)
- : ref(1), scheme(copy.scheme),
- userName(copy.userName),
- password(copy.password),
- host(copy.host),
- path(copy.path),
- query(copy.query),
- fragment(copy.fragment),
- encodedOriginal(copy.encodedOriginal),
- encodedUserName(copy.encodedUserName),
- encodedPassword(copy.encodedPassword),
- encodedPath(copy.encodedPath),
- encodedFragment(copy.encodedFragment),
- port(copy.port),
- parsingMode(copy.parsingMode),
- hasQuery(copy.hasQuery),
- hasFragment(copy.hasFragment),
- isValid(copy.isValid),
- isHostValid(copy.isHostValid),
- valueDelimiter(copy.valueDelimiter),
- pairDelimiter(copy.pairDelimiter),
- stateFlags(copy.stateFlags),
- encodedNormalized(copy.encodedNormalized)
-{
-}
-
-QString QUrlPrivate::canonicalHost() const
-{
- if (QURL_HASFLAG(stateFlags, HostCanonicalized) || host.isEmpty())
- return host;
-
- QUrlPrivate *that = const_cast<QUrlPrivate *>(this);
- QURL_SETFLAG(that->stateFlags, HostCanonicalized);
- if (host.contains(QLatin1Char(':'))) {
- // This is an IP Literal, use _IPLiteral to validate
- QByteArray ba = host.toLatin1();
- bool needsBraces = false;
- if (!ba.startsWith('[')) {
- // surround the IP Literal with [ ] if it's not already done so
- ba.reserve(ba.length() + 2);
- ba.prepend('[');
- ba.append(']');
- needsBraces = true;
+ if (question == -1) {
+ if (uc == ':' && colon == -1)
+ colon = i;
+ else if (uc == '?')
+ question = i;
}
-
- const char *ptr = ba.constData();
- if (!_IPLiteral(&ptr))
- that->host.clear();
- else if (needsBraces)
- that->host = QString::fromLatin1(ba.toLower());
- else
- that->host = host.toLower();
- } else {
- that->host = qt_ACE_do(host, NormalizeAce);
- }
- that->isHostValid = !that->host.isNull();
- return that->host;
-}
-
-// From RFC 3896, Appendix A Collected ABNF for URI
-// authority = [ userinfo "@" ] host [ ":" port ]
-// userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
-// host = IP-literal / IPv4address / reg-name
-// port = *DIGIT
-//[...]
-// pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
-//
-// query = *( pchar / "/" / "?" )
-//
-// fragment = *( pchar / "/" / "?" )
-//
-// pct-encoded = "%" HEXDIG HEXDIG
-//
-// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
-// reserved = gen-delims / sub-delims
-// gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
-// sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
-// / "*" / "+" / "," / ";" / "="
-
-// use defines for concatenation:
-#define ABNF_sub_delims "!$&'()*+,;="
-#define ABNF_gen_delims ":/?#[]@"
-#define ABNF_pchar ABNF_sub_delims ":@"
-#define ABNF_reserved ABNF_sub_delims ABNF_gen_delims
-
-// list the characters that don't have to be converted according to the list above.
-// "unreserved" is already automatically not encoded, so we don't have to list it.
-// the path component has a complex ABNF that basically boils down to
-// slash-separated segments of "pchar"
-
-static const char userNameExcludeChars[] = ABNF_sub_delims;
-static const char passwordExcludeChars[] = ABNF_sub_delims ":";
-static const char pathExcludeChars[] = ABNF_pchar "/";
-static const char queryExcludeChars[] = ABNF_pchar "/?";
-static const char fragmentExcludeChars[] = ABNF_pchar "/?";
-
-void QUrlPrivate::ensureEncodedParts() const
-{
- QUrlPrivate *that = const_cast<QUrlPrivate *>(this);
-
- if (encodedUserName.isNull())
- // userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
- that->encodedUserName = toPercentEncodingHelper(userName, userNameExcludeChars);
- if (encodedPassword.isNull())
- // userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
- that->encodedPassword = toPercentEncodingHelper(password, passwordExcludeChars);
- if (encodedPath.isNull())
- // pchar = unreserved / pct-encoded / sub-delims / ":" / "@" ... also "/"
- that->encodedPath = toPercentEncodingHelper(path, pathExcludeChars);
- if (encodedFragment.isNull())
- // fragment = *( pchar / "/" / "?" )
- that->encodedFragment = toPercentEncodingHelper(fragment, fragmentExcludeChars);
-}
-
-QString QUrlPrivate::authority(QUrl::FormattingOptions options) const
-{
- if ((options & QUrl::RemoveAuthority) == QUrl::RemoveAuthority)
- return QString();
-
- QString tmp = userInfo(options);
- if (!tmp.isEmpty())
- tmp += QLatin1Char('@');
- tmp += canonicalHost();
- if (!(options & QUrl::RemovePort) && port != -1)
- tmp += QLatin1Char(':') + QString::number(port);
-
- return tmp;
-}
-
-void QUrlPrivate::setAuthority(const QString &auth)
-{
- isHostValid = true;
- if (auth.isEmpty()) {
- setUserInfo(QString());
- host.clear();
- port = -1;
- return;
}
- // find the port section of the authority by searching from the
- // end towards the beginning for numbers until a ':' is reached.
- int portIndex = auth.length() - 1;
- if (portIndex == 0) {
- portIndex = -1;
+ // check if we have a scheme
+ int hierStart;
+ if (colon != -1 && setScheme(url, colon)) {
+ hierStart = colon + 1;
} else {
- short c = auth.at(portIndex--).unicode();
- if (c < '0' || c > '9') {
- portIndex = -1;
- } else while (portIndex >= 0) {
- c = auth.at(portIndex).unicode();
- if (c == ':') {
- break;
- } else if (c == '.') {
- portIndex = -1;
+ // recover from a failed scheme: it might not have been a scheme at all
+ scheme.clear();
+ sectionHasError = 0;
+ sectionIsPresent = 0;
+ hierStart = 0;
+ }
+
+ int pathStart;
+ int hierEnd = qMin<uint>(qMin<uint>(question, hash), len);
+ if (hierEnd - hierStart >= 2 && data[hierStart] == '/' && data[hierStart + 1] == '/') {
+ // we have an authority, it ends at the first slash after these
+ int authorityEnd = hierEnd;
+ for (int i = hierStart + 2; i < authorityEnd ; ++i) {
+ if (data[i] == '/') {
+ authorityEnd = i;
break;
}
- --portIndex;
}
- }
- if (portIndex != -1) {
- port = 0;
- for (int i = portIndex + 1; i < auth.length(); ++i)
- port = (port * 10) + (auth.at(i).unicode() - '0');
+ setAuthority(url, hierStart + 2, authorityEnd);
+
+ // even if we failed to set the authority properly, let's try to recover
+ pathStart = authorityEnd;
+ setPath(url, pathStart, hierEnd);
} else {
+ userName.clear();
+ password.clear();
+ host.clear();
port = -1;
- }
-
- int userInfoIndex = auth.indexOf(QLatin1Char('@'));
- if (userInfoIndex != -1 && (portIndex == -1 || userInfoIndex < portIndex))
- setUserInfo(auth.left(userInfoIndex));
-
- int hostIndex = 0;
- if (userInfoIndex != -1)
- hostIndex = userInfoIndex + 1;
- int hostLength = auth.length() - hostIndex;
- if (portIndex != -1)
- hostLength -= (auth.length() - portIndex);
-
- host = auth.mid(hostIndex, hostLength).trimmed();
-}
+ pathStart = hierStart;
-void QUrlPrivate::setUserInfo(const QString &userInfo)
-{
- encodedUserName.clear();
- encodedPassword.clear();
-
- int delimIndex = userInfo.indexOf(QLatin1Char(':'));
- if (delimIndex == -1) {
- userName = userInfo;
- password.clear();
- return;
+ if (hierStart < hierEnd)
+ setPath(url, hierStart, hierEnd);
+ else
+ path.clear();
}
- userName = userInfo.left(delimIndex);
- password = userInfo.right(userInfo.length() - delimIndex - 1);
-}
-void QUrlPrivate::setEncodedUserInfo(const QUrlParseData *parseData)
-{
- userName.clear();
- password.clear();
- if (!parseData->userInfoLength) {
- encodedUserName.clear();
- encodedPassword.clear();
- } else if (parseData->userInfoDelimIndex == -1) {
- encodedUserName = QByteArray(parseData->userInfo, parseData->userInfoLength);
- encodedPassword.clear();
- } else {
- encodedUserName = QByteArray(parseData->userInfo, parseData->userInfoDelimIndex);
- encodedPassword = QByteArray(parseData->userInfo + parseData->userInfoDelimIndex + 1,
- parseData->userInfoLength - parseData->userInfoDelimIndex - 1);
- }
-}
+ if (uint(question) < uint(hash))
+ setQuery(url, question + 1, qMin<uint>(hash, len));
-QString QUrlPrivate::userInfo(QUrl::FormattingOptions options) const
-{
- if ((options & QUrl::RemoveUserInfo) == QUrl::RemoveUserInfo)
- return QString();
+ if (hash != -1)
+ setFragment(url, hash + 1, len);
- QUrlPrivate *that = const_cast<QUrlPrivate *>(this);
- if (userName.isNull())
- that->userName = fromPercentEncodingHelper(encodedUserName);
- if (password.isNull())
- that->password = fromPercentEncodingHelper(encodedPassword);
+ if (sectionHasError || parsingMode == QUrl::TolerantMode)
+ return;
- QString tmp = userName;
+ // The parsing so far was tolerant of errors, so the StrictMode
+ // parsing is actually implemented here, as an extra post-check.
+ // We only execute it if we haven't found any errors so far.
+
+ // What we need to look out for, that the regular parser tolerates:
+ // - percent signs not followed by two hex digits
+ // - forbidden characters, which should always appear encoded
+ // '"' / '<' / '>' / '\' / '^' / '`' / '{' / '|' / '}' / BKSP
+ // control characters
+ // - delimiters not allowed in certain positions
+ // . scheme: parser is already strict
+ // . user info: gen-delims (except for ':') disallowed
+ // . host: parser is stricter than the standard
+ // . port: parser is stricter than the standard
+ // . path: all delimiters allowed
+ // . fragment: all delimiters allowed
+ // . query: all delimiters allowed
+ // We would only need to check the user-info. However, the presence
+ // of the disallowed gen-delims changes the parsing, so we don't
+ // actually need to do anything
+ static const char forbidden[] = "\"<>\\^`{|}\x7F";
+ for (uint i = 0; i < uint(len); ++i) {
+ register uint uc = data[i];
+ if (uc >= 0x80)
+ continue;
- if (!(options & QUrl::RemovePassword) && !password.isEmpty()) {
- tmp += QLatin1Char(':');
- tmp += password;
+ if ((uc == '%' && (uint(len) < i + 2 || !isHex(data[i + 1]) || !isHex(data[i + 2])))
+ || uc <= 0x20 || strchr(forbidden, uc)) {
+ // found an error
+ errorSupplement = uc;
+
+ // where are we?
+ if (i > uint(hash)) {
+ errorCode = InvalidFragmentError;
+ sectionHasError |= Fragment;
+ } else if (i > uint(question)) {
+ errorCode = InvalidQueryError;
+ sectionHasError |= Query;
+ } else if (i > uint(pathStart)) {
+ // pathStart is never -1
+ errorCode = InvalidPathError;
+ sectionHasError |= Path;
+ } else {
+ // It must be in the authority, since the scheme is strict.
+ // Since the port and hostname parsers are also strict,
+ // the error can only have happened in the user info.
+ int pos = url.indexOf(QLatin1Char(':'), hierStart);
+ if (i > uint(pos)) {
+ errorCode = InvalidPasswordError;
+ sectionHasError |= Password;
+ } else {
+ errorCode = InvalidUserNameError;
+ sectionHasError |= UserName;
+ }
+ }
+ }
}
-
- return tmp;
}
/*
@@ -3652,85 +1144,73 @@ QString QUrlPrivate::userInfo(QUrl::FormattingOptions options) const
Returns a merge of the current path with the relative path passed
as argument.
+
+ Note: \a relativePath is relative (does not start with '/').
*/
-QByteArray QUrlPrivate::mergePaths(const QByteArray &relativePath) const
+QString QUrlPrivate::mergePaths(const QString &relativePath) const
{
- if (encodedPath.isNull())
- ensureEncodedParts();
-
// If the base URI has a defined authority component and an empty
// path, then return a string consisting of "/" concatenated with
// the reference's path; otherwise,
- if (!authority().isEmpty() && encodedPath.isEmpty())
- return '/' + relativePath;
+ if (!host.isEmpty() && path.isEmpty())
+ return QLatin1Char('/') + relativePath;
// Return a string consisting of the reference's path component
// appended to all but the last segment of the base URI's path
// (i.e., excluding any characters after the right-most "/" in the
// base URI path, or excluding the entire base URI path if it does
// not contain any "/" characters).
- QByteArray newPath;
- if (!encodedPath.contains('/'))
+ QString newPath;
+ if (!path.contains(QLatin1Char('/')))
newPath = relativePath;
else
- newPath = encodedPath.left(encodedPath.lastIndexOf('/') + 1) + relativePath;
+ newPath = path.leftRef(path.lastIndexOf(QLatin1Char('/')) + 1) + relativePath;
return newPath;
}
-void QUrlPrivate::queryItem(int pos, int *value, int *end)
-{
- *end = query.indexOf(pairDelimiter, pos);
- if (*end == -1)
- *end = query.size();
- *value = pos;
- while (*value < *end) {
- if (query[*value] == valueDelimiter)
- break;
- ++*value;
- }
-}
-
/*
From http://www.ietf.org/rfc/rfc3986.txt, 5.2.4: Remove dot segments
Removes unnecessary ../ and ./ from the path. Used for normalizing
the URL.
*/
-static void removeDotsFromPath(QByteArray *path)
+static void removeDotsFromPath(QString *path)
{
// The input buffer is initialized with the now-appended path
// components and the output buffer is initialized to the empty
// string.
- char *out = path->data();
- const char *in = out;
- const char *end = out + path->size();
+ QChar *out = path->data();
+ const QChar *in = out;
+ const QChar *end = out + path->size();
// If the input buffer consists only of
// "." or "..", then remove that from the input
// buffer;
- if (path->size() == 1 && in[0] == '.')
+ if (path->size() == 1 && in[0].unicode() == '.')
++in;
- else if (path->size() == 2 && in[0] == '.' && in[1] == '.')
+ else if (path->size() == 2 && in[0].unicode() == '.' && in[1].unicode() == '.')
in += 2;
// While the input buffer is not empty, loop:
while (in < end) {
// otherwise, if the input buffer begins with a prefix of "../" or "./",
// then remove that prefix from the input buffer;
- if (path->size() >= 2 && in[0] == '.' && in[1] == '/')
+ if (path->size() >= 2 && in[0].unicode() == '.' && in[1].unicode() == '/')
in += 2;
- else if (path->size() >= 3 && in[0] == '.' && in[1] == '.' && in[2] == '/')
+ else if (path->size() >= 3 && in[0].unicode() == '.'
+ && in[1].unicode() == '.' && in[2].unicode() == '/')
in += 3;
// otherwise, if the input buffer begins with a prefix of
// "/./" or "/.", where "." is a complete path segment,
// then replace that prefix with "/" in the input buffer;
- if (in <= end - 3 && in[0] == '/' && in[1] == '.' && in[2] == '/') {
+ if (in <= end - 3 && in[0].unicode() == '/' && in[1].unicode() == '.'
+ && in[2].unicode() == '/') {
in += 2;
continue;
- } else if (in == end - 2 && in[0] == '/' && in[1] == '.') {
- *out++ = '/';
+ } else if (in == end - 2 && in[0].unicode() == '/' && in[1].unicode() == '.') {
+ *out++ = QLatin1Char('/');
in += 2;
break;
}
@@ -3740,17 +1220,19 @@ static void removeDotsFromPath(QByteArray *path)
// segment, then replace that prefix with "/" in the
// input buffer and remove the last //segment and its
// preceding "/" (if any) from the output buffer;
- if (in <= end - 4 && in[0] == '/' && in[1] == '.' && in[2] == '.' && in[3] == '/') {
- while (out > path->constData() && *(--out) != '/')
+ if (in <= end - 4 && in[0].unicode() == '/' && in[1].unicode() == '.'
+ && in[2].unicode() == '.' && in[3].unicode() == '/') {
+ while (out > path->constData() && (--out)->unicode() != '/')
;
- if (out == path->constData() && *out != '/')
+ if (out == path->constData() && out->unicode() != '/')
++in;
in += 3;
continue;
- } else if (in == end - 3 && in[0] == '/' && in[1] == '.' && in[2] == '.') {
- while (out > path->constData() && *(--out) != '/')
+ } else if (in == end - 3 && in[0].unicode() == '/' && in[1].unicode() == '.'
+ && in[2].unicode() == '.') {
+ while (out > path->constData() && (--out)->unicode() != '/')
;
- if (*out == '/')
+ if (out->unicode() == '/')
++out;
in += 3;
break;
@@ -3763,12 +1245,13 @@ static void removeDotsFromPath(QByteArray *path)
// to, but not including, the next "/"
// character or the end of the input buffer.
*out++ = *in++;
- while (in < end && *in != '/')
+ while (in < end && in->unicode() != '/')
*out++ = *in++;
}
path->truncate(out - path->constData());
}
+#if 0
void QUrlPrivate::validate() const
{
QUrlPrivate *that = (QUrlPrivate *)this;
@@ -3793,7 +1276,7 @@ void QUrlPrivate::validate() const
"port and password"),
0, 0);
}
- } else if (scheme == QLatin1String("ftp") || scheme == QLatin1String("http")) {
+ } else if (scheme == ftpScheme() || scheme == httpScheme()) {
if (host.isEmpty() && !(path.isEmpty() && encodedPath.isEmpty())) {
that->isValid = false;
that->errorInfo.setParams(0, QT_TRANSLATE_NOOP(QUrl, "the host is empty, but not the path"),
@@ -3802,234 +1285,6 @@ void QUrlPrivate::validate() const
}
}
-void QUrlPrivate::parse(ParseOptions parseOptions) const
-{
- QUrlPrivate *that = (QUrlPrivate *)this;
- that->errorInfo.setParams(0, 0, 0, 0);
- if (encodedOriginal.isEmpty()) {
- that->isValid = false;
- that->errorInfo.setParams(0, QT_TRANSLATE_NOOP(QUrl, "empty"),
- 0, 0);
- QURL_SETFLAG(that->stateFlags, Validated | Parsed);
- return;
- }
-
-
- QUrlParseData parseData;
- memset(&parseData, 0, sizeof(parseData));
- parseData.userInfoDelimIndex = -1;
- parseData.port = -1;
-
- const char *pptr = (char *) encodedOriginal.constData();
- const char **ptr = &pptr;
-
-#if defined (QURL_DEBUG)
- qDebug("QUrlPrivate::parse(), parsing \"%s\"", pptr);
-#endif
-
- // optional scheme
- bool isSchemeValid = _scheme(ptr, &parseData);
-
- if (isSchemeValid == false) {
- that->isValid = false;
- char ch = *((*ptr)++);
- that->errorInfo.setParams(*ptr, QT_TRANSLATE_NOOP(QUrl, "unexpected URL scheme"),
- 0, ch);
- QURL_SETFLAG(that->stateFlags, Validated | Parsed);
-#if defined (QURL_DEBUG)
- qDebug("QUrlPrivate::parse(), unrecognized: %c%s", ch, *ptr);
-#endif
- return;
- }
-
- // hierpart
- _hierPart(ptr, &parseData);
-
- // optional query
- char ch = *((*ptr)++);
- if (ch == '?') {
- that->hasQuery = true;
- _query(ptr, &parseData);
- ch = *((*ptr)++);
- }
-
- // optional fragment
- if (ch == '#') {
- that->hasFragment = true;
- _fragment(ptr, &parseData);
- } else if (ch != '\0') {
- that->isValid = false;
- that->errorInfo.setParams(*ptr, QT_TRANSLATE_NOOP(QUrl, "expected end of URL"),
- 0, ch);
- QURL_SETFLAG(that->stateFlags, Validated | Parsed);
-#if defined (QURL_DEBUG)
- qDebug("QUrlPrivate::parse(), unrecognized: %c%s", ch, *ptr);
-#endif
- return;
- }
-
- // when doing lazy validation, this function is called after
- // encodedOriginal has been constructed from the individual parts,
- // only to see if the constructed URL can be parsed. in that case,
- // parse() is called in ParseOnly mode; we don't want to set all
- // the members over again.
- if (parseOptions == ParseAndSet) {
- QURL_UNSETFLAG(that->stateFlags, HostCanonicalized);
-
- if (parseData.scheme) {
- QByteArray s(parseData.scheme, parseData.schemeLength);
- that->scheme = fromPercentEncodingMutable(&s).toLower();
- }
-
- that->setEncodedUserInfo(&parseData);
-
- QByteArray h(parseData.host, parseData.hostLength);
- that->host = fromPercentEncodingMutable(&h);
- that->port = parseData.port;
-
- that->path.clear();
- that->encodedPath = QByteArray(parseData.path, parseData.pathLength);
-
- if (that->hasQuery)
- that->query = QByteArray(parseData.query, parseData.queryLength);
- else
- that->query.clear();
-
- that->fragment.clear();
- if (that->hasFragment) {
- that->encodedFragment = QByteArray(parseData.fragment, parseData.fragmentLength);
- } else {
- that->encodedFragment.clear();
- }
- }
-
- that->isValid = true;
- QURL_SETFLAG(that->stateFlags, Parsed);
-
-#if defined (QURL_DEBUG)
- qDebug("QUrl::setUrl(), scheme = %s", that->scheme.toLatin1().constData());
- qDebug("QUrl::setUrl(), userInfo = %s", that->userInfo.toLatin1().constData());
- qDebug("QUrl::setUrl(), host = %s", that->host.toLatin1().constData());
- qDebug("QUrl::setUrl(), port = %i", that->port);
- qDebug("QUrl::setUrl(), path = %s", fromPercentEncodingHelper(__path).toLatin1().constData());
- qDebug("QUrl::setUrl(), query = %s", __query.constData());
- qDebug("QUrl::setUrl(), fragment = %s", fromPercentEncodingHelper(__fragment).toLatin1().constData());
-#endif
-}
-
-void QUrlPrivate::clear()
-{
- scheme.clear();
- userName.clear();
- password.clear();
- host.clear();
- port = -1;
- path.clear();
- query.clear();
- fragment.clear();
-
- encodedOriginal.clear();
- encodedUserName.clear();
- encodedPassword.clear();
- encodedPath.clear();
- encodedFragment.clear();
- encodedNormalized.clear();
-
- isValid = false;
- hasQuery = false;
- hasFragment = false;
-
- valueDelimiter = '=';
- pairDelimiter = '&';
-
- QURL_UNSETFLAG(stateFlags, Parsed | Validated | Normalized | HostCanonicalized);
-}
-
-QByteArray QUrlPrivate::toEncoded(QUrl::FormattingOptions options) const
-{
- if (!QURL_HASFLAG(stateFlags, Parsed)) parse();
- else ensureEncodedParts();
-
- if (options==0x100) // private - see qHash(QUrl)
- return normalized();
-
- QByteArray url;
-
- if (!(options & QUrl::RemoveScheme) && !scheme.isEmpty()) {
- url += scheme.toLatin1();
- url += ':';
- }
- QString savedHost = host; // pre-validation, may be invalid!
- QString auth = authority();
- bool doFileScheme = scheme == QLatin1String("file") && encodedPath.startsWith('/');
- if ((options & QUrl::RemoveAuthority) != QUrl::RemoveAuthority && (!auth.isEmpty() || doFileScheme || !savedHost.isEmpty())) {
- if (doFileScheme && !encodedPath.startsWith('/'))
- url += '/';
- url += "//";
-
- if ((options & QUrl::RemoveUserInfo) != QUrl::RemoveUserInfo) {
- bool hasUserOrPass = false;
- if (!userName.isEmpty()) {
- url += encodedUserName;
- hasUserOrPass = true;
- }
- if (!(options & QUrl::RemovePassword) && !password.isEmpty()) {
- url += ':';
- url += encodedPassword;
- hasUserOrPass = true;
- }
- if (hasUserOrPass)
- url += '@';
- }
-
- if (host.startsWith(QLatin1Char('['))) {
- url += host.toLatin1();
- } else if (host.contains(QLatin1Char(':'))) {
- url += '[';
- url += host.toLatin1();
- url += ']';
- } else if (host.isEmpty() && !savedHost.isEmpty()) {
- // this case is only possible with an invalid URL
- // it's here only so that we can keep the original, invalid hostname
- // in encodedOriginal.
- // QUrl::isValid() will return false, so toEncoded() can be anything (it's not valid)
- url += savedHost.toUtf8();
- } else {
- url += QUrl::toAce(host);
- }
- if (!(options & QUrl::RemovePort) && port != -1) {
- url += ':';
- url += QString::number(port).toAscii();
- }
- }
-
- if (!(options & QUrl::RemovePath)) {
- // check if we need to insert a slash
- if (!encodedPath.isEmpty() && !auth.isEmpty()) {
- if (!encodedPath.startsWith('/'))
- url += '/';
- }
- url += encodedPath;
-
- // check if we need to remove trailing slashes
- while ((options & QUrl::StripTrailingSlash) && url.endsWith('/'))
- url.chop(1);
- }
-
- if (!(options & QUrl::RemoveQuery) && hasQuery) {
- url += '?';
- url += query;
- }
- if (!(options & QUrl::RemoveFragment) && hasFragment) {
- url += '#';
- url += encodedFragment;
- }
-
- return url;
-}
-
-#define qToLower(ch) (((ch|32) >= 'a' && (ch|32) <= 'z') ? (ch|32) : ch)
-
const QByteArray &QUrlPrivate::normalized() const
{
if (QURL_HASFLAG(stateFlags, QUrlPrivate::Normalized))
@@ -4039,6 +1294,7 @@ const QByteArray &QUrlPrivate::normalized() const
QURL_SETFLAG(that->stateFlags, QUrlPrivate::Normalized);
QUrlPrivate tmp = *this;
+ tmp.scheme = tmp.scheme.toLower();
tmp.host = tmp.canonicalHost();
// ensure the encoded and normalized parts of the URL
@@ -4109,45 +1365,7 @@ const QByteArray &QUrlPrivate::normalized() const
return encodedNormalized;
}
-
-QString QUrlPrivate::createErrorString()
-{
- if (isValid && isHostValid)
- return QString();
-
- QString errorString(QLatin1String(QT_TRANSLATE_NOOP(QUrl, "Invalid URL \"")));
- errorString += QLatin1String(encodedOriginal.constData());
- errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, "\""));
-
- if (errorInfo._source) {
- int position = encodedOriginal.indexOf(errorInfo._source) - 1;
- if (position > 0) {
- errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, ": error at position "));
- errorString += QString::number(position);
- } else {
- errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, ": "));
- errorString += QLatin1String(errorInfo._source);
- }
- }
-
- if (errorInfo._expected) {
- errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, ": expected \'"));
- errorString += QLatin1Char(errorInfo._expected);
- errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, "\'"));
- } else {
- errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, ": "));
- if (isHostValid)
- errorString += QLatin1String(errorInfo._message);
- else
- errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, "invalid hostname"));
- }
- if (errorInfo._found) {
- errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, ", but found \'"));
- errorString += QLatin1Char(errorInfo._found);
- errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, "\'"));
- }
- return errorString;
-}
+#endif
/*!
\macro QT_NO_URL_CAST_FROM_STRING
@@ -4178,22 +1396,21 @@ QString QUrlPrivate::createErrorString()
percent encode all characters that are not allowed in a URL.
The default parsing mode is TolerantMode.
- The parsing mode \a parsingMode is used for parsing \a url.
+ Parses the \a url using the parser mode \a parsingMode.
Example:
\snippet doc/src/snippets/code/src_corelib_io_qurl.cpp 0
- \sa setUrl(), TolerantMode
+ To construct a URL from an encoded string, call fromEncoded():
+
+ \snippet doc/src/snippets/code/src_corelib_io_qurl.cpp 1
+
+ \sa setUrl(), setEncodedUrl(), fromEncoded(), TolerantMode
*/
QUrl::QUrl(const QString &url, ParsingMode parsingMode) : d(0)
{
- if (!url.isEmpty())
- setUrl(url, parsingMode);
- else {
- d = new QUrlPrivate;
- d->parsingMode = parsingMode;
- }
+ setUrl(url, parsingMode);
}
/*!
@@ -4222,7 +1439,7 @@ QUrl::~QUrl()
}
/*!
- Returns true if the URL is valid; otherwise returns false.
+ Returns true if the URL is non-empty and valid; otherwise returns false.
The URL is run through a conformance test. Every part of the URL
must conform to the standard encoding rules of the URI standard
@@ -4232,12 +1449,8 @@ QUrl::~QUrl()
*/
bool QUrl::isValid() const
{
- if (!d) return false;
-
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Validated)) d->validate();
-
- return d->isValid && d->isHostValid;
+ if (isEmpty()) return false;
+ return d->sectionHasError == 0;
}
/*!
@@ -4246,18 +1459,7 @@ bool QUrl::isValid() const
bool QUrl::isEmpty() const
{
if (!d) return true;
-
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed))
- return d->encodedOriginal.isEmpty();
- else
- return d->scheme.isEmpty() // no encodedScheme
- && d->userName.isEmpty() && d->encodedUserName.isEmpty()
- && d->password.isEmpty() && d->encodedPassword.isEmpty()
- && d->host.isEmpty() // no encodedHost
- && d->port == -1
- && d->path.isEmpty() && d->encodedPath.isEmpty()
- && d->query.isEmpty()
- && d->fragment.isEmpty() && d->encodedFragment.isEmpty();
+ return d->isEmpty();
}
/*!
@@ -4273,142 +1475,21 @@ void QUrl::clear()
}
/*!
- Constructs a URL by parsing the contents of \a url.
-
- \a url is assumed to be in unicode format, and encoded,
- such as URLs produced by url().
+ Parses \a url using the parsing mode \a parsingMode.
- The parsing mode \a parsingMode is used for parsing \a url.
+ \a url is assumed to be in unicode format, with no percent
+ encoding.
- Calling isValid() will tell whether or not a valid URL was
- constructed.
+ Calling isValid() will tell whether or not a valid URL was constructed.
\sa setEncodedUrl()
*/
void QUrl::setUrl(const QString &url, ParsingMode parsingMode)
{
detach();
-
- d->setEncodedUrl(url.toUtf8(), parsingMode);
- if (isValid() || parsingMode == StrictMode)
- return;
-
- // Tolerant preprocessing
- QString tmp = url;
-
- // Allow %20 in the QString variant
- tmp.replace(QLatin1String("%20"), QLatin1String(" "));
-
- // Percent-encode unsafe ASCII characters after host part
- int start = tmp.indexOf(QLatin1String("//"));
- if (start != -1) {
- // Has host part, find delimiter
- start += 2; // skip "//"
- const char delims[] = "/#?";
- const char *d = delims;
- int hostEnd = -1;
- while (*d && (hostEnd = tmp.indexOf(QLatin1Char(*d), start)) == -1)
- ++d;
- start = (hostEnd == -1) ? -1 : hostEnd + 1;
- } else {
- start = 0; // Has no host part
- }
- QByteArray encodedUrl;
- if (start != -1) {
- QString hostPart = tmp.left(start);
- QString otherPart = tmp.mid(start);
- encodedUrl = toPercentEncodingHelper(hostPart, ":/?#[]@!$&'()*+,;=")
- + toPercentEncodingHelper(otherPart, ":/?#@!$&'()*+,;=");
- } else {
- encodedUrl = toPercentEncodingHelper(tmp, ABNF_reserved);
- }
- d->setEncodedUrl(encodedUrl, StrictMode);
-}
-
-inline static bool isHex(char c)
-{
- c |= 0x20;
- return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
-}
-
-static inline char toHex(quint8 c)
-{
- return c > 9 ? c - 10 + 'A' : c + '0';
+ d->parse(url, parsingMode);
}
-/*!
- \fn void QUrl::setEncodedUrl(const QByteArray &encodedUrl, ParsingMode parsingMode)
- Constructs a URL by parsing the contents of \a encodedUrl.
-
- \a encodedUrl is assumed to be a URL string in percent encoded
- form, containing only ASCII characters.
-
- The parsing mode \a parsingMode is used for parsing \a encodedUrl.
-
- \obsolete Use setUrl(QString::fromUtf8(encodedUrl), parsingMode)
-
- \sa setUrl()
-*/
-
-
-void QUrlPrivate::setEncodedUrl(const QByteArray &encodedUrl, QUrl::ParsingMode mode)
-{
- QByteArray tmp = encodedUrl;
- clear();
- parsingMode = mode;
- if (parsingMode == QUrl::TolerantMode) {
- // Replace stray % with %25
- QByteArray copy = tmp;
- for (int i = 0, j = 0; i < copy.size(); ++i, ++j) {
- if (copy.at(i) == '%') {
- if (i + 2 >= copy.size() || !isHex(copy.at(i + 1)) || !isHex(copy.at(i + 2))) {
- tmp.replace(j, 1, "%25");
- j += 2;
- }
- }
- }
-
- // Find the host part
- int hostStart = tmp.indexOf("//");
- int hostEnd = -1;
- if (hostStart != -1) {
- // Has host part, find delimiter
- hostStart += 2; // skip "//"
- hostEnd = tmp.indexOf('/', hostStart);
- if (hostEnd == -1)
- hostEnd = tmp.indexOf('#', hostStart);
- if (hostEnd == -1)
- hostEnd = tmp.indexOf('?');
- if (hostEnd == -1)
- hostEnd = tmp.length() - 1;
- }
-
- // Reserved and unreserved characters are fine
-// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
-// reserved = gen-delims / sub-delims
-// gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
-// sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
-// / "*" / "+" / "," / ";" / "="
- // Replace everything else with percent encoding
- static const char doEncode[] = " \"<>[\\]^`{|}";
- static const char doEncodeHost[] = " \"<>\\^`{|}";
- for (int i = 0; i < tmp.size(); ++i) {
- quint8 c = quint8(tmp.at(i));
- if (c < 32 || c > 127 ||
- strchr(hostStart <= i && i <= hostEnd ? doEncodeHost : doEncode, c)) {
- char buf[4];
- buf[0] = '%';
- buf[1] = toHex(c >> 4);
- buf[2] = toHex(c & 0xf);
- buf[3] = '\0';
- tmp.replace(i, 1, buf);
- i += 2;
- }
- }
- }
-
- encodedOriginal = tmp;
-}
/*!
Sets the scheme of the URL to \a scheme. As a scheme can only
@@ -4429,26 +1510,26 @@ void QUrlPrivate::setEncodedUrl(const QByteArray &encodedUrl, QUrl::ParsingMode
*/
void QUrl::setScheme(const QString &scheme)
{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
-
- d->scheme = scheme.toLower();
+ if (scheme.isEmpty()) {
+ // schemes are not allowed to be empty
+ d->sectionIsPresent &= ~QUrlPrivate::Scheme;
+ d->sectionHasError &= ~QUrlPrivate::Scheme;
+ d->scheme.clear();
+ } else {
+ d->setScheme(scheme, scheme.length());
+ }
}
/*!
Returns the scheme of the URL. If an empty string is returned,
this means the scheme is undefined and the URL is then relative.
- The returned scheme is always lowercase, for convenience.
-
\sa setScheme(), isRelative()
*/
QString QUrl::scheme() const
{
if (!d) return QString();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
return d->scheme;
}
@@ -4471,12 +1552,13 @@ QString QUrl::scheme() const
*/
void QUrl::setAuthority(const QString &authority)
{
- if (!d) d = new QUrlPrivate;
-
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized | QUrlPrivate::HostCanonicalized);
- d->setAuthority(authority);
+ d->setAuthority(authority, 0, authority.length());
+ if (authority.isNull()) {
+ // QUrlPrivate::setAuthority cleared almost everything
+ // but it leaves the Host bit set
+ d->sectionIsPresent &= ~QUrlPrivate::Authority;
+ }
}
/*!
@@ -4485,13 +1567,13 @@ void QUrl::setAuthority(const QString &authority)
\sa setAuthority()
*/
-QString QUrl::authority() const
+QString QUrl::authority(ComponentFormattingOptions options) const
{
if (!d) return QString();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- return d->authority();
+ QString result;
+ d->appendAuthority(result, options, QUrlPrivate::Authority);
+ return result;
}
/*!
@@ -4509,26 +1591,27 @@ QString QUrl::authority() const
*/
void QUrl::setUserInfo(const QString &userInfo)
{
- if (!d) d = new QUrlPrivate;
-
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
-
- d->setUserInfo(userInfo.trimmed());
+ QString trimmed = userInfo.trimmed();
+ d->setUserInfo(trimmed, 0, trimmed.length());
+ if (userInfo.isNull()) {
+ // QUrlPrivate::setUserInfo cleared almost everything
+ // but it leaves the UserName bit set
+ d->sectionIsPresent &= ~QUrlPrivate::UserInfo;
+ }
}
/*!
Returns the user info of the URL, or an empty string if the user
info is undefined.
*/
-QString QUrl::userInfo() const
+QString QUrl::userInfo(ComponentFormattingOptions options) const
{
if (!d) return QString();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- return d->userInfo();
+ QString result;
+ d->appendUserInfo(result, options, QUrlPrivate::UserInfo);
+ return result;
}
/*!
@@ -4540,14 +1623,10 @@ QString QUrl::userInfo() const
*/
void QUrl::setUserName(const QString &userName)
{
- if (!d) d = new QUrlPrivate;
-
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
-
- d->userName = userName;
- d->encodedUserName.clear();
+ d->setUserName(userName, 0, userName.length());
+ if (userName.isNull())
+ d->sectionIsPresent &= ~QUrlPrivate::UserName;
}
/*!
@@ -4556,57 +1635,13 @@ void QUrl::setUserName(const QString &userName)
\sa setUserName(), encodedUserName()
*/
-QString QUrl::userName() const
+QString QUrl::userName(ComponentFormattingOptions options) const
{
if (!d) return QString();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- d->userInfo(); // causes the unencoded form to be set
- return d->userName;
-}
-
-/*!
- \since 4.4
-
- Sets the URL's user name to the percent-encoded \a userName. The \a
- userName is part of the user info element in the authority of the
- URL, as described in setUserInfo().
-
- Note: this function does not verify that \a userName is properly
- encoded. It is the caller's responsibility to ensure that the any
- delimiters (such as colons or slashes) are properly encoded.
-
- \sa setUserName(), encodedUserName(), setUserInfo()
-*/
-void QUrl::setEncodedUserName(const QByteArray &userName)
-{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
-
- d->encodedUserName = userName;
- d->userName.clear();
-}
-
-/*!
- \since 4.4
-
- Returns the user name of the URL if it is defined; otherwise
- an empty string is returned. The returned value will have its
- non-ASCII and other control characters percent-encoded, as in
- toEncoded().
-
- \sa setEncodedUserName()
-*/
-QByteArray QUrl::encodedUserName() const
-{
- if (!d) return QByteArray();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- d->ensureEncodedParts();
- return d->encodedUserName;
+ QString result;
+ d->appendUserName(result, options);
+ return result;
}
/*!
@@ -4618,13 +1653,10 @@ QByteArray QUrl::encodedUserName() const
*/
void QUrl::setPassword(const QString &password)
{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
-
- d->password = password;
- d->encodedPassword.clear();
+ d->setPassword(password, 0, password.length());
+ if (password.isNull())
+ d->sectionIsPresent &= ~QUrlPrivate::Password;
}
/*!
@@ -4633,56 +1665,13 @@ void QUrl::setPassword(const QString &password)
\sa setPassword()
*/
-QString QUrl::password() const
+QString QUrl::password(ComponentFormattingOptions options) const
{
if (!d) return QString();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- d->userInfo(); // causes the unencoded form to be set
- return d->password;
-}
-
-/*!
- \since 4.4
-
- Sets the URL's password to the percent-encoded \a password. The \a
- password is part of the user info element in the authority of the
- URL, as described in setUserInfo().
-
- Note: this function does not verify that \a password is properly
- encoded. It is the caller's responsibility to ensure that the any
- delimiters (such as colons or slashes) are properly encoded.
-
- \sa setPassword(), encodedPassword(), setUserInfo()
-*/
-void QUrl::setEncodedPassword(const QByteArray &password)
-{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
-
- d->encodedPassword = password;
- d->password.clear();
-}
-/*!
- \since 4.4
-
- Returns the password of the URL if it is defined; otherwise an
- empty string is returned. The returned value will have its
- non-ASCII and other control characters percent-encoded, as in
- toEncoded().
-
- \sa setEncodedPassword(), toEncoded()
-*/
-QByteArray QUrl::encodedPassword() const
-{
- if (!d) return QByteArray();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- d->ensureEncodedParts();
- return d->encodedPassword;
+ QString result;
+ d->appendPassword(result, options);
+ return result;
}
/*!
@@ -4693,64 +1682,37 @@ QByteArray QUrl::encodedPassword() const
*/
void QUrl::setHost(const QString &host)
{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
- d->isHostValid = true;
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized | QUrlPrivate::HostCanonicalized);
-
- d->host = host;
+ if (d->setHost(host, 0, host.length())) {
+ if (host.isNull())
+ d->sectionIsPresent &= ~QUrlPrivate::Host;
+ } else if (!host.startsWith(QLatin1Char('['))) {
+ // setHost failed, it might be IPv6 or IPvFuture in need of bracketing
+ ushort oldCode = d->errorCode;
+ ushort oldSupplement = d->errorSupplement;
+ if (!d->setHost(QLatin1Char('[') + host + QLatin1Char(']'), 0, host.length() + 2)) {
+ // failed again: choose if this was an IPv6 error or not
+ if (!host.contains(QLatin1Char(':'))) {
+ d->errorCode = oldCode;
+ d->errorSupplement = oldSupplement;
+ }
+ }
+ }
}
/*!
Returns the host of the URL if it is defined; otherwise
an empty string is returned.
*/
-QString QUrl::host() const
+QString QUrl::host(ComponentFormattingOptions options) const
{
if (!d) return QString();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- if (d->host.isEmpty() || d->host.at(0) != QLatin1Char('['))
- return d->canonicalHost();
- QString tmp = d->host.mid(1);
- tmp.truncate(tmp.length() - 1);
- return tmp;
-}
-
-/*!
- \since 4.4
-
- Sets the URL's host to the ACE- or percent-encoded \a host. The \a
- host is part of the user info element in the authority of the
- URL, as described in setAuthority().
- \sa setHost(), encodedHost(), setAuthority(), fromAce()
-*/
-void QUrl::setEncodedHost(const QByteArray &host)
-{
- setHost(fromPercentEncodingHelper(host));
-}
-
-/*!
- \since 4.4
-
- Returns the host part of the URL if it is defined; otherwise
- an empty string is returned.
-
- Note: encodedHost() does not return percent-encoded hostnames. Instead,
- the ACE-encoded (bare ASCII in Punycode encoding) form will be
- returned for any non-ASCII hostname.
-
- This function is equivalent to calling QUrl::toAce() on the return
- value of host().
-
- \sa setEncodedHost()
-*/
-QByteArray QUrl::encodedHost() const
-{
- // should we cache this in d->encodedHost?
- return QUrl::toAce(host());
+ QString result;
+ d->appendHost(result, options);
+ if (result.startsWith(QLatin1Char('[')))
+ return result.mid(1, result.length() - 2);
+ return result;
}
/*!
@@ -4762,14 +1724,15 @@ QByteArray QUrl::encodedHost() const
*/
void QUrl::setPort(int port)
{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
if (port < -1 || port > 65535) {
qWarning("QUrl::setPort: Out of range");
port = -1;
+ d->sectionHasError |= QUrlPrivate::Port;
+ d->errorCode = QUrlPrivate::InvalidPortError;
+ } else {
+ d->sectionHasError &= ~QUrlPrivate::Port;
}
d->port = port;
@@ -4788,7 +1751,6 @@ void QUrl::setPort(int port)
int QUrl::port(int defaultPort) const
{
if (!d) return defaultPort;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
return d->port == -1 ? defaultPort : d->port;
}
@@ -4807,13 +1769,12 @@ int QUrl::port(int defaultPort) const
*/
void QUrl::setPath(const QString &path)
{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
+ d->setPath(path, 0, path.length());
- d->path = path;
- d->encodedPath.clear();
+ // optimized out, since there is no path delimiter
+// if (path.isNull())
+// d->sectionIsPresent &= ~QUrlPrivate::Path;
}
/*!
@@ -4821,66 +1782,13 @@ void QUrl::setPath(const QString &path)
\sa setPath()
*/
-QString QUrl::path() const
+QString QUrl::path(ComponentFormattingOptions options) const
{
if (!d) return QString();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- if (d->path.isNull()) {
- QUrlPrivate *that = const_cast<QUrlPrivate *>(d);
- that->path = fromPercentEncodingHelper(d->encodedPath);
- }
- return d->path;
-}
-/*!
- \since 4.4
-
- Sets the URL's path to the percent-encoded \a path. The path is
- the part of the URL that comes after the authority but before the
- query string.
-
- \img qurl-ftppath.png
-
- For non-hierarchical schemes, the path will be everything
- following the scheme declaration, as in the following example:
-
- \img qurl-mailtopath.png
-
- Note: this function does not verify that \a path is properly
- encoded. It is the caller's responsibility to ensure that the any
- delimiters (such as '?' and '#') are properly encoded.
-
- \sa setPath(), encodedPath(), setUserInfo()
-*/
-void QUrl::setEncodedPath(const QByteArray &path)
-{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
-
- d->encodedPath = path;
- d->path.clear();
-}
-
-/*!
- \since 4.4
-
- Returns the path of the URL if it is defined; otherwise an
- empty string is returned. The returned value will have its
- non-ASCII and other control characters percent-encoded, as in
- toEncoded().
-
- \sa setEncodedPath(), toEncoded()
-*/
-QByteArray QUrl::encodedPath() const
-{
- if (!d) return QByteArray();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- d->ensureEncodedParts();
- return d->encodedPath;
+ QString result;
+ d->appendPath(result, options, QUrlPrivate::Path);
+ return result;
}
/*!
@@ -4893,60 +1801,7 @@ QByteArray QUrl::encodedPath() const
bool QUrl::hasQuery() const
{
if (!d) return false;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- return d->hasQuery;
-}
-
-/*!
- Sets the characters used for delimiting between keys and values,
- and between key-value pairs in the URL's query string. The default
- value delimiter is '=' and the default pair delimiter is '&'.
-
- \img qurl-querystring.png
-
- \a valueDelimiter will be used for separating keys from values,
- and \a pairDelimiter will be used to separate key-value pairs.
- Any occurrences of these delimiting characters in the encoded
- representation of the keys and values of the query string are
- percent encoded.
-
- If \a valueDelimiter is set to '-' and \a pairDelimiter is '/',
- the above query string would instead be represented like this:
-
- \snippet doc/src/snippets/code/src_corelib_io_qurl.cpp 4
-
- Calling this function does not change the delimiters of the
- current query string. It only affects queryItems(),
- setQueryItems() and addQueryItems().
-*/
-void QUrl::setQueryDelimiters(char valueDelimiter, char pairDelimiter)
-{
- if (!d) d = new QUrlPrivate;
- detach();
-
- d->valueDelimiter = valueDelimiter;
- d->pairDelimiter = pairDelimiter;
-}
-
-/*!
- Returns the character used to delimit between key-value pairs in
- the query string of the URL.
-*/
-char QUrl::queryPairDelimiter() const
-{
- if (!d) return '&';
- return d->pairDelimiter;
-}
-
-/*!
- Returns the character used to delimit between keys and values in
- the query string of the URL.
-*/
-char QUrl::queryValueDelimiter() const
-{
- if (!d) return '=';
- return d->valueDelimiter;
+ return d->hasQuery();
}
/*!
@@ -4966,482 +1821,39 @@ char QUrl::queryValueDelimiter() const
\sa encodedQuery(), hasQuery()
*/
-void QUrl::setEncodedQuery(const QByteArray &query)
+void QUrl::setQuery(const QString &query)
{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
- d->query = query;
- d->hasQuery = !query.isNull();
+ d->setQuery(query, 0, query.length());
+ if (query.isNull())
+ d->sectionIsPresent &= ~QUrlPrivate::Query;
}
-/*!
- Sets the query string of the URL to an encoded version of \a
- query. The contents of \a query are converted to a string
- internally, each pair delimited by the character returned by
- pairDelimiter(), and the key and value are delimited by
- valueDelimiter().
-
- \note This method does not encode spaces (ASCII 0x20) as plus (+) signs,
- like HTML forms do. If you need that kind of encoding, you must encode
- the value yourself and use QUrl::setEncodedQueryItems.
-
- \sa setQueryDelimiters(), queryItems(), setEncodedQueryItems()
-*/
-void QUrl::setQueryItems(const QList<QPair<QString, QString> > &query)
+void QUrl::setQuery(const QUrlQuery &query)
{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
- char alsoEncode[3];
- alsoEncode[0] = d->valueDelimiter;
- alsoEncode[1] = d->pairDelimiter;
- alsoEncode[2] = 0;
-
- QByteArray queryTmp;
- for (int i = 0; i < query.size(); i++) {
- if (i) queryTmp += d->pairDelimiter;
- // query = *( pchar / "/" / "?" )
- queryTmp += toPercentEncodingHelper(query.at(i).first, queryExcludeChars, alsoEncode);
- queryTmp += d->valueDelimiter;
- // query = *( pchar / "/" / "?" )
- queryTmp += toPercentEncodingHelper(query.at(i).second, queryExcludeChars, alsoEncode);
- }
-
- d->query = queryTmp;
- d->hasQuery = !query.isEmpty();
-}
-
-/*!
- \since 4.4
-
- Sets the query string of the URL to the encoded version of \a
- query. The contents of \a query are converted to a string
- internally, each pair delimited by the character returned by
- pairDelimiter(), and the key and value are delimited by
- valueDelimiter().
-
- Note: this function does not verify that the key-value pairs
- are properly encoded. It is the caller's responsibility to ensure
- that the query delimiters are properly encoded, if any.
-
- \sa setQueryDelimiters(), encodedQueryItems(), setQueryItems()
-*/
-void QUrl::setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray> > &query)
-{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- detach();
-
- QByteArray queryTmp;
- for (int i = 0; i < query.size(); i++) {
- if (i) queryTmp += d->pairDelimiter;
- queryTmp += query.at(i).first;
- queryTmp += d->valueDelimiter;
- queryTmp += query.at(i).second;
- }
-
- d->query = queryTmp;
- d->hasQuery = !query.isEmpty();
-}
-
-/*!
- Inserts the pair \a key = \a value into the query string of the
- URL.
-
- The key/value pair is encoded before it is added to the query. The
- pair is converted into separate strings internally. The \a key and
- \a value is first encoded into UTF-8 and then delimited by the
- character returned by valueDelimiter(). Each key/value pair is
- delimited by the character returned by pairDelimiter().
-
- \note This method does not encode spaces (ASCII 0x20) as plus (+) signs,
- like HTML forms do. If you need that kind of encoding, you must encode
- the value yourself and use QUrl::addEncodedQueryItem.
-
- \sa addEncodedQueryItem()
-*/
-void QUrl::addQueryItem(const QString &key, const QString &value)
-{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- detach();
-
- char alsoEncode[3];
- alsoEncode[0] = d->valueDelimiter;
- alsoEncode[1] = d->pairDelimiter;
- alsoEncode[2] = 0;
-
- if (!d->query.isEmpty())
- d->query += d->pairDelimiter;
-
- // query = *( pchar / "/" / "?" )
- d->query += toPercentEncodingHelper(key, queryExcludeChars, alsoEncode);
- d->query += d->valueDelimiter;
- // query = *( pchar / "/" / "?" )
- d->query += toPercentEncodingHelper(value, queryExcludeChars, alsoEncode);
-
- d->hasQuery = !d->query.isEmpty();
-}
-
-/*!
- \since 4.4
-
- Inserts the pair \a key = \a value into the query string of the
- URL.
-
- Note: this function does not verify that either \a key or \a value
- are properly encoded. It is the caller's responsibility to ensure
- that the query delimiters are properly encoded, if any.
-
- \sa addQueryItem(), setQueryDelimiters()
-*/
-void QUrl::addEncodedQueryItem(const QByteArray &key, const QByteArray &value)
-{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- detach();
-
- if (!d->query.isEmpty())
- d->query += d->pairDelimiter;
-
- d->query += key;
- d->query += d->valueDelimiter;
- d->query += value;
-
- d->hasQuery = !d->query.isEmpty();
-}
-
-/*!
- Returns the query string of the URL, as a map of keys and values.
-
- \note This method does not decode spaces plus (+) signs as spaces (ASCII
- 0x20), like HTML forms do. If you need that kind of decoding, you must
- use QUrl::encodedQueryItems and decode the data yourself.
-
- \sa setQueryItems(), setEncodedQuery()
-*/
-QList<QPair<QString, QString> > QUrl::queryItems() const
-{
- if (!d) return QList<QPair<QString, QString> >();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- QList<QPair<QString, QString> > itemMap;
-
- int pos = 0;
- const char *query = d->query.constData();
- while (pos < d->query.size()) {
- int valuedelim, end;
- d->queryItem(pos, &valuedelim, &end);
- QByteArray q(query + pos, valuedelim - pos);
- if (valuedelim < end) {
- QByteArray v(query + valuedelim + 1, end - valuedelim - 1);
- itemMap += qMakePair(fromPercentEncodingMutable(&q),
- fromPercentEncodingMutable(&v));
- } else {
- itemMap += qMakePair(fromPercentEncodingMutable(&q), QString());
- }
- pos = end + 1;
- }
-
- return itemMap;
-}
-
-/*!
- \since 4.4
-
- Returns the query string of the URL, as a map of encoded keys and values.
-
- \sa setEncodedQueryItems(), setQueryItems(), setEncodedQuery()
-*/
-QList<QPair<QByteArray, QByteArray> > QUrl::encodedQueryItems() const
-{
- if (!d) return QList<QPair<QByteArray, QByteArray> >();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- QList<QPair<QByteArray, QByteArray> > itemMap;
-
- int pos = 0;
- const char *query = d->query.constData();
- while (pos < d->query.size()) {
- int valuedelim, end;
- d->queryItem(pos, &valuedelim, &end);
- if (valuedelim < end)
- itemMap += qMakePair(QByteArray(query + pos, valuedelim - pos),
- QByteArray(query + valuedelim + 1, end - valuedelim - 1));
- else
- itemMap += qMakePair(QByteArray(query + pos, valuedelim - pos), QByteArray());
- pos = end + 1;
- }
-
- return itemMap;
-}
-
-/*!
- Returns true if there is a query string pair whose key is equal
- to \a key from the URL.
-
- \sa hasEncodedQueryItem()
-*/
-bool QUrl::hasQueryItem(const QString &key) const
-{
- if (!d) return false;
- return hasEncodedQueryItem(toPercentEncoding(key, queryExcludeChars));
-}
-
-/*!
- \since 4.4
-
- Returns true if there is a query string pair whose key is equal
- to \a key from the URL.
-
- Note: if the encoded \a key does not match the encoded version of
- the query, this function will return false. That is, if the
- encoded query of this URL is "search=Qt%20Rules", calling this
- function with \a key = "%73earch" will return false.
-
- \sa hasQueryItem()
-*/
-bool QUrl::hasEncodedQueryItem(const QByteArray &key) const
-{
- if (!d) return false;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- int pos = 0;
- const char *query = d->query.constData();
- while (pos < d->query.size()) {
- int valuedelim, end;
- d->queryItem(pos, &valuedelim, &end);
- if (key == QByteArray::fromRawData(query + pos, valuedelim - pos))
- return true;
- pos = end + 1;
- }
- return false;
-}
-
-/*!
- Returns the first query string value whose key is equal to \a key
- from the URL.
-
- \note This method does not decode spaces plus (+) signs as spaces (ASCII
- 0x20), like HTML forms do. If you need that kind of decoding, you must
- use QUrl::encodedQueryItemValue and decode the data yourself.
-
- \sa allQueryItemValues()
-*/
-QString QUrl::queryItemValue(const QString &key) const
-{
- if (!d) return QString();
- QByteArray tmp = encodedQueryItemValue(toPercentEncoding(key, queryExcludeChars));
- return fromPercentEncodingMutable(&tmp);
-}
-
-/*!
- \since 4.4
-
- Returns the first query string value whose key is equal to \a key
- from the URL.
-
- Note: if the encoded \a key does not match the encoded version of
- the query, this function will not work. That is, if the
- encoded query of this URL is "search=Qt%20Rules", calling this
- function with \a key = "%73earch" will return an empty string.
-
- \sa queryItemValue(), allQueryItemValues()
-*/
-QByteArray QUrl::encodedQueryItemValue(const QByteArray &key) const
-{
- if (!d) return QByteArray();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- int pos = 0;
- const char *query = d->query.constData();
- while (pos < d->query.size()) {
- int valuedelim, end;
- d->queryItem(pos, &valuedelim, &end);
- if (key == QByteArray::fromRawData(query + pos, valuedelim - pos))
- return valuedelim < end ?
- QByteArray(query + valuedelim + 1, end - valuedelim - 1) : QByteArray();
- pos = end + 1;
- }
- return QByteArray();
-}
-
-/*!
- Returns the a list of query string values whose key is equal to
- \a key from the URL.
-
- \note This method does not decode spaces plus (+) signs as spaces (ASCII
- 0x20), like HTML forms do. If you need that kind of decoding, you must
- use QUrl::allEncodedQueryItemValues and decode the data yourself.
-
- \sa queryItemValue()
-*/
-QStringList QUrl::allQueryItemValues(const QString &key) const
-{
- if (!d) return QStringList();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- QByteArray encodedKey = toPercentEncoding(key, queryExcludeChars);
- QStringList values;
-
- int pos = 0;
- const char *query = d->query.constData();
- while (pos < d->query.size()) {
- int valuedelim, end;
- d->queryItem(pos, &valuedelim, &end);
- if (encodedKey == QByteArray::fromRawData(query + pos, valuedelim - pos)) {
- QByteArray v(query + valuedelim + 1, end - valuedelim - 1);
- values += valuedelim < end ?
- fromPercentEncodingMutable(&v)
- : QString();
- }
- pos = end + 1;
- }
-
- return values;
-}
-
-/*!
- \since 4.4
-
- Returns the a list of query string values whose key is equal to
- \a key from the URL.
-
- Note: if the encoded \a key does not match the encoded version of
- the query, this function will not work. That is, if the
- encoded query of this URL is "search=Qt%20Rules", calling this
- function with \a key = "%73earch" will return an empty list.
-
- \sa allQueryItemValues(), queryItemValue(), encodedQueryItemValue()
-*/
-QList<QByteArray> QUrl::allEncodedQueryItemValues(const QByteArray &key) const
-{
- if (!d) return QList<QByteArray>();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- QList<QByteArray> values;
-
- int pos = 0;
- const char *query = d->query.constData();
- while (pos < d->query.size()) {
- int valuedelim, end;
- d->queryItem(pos, &valuedelim, &end);
- if (key == QByteArray::fromRawData(query + pos, valuedelim - pos))
- values += valuedelim < end ?
- QByteArray(query + valuedelim + 1, end - valuedelim - 1)
- : QByteArray();
- pos = end + 1;
- }
-
- return values;
-}
-
-/*!
- Removes the first query string pair whose key is equal to \a key
- from the URL.
-
- \sa removeAllQueryItems()
-*/
-void QUrl::removeQueryItem(const QString &key)
-{
- if (!d) return;
- removeEncodedQueryItem(toPercentEncoding(key, queryExcludeChars));
-}
-
-/*!
- \since 4.4
-
- Removes the first query string pair whose key is equal to \a key
- from the URL.
-
- Note: if the encoded \a key does not match the encoded version of
- the query, this function will not work. That is, if the
- encoded query of this URL is "search=Qt%20Rules", calling this
- function with \a key = "%73earch" will do nothing.
-
- \sa removeQueryItem(), removeAllQueryItems()
-*/
-void QUrl::removeEncodedQueryItem(const QByteArray &key)
-{
- if (!d) return;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- detach();
-
- int pos = 0;
- const char *query = d->query.constData();
- while (pos < d->query.size()) {
- int valuedelim, end;
- d->queryItem(pos, &valuedelim, &end);
- if (key == QByteArray::fromRawData(query + pos, valuedelim - pos)) {
- if (end < d->query.size())
- ++end; // remove additional '%'
- d->query.remove(pos, end - pos);
- return;
- }
- pos = end + 1;
- }
-}
-
-/*!
- Removes all the query string pairs whose key is equal to \a key
- from the URL.
-
- \sa removeQueryItem()
-*/
-void QUrl::removeAllQueryItems(const QString &key)
-{
- if (!d) return;
- removeAllEncodedQueryItems(toPercentEncoding(key, queryExcludeChars));
-}
-
-/*!
- \since 4.4
-
- Removes all the query string pairs whose key is equal to \a key
- from the URL.
-
- Note: if the encoded \a key does not match the encoded version of
- the query, this function will not work. That is, if the
- encoded query of this URL is "search=Qt%20Rules", calling this
- function with \a key = "%73earch" will do nothing.
-
- \sa removeQueryItem()
-*/
-void QUrl::removeAllEncodedQueryItems(const QByteArray &key)
-{
- if (!d) return;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- detach();
-
- int pos = 0;
- const char *query = d->query.constData();
- while (pos < d->query.size()) {
- int valuedelim, end;
- d->queryItem(pos, &valuedelim, &end);
- if (key == QByteArray::fromRawData(query + pos, valuedelim - pos)) {
- if (end < d->query.size())
- ++end; // remove additional '%'
- d->query.remove(pos, end - pos);
- query = d->query.constData(); //required if remove detach;
- } else {
- pos = end + 1;
- }
- }
+ // we know the data is in the right format
+ d->query = query.toString();
+ if (query.isEmpty())
+ d->sectionIsPresent &= ~QUrlPrivate::Query;
+ else
+ d->sectionIsPresent |= QUrlPrivate::Query;
}
/*!
Returns the query string of the URL in percent encoded form.
*/
-QByteArray QUrl::encodedQuery() const
+QString QUrl::query(ComponentFormattingOptions options) const
{
- if (!d) return QByteArray();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+ if (!d) return QString();
- return d->query;
+ QString result;
+ d->appendQuery(result, options, QUrlPrivate::Query);
+ if (d->hasQuery() && result.isNull())
+ result.detach();
+ return result;
}
/*!
@@ -5463,14 +1875,11 @@ QByteArray QUrl::encodedQuery() const
*/
void QUrl::setFragment(const QString &fragment)
{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
- d->fragment = fragment;
- d->hasFragment = !fragment.isNull();
- d->encodedFragment.clear();
+ d->setFragment(fragment, 0, fragment.length());
+ if (fragment.isNull())
+ d->sectionIsPresent &= ~QUrlPrivate::Fragment;
}
/*!
@@ -5478,66 +1887,15 @@ void QUrl::setFragment(const QString &fragment)
\sa setFragment()
*/
-QString QUrl::fragment() const
+QString QUrl::fragment(ComponentFormattingOptions options) const
{
if (!d) return QString();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- if (d->fragment.isNull() && !d->encodedFragment.isNull()) {
- QUrlPrivate *that = const_cast<QUrlPrivate *>(d);
- that->fragment = fromPercentEncodingHelper(d->encodedFragment);
- }
- return d->fragment;
-}
-
-/*!
- \since 4.4
-
- Sets the URL's fragment to the percent-encoded \a fragment. The fragment is the
- last part of the URL, represented by a '#' followed by a string of
- characters. It is typically used in HTTP for referring to a
- certain link or point on a page:
-
- \img qurl-fragment.png
-
- The fragment is sometimes also referred to as the URL "reference".
-
- Passing an argument of QByteArray() (a null QByteArray) will unset
- the fragment. Passing an argument of QByteArray("") (an empty but
- not null QByteArray) will set the fragment to an empty string (as
- if the original URL had a lone "#").
- \sa setFragment(), encodedFragment()
-*/
-void QUrl::setEncodedFragment(const QByteArray &fragment)
-{
- if (!d) d = new QUrlPrivate;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
-
- d->encodedFragment = fragment;
- d->hasFragment = !fragment.isNull();
- d->fragment.clear();
-}
-
-/*!
- \since 4.4
-
- Returns the fragment of the URL if it is defined; otherwise an
- empty string is returned. The returned value will have its
- non-ASCII and other control characters percent-encoded, as in
- toEncoded().
-
- \sa setEncodedFragment(), toEncoded()
-*/
-QByteArray QUrl::encodedFragment() const
-{
- if (!d) return QByteArray();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- d->ensureEncodedParts();
- return d->encodedFragment;
+ QString result;
+ d->appendFragment(result, options);
+ if (d->hasFragment() && result.isNull())
+ result.detach();
+ return result;
}
/*!
@@ -5550,9 +1908,7 @@ QByteArray QUrl::encodedFragment() const
bool QUrl::hasFragment() const
{
if (!d) return false;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- return d->hasFragment;
+ return d->hasFragment();
}
/*!
@@ -5563,12 +1919,14 @@ bool QUrl::hasFragment() const
URL does not contain a valid TLD, in which case the function returns
an empty string.
*/
-#ifndef QT_BOOTSTRAPPED
-QString QUrl::topLevelDomain() const
+QString QUrl::topLevelDomain(ComponentFormattingOptions options) const
{
- return qTopLevelDomain(host());
+ QString tld = qTopLevelDomain(host());
+ if (options & EncodeUnicode) {
+ return qt_ACE_do(tld, ToAceOnly);
+ }
+ return tld;
}
-#endif
/*!
Returns the result of the merge of this URL with \a relative. This
@@ -5593,48 +1951,62 @@ QUrl QUrl::resolved(const QUrl &relative) const
{
if (!d) return relative;
if (!relative.d) return *this;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- if (!QURL_HASFLAG(relative.d->stateFlags, QUrlPrivate::Parsed))
- relative.d->parse();
-
- d->ensureEncodedParts();
- relative.d->ensureEncodedParts();
QUrl t;
// be non strict and allow scheme in relative url
if (!relative.d->scheme.isEmpty() && relative.d->scheme != d->scheme) {
t = relative;
} else {
- if (!relative.authority().isEmpty()) {
+ if (relative.d->hasAuthority()) {
t = relative;
} else {
t.d = new QUrlPrivate;
- if (relative.d->encodedPath.isEmpty()) {
- t.d->encodedPath = d->encodedPath;
- t.setEncodedQuery(relative.d->hasQuery ? relative.d->query : d->query);
- } else {
- t.d->encodedPath = relative.d->encodedPath.at(0) == '/'
- ? relative.d->encodedPath
- : d->mergePaths(relative.d->encodedPath);
- t.setEncodedQuery(relative.d->query);
- }
- t.d->encodedUserName = d->encodedUserName;
- t.d->encodedPassword = d->encodedPassword;
+
+ // copy the authority
+ t.d->userName = d->userName;
+ t.d->password = d->password;
t.d->host = d->host;
t.d->port = d->port;
+ t.d->sectionIsPresent = d->sectionIsPresent & QUrlPrivate::Authority;
+
+ if (relative.d->path.isEmpty()) {
+ t.d->path = d->path;
+ if (relative.d->hasQuery()) {
+ t.d->query = relative.d->query;
+ t.d->sectionIsPresent |= QUrlPrivate::Query;
+ } else if (d->hasQuery()) {
+ t.d->query = d->query;
+ t.d->sectionIsPresent |= QUrlPrivate::Query;
+ }
+ } else {
+ t.d->path = relative.d->path.startsWith(QLatin1Char('/'))
+ ? relative.d->path
+ : d->mergePaths(relative.d->path);
+ if (relative.d->hasQuery()) {
+ t.d->query = relative.d->query;
+ t.d->sectionIsPresent |= QUrlPrivate::Query;
+ }
+ }
}
- t.setScheme(d->scheme);
+ t.d->scheme = d->scheme;
+ if (d->hasScheme())
+ t.d->sectionIsPresent |= QUrlPrivate::Scheme;
+ else
+ t.d->sectionIsPresent &= ~QUrlPrivate::Scheme;
}
- t.setFragment(relative.fragment());
- removeDotsFromPath(&t.d->encodedPath);
- t.d->path.clear();
+ t.d->fragment = relative.d->fragment;
+ if (relative.d->hasFragment())
+ t.d->sectionIsPresent |= QUrlPrivate::Fragment;
+ else
+ t.d->sectionIsPresent &= ~QUrlPrivate::Fragment;
+
+ removeDotsFromPath(&t.d->path);
#if defined(QURL_DEBUG)
qDebug("QUrl(\"%s\").resolved(\"%s\") = \"%s\"",
- toEncoded().constData(),
- relative.toEncoded().constData(),
- t.toEncoded().constData());
+ qPrintable(url()),
+ qPrintable(relative.url()),
+ qPrintable(t.url()));
#endif
return t;
}
@@ -5647,35 +2019,7 @@ QUrl QUrl::resolved(const QUrl &relative) const
bool QUrl::isRelative() const
{
if (!d) return true;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
- return d->scheme.isEmpty();
-}
-
-// Encodes only what really needs to be encoded.
-// \a input must be decoded.
-static QString toPrettyPercentEncoding(const QString &input, bool forFragment)
-{
- const int len = input.length();
- QString result;
- result.reserve(len);
- for (int i = 0; i < len; ++i) {
- const QChar c = input.at(i);
- register ushort u = c.unicode();
- if (u < 0x20
- || (!forFragment && u == '?') // don't escape '?' in fragments
- || u == '#' || u == '%'
- || (u == ' ' && (i+1 == len|| input.at(i+1).unicode() == ' '))) {
- static const char hexdigits[] = "0123456789ABCDEF";
- result += QLatin1Char('%');
- result += QLatin1Char(hexdigits[(u & 0xf0) >> 4]);
- result += QLatin1Char(hexdigits[u & 0xf]);
- } else {
- result += c;
- }
- }
-
- return result;
+ return !d->hasScheme() && !d->path.startsWith(QLatin1Char('/'));
}
/*!
@@ -5684,77 +2028,92 @@ static QString toPrettyPercentEncoding(const QString &input, bool forFragment)
The resulting QString can be passed back to a QUrl later on.
- Synonym for url(options).
+ Synonym for toString(options).
- \sa FormattingOptions, toEncoded(), url()
+ \sa FormattingOptions, toEncoded(), toString()
+*/
+QString QUrl::url(FormattingOptions options) const
+{
+ return toString(options);
+}
+
+/*!
+ Returns a string representation of the URL.
+ The output can be customized by passing flags with \a options.
+
+ \sa FormattingOptions, url(), setUrl()
*/
QString QUrl::toString(FormattingOptions options) const
{
if (!d) return QString();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
+
+ // return just the path if:
+ // - QUrl::PreferLocalFile is passed
+ // - QUrl::RemovePath isn't passed (rather stupid if the user did...)
+ // - there's no query or fragment to return
+ // that is, either they aren't present, or we're removing them
+ // - it's a local file
+ // (test done last since it's the most expensive)
+ if (options.testFlag(QUrl::PreferLocalFile) && !options.testFlag(QUrl::RemovePath)
+ && (!d->hasQuery() || options.testFlag(QUrl::RemoveQuery))
+ && (!d->hasFragment() || options.testFlag(QUrl::RemoveFragment))
+ && isLocalFile()) {
+ return path(options);
+ }
QString url;
- if (!(options & QUrl::RemoveScheme) && !d->scheme.isEmpty())
+ // for the full URL, we consider that the reserved characters are prettier if encoded
+ if (options & DecodeReserved)
+ options &= ~EncodeReserved;
+ else
+ options |= EncodeReserved;
+
+ if (!(options & QUrl::RemoveScheme) && d->hasScheme())
url += d->scheme + QLatin1Char(':');
- QString ourPath = path();
- if ((options & QUrl::RemoveAuthority) != QUrl::RemoveAuthority) {
- bool doFileScheme = d->scheme == QLatin1String("file") && ourPath.startsWith(QLatin1Char('/'));
- QString tmp = d->authority(options);
- if (!tmp.isNull() || doFileScheme) {
- if (doFileScheme && !ourPath.startsWith(QLatin1Char('/')))
- url += QLatin1Char('/');
- url += QLatin1String("//");
- url += tmp;
- }
+
+ bool pathIsAbsolute = d->path.startsWith(QLatin1Char('/'));
+ if (!((options & QUrl::RemoveAuthority) == QUrl::RemoveAuthority) && d->hasAuthority()) {
+ url += QLatin1String("//");
+ d->appendAuthority(url, options, QUrlPrivate::FullUrl);
+ } else if (isLocalFile() && pathIsAbsolute) {
+ url += QLatin1String("//");
}
+
if (!(options & QUrl::RemovePath)) {
// check if we need to insert a slash
- if ((options & QUrl::RemoveAuthority) != QUrl::RemoveAuthority
- && !d->authority(options).isEmpty() && !ourPath.isEmpty() && ourPath.at(0) != QLatin1Char('/'))
+ if (!pathIsAbsolute && !d->path.isEmpty() && !url.isEmpty() && !url.endsWith(QLatin1Char(':')))
url += QLatin1Char('/');
- url += toPrettyPercentEncoding(ourPath, false);
+
+ d->appendPath(url, options, QUrlPrivate::FullUrl);
// check if we need to remove trailing slashes
while ((options & StripTrailingSlash) && url.endsWith(QLatin1Char('/')))
url.chop(1);
}
- if (!(options & QUrl::RemoveQuery) && d->hasQuery) {
+ if (!(options & QUrl::RemoveQuery) && d->hasQuery()) {
url += QLatin1Char('?');
- // query is already encoded, but possibly more than necessary.
- url += toPrettyPercentEncoding(fromPercentEncoding(d->query), true);
+ d->appendQuery(url, options, QUrlPrivate::FullUrl);
}
- if (!(options & QUrl::RemoveFragment) && d->hasFragment) {
+ if (!(options & QUrl::RemoveFragment) && d->hasFragment()) {
url += QLatin1Char('#');
- url += fragment();
+ d->appendFragment(url, options);
}
return url;
}
/*!
- Returns a string representation of the URL.
- The output can be customized by passing flags with \a options.
-
- The resulting QString can be passed back to a QUrl later on.
-
- Synonym for toString(options).
-
- \sa FormattingOptions, toEncoded(), toString()
-*/
-QString QUrl::url(FormattingOptions options) const
-{
- return toString(options);
-}
+ \since 5.0
-/*!
Returns a human-displayable string representation of the URL.
The output can be customized by passing flags with \a options.
The option RemovePassword is always enabled, since passwords
should never be shown back to users.
- The resulting QString can be passed back to a QUrl later on,
- but any password that was present initially will be lost.
+ With the default options, the resulting QString can be passed back
+ to a QUrl later on, but any password that was present initially will
+ be lost.
\sa FormattingOptions, toEncoded(), toString()
*/
@@ -5775,23 +2134,25 @@ QString QUrl::toDisplayString(FormattingOptions options) const
*/
QByteArray QUrl::toEncoded(FormattingOptions options) const
{
- if (!d) return QByteArray();
- return d->toEncoded(options);
+ options &= ~DecodeReserved;
+ QString stringForm = toString(options | FullyEncoded);
+ return stringForm.toLatin1();
}
/*!
\fn QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode parsingMode)
- \obsolete
Parses \a input and returns the corresponding QUrl. \a input is
assumed to be in encoded form, containing only ASCII characters.
- The URL is parsed using \a parsingMode.
-
- Use QUrl(QString::fromUtf8(input), parsingMode) instead.
+ Parses the URL using \a parsingMode.
\sa toEncoded(), setUrl()
*/
+QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode)
+{
+ return QUrl(QString::fromUtf8(input.constData(), input.size()), mode);
+}
/*!
Returns a decoded copy of \a input. \a input is first decoded from
@@ -5799,7 +2160,7 @@ QByteArray QUrl::toEncoded(FormattingOptions options) const
*/
QString QUrl::fromPercentEncoding(const QByteArray &input)
{
- return fromPercentEncodingHelper(input);
+ return QString::fromUtf8(QByteArray::fromPercentEncoding(input));
}
/*!
@@ -5816,10 +2177,11 @@ QString QUrl::fromPercentEncoding(const QByteArray &input)
*/
QByteArray QUrl::toPercentEncoding(const QString &input, const QByteArray &exclude, const QByteArray &include)
{
- return toPercentEncodingHelper(input, exclude.constData(), include.constData());
+ return input.toUtf8().toPercentEncoding(exclude, include);
}
/*!
+ \fn QByteArray QUrl::toPunycode(const QString &uc)
\obsolete
Returns a \a uc in Punycode encoding.
@@ -5827,14 +2189,9 @@ QByteArray QUrl::toPercentEncoding(const QString &input, const QByteArray &exclu
names, as defined in RFC3492. If you want to convert a domain name from
Unicode to its ASCII-compatible representation, use toAce().
*/
-QByteArray QUrl::toPunycode(const QString &uc)
-{
- QString output;
- toPunycodeHelper(uc.constData(), uc.size(), &output);
- return output.toLatin1();
-}
/*!
+ \fn QString QUrl::fromPunycode(const QByteArray &pc)
\obsolete
Returns the Punycode decoded representation of \a pc.
@@ -5843,76 +2200,6 @@ QByteArray QUrl::toPunycode(const QString &uc)
its ASCII-compatible encoding to the Unicode representation, use
fromAce().
*/
-QString QUrl::fromPunycode(const QByteArray &pc)
-{
- uint n = initial_n;
- uint i = 0;
- uint bias = initial_bias;
-
- // strip any ACE prefix
- int start = pc.startsWith("xn--") ? 4 : 0;
- if (!start)
- return QString::fromLatin1(pc);
-
- // find the last delimiter character '-' in the input array. copy
- // all data before this delimiter directly to the output array.
- int delimiterPos = pc.lastIndexOf(0x2d);
- QString output = delimiterPos < 4 ?
- QString() : QString::fromLatin1(pc.constData() + start, delimiterPos - start);
-
- // if a delimiter was found, skip to the position after it;
- // otherwise start at the front of the input string. everything
- // before the delimiter is assumed to be basic code points.
- uint cnt = delimiterPos + 1;
-
- // loop through the rest of the input string, inserting non-basic
- // characters into output as we go.
- while (cnt < (uint) pc.size()) {
- uint oldi = i;
- uint w = 1;
-
- // find the next index for inserting a non-basic character.
- for (uint k = base; cnt < (uint) pc.size(); k += base) {
- // grab a character from the punycode input and find its
- // delta digit (each digit code is part of the
- // variable-length integer delta)
- uint digit = pc.at(cnt++);
- if (digit - 48 < 10) digit -= 22;
- else if (digit - 65 < 26) digit -= 65;
- else if (digit - 97 < 26) digit -= 97;
- else digit = base;
-
- // reject out of range digits
- if (digit >= base || digit > (Q_MAXINT - i) / w)
- return QLatin1String("");
-
- i += (digit * w);
-
- // detect threshold to stop reading delta digits
- uint t;
- if (k <= bias) t = tmin;
- else if (k >= bias + tmax) t = tmax;
- else t = k - bias;
- if (digit < t) break;
-
- w *= (base - t);
- }
-
- // find new bias and calculate the next non-basic code
- // character.
- bias = adapt(i - oldi, output.length() + 1, oldi == 0);
- n += i / (output.length() + 1);
-
- // allow the deltas to wrap around
- i %= (output.length() + 1);
-
- // insert the character n at position i
- output.insert((uint) i, QChar((ushort) n));
- ++i;
- }
-
- return output;
-}
/*!
\since 4.2
@@ -5958,64 +2245,51 @@ QByteArray QUrl::toAce(const QString &domain)
}
/*!
- \since 4.2
-
- Returns the current whitelist of top-level domains that are allowed
- to have non-ASCII characters in their compositions.
+ \internal
- See setIdnWhitelist() for the rationale of this list.
+ Returns true if this URL is "less than" the given \a url. This
+ provides a means of ordering URLs.
*/
-QStringList QUrl::idnWhitelist()
+bool QUrl::operator <(const QUrl &url) const
{
- if (user_idn_whitelist)
- return *user_idn_whitelist;
- QStringList list;
- unsigned int i = 0;
- while (i < sizeof(idn_whitelist)/sizeof(const char *)) {
- list << QLatin1String(idn_whitelist[i]);
- ++i;
+ if (!d || !url.d) {
+ bool thisIsEmpty = !d || d->isEmpty();
+ bool thatIsEmpty = !url.d || url.d->isEmpty();
+
+ // sort an empty URL first
+ return thisIsEmpty && !thatIsEmpty;
}
- return list;
-}
-/*!
- \since 4.2
+ int cmp;
+ cmp = d->scheme.compare(url.d->scheme);
+ if (cmp != 0)
+ return cmp < 0;
- Sets the whitelist of Top-Level Domains (TLDs) that are allowed to have
- non-ASCII characters in domains to the value of \a list.
+ cmp = d->userName.compare(url.d->userName);
+ if (cmp != 0)
+ return cmp < 0;
- Qt has comes a default list that contains the Internet top-level domains
- that have published support for Internationalized Domain Names (IDNs)
- and rules to guarantee that no deception can happen between similarly-looking
- characters (such as the Latin lowercase letter \c 'a' and the Cyrillic
- equivalent, which in most fonts are visually identical).
+ cmp = d->password.compare(url.d->password);
+ if (cmp != 0)
+ return cmp < 0;
- This list is periodically maintained, as registrars publish new rules.
+ cmp = d->host.compare(url.d->host);
+ if (cmp != 0)
+ return cmp < 0;
- This function is provided for those who need to manipulate the list, in
- order to add or remove a TLD. It is not recommended to change its value
- for purposes other than testing, as it may expose users to security risks.
-*/
-void QUrl::setIdnWhitelist(const QStringList &list)
-{
- if (!user_idn_whitelist)
- user_idn_whitelist = new QStringList;
- *user_idn_whitelist = list;
-}
+ if (d->port != url.d->port)
+ return d->port < url.d->port;
-/*!
- \internal
+ cmp = d->path.compare(url.d->path);
+ if (cmp != 0)
+ return cmp < 0;
- Returns true if this URL is "less than" the given \a url. This
- provides a means of ordering URLs.
-*/
-bool QUrl::operator <(const QUrl &url) const
-{
- if (!d) return url.d ? QByteArray() < url.d->normalized() : false;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- if (!url.d) return d->normalized() < QByteArray();
- if (!QURL_HASFLAG(url.d->stateFlags, QUrlPrivate::Parsed)) url.d->parse();
- return d->normalized() < url.d->normalized();
+ cmp = d->query.compare(url.d->query);
+ if (cmp != 0)
+ return cmp < 0;
+
+ cmp = d->fragment.compare(url.d->fragment);
+ return cmp < 0;
}
/*!
@@ -6024,11 +2298,20 @@ bool QUrl::operator <(const QUrl &url) const
*/
bool QUrl::operator ==(const QUrl &url) const
{
- if (!d) return url.isEmpty();
- if (!url.d) return isEmpty();
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- if (!QURL_HASFLAG(url.d->stateFlags, QUrlPrivate::Parsed)) url.d->parse();
- return d->normalized() == url.d->normalized();
+ if (!d && !url.d)
+ return true;
+ if (!d)
+ return url.d->isEmpty();
+ if (!url.d)
+ return d->isEmpty();
+ return d->scheme == url.d->scheme &&
+ d->userName == url.d->userName &&
+ d->password == url.d->password &&
+ d->host == url.d->host &&
+ d->port == url.d->port &&
+ d->path == url.d->path &&
+ d->query == url.d->query &&
+ d->fragment == url.d->fragment;
}
/*!
@@ -6067,9 +2350,8 @@ QUrl &QUrl::operator =(const QString &url)
if (url.isEmpty()) {
clear();
} else {
- QUrl tmp(url);
- if (!d) d = new QUrlPrivate;
- qAtomicAssign(d, tmp.d);
+ detach();
+ d->parse(url, TolerantMode);
}
return *this;
}
@@ -6118,22 +2400,23 @@ bool QUrl::isDetached() const
QUrl QUrl::fromLocalFile(const QString &localFile)
{
QUrl url;
- url.setScheme(QLatin1String("file"));
+ url.setScheme(fileScheme());
QString deslashified = QDir::fromNativeSeparators(localFile);
// magic for drives on windows
if (deslashified.length() > 1 && deslashified.at(1) == QLatin1Char(':') && deslashified.at(0) != QLatin1Char('/')) {
- url.setPath(QLatin1Char('/') + deslashified);
- // magic for shared drive on windows
+ deslashified.prepend(QLatin1Char('/'));
} else if (deslashified.startsWith(QLatin1String("//"))) {
+ // magic for shared drive on windows
int indexOfPath = deslashified.indexOf(QLatin1Char('/'), 2);
url.setHost(deslashified.mid(2, indexOfPath - 2));
if (indexOfPath > 2)
- url.setPath(deslashified.right(deslashified.length() - indexOfPath));
- } else {
- url.setPath(deslashified);
+ deslashified = deslashified.right(deslashified.length() - indexOfPath);
+ else
+ deslashified.clear();
}
+ url.setPath(deslashified.replace(QLatin1Char('%'), QStringLiteral("%25")));
return url;
}
@@ -6159,7 +2442,7 @@ QString QUrl::toLocalFile() const
// magic for shared drive on windows
if (!d->host.isEmpty()) {
- tmp = QLatin1String("//") + d->host + (ourPath.length() > 0 && ourPath.at(0) != QLatin1Char('/')
+ tmp = QStringLiteral("//") + d->host + (ourPath.length() > 0 && ourPath.at(0) != QLatin1Char('/')
? QLatin1Char('/') + ourPath : ourPath);
} else {
tmp = ourPath;
@@ -6185,9 +2468,8 @@ QString QUrl::toLocalFile() const
bool QUrl::isLocalFile() const
{
if (!d) return false;
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
- if (d->scheme.compare(QLatin1String("file"), Qt::CaseInsensitive) != 0)
+ if (d->scheme != fileScheme())
return false; // not file
return true;
}
@@ -6206,12 +2488,10 @@ bool QUrl::isParentOf(const QUrl &childUrl) const
&& (childUrl.authority().isEmpty())
&& childPath.length() > 0 && childPath.at(0) == QLatin1Char('/'));
- if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
-
QString ourPath = path();
return ((childUrl.scheme().isEmpty() || d->scheme == childUrl.scheme())
- && (childUrl.authority().isEmpty() || d->authority() == childUrl.authority())
+ && (childUrl.authority().isEmpty() || authority() == childUrl.authority())
&& childPath.startsWith(ourPath)
&& ((ourPath.endsWith(QLatin1Char('/')) && childPath.length() > ourPath.length())
|| (!ourPath.endsWith(QLatin1Char('/'))
@@ -6229,7 +2509,7 @@ bool QUrl::isParentOf(const QUrl &childUrl) const
*/
QDataStream &operator<<(QDataStream &out, const QUrl &url)
{
- QByteArray u = url.toEncoded();
+ QByteArray u = url.toString(QUrl::FullyEncoded).toLatin1();
out << u;
return out;
}
@@ -6245,7 +2525,7 @@ QDataStream &operator>>(QDataStream &in, QUrl &url)
{
QByteArray u;
in >> u;
- url = QUrl(QString::fromUtf8(u));
+ url.setUrl(QString::fromLatin1(u));
return in;
}
#endif // QT_NO_DATASTREAM
@@ -6267,8 +2547,69 @@ QDebug operator<<(QDebug d, const QUrl &url)
QString QUrl::errorString() const
{
if (!d)
- return QLatin1String(QT_TRANSLATE_NOOP(QUrl, "Invalid URL \"\": ")); // XXX not a good message, but the one an empty URL produces
- return d->createErrorString();
+ return QString();
+
+ if (d->sectionHasError == 0)
+ return QString();
+
+ // check if the error code matches a section with error
+ if ((d->sectionHasError & (d->errorCode >> 8)) == 0)
+ return QString();
+
+ QChar c = d->errorSupplement;
+ switch (QUrlPrivate::ErrorCode(d->errorCode)) {
+ case QUrlPrivate::NoError:
+ return QString();
+
+ case QUrlPrivate::InvalidSchemeError: {
+ QString msg = QStringLiteral("Invalid scheme (character '%1' not permitted)");
+ return msg.arg(c);
+ }
+ case QUrlPrivate::SchemeEmptyError:
+ return QStringLiteral("Empty scheme");
+
+ case QUrlPrivate::InvalidUserNameError:
+ return QString(QStringLiteral("Invalid user name (character '%1' not permitted)"))
+ .arg(c);
+
+ case QUrlPrivate::InvalidPasswordError:
+ return QString(QStringLiteral("Invalid password (character '%1' not permitted)"))
+ .arg(c);
+
+ case QUrlPrivate::InvalidRegNameError:
+ if (d->errorSupplement)
+ return QString(QStringLiteral("Invalid hostname (character '%1' not permitted)"))
+ .arg(c);
+ else
+ return QStringLiteral("Hostname contains invalid characters");
+ case QUrlPrivate::InvalidIPv4AddressError:
+ return QString(); // doesn't happen yet
+ case QUrlPrivate::InvalidIPv6AddressError:
+ return QStringLiteral("Invalid IPv6 address");
+ case QUrlPrivate::InvalidIPvFutureError:
+ return QStringLiteral("Invalid IPvFuture address");
+ case QUrlPrivate::HostMissingEndBracket:
+ return QStringLiteral("Expected ']' to match '[' in hostname");
+
+ case QUrlPrivate::InvalidPortError:
+ case QUrlPrivate::PortEmptyError:
+ return QStringLiteral("Invalid port or port number out of range");
+
+ case QUrlPrivate::InvalidPathError:
+ return QString(QStringLiteral("Invalid path (character '%1' not permitted)"))
+ .arg(c);
+ case QUrlPrivate::PathContainsColonBeforeSlash:
+ return QStringLiteral("Path component contains ':' before any '/'");
+
+ case QUrlPrivate::InvalidQueryError:
+ return QString(QStringLiteral("Invalid query (character '%1' not permitted)"))
+ .arg(c);
+
+ case QUrlPrivate::InvalidFragmentError:
+ return QString(QStringLiteral("Invalid fragment (character '%1' not permitted)"))
+ .arg(c);
+ }
+ return QStringLiteral("<unknown error>");
}
/*!
@@ -6281,6 +2622,38 @@ QString QUrl::errorString() const
\internal
*/
+/*! \fn uint qHash(const QUrl &url, uint seed = 0)
+ \relates QHash
+ \since 5.0
+
+ Returns the hash value for the \a url.
+*/
+uint qHash(const QUrl &url, uint seed)
+{
+ if (!url.d)
+ return qHash(-1, seed); // the hash of an unset port (-1)
+
+ return qHash(url.d->scheme) ^
+ qHash(url.d->userName) ^
+ qHash(url.d->password) ^
+ qHash(url.d->host) ^
+ qHash(url.d->port, seed) ^
+ qHash(url.d->path) ^
+ qHash(url.d->query) ^
+ qHash(url.d->fragment);
+}
+
+static QUrl adjustFtpPath(QUrl url)
+{
+ if (url.scheme() == ftpScheme()) {
+ QString path = url.path();
+ if (path.startsWith(QLatin1String("//")))
+ url.setPath(QLatin1String("/%2F") + path.midRef(2));
+ }
+ return url;
+}
+
+
// The following code has the following copyright:
/*
Copyright (C) Research In Motion Limited 2009. All rights reserved.
@@ -6349,8 +2722,8 @@ QUrl QUrl::fromUserInput(const QString &userInput)
if (QDir::isAbsolutePath(trimmedString))
return QUrl::fromLocalFile(trimmedString);
- QUrl url(trimmedString, QUrl::TolerantMode);
- QUrl urlPrepended(QString::fromLatin1("http://") + trimmedString, QUrl::TolerantMode);
+ QUrl url = QUrl(trimmedString, QUrl::TolerantMode);
+ QUrl urlPrepended = QUrl(QStringLiteral("http://") + trimmedString, QUrl::TolerantMode);
// Check the most common case of a valid url with scheme and host
// We check if the port would be valid by adding the scheme to handle the case host:port
@@ -6359,16 +2732,16 @@ QUrl QUrl::fromUserInput(const QString &userInput)
&& !url.scheme().isEmpty()
&& (!url.host().isEmpty() || !url.path().isEmpty())
&& urlPrepended.port() == -1)
- return url;
+ return adjustFtpPath(url);
// Else, try the prepended one and adjust the scheme from the host name
if (urlPrepended.isValid() && (!urlPrepended.host().isEmpty() || !urlPrepended.path().isEmpty()))
{
int dotIndex = trimmedString.indexOf(QLatin1Char('.'));
const QString hostscheme = trimmedString.left(dotIndex).toLower();
- if (hostscheme == QLatin1String("ftp"))
- urlPrepended.setScheme(QLatin1String("ftp"));
- return urlPrepended;
+ if (hostscheme == ftpScheme())
+ urlPrepended.setScheme(ftpScheme());
+ return adjustFtpPath(urlPrepended);
}
return QUrl();
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index 3e5c62cd7c..7c6e47c73f 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Intel Corporation.
** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -44,18 +45,74 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qobjectdefs.h>
-#include <QtCore/qpair.h>
#include <QtCore/qstring.h>
-#include <QtCore/qhash.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qpair.h>
+#include <QtCore/qglobal.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+class QUrlQuery;
class QUrlPrivate;
class QDataStream;
+template <typename E1, typename E2>
+class QUrlTwoFlags
+{
+ int i;
+ typedef int QUrlTwoFlags:: *Zero;
+public:
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags(E1 f) : i(f) {}
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags(E2 f) : i(f) {}
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags(QFlag f) : i(f) {}
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags(QFlags<E1> f) : i(f.operator int()) {}
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags(QFlags<E2> f) : i(f.operator int()) {}
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags(Zero = 0) : i(0) {}
+
+ inline QUrlTwoFlags &operator&=(int mask) { i &= mask; return *this; }
+ inline QUrlTwoFlags &operator&=(uint mask) { i &= mask; return *this; }
+ inline QUrlTwoFlags &operator|=(QUrlTwoFlags f) { i |= f.i; return *this; }
+ inline QUrlTwoFlags &operator|=(E1 f) { i |= f; return *this; }
+ inline QUrlTwoFlags &operator|=(E2 f) { i |= f; return *this; }
+ inline QUrlTwoFlags &operator^=(QUrlTwoFlags f) { i ^= f.i; return *this; }
+ inline QUrlTwoFlags &operator^=(E1 f) { i ^= f; return *this; }
+ inline QUrlTwoFlags &operator^=(E2 f) { i ^= f; return *this; }
+
+ Q_DECL_CONSTEXPR inline operator QFlags<E1>() const { return E1(i); }
+ Q_DECL_CONSTEXPR inline operator QFlags<E2>() const { return E2(i); }
+ Q_DECL_CONSTEXPR inline operator int() const { return i; }
+ Q_DECL_CONSTEXPR inline bool operator!() const { return !i; }
+
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(QUrlTwoFlags f) const
+ { return QUrlTwoFlags(E1(i | f.i)); }
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(E1 f) const
+ { return QUrlTwoFlags(E1(i | f)); }
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(E2 f) const
+ { return QUrlTwoFlags(E2(i | f)); }
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(QUrlTwoFlags f) const
+ { return QUrlTwoFlags(E1(i ^ f.i)); }
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(E1 f) const
+ { return QUrlTwoFlags(E1(i ^ f)); }
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(E2 f) const
+ { return QUrlTwoFlags(E2(i ^ f)); }
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(int mask) const
+ { return QUrlTwoFlags(E1(i & mask)); }
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(uint mask) const
+ { return QUrlTwoFlags(E1(i & mask)); }
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(E1 f) const
+ { return QUrlTwoFlags(E1(i & f)); }
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(E2 f) const
+ { return QUrlTwoFlags(E2(i & f)); }
+ Q_DECL_CONSTEXPR inline QUrlTwoFlags operator~() const
+ { return QUrlTwoFlags(E1(~i)); }
+
+ inline bool testFlag(E1 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
+ inline bool testFlag(E2 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
+};
+
class Q_CORE_EXPORT QUrl
{
public:
@@ -65,7 +122,7 @@ public:
};
// encoding / toString values
- enum FormattingOption {
+ enum UrlFormattingOption {
None = 0x0,
RemoveScheme = 0x1,
RemovePassword = 0x2,
@@ -75,23 +132,41 @@ public:
RemovePath = 0x20,
RemoveQuery = 0x40,
RemoveFragment = 0x80,
- // 0x100: private: normalized
+ // 0x100 was a private code in Qt 4, keep unused for a while
+ PreferLocalFile = 0x200,
+ StripTrailingSlash = 0x400
+ };
- StripTrailingSlash = 0x10000
+ enum ComponentFormattingOption {
+ PrettyDecoded = 0x000000,
+ EncodeSpaces = 0x100000,
+ EncodeUnicode = 0x200000,
+ EncodeDelimiters = 0x400000 | 0x800000,
+ EncodeReserved = 0x1000000,
+ DecodeReserved = 0x2000000,
+
+ FullyEncoded = EncodeSpaces | EncodeUnicode | EncodeDelimiters | EncodeReserved,
+ MostDecoded = PrettyDecoded | DecodeReserved
};
- Q_DECLARE_FLAGS(FormattingOptions, FormattingOption)
+ Q_DECLARE_FLAGS(ComponentFormattingOptions, ComponentFormattingOption)
+#ifdef qdoc
+ Q_DECLARE_FLAGS(FormattingOptions, UrlFormattingOption)
+#else
+ typedef QUrlTwoFlags<UrlFormattingOption, ComponentFormattingOption> FormattingOptions;
+#endif
QUrl();
-#ifdef QT_NO_URL_CAST_FROM_STRING
- explicit
-#endif
- QUrl(const QString &url, ParsingMode mode = TolerantMode);
QUrl(const QUrl &copy);
QUrl &operator =(const QUrl &copy);
-#ifndef QT_NO_URL_CAST_FROM_STRING
- QUrl &operator =(const QString &url);
+#ifdef QT_NO_URL_CAST_FROM_STRING
+ explicit QUrl(const QString &url, ParsingMode mode = TolerantMode);
+#else
+ QUrl(const QString &url, ParsingMode mode = TolerantMode);
+ QUrl &operator=(const QString &url);
#endif
#ifdef Q_COMPILER_RVALUE_REFS
+ QUrl(QUrl &&other) : d(0)
+ { qSwap(d, other.d); }
inline QUrl &operator=(QUrl &&other)
{ qSwap(d, other.d); return *this; }
#endif
@@ -100,96 +175,63 @@ public:
inline void swap(QUrl &other) { qSwap(d, other.d); }
void setUrl(const QString &url, ParsingMode mode = TolerantMode);
- QString url(FormattingOptions options = None) const;
- QString toString(FormattingOptions options = None) const;
- QString toDisplayString(FormattingOptions options = None) const;
+ QString url(FormattingOptions options = FormattingOptions(PrettyDecoded)) const;
+ QString toString(FormattingOptions options = FormattingOptions(PrettyDecoded)) const;
+ QString toDisplayString(FormattingOptions options = FormattingOptions(PrettyDecoded)) const;
+
+ QByteArray toEncoded(FormattingOptions options = FullyEncoded) const;
+ static QUrl fromEncoded(const QByteArray &url, ParsingMode mode = TolerantMode);
+
+ static QUrl fromUserInput(const QString &userInput);
bool isValid() const;
+ QString errorString() const;
bool isEmpty() const;
-
void clear();
void setScheme(const QString &scheme);
QString scheme() const;
void setAuthority(const QString &authority);
- QString authority() const;
+ QString authority(ComponentFormattingOptions options = PrettyDecoded) const;
void setUserInfo(const QString &userInfo);
- QString userInfo() const;
+ QString userInfo(ComponentFormattingOptions options = PrettyDecoded) const;
void setUserName(const QString &userName);
- QString userName() const;
- void setEncodedUserName(const QByteArray &userName);
- QByteArray encodedUserName() const;
+ QString userName(ComponentFormattingOptions options = PrettyDecoded) const;
void setPassword(const QString &password);
- QString password() const;
- void setEncodedPassword(const QByteArray &password);
- QByteArray encodedPassword() const;
+ QString password(ComponentFormattingOptions = PrettyDecoded) const;
void setHost(const QString &host);
- QString host() const;
- void setEncodedHost(const QByteArray &host);
- QByteArray encodedHost() const;
+ QString host(ComponentFormattingOptions = PrettyDecoded) const;
+ QString topLevelDomain(ComponentFormattingOptions options = PrettyDecoded) const;
void setPort(int port);
int port(int defaultPort = -1) const;
void setPath(const QString &path);
- QString path() const;
- void setEncodedPath(const QByteArray &path);
- QByteArray encodedPath() const;
+ QString path(ComponentFormattingOptions options = PrettyDecoded) const;
bool hasQuery() const;
+ void setQuery(const QString &query);
+ void setQuery(const QUrlQuery &query);
+ QString query(ComponentFormattingOptions = PrettyDecoded) const;
- void setEncodedQuery(const QByteArray &query);
- QByteArray encodedQuery() const;
-
- void setQueryDelimiters(char valueDelimiter, char pairDelimiter);
- char queryValueDelimiter() const;
- char queryPairDelimiter() const;
-
- void setQueryItems(const QList<QPair<QString, QString> > &query);
- void addQueryItem(const QString &key, const QString &value);
- QList<QPair<QString, QString> > queryItems() const;
- bool hasQueryItem(const QString &key) const;
- QString queryItemValue(const QString &key) const;
- QStringList allQueryItemValues(const QString &key) const;
- void removeQueryItem(const QString &key);
- void removeAllQueryItems(const QString &key);
-
- void setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray> > &query);
- void addEncodedQueryItem(const QByteArray &key, const QByteArray &value);
- QList<QPair<QByteArray, QByteArray> > encodedQueryItems() const;
- bool hasEncodedQueryItem(const QByteArray &key) const;
- QByteArray encodedQueryItemValue(const QByteArray &key) const;
- QList<QByteArray> allEncodedQueryItemValues(const QByteArray &key) const;
- void removeEncodedQueryItem(const QByteArray &key);
- void removeAllEncodedQueryItems(const QByteArray &key);
-
- void setFragment(const QString &fragment);
- QString fragment() const;
- void setEncodedFragment(const QByteArray &fragment);
- QByteArray encodedFragment() const;
bool hasFragment() const;
-#ifndef QT_BOOTSTRAPPED
- QString topLevelDomain() const;
-#endif
+ QString fragment(ComponentFormattingOptions options = PrettyDecoded) const;
+ void setFragment(const QString &fragment);
QUrl resolved(const QUrl &relative) const;
bool isRelative() const;
bool isParentOf(const QUrl &url) const;
+ bool isLocalFile() const;
static QUrl fromLocalFile(const QString &localfile);
QString toLocalFile() const;
- bool isLocalFile() const;
-
- QByteArray toEncoded(FormattingOptions options = None) const;
-
- static QUrl fromUserInput(const QString &userInput);
void detach();
bool isDetached() const;
@@ -202,37 +244,121 @@ public:
static QByteArray toPercentEncoding(const QString &,
const QByteArray &exclude = QByteArray(),
const QByteArray &include = QByteArray());
- static QString fromPunycode(const QByteArray &);
- static QByteArray toPunycode(const QString &);
- static QString fromAce(const QByteArray &);
- static QByteArray toAce(const QString &);
- static QStringList idnWhitelist();
- static void setIdnWhitelist(const QStringList &);
-
- QString errorString() const;
-
#if QT_DEPRECATED_SINCE(5,0)
+ QT_DEPRECATED static QString fromPunycode(const QByteArray &punycode)
+ { return fromAce(punycode); }
+ QT_DEPRECATED static QByteArray toPunycode(const QString &string)
+ { return toAce(string); }
+
+ QT_DEPRECATED inline void setQueryItems(const QList<QPair<QString, QString> > &qry);
+ QT_DEPRECATED inline void addQueryItem(const QString &key, const QString &value);
+ QT_DEPRECATED inline QList<QPair<QString, QString> > queryItems() const;
+ QT_DEPRECATED inline bool hasQueryItem(const QString &key) const;
+ QT_DEPRECATED inline QString queryItemValue(const QString &key) const;
+ QT_DEPRECATED inline QStringList allQueryItemValues(const QString &key) const;
+ QT_DEPRECATED inline void removeQueryItem(const QString &key);
+ QT_DEPRECATED inline void removeAllQueryItems(const QString &key);
+
+ QT_DEPRECATED inline void setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray> > &query);
+ QT_DEPRECATED inline void addEncodedQueryItem(const QByteArray &key, const QByteArray &value);
+ QT_DEPRECATED inline QList<QPair<QByteArray, QByteArray> > encodedQueryItems() const;
+ QT_DEPRECATED inline bool hasEncodedQueryItem(const QByteArray &key) const;
+ QT_DEPRECATED inline QByteArray encodedQueryItemValue(const QByteArray &key) const;
+ QT_DEPRECATED inline QList<QByteArray> allEncodedQueryItemValues(const QByteArray &key) const;
+ QT_DEPRECATED inline void removeEncodedQueryItem(const QByteArray &key);
+ QT_DEPRECATED inline void removeAllEncodedQueryItems(const QByteArray &key);
+
QT_DEPRECATED void setEncodedUrl(const QByteArray &u, ParsingMode mode = TolerantMode)
{ setUrl(QString::fromUtf8(u.constData(), u.size()), mode); }
- QT_DEPRECATED static QUrl fromEncoded(const QByteArray &u, ParsingMode mode = TolerantMode)
- { return QUrl(QString::fromUtf8(u.constData(), u.size()), mode); }
+
+ QT_DEPRECATED QByteArray encodedUserName() const
+ { return userName(FullyEncoded).toLatin1(); }
+ QT_DEPRECATED void setEncodedUserName(const QByteArray &value)
+ { setUserName(QString::fromLatin1(value)); }
+
+ QT_DEPRECATED QByteArray encodedPassword() const
+ { return password(FullyEncoded).toLatin1(); }
+ QT_DEPRECATED void setEncodedPassword(const QByteArray &value)
+ { setPassword(QString::fromLatin1(value)); }
+
+ QT_DEPRECATED QByteArray encodedHost() const
+ { return host(FullyEncoded).toLatin1(); }
+ QT_DEPRECATED void setEncodedHost(const QByteArray &value)
+ { setHost(QString::fromLatin1(value)); }
+
+ QT_DEPRECATED QByteArray encodedPath() const
+ { return path(FullyEncoded).toLatin1(); }
+ QT_DEPRECATED void setEncodedPath(const QByteArray &value)
+ { setPath(QString::fromLatin1(value)); }
+
+ QT_DEPRECATED QByteArray encodedQuery() const
+ { return toLatin1_helper(query(FullyEncoded)); }
+ QT_DEPRECATED void setEncodedQuery(const QByteArray &value)
+ { setQuery(QString::fromLatin1(value)); }
+
+ QT_DEPRECATED QByteArray encodedFragment() const
+ { return toLatin1_helper(fragment(FullyEncoded)); }
+ QT_DEPRECATED void setEncodedFragment(const QByteArray &value)
+ { setFragment(QString::fromLatin1(value)); }
+
+private:
+ // helper function for the encodedQuery and encodedFragment functions
+ static QByteArray toLatin1_helper(const QString &string)
+ {
+ if (string.isEmpty())
+ return string.isNull() ? QByteArray() : QByteArray("");
+ return string.toLatin1();
+ }
#endif
+public:
+ static QString fromAce(const QByteArray &);
+ static QByteArray toAce(const QString &);
+ static QStringList idnWhitelist();
+ static void setIdnWhitelist(const QStringList &);
+ friend Q_CORE_EXPORT uint qHash(const QUrl &url, uint seed = 0);
+
private:
QUrlPrivate *d;
+ friend class QUrlQuery;
+
public:
typedef QUrlPrivate * DataPtr;
inline DataPtr &data_ptr() { return d; }
};
-inline uint qHash(const QUrl &url)
-{
- return qHash(url.toEncoded(QUrl::FormattingOption(0x100)));
-}
-
Q_DECLARE_TYPEINFO(QUrl, Q_MOVABLE_TYPE);
Q_DECLARE_SHARED(QUrl)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::FormattingOptions)
+Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::ComponentFormattingOptions)
+//Q_DECLARE_OPERATORS_FOR_FLAGS(QUrl::FormattingOptions)
+
+Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::UrlFormattingOption f2)
+{ return QUrl::FormattingOptions(f1) | f2; }
+Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption f1, QUrl::FormattingOptions f2)
+{ return f2 | f1; }
+inline QIncompatibleFlag operator|(QUrl::UrlFormattingOption f1, int f2)
+{ return QIncompatibleFlag(int(f1) | f2); }
+
+// add operators for OR'ing the two types of flags
+inline QUrl::FormattingOptions &operator|=(QUrl::FormattingOptions &i, QUrl::ComponentFormattingOptions f)
+{ i |= QUrl::UrlFormattingOption(int(f)); return i; }
+Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption i, QUrl::ComponentFormattingOption f)
+{ return i | QUrl::UrlFormattingOption(int(f)); }
+Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::UrlFormattingOption i, QUrl::ComponentFormattingOptions f)
+{ return i | QUrl::UrlFormattingOption(int(f)); }
+Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOption f, QUrl::UrlFormattingOption i)
+{ return i | QUrl::UrlFormattingOption(int(f)); }
+Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOptions f, QUrl::UrlFormattingOption i)
+{ return i | QUrl::UrlFormattingOption(int(f)); }
+Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::FormattingOptions i, QUrl::ComponentFormattingOptions f)
+{ return i | QUrl::UrlFormattingOption(int(f)); }
+Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOption f, QUrl::FormattingOptions i)
+{ return i | QUrl::UrlFormattingOption(int(f)); }
+Q_DECL_CONSTEXPR inline QUrl::FormattingOptions operator|(QUrl::ComponentFormattingOptions f, QUrl::FormattingOptions i)
+{ return i | QUrl::UrlFormattingOption(int(f)); }
+
+//inline QUrl::UrlFormattingOption &operator=(const QUrl::UrlFormattingOption &i, QUrl::ComponentFormattingOptions f)
+//{ i = int(f); f; }
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QUrl &);
@@ -245,6 +371,10 @@ Q_CORE_EXPORT QDebug operator<<(QDebug, const QUrl &);
QT_END_NAMESPACE
+#if QT_DEPRECATED_SINCE(5,0)
+# include <QtCore/qurlquery.h>
+#endif
+
QT_END_HEADER
#endif // QURL_H
diff --git a/src/corelib/io/qurl_p.h b/src/corelib/io/qurl_p.h
new file mode 100644
index 0000000000..201ee66238
--- /dev/null
+++ b/src/corelib/io/qurl_p.h
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Intel Corporation.
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QURL_P_H
+#define QURL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience of
+// qurl*.cpp This header file may change from version to version without
+// notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qurl.h"
+
+QT_BEGIN_NAMESPACE
+
+class QUrlPrivate
+{
+public:
+ enum Section {
+ Scheme = 0x01,
+ UserName = 0x02,
+ Password = 0x04,
+ UserInfo = UserName | Password,
+ Host = 0x08,
+ Port = 0x10,
+ Authority = UserInfo | Host | Port,
+ Path = 0x20,
+ Hierarchy = Authority | Path,
+ Query = 0x40,
+ Fragment = 0x80,
+ FullUrl = 0xff
+ };
+
+ enum ErrorCode {
+ // the high byte of the error code matches the Section
+ InvalidSchemeError = Scheme << 8,
+ SchemeEmptyError,
+
+ InvalidUserNameError = UserName << 8,
+
+ InvalidPasswordError = Password << 8,
+
+ InvalidRegNameError = Host << 8,
+ InvalidIPv4AddressError,
+ InvalidIPv6AddressError,
+ InvalidIPvFutureError,
+ HostMissingEndBracket,
+
+ InvalidPortError = Port << 8,
+ PortEmptyError,
+
+ InvalidPathError = Path << 8,
+ PathContainsColonBeforeSlash,
+
+ InvalidQueryError = Query << 8,
+
+ InvalidFragmentError = Fragment << 8,
+
+ NoError = 0
+ };
+
+ QUrlPrivate();
+ QUrlPrivate(const QUrlPrivate &copy);
+
+ void parse(const QString &url, QUrl::ParsingMode parsingMode);
+ void clear();
+ bool isEmpty() const
+ { return sectionIsPresent == 0 && port == -1 && path.isEmpty(); }
+
+ // no QString scheme() const;
+ void appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;
+ void appendUserInfo(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;
+ void appendUserName(QString &appendTo, QUrl::FormattingOptions options) const;
+ void appendPassword(QString &appendTo, QUrl::FormattingOptions options) const;
+ void appendHost(QString &appendTo, QUrl::FormattingOptions options) const;
+ void appendPath(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;
+ void appendQuery(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;
+ void appendFragment(QString &appendTo, QUrl::FormattingOptions options) const;
+
+ // the "end" parameters are like STL iterators: they point to one past the last valid element
+ bool setScheme(const QString &value, int len, bool decoded = false);
+ bool setAuthority(const QString &auth, int from, int end);
+ void setUserInfo(const QString &userInfo, int from, int end);
+ void setUserName(const QString &value, int from, int end);
+ void setPassword(const QString &value, int from, int end);
+ bool setHost(const QString &value, int from, int end, bool maybePercentEncoded = true);
+ void setPath(const QString &value, int from, int end);
+ void setQuery(const QString &value, int from, int end);
+ void setFragment(const QString &value, int from, int end);
+
+ inline bool hasScheme() const { return sectionIsPresent & Scheme; }
+ inline bool hasAuthority() const { return sectionIsPresent & Authority; }
+ inline bool hasUserInfo() const { return sectionIsPresent & UserInfo; }
+ inline bool hasUserName() const { return sectionIsPresent & UserName; }
+ inline bool hasPassword() const { return sectionIsPresent & Password; }
+ inline bool hasHost() const { return sectionIsPresent & Host; }
+ inline bool hasPort() const { return port != -1; }
+ inline bool hasPath() const { return !path.isEmpty(); }
+ inline bool hasQuery() const { return sectionIsPresent & Query; }
+ inline bool hasFragment() const { return sectionIsPresent & Fragment; }
+
+ QString mergePaths(const QString &relativePath) const;
+
+ QAtomicInt ref;
+ int port;
+
+ QString scheme;
+ QString userName;
+ QString password;
+ QString host;
+ QString path;
+ QString query;
+ QString fragment;
+
+ ushort errorCode;
+ ushort errorSupplement;
+
+ // not used for:
+ // - Port (port == -1 means absence)
+ // - Path (there's no path delimiter, so we optimize its use out of existence)
+ // Schemes are never supposed to be empty, but we keep the flag anyway
+ uchar sectionIsPresent;
+
+ // UserName, Password, Path, Query, and Fragment never contain errors in TolerantMode.
+ // Those flags are set only by the strict parser.
+ uchar sectionHasError;
+};
+
+
+// in qurlrecode.cpp
+extern Q_AUTOTEST_EXPORT int qt_urlRecode(QString &appendTo, const QChar *begin, const QChar *end,
+ QUrl::ComponentFormattingOptions encoding, const ushort *tableModifications);
+
+// in qurlidna.cpp
+enum AceOperation { ToAceOnly, NormalizeAce };
+extern QString qt_ACE_do(const QString &domain, AceOperation op);
+extern Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from);
+extern Q_AUTOTEST_EXPORT bool qt_check_std3rules(const QChar *uc, int len);
+extern Q_AUTOTEST_EXPORT void qt_punycodeEncoder(const QChar *s, int ucLength, QString *output);
+extern Q_AUTOTEST_EXPORT QString qt_punycodeDecoder(const QString &pc);
+
+QT_END_NAMESPACE
+
+#endif // QURL_P_H
diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp
new file mode 100644
index 0000000000..e28d886c3b
--- /dev/null
+++ b/src/corelib/io/qurlidna.cpp
@@ -0,0 +1,2592 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qurl_p.h"
+
+QT_BEGIN_NAMESPACE
+
+// needed by the punycode encoder/decoder
+#define Q_MAXINT ((uint)((uint)(-1)>>1))
+static const uint base = 36;
+static const uint tmin = 1;
+static const uint tmax = 26;
+static const uint skew = 38;
+static const uint damp = 700;
+static const uint initial_bias = 72;
+static const uint initial_n = 128;
+
+struct NameprepCaseFoldingEntry {
+ uint uc;
+ ushort mapping[4];
+};
+
+inline bool operator<(uint one, const NameprepCaseFoldingEntry &other)
+{ return one < other.uc; }
+
+inline bool operator<(const NameprepCaseFoldingEntry &one, uint other)
+{ return one.uc < other; }
+
+static const NameprepCaseFoldingEntry NameprepCaseFolding[] = {
+/* { 0x0041, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x0042, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x0043, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x0044, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x0045, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x0046, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x0047, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x0048, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x0049, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x004A, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x004B, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x004C, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x004D, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x004E, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x004F, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0050, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x0051, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x0052, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x0053, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x0054, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x0055, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x0056, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x0057, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x0058, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x0059, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x005A, { 0x007A, 0x0000, 0x0000, 0x0000 } },*/
+ { 0x00B5, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
+ { 0x00C0, { 0x00E0, 0x0000, 0x0000, 0x0000 } },
+ { 0x00C1, { 0x00E1, 0x0000, 0x0000, 0x0000 } },
+ { 0x00C2, { 0x00E2, 0x0000, 0x0000, 0x0000 } },
+ { 0x00C3, { 0x00E3, 0x0000, 0x0000, 0x0000 } },
+ { 0x00C4, { 0x00E4, 0x0000, 0x0000, 0x0000 } },
+ { 0x00C5, { 0x00E5, 0x0000, 0x0000, 0x0000 } },
+ { 0x00C6, { 0x00E6, 0x0000, 0x0000, 0x0000 } },
+ { 0x00C7, { 0x00E7, 0x0000, 0x0000, 0x0000 } },
+ { 0x00C8, { 0x00E8, 0x0000, 0x0000, 0x0000 } },
+ { 0x00C9, { 0x00E9, 0x0000, 0x0000, 0x0000 } },
+ { 0x00CA, { 0x00EA, 0x0000, 0x0000, 0x0000 } },
+ { 0x00CB, { 0x00EB, 0x0000, 0x0000, 0x0000 } },
+ { 0x00CC, { 0x00EC, 0x0000, 0x0000, 0x0000 } },
+ { 0x00CD, { 0x00ED, 0x0000, 0x0000, 0x0000 } },
+ { 0x00CE, { 0x00EE, 0x0000, 0x0000, 0x0000 } },
+ { 0x00CF, { 0x00EF, 0x0000, 0x0000, 0x0000 } },
+ { 0x00D0, { 0x00F0, 0x0000, 0x0000, 0x0000 } },
+ { 0x00D1, { 0x00F1, 0x0000, 0x0000, 0x0000 } },
+ { 0x00D2, { 0x00F2, 0x0000, 0x0000, 0x0000 } },
+ { 0x00D3, { 0x00F3, 0x0000, 0x0000, 0x0000 } },
+ { 0x00D4, { 0x00F4, 0x0000, 0x0000, 0x0000 } },
+ { 0x00D5, { 0x00F5, 0x0000, 0x0000, 0x0000 } },
+ { 0x00D6, { 0x00F6, 0x0000, 0x0000, 0x0000 } },
+ { 0x00D8, { 0x00F8, 0x0000, 0x0000, 0x0000 } },
+ { 0x00D9, { 0x00F9, 0x0000, 0x0000, 0x0000 } },
+ { 0x00DA, { 0x00FA, 0x0000, 0x0000, 0x0000 } },
+ { 0x00DB, { 0x00FB, 0x0000, 0x0000, 0x0000 } },
+ { 0x00DC, { 0x00FC, 0x0000, 0x0000, 0x0000 } },
+ { 0x00DD, { 0x00FD, 0x0000, 0x0000, 0x0000 } },
+ { 0x00DE, { 0x00FE, 0x0000, 0x0000, 0x0000 } },
+ { 0x00DF, { 0x0073, 0x0073, 0x0000, 0x0000 } },
+ { 0x0100, { 0x0101, 0x0000, 0x0000, 0x0000 } },
+ { 0x0102, { 0x0103, 0x0000, 0x0000, 0x0000 } },
+ { 0x0104, { 0x0105, 0x0000, 0x0000, 0x0000 } },
+ { 0x0106, { 0x0107, 0x0000, 0x0000, 0x0000 } },
+ { 0x0108, { 0x0109, 0x0000, 0x0000, 0x0000 } },
+ { 0x010A, { 0x010B, 0x0000, 0x0000, 0x0000 } },
+ { 0x010C, { 0x010D, 0x0000, 0x0000, 0x0000 } },
+ { 0x010E, { 0x010F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0110, { 0x0111, 0x0000, 0x0000, 0x0000 } },
+ { 0x0112, { 0x0113, 0x0000, 0x0000, 0x0000 } },
+ { 0x0114, { 0x0115, 0x0000, 0x0000, 0x0000 } },
+ { 0x0116, { 0x0117, 0x0000, 0x0000, 0x0000 } },
+ { 0x0118, { 0x0119, 0x0000, 0x0000, 0x0000 } },
+ { 0x011A, { 0x011B, 0x0000, 0x0000, 0x0000 } },
+ { 0x011C, { 0x011D, 0x0000, 0x0000, 0x0000 } },
+ { 0x011E, { 0x011F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0120, { 0x0121, 0x0000, 0x0000, 0x0000 } },
+ { 0x0122, { 0x0123, 0x0000, 0x0000, 0x0000 } },
+ { 0x0124, { 0x0125, 0x0000, 0x0000, 0x0000 } },
+ { 0x0126, { 0x0127, 0x0000, 0x0000, 0x0000 } },
+ { 0x0128, { 0x0129, 0x0000, 0x0000, 0x0000 } },
+ { 0x012A, { 0x012B, 0x0000, 0x0000, 0x0000 } },
+ { 0x012C, { 0x012D, 0x0000, 0x0000, 0x0000 } },
+ { 0x012E, { 0x012F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0130, { 0x0069, 0x0307, 0x0000, 0x0000 } },
+ { 0x0132, { 0x0133, 0x0000, 0x0000, 0x0000 } },
+ { 0x0134, { 0x0135, 0x0000, 0x0000, 0x0000 } },
+ { 0x0136, { 0x0137, 0x0000, 0x0000, 0x0000 } },
+ { 0x0139, { 0x013A, 0x0000, 0x0000, 0x0000 } },
+ { 0x013B, { 0x013C, 0x0000, 0x0000, 0x0000 } },
+ { 0x013D, { 0x013E, 0x0000, 0x0000, 0x0000 } },
+ { 0x013F, { 0x0140, 0x0000, 0x0000, 0x0000 } },
+ { 0x0141, { 0x0142, 0x0000, 0x0000, 0x0000 } },
+ { 0x0143, { 0x0144, 0x0000, 0x0000, 0x0000 } },
+ { 0x0145, { 0x0146, 0x0000, 0x0000, 0x0000 } },
+ { 0x0147, { 0x0148, 0x0000, 0x0000, 0x0000 } },
+ { 0x0149, { 0x02BC, 0x006E, 0x0000, 0x0000 } },
+ { 0x014A, { 0x014B, 0x0000, 0x0000, 0x0000 } },
+ { 0x014C, { 0x014D, 0x0000, 0x0000, 0x0000 } },
+ { 0x014E, { 0x014F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0150, { 0x0151, 0x0000, 0x0000, 0x0000 } },
+ { 0x0152, { 0x0153, 0x0000, 0x0000, 0x0000 } },
+ { 0x0154, { 0x0155, 0x0000, 0x0000, 0x0000 } },
+ { 0x0156, { 0x0157, 0x0000, 0x0000, 0x0000 } },
+ { 0x0158, { 0x0159, 0x0000, 0x0000, 0x0000 } },
+ { 0x015A, { 0x015B, 0x0000, 0x0000, 0x0000 } },
+ { 0x015C, { 0x015D, 0x0000, 0x0000, 0x0000 } },
+ { 0x015E, { 0x015F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0160, { 0x0161, 0x0000, 0x0000, 0x0000 } },
+ { 0x0162, { 0x0163, 0x0000, 0x0000, 0x0000 } },
+ { 0x0164, { 0x0165, 0x0000, 0x0000, 0x0000 } },
+ { 0x0166, { 0x0167, 0x0000, 0x0000, 0x0000 } },
+ { 0x0168, { 0x0169, 0x0000, 0x0000, 0x0000 } },
+ { 0x016A, { 0x016B, 0x0000, 0x0000, 0x0000 } },
+ { 0x016C, { 0x016D, 0x0000, 0x0000, 0x0000 } },
+ { 0x016E, { 0x016F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0170, { 0x0171, 0x0000, 0x0000, 0x0000 } },
+ { 0x0172, { 0x0173, 0x0000, 0x0000, 0x0000 } },
+ { 0x0174, { 0x0175, 0x0000, 0x0000, 0x0000 } },
+ { 0x0176, { 0x0177, 0x0000, 0x0000, 0x0000 } },
+ { 0x0178, { 0x00FF, 0x0000, 0x0000, 0x0000 } },
+ { 0x0179, { 0x017A, 0x0000, 0x0000, 0x0000 } },
+ { 0x017B, { 0x017C, 0x0000, 0x0000, 0x0000 } },
+ { 0x017D, { 0x017E, 0x0000, 0x0000, 0x0000 } },
+ { 0x017F, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x0181, { 0x0253, 0x0000, 0x0000, 0x0000 } },
+ { 0x0182, { 0x0183, 0x0000, 0x0000, 0x0000 } },
+ { 0x0184, { 0x0185, 0x0000, 0x0000, 0x0000 } },
+ { 0x0186, { 0x0254, 0x0000, 0x0000, 0x0000 } },
+ { 0x0187, { 0x0188, 0x0000, 0x0000, 0x0000 } },
+ { 0x0189, { 0x0256, 0x0000, 0x0000, 0x0000 } },
+ { 0x018A, { 0x0257, 0x0000, 0x0000, 0x0000 } },
+ { 0x018B, { 0x018C, 0x0000, 0x0000, 0x0000 } },
+ { 0x018E, { 0x01DD, 0x0000, 0x0000, 0x0000 } },
+ { 0x018F, { 0x0259, 0x0000, 0x0000, 0x0000 } },
+ { 0x0190, { 0x025B, 0x0000, 0x0000, 0x0000 } },
+ { 0x0191, { 0x0192, 0x0000, 0x0000, 0x0000 } },
+ { 0x0193, { 0x0260, 0x0000, 0x0000, 0x0000 } },
+ { 0x0194, { 0x0263, 0x0000, 0x0000, 0x0000 } },
+ { 0x0196, { 0x0269, 0x0000, 0x0000, 0x0000 } },
+ { 0x0197, { 0x0268, 0x0000, 0x0000, 0x0000 } },
+ { 0x0198, { 0x0199, 0x0000, 0x0000, 0x0000 } },
+ { 0x019C, { 0x026F, 0x0000, 0x0000, 0x0000 } },
+ { 0x019D, { 0x0272, 0x0000, 0x0000, 0x0000 } },
+ { 0x019F, { 0x0275, 0x0000, 0x0000, 0x0000 } },
+ { 0x01A0, { 0x01A1, 0x0000, 0x0000, 0x0000 } },
+ { 0x01A2, { 0x01A3, 0x0000, 0x0000, 0x0000 } },
+ { 0x01A4, { 0x01A5, 0x0000, 0x0000, 0x0000 } },
+ { 0x01A6, { 0x0280, 0x0000, 0x0000, 0x0000 } },
+ { 0x01A7, { 0x01A8, 0x0000, 0x0000, 0x0000 } },
+ { 0x01A9, { 0x0283, 0x0000, 0x0000, 0x0000 } },
+ { 0x01AC, { 0x01AD, 0x0000, 0x0000, 0x0000 } },
+ { 0x01AE, { 0x0288, 0x0000, 0x0000, 0x0000 } },
+ { 0x01AF, { 0x01B0, 0x0000, 0x0000, 0x0000 } },
+ { 0x01B1, { 0x028A, 0x0000, 0x0000, 0x0000 } },
+ { 0x01B2, { 0x028B, 0x0000, 0x0000, 0x0000 } },
+ { 0x01B3, { 0x01B4, 0x0000, 0x0000, 0x0000 } },
+ { 0x01B5, { 0x01B6, 0x0000, 0x0000, 0x0000 } },
+ { 0x01B7, { 0x0292, 0x0000, 0x0000, 0x0000 } },
+ { 0x01B8, { 0x01B9, 0x0000, 0x0000, 0x0000 } },
+ { 0x01BC, { 0x01BD, 0x0000, 0x0000, 0x0000 } },
+ { 0x01C4, { 0x01C6, 0x0000, 0x0000, 0x0000 } },
+ { 0x01C5, { 0x01C6, 0x0000, 0x0000, 0x0000 } },
+ { 0x01C7, { 0x01C9, 0x0000, 0x0000, 0x0000 } },
+ { 0x01C8, { 0x01C9, 0x0000, 0x0000, 0x0000 } },
+ { 0x01CA, { 0x01CC, 0x0000, 0x0000, 0x0000 } },
+ { 0x01CB, { 0x01CC, 0x0000, 0x0000, 0x0000 } },
+ { 0x01CD, { 0x01CE, 0x0000, 0x0000, 0x0000 } },
+ { 0x01CF, { 0x01D0, 0x0000, 0x0000, 0x0000 } },
+ { 0x01D1, { 0x01D2, 0x0000, 0x0000, 0x0000 } },
+ { 0x01D3, { 0x01D4, 0x0000, 0x0000, 0x0000 } },
+ { 0x01D5, { 0x01D6, 0x0000, 0x0000, 0x0000 } },
+ { 0x01D7, { 0x01D8, 0x0000, 0x0000, 0x0000 } },
+ { 0x01D9, { 0x01DA, 0x0000, 0x0000, 0x0000 } },
+ { 0x01DB, { 0x01DC, 0x0000, 0x0000, 0x0000 } },
+ { 0x01DE, { 0x01DF, 0x0000, 0x0000, 0x0000 } },
+ { 0x01E0, { 0x01E1, 0x0000, 0x0000, 0x0000 } },
+ { 0x01E2, { 0x01E3, 0x0000, 0x0000, 0x0000 } },
+ { 0x01E4, { 0x01E5, 0x0000, 0x0000, 0x0000 } },
+ { 0x01E6, { 0x01E7, 0x0000, 0x0000, 0x0000 } },
+ { 0x01E8, { 0x01E9, 0x0000, 0x0000, 0x0000 } },
+ { 0x01EA, { 0x01EB, 0x0000, 0x0000, 0x0000 } },
+ { 0x01EC, { 0x01ED, 0x0000, 0x0000, 0x0000 } },
+ { 0x01EE, { 0x01EF, 0x0000, 0x0000, 0x0000 } },
+ { 0x01F0, { 0x006A, 0x030C, 0x0000, 0x0000 } },
+ { 0x01F1, { 0x01F3, 0x0000, 0x0000, 0x0000 } },
+ { 0x01F2, { 0x01F3, 0x0000, 0x0000, 0x0000 } },
+ { 0x01F4, { 0x01F5, 0x0000, 0x0000, 0x0000 } },
+ { 0x01F6, { 0x0195, 0x0000, 0x0000, 0x0000 } },
+ { 0x01F7, { 0x01BF, 0x0000, 0x0000, 0x0000 } },
+ { 0x01F8, { 0x01F9, 0x0000, 0x0000, 0x0000 } },
+ { 0x01FA, { 0x01FB, 0x0000, 0x0000, 0x0000 } },
+ { 0x01FC, { 0x01FD, 0x0000, 0x0000, 0x0000 } },
+ { 0x01FE, { 0x01FF, 0x0000, 0x0000, 0x0000 } },
+ { 0x0200, { 0x0201, 0x0000, 0x0000, 0x0000 } },
+ { 0x0202, { 0x0203, 0x0000, 0x0000, 0x0000 } },
+ { 0x0204, { 0x0205, 0x0000, 0x0000, 0x0000 } },
+ { 0x0206, { 0x0207, 0x0000, 0x0000, 0x0000 } },
+ { 0x0208, { 0x0209, 0x0000, 0x0000, 0x0000 } },
+ { 0x020A, { 0x020B, 0x0000, 0x0000, 0x0000 } },
+ { 0x020C, { 0x020D, 0x0000, 0x0000, 0x0000 } },
+ { 0x020E, { 0x020F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0210, { 0x0211, 0x0000, 0x0000, 0x0000 } },
+ { 0x0212, { 0x0213, 0x0000, 0x0000, 0x0000 } },
+ { 0x0214, { 0x0215, 0x0000, 0x0000, 0x0000 } },
+ { 0x0216, { 0x0217, 0x0000, 0x0000, 0x0000 } },
+ { 0x0218, { 0x0219, 0x0000, 0x0000, 0x0000 } },
+ { 0x021A, { 0x021B, 0x0000, 0x0000, 0x0000 } },
+ { 0x021C, { 0x021D, 0x0000, 0x0000, 0x0000 } },
+ { 0x021E, { 0x021F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0220, { 0x019E, 0x0000, 0x0000, 0x0000 } },
+ { 0x0222, { 0x0223, 0x0000, 0x0000, 0x0000 } },
+ { 0x0224, { 0x0225, 0x0000, 0x0000, 0x0000 } },
+ { 0x0226, { 0x0227, 0x0000, 0x0000, 0x0000 } },
+ { 0x0228, { 0x0229, 0x0000, 0x0000, 0x0000 } },
+ { 0x022A, { 0x022B, 0x0000, 0x0000, 0x0000 } },
+ { 0x022C, { 0x022D, 0x0000, 0x0000, 0x0000 } },
+ { 0x022E, { 0x022F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0230, { 0x0231, 0x0000, 0x0000, 0x0000 } },
+ { 0x0232, { 0x0233, 0x0000, 0x0000, 0x0000 } },
+ { 0x0345, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
+ { 0x037A, { 0x0020, 0x03B9, 0x0000, 0x0000 } },
+ { 0x0386, { 0x03AC, 0x0000, 0x0000, 0x0000 } },
+ { 0x0388, { 0x03AD, 0x0000, 0x0000, 0x0000 } },
+ { 0x0389, { 0x03AE, 0x0000, 0x0000, 0x0000 } },
+ { 0x038A, { 0x03AF, 0x0000, 0x0000, 0x0000 } },
+ { 0x038C, { 0x03CC, 0x0000, 0x0000, 0x0000 } },
+ { 0x038E, { 0x03CD, 0x0000, 0x0000, 0x0000 } },
+ { 0x038F, { 0x03CE, 0x0000, 0x0000, 0x0000 } },
+ { 0x0390, { 0x03B9, 0x0308, 0x0301, 0x0000 } },
+ { 0x0391, { 0x03B1, 0x0000, 0x0000, 0x0000 } },
+ { 0x0392, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
+ { 0x0393, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
+ { 0x0394, { 0x03B4, 0x0000, 0x0000, 0x0000 } },
+ { 0x0395, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
+ { 0x0396, { 0x03B6, 0x0000, 0x0000, 0x0000 } },
+ { 0x0397, { 0x03B7, 0x0000, 0x0000, 0x0000 } },
+ { 0x0398, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x0399, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
+ { 0x039A, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
+ { 0x039B, { 0x03BB, 0x0000, 0x0000, 0x0000 } },
+ { 0x039C, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
+ { 0x039D, { 0x03BD, 0x0000, 0x0000, 0x0000 } },
+ { 0x039E, { 0x03BE, 0x0000, 0x0000, 0x0000 } },
+ { 0x039F, { 0x03BF, 0x0000, 0x0000, 0x0000 } },
+ { 0x03A0, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
+ { 0x03A1, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
+ { 0x03A3, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
+ { 0x03A4, { 0x03C4, 0x0000, 0x0000, 0x0000 } },
+ { 0x03A5, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
+ { 0x03A6, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
+ { 0x03A7, { 0x03C7, 0x0000, 0x0000, 0x0000 } },
+ { 0x03A8, { 0x03C8, 0x0000, 0x0000, 0x0000 } },
+ { 0x03A9, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
+ { 0x03AA, { 0x03CA, 0x0000, 0x0000, 0x0000 } },
+ { 0x03AB, { 0x03CB, 0x0000, 0x0000, 0x0000 } },
+ { 0x03B0, { 0x03C5, 0x0308, 0x0301, 0x0000 } },
+ { 0x03C2, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
+ { 0x03D0, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
+ { 0x03D1, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x03D2, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
+ { 0x03D3, { 0x03CD, 0x0000, 0x0000, 0x0000 } },
+ { 0x03D4, { 0x03CB, 0x0000, 0x0000, 0x0000 } },
+ { 0x03D5, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
+ { 0x03D6, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
+ { 0x03D8, { 0x03D9, 0x0000, 0x0000, 0x0000 } },
+ { 0x03DA, { 0x03DB, 0x0000, 0x0000, 0x0000 } },
+ { 0x03DC, { 0x03DD, 0x0000, 0x0000, 0x0000 } },
+ { 0x03DE, { 0x03DF, 0x0000, 0x0000, 0x0000 } },
+ { 0x03E0, { 0x03E1, 0x0000, 0x0000, 0x0000 } },
+ { 0x03E2, { 0x03E3, 0x0000, 0x0000, 0x0000 } },
+ { 0x03E4, { 0x03E5, 0x0000, 0x0000, 0x0000 } },
+ { 0x03E6, { 0x03E7, 0x0000, 0x0000, 0x0000 } },
+ { 0x03E8, { 0x03E9, 0x0000, 0x0000, 0x0000 } },
+ { 0x03EA, { 0x03EB, 0x0000, 0x0000, 0x0000 } },
+ { 0x03EC, { 0x03ED, 0x0000, 0x0000, 0x0000 } },
+ { 0x03EE, { 0x03EF, 0x0000, 0x0000, 0x0000 } },
+ { 0x03F0, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
+ { 0x03F1, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
+ { 0x03F2, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
+ { 0x03F4, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x03F5, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
+ { 0x0400, { 0x0450, 0x0000, 0x0000, 0x0000 } },
+ { 0x0401, { 0x0451, 0x0000, 0x0000, 0x0000 } },
+ { 0x0402, { 0x0452, 0x0000, 0x0000, 0x0000 } },
+ { 0x0403, { 0x0453, 0x0000, 0x0000, 0x0000 } },
+ { 0x0404, { 0x0454, 0x0000, 0x0000, 0x0000 } },
+ { 0x0405, { 0x0455, 0x0000, 0x0000, 0x0000 } },
+ { 0x0406, { 0x0456, 0x0000, 0x0000, 0x0000 } },
+ { 0x0407, { 0x0457, 0x0000, 0x0000, 0x0000 } },
+ { 0x0408, { 0x0458, 0x0000, 0x0000, 0x0000 } },
+ { 0x0409, { 0x0459, 0x0000, 0x0000, 0x0000 } },
+ { 0x040A, { 0x045A, 0x0000, 0x0000, 0x0000 } },
+ { 0x040B, { 0x045B, 0x0000, 0x0000, 0x0000 } },
+ { 0x040C, { 0x045C, 0x0000, 0x0000, 0x0000 } },
+ { 0x040D, { 0x045D, 0x0000, 0x0000, 0x0000 } },
+ { 0x040E, { 0x045E, 0x0000, 0x0000, 0x0000 } },
+ { 0x040F, { 0x045F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0410, { 0x0430, 0x0000, 0x0000, 0x0000 } },
+ { 0x0411, { 0x0431, 0x0000, 0x0000, 0x0000 } },
+ { 0x0412, { 0x0432, 0x0000, 0x0000, 0x0000 } },
+ { 0x0413, { 0x0433, 0x0000, 0x0000, 0x0000 } },
+ { 0x0414, { 0x0434, 0x0000, 0x0000, 0x0000 } },
+ { 0x0415, { 0x0435, 0x0000, 0x0000, 0x0000 } },
+ { 0x0416, { 0x0436, 0x0000, 0x0000, 0x0000 } },
+ { 0x0417, { 0x0437, 0x0000, 0x0000, 0x0000 } },
+ { 0x0418, { 0x0438, 0x0000, 0x0000, 0x0000 } },
+ { 0x0419, { 0x0439, 0x0000, 0x0000, 0x0000 } },
+ { 0x041A, { 0x043A, 0x0000, 0x0000, 0x0000 } },
+ { 0x041B, { 0x043B, 0x0000, 0x0000, 0x0000 } },
+ { 0x041C, { 0x043C, 0x0000, 0x0000, 0x0000 } },
+ { 0x041D, { 0x043D, 0x0000, 0x0000, 0x0000 } },
+ { 0x041E, { 0x043E, 0x0000, 0x0000, 0x0000 } },
+ { 0x041F, { 0x043F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0420, { 0x0440, 0x0000, 0x0000, 0x0000 } },
+ { 0x0421, { 0x0441, 0x0000, 0x0000, 0x0000 } },
+ { 0x0422, { 0x0442, 0x0000, 0x0000, 0x0000 } },
+ { 0x0423, { 0x0443, 0x0000, 0x0000, 0x0000 } },
+ { 0x0424, { 0x0444, 0x0000, 0x0000, 0x0000 } },
+ { 0x0425, { 0x0445, 0x0000, 0x0000, 0x0000 } },
+ { 0x0426, { 0x0446, 0x0000, 0x0000, 0x0000 } },
+ { 0x0427, { 0x0447, 0x0000, 0x0000, 0x0000 } },
+ { 0x0428, { 0x0448, 0x0000, 0x0000, 0x0000 } },
+ { 0x0429, { 0x0449, 0x0000, 0x0000, 0x0000 } },
+ { 0x042A, { 0x044A, 0x0000, 0x0000, 0x0000 } },
+ { 0x042B, { 0x044B, 0x0000, 0x0000, 0x0000 } },
+ { 0x042C, { 0x044C, 0x0000, 0x0000, 0x0000 } },
+ { 0x042D, { 0x044D, 0x0000, 0x0000, 0x0000 } },
+ { 0x042E, { 0x044E, 0x0000, 0x0000, 0x0000 } },
+ { 0x042F, { 0x044F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0460, { 0x0461, 0x0000, 0x0000, 0x0000 } },
+ { 0x0462, { 0x0463, 0x0000, 0x0000, 0x0000 } },
+ { 0x0464, { 0x0465, 0x0000, 0x0000, 0x0000 } },
+ { 0x0466, { 0x0467, 0x0000, 0x0000, 0x0000 } },
+ { 0x0468, { 0x0469, 0x0000, 0x0000, 0x0000 } },
+ { 0x046A, { 0x046B, 0x0000, 0x0000, 0x0000 } },
+ { 0x046C, { 0x046D, 0x0000, 0x0000, 0x0000 } },
+ { 0x046E, { 0x046F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0470, { 0x0471, 0x0000, 0x0000, 0x0000 } },
+ { 0x0472, { 0x0473, 0x0000, 0x0000, 0x0000 } },
+ { 0x0474, { 0x0475, 0x0000, 0x0000, 0x0000 } },
+ { 0x0476, { 0x0477, 0x0000, 0x0000, 0x0000 } },
+ { 0x0478, { 0x0479, 0x0000, 0x0000, 0x0000 } },
+ { 0x047A, { 0x047B, 0x0000, 0x0000, 0x0000 } },
+ { 0x047C, { 0x047D, 0x0000, 0x0000, 0x0000 } },
+ { 0x047E, { 0x047F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0480, { 0x0481, 0x0000, 0x0000, 0x0000 } },
+ { 0x048A, { 0x048B, 0x0000, 0x0000, 0x0000 } },
+ { 0x048C, { 0x048D, 0x0000, 0x0000, 0x0000 } },
+ { 0x048E, { 0x048F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0490, { 0x0491, 0x0000, 0x0000, 0x0000 } },
+ { 0x0492, { 0x0493, 0x0000, 0x0000, 0x0000 } },
+ { 0x0494, { 0x0495, 0x0000, 0x0000, 0x0000 } },
+ { 0x0496, { 0x0497, 0x0000, 0x0000, 0x0000 } },
+ { 0x0498, { 0x0499, 0x0000, 0x0000, 0x0000 } },
+ { 0x049A, { 0x049B, 0x0000, 0x0000, 0x0000 } },
+ { 0x049C, { 0x049D, 0x0000, 0x0000, 0x0000 } },
+ { 0x049E, { 0x049F, 0x0000, 0x0000, 0x0000 } },
+ { 0x04A0, { 0x04A1, 0x0000, 0x0000, 0x0000 } },
+ { 0x04A2, { 0x04A3, 0x0000, 0x0000, 0x0000 } },
+ { 0x04A4, { 0x04A5, 0x0000, 0x0000, 0x0000 } },
+ { 0x04A6, { 0x04A7, 0x0000, 0x0000, 0x0000 } },
+ { 0x04A8, { 0x04A9, 0x0000, 0x0000, 0x0000 } },
+ { 0x04AA, { 0x04AB, 0x0000, 0x0000, 0x0000 } },
+ { 0x04AC, { 0x04AD, 0x0000, 0x0000, 0x0000 } },
+ { 0x04AE, { 0x04AF, 0x0000, 0x0000, 0x0000 } },
+ { 0x04B0, { 0x04B1, 0x0000, 0x0000, 0x0000 } },
+ { 0x04B2, { 0x04B3, 0x0000, 0x0000, 0x0000 } },
+ { 0x04B4, { 0x04B5, 0x0000, 0x0000, 0x0000 } },
+ { 0x04B6, { 0x04B7, 0x0000, 0x0000, 0x0000 } },
+ { 0x04B8, { 0x04B9, 0x0000, 0x0000, 0x0000 } },
+ { 0x04BA, { 0x04BB, 0x0000, 0x0000, 0x0000 } },
+ { 0x04BC, { 0x04BD, 0x0000, 0x0000, 0x0000 } },
+ { 0x04BE, { 0x04BF, 0x0000, 0x0000, 0x0000 } },
+ { 0x04C1, { 0x04C2, 0x0000, 0x0000, 0x0000 } },
+ { 0x04C3, { 0x04C4, 0x0000, 0x0000, 0x0000 } },
+ { 0x04C5, { 0x04C6, 0x0000, 0x0000, 0x0000 } },
+ { 0x04C7, { 0x04C8, 0x0000, 0x0000, 0x0000 } },
+ { 0x04C9, { 0x04CA, 0x0000, 0x0000, 0x0000 } },
+ { 0x04CB, { 0x04CC, 0x0000, 0x0000, 0x0000 } },
+ { 0x04CD, { 0x04CE, 0x0000, 0x0000, 0x0000 } },
+ { 0x04D0, { 0x04D1, 0x0000, 0x0000, 0x0000 } },
+ { 0x04D2, { 0x04D3, 0x0000, 0x0000, 0x0000 } },
+ { 0x04D4, { 0x04D5, 0x0000, 0x0000, 0x0000 } },
+ { 0x04D6, { 0x04D7, 0x0000, 0x0000, 0x0000 } },
+ { 0x04D8, { 0x04D9, 0x0000, 0x0000, 0x0000 } },
+ { 0x04DA, { 0x04DB, 0x0000, 0x0000, 0x0000 } },
+ { 0x04DC, { 0x04DD, 0x0000, 0x0000, 0x0000 } },
+ { 0x04DE, { 0x04DF, 0x0000, 0x0000, 0x0000 } },
+ { 0x04E0, { 0x04E1, 0x0000, 0x0000, 0x0000 } },
+ { 0x04E2, { 0x04E3, 0x0000, 0x0000, 0x0000 } },
+ { 0x04E4, { 0x04E5, 0x0000, 0x0000, 0x0000 } },
+ { 0x04E6, { 0x04E7, 0x0000, 0x0000, 0x0000 } },
+ { 0x04E8, { 0x04E9, 0x0000, 0x0000, 0x0000 } },
+ { 0x04EA, { 0x04EB, 0x0000, 0x0000, 0x0000 } },
+ { 0x04EC, { 0x04ED, 0x0000, 0x0000, 0x0000 } },
+ { 0x04EE, { 0x04EF, 0x0000, 0x0000, 0x0000 } },
+ { 0x04F0, { 0x04F1, 0x0000, 0x0000, 0x0000 } },
+ { 0x04F2, { 0x04F3, 0x0000, 0x0000, 0x0000 } },
+ { 0x04F4, { 0x04F5, 0x0000, 0x0000, 0x0000 } },
+ { 0x04F8, { 0x04F9, 0x0000, 0x0000, 0x0000 } },
+ { 0x0500, { 0x0501, 0x0000, 0x0000, 0x0000 } },
+ { 0x0502, { 0x0503, 0x0000, 0x0000, 0x0000 } },
+ { 0x0504, { 0x0505, 0x0000, 0x0000, 0x0000 } },
+ { 0x0506, { 0x0507, 0x0000, 0x0000, 0x0000 } },
+ { 0x0508, { 0x0509, 0x0000, 0x0000, 0x0000 } },
+ { 0x050A, { 0x050B, 0x0000, 0x0000, 0x0000 } },
+ { 0x050C, { 0x050D, 0x0000, 0x0000, 0x0000 } },
+ { 0x050E, { 0x050F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0531, { 0x0561, 0x0000, 0x0000, 0x0000 } },
+ { 0x0532, { 0x0562, 0x0000, 0x0000, 0x0000 } },
+ { 0x0533, { 0x0563, 0x0000, 0x0000, 0x0000 } },
+ { 0x0534, { 0x0564, 0x0000, 0x0000, 0x0000 } },
+ { 0x0535, { 0x0565, 0x0000, 0x0000, 0x0000 } },
+ { 0x0536, { 0x0566, 0x0000, 0x0000, 0x0000 } },
+ { 0x0537, { 0x0567, 0x0000, 0x0000, 0x0000 } },
+ { 0x0538, { 0x0568, 0x0000, 0x0000, 0x0000 } },
+ { 0x0539, { 0x0569, 0x0000, 0x0000, 0x0000 } },
+ { 0x053A, { 0x056A, 0x0000, 0x0000, 0x0000 } },
+ { 0x053B, { 0x056B, 0x0000, 0x0000, 0x0000 } },
+ { 0x053C, { 0x056C, 0x0000, 0x0000, 0x0000 } },
+ { 0x053D, { 0x056D, 0x0000, 0x0000, 0x0000 } },
+ { 0x053E, { 0x056E, 0x0000, 0x0000, 0x0000 } },
+ { 0x053F, { 0x056F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0540, { 0x0570, 0x0000, 0x0000, 0x0000 } },
+ { 0x0541, { 0x0571, 0x0000, 0x0000, 0x0000 } },
+ { 0x0542, { 0x0572, 0x0000, 0x0000, 0x0000 } },
+ { 0x0543, { 0x0573, 0x0000, 0x0000, 0x0000 } },
+ { 0x0544, { 0x0574, 0x0000, 0x0000, 0x0000 } },
+ { 0x0545, { 0x0575, 0x0000, 0x0000, 0x0000 } },
+ { 0x0546, { 0x0576, 0x0000, 0x0000, 0x0000 } },
+ { 0x0547, { 0x0577, 0x0000, 0x0000, 0x0000 } },
+ { 0x0548, { 0x0578, 0x0000, 0x0000, 0x0000 } },
+ { 0x0549, { 0x0579, 0x0000, 0x0000, 0x0000 } },
+ { 0x054A, { 0x057A, 0x0000, 0x0000, 0x0000 } },
+ { 0x054B, { 0x057B, 0x0000, 0x0000, 0x0000 } },
+ { 0x054C, { 0x057C, 0x0000, 0x0000, 0x0000 } },
+ { 0x054D, { 0x057D, 0x0000, 0x0000, 0x0000 } },
+ { 0x054E, { 0x057E, 0x0000, 0x0000, 0x0000 } },
+ { 0x054F, { 0x057F, 0x0000, 0x0000, 0x0000 } },
+ { 0x0550, { 0x0580, 0x0000, 0x0000, 0x0000 } },
+ { 0x0551, { 0x0581, 0x0000, 0x0000, 0x0000 } },
+ { 0x0552, { 0x0582, 0x0000, 0x0000, 0x0000 } },
+ { 0x0553, { 0x0583, 0x0000, 0x0000, 0x0000 } },
+ { 0x0554, { 0x0584, 0x0000, 0x0000, 0x0000 } },
+ { 0x0555, { 0x0585, 0x0000, 0x0000, 0x0000 } },
+ { 0x0556, { 0x0586, 0x0000, 0x0000, 0x0000 } },
+ { 0x0587, { 0x0565, 0x0582, 0x0000, 0x0000 } },
+ { 0x1E00, { 0x1E01, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E02, { 0x1E03, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E04, { 0x1E05, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E06, { 0x1E07, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E08, { 0x1E09, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E0A, { 0x1E0B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E0C, { 0x1E0D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E0E, { 0x1E0F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E10, { 0x1E11, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E12, { 0x1E13, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E14, { 0x1E15, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E16, { 0x1E17, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E18, { 0x1E19, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E1A, { 0x1E1B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E1C, { 0x1E1D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E1E, { 0x1E1F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E20, { 0x1E21, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E22, { 0x1E23, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E24, { 0x1E25, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E26, { 0x1E27, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E28, { 0x1E29, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E2A, { 0x1E2B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E2C, { 0x1E2D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E2E, { 0x1E2F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E30, { 0x1E31, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E32, { 0x1E33, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E34, { 0x1E35, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E36, { 0x1E37, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E38, { 0x1E39, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E3A, { 0x1E3B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E3C, { 0x1E3D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E3E, { 0x1E3F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E40, { 0x1E41, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E42, { 0x1E43, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E44, { 0x1E45, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E46, { 0x1E47, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E48, { 0x1E49, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E4A, { 0x1E4B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E4C, { 0x1E4D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E4E, { 0x1E4F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E50, { 0x1E51, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E52, { 0x1E53, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E54, { 0x1E55, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E56, { 0x1E57, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E58, { 0x1E59, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E5A, { 0x1E5B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E5C, { 0x1E5D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E5E, { 0x1E5F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E60, { 0x1E61, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E62, { 0x1E63, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E64, { 0x1E65, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E66, { 0x1E67, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E68, { 0x1E69, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E6A, { 0x1E6B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E6C, { 0x1E6D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E6E, { 0x1E6F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E70, { 0x1E71, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E72, { 0x1E73, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E74, { 0x1E75, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E76, { 0x1E77, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E78, { 0x1E79, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E7A, { 0x1E7B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E7C, { 0x1E7D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E7E, { 0x1E7F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E80, { 0x1E81, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E82, { 0x1E83, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E84, { 0x1E85, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E86, { 0x1E87, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E88, { 0x1E89, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E8A, { 0x1E8B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E8C, { 0x1E8D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E8E, { 0x1E8F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E90, { 0x1E91, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E92, { 0x1E93, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E94, { 0x1E95, 0x0000, 0x0000, 0x0000 } },
+ { 0x1E96, { 0x0068, 0x0331, 0x0000, 0x0000 } },
+ { 0x1E97, { 0x0074, 0x0308, 0x0000, 0x0000 } },
+ { 0x1E98, { 0x0077, 0x030A, 0x0000, 0x0000 } },
+ { 0x1E99, { 0x0079, 0x030A, 0x0000, 0x0000 } },
+ { 0x1E9A, { 0x0061, 0x02BE, 0x0000, 0x0000 } },
+ { 0x1E9B, { 0x1E61, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EA0, { 0x1EA1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EA2, { 0x1EA3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EA4, { 0x1EA5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EA6, { 0x1EA7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EA8, { 0x1EA9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EAA, { 0x1EAB, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EAC, { 0x1EAD, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EAE, { 0x1EAF, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EB0, { 0x1EB1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EB2, { 0x1EB3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EB4, { 0x1EB5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EB6, { 0x1EB7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EB8, { 0x1EB9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EBA, { 0x1EBB, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EBC, { 0x1EBD, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EBE, { 0x1EBF, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EC0, { 0x1EC1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EC2, { 0x1EC3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EC4, { 0x1EC5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EC6, { 0x1EC7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EC8, { 0x1EC9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1ECA, { 0x1ECB, 0x0000, 0x0000, 0x0000 } },
+ { 0x1ECC, { 0x1ECD, 0x0000, 0x0000, 0x0000 } },
+ { 0x1ECE, { 0x1ECF, 0x0000, 0x0000, 0x0000 } },
+ { 0x1ED0, { 0x1ED1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1ED2, { 0x1ED3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1ED4, { 0x1ED5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1ED6, { 0x1ED7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1ED8, { 0x1ED9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EDA, { 0x1EDB, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EDC, { 0x1EDD, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EDE, { 0x1EDF, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EE0, { 0x1EE1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EE2, { 0x1EE3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EE4, { 0x1EE5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EE6, { 0x1EE7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EE8, { 0x1EE9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EEA, { 0x1EEB, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EEC, { 0x1EED, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EEE, { 0x1EEF, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EF0, { 0x1EF1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EF2, { 0x1EF3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EF4, { 0x1EF5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EF6, { 0x1EF7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1EF8, { 0x1EF9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F08, { 0x1F00, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F09, { 0x1F01, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F0A, { 0x1F02, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F0B, { 0x1F03, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F0C, { 0x1F04, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F0D, { 0x1F05, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F0E, { 0x1F06, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F0F, { 0x1F07, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F18, { 0x1F10, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F19, { 0x1F11, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F1A, { 0x1F12, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F1B, { 0x1F13, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F1C, { 0x1F14, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F1D, { 0x1F15, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F28, { 0x1F20, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F29, { 0x1F21, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F2A, { 0x1F22, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F2B, { 0x1F23, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F2C, { 0x1F24, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F2D, { 0x1F25, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F2E, { 0x1F26, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F2F, { 0x1F27, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F38, { 0x1F30, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F39, { 0x1F31, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F3A, { 0x1F32, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F3B, { 0x1F33, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F3C, { 0x1F34, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F3D, { 0x1F35, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F3E, { 0x1F36, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F3F, { 0x1F37, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F48, { 0x1F40, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F49, { 0x1F41, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F4A, { 0x1F42, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F4B, { 0x1F43, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F4C, { 0x1F44, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F4D, { 0x1F45, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F50, { 0x03C5, 0x0313, 0x0000, 0x0000 } },
+ { 0x1F52, { 0x03C5, 0x0313, 0x0300, 0x0000 } },
+ { 0x1F54, { 0x03C5, 0x0313, 0x0301, 0x0000 } },
+ { 0x1F56, { 0x03C5, 0x0313, 0x0342, 0x0000 } },
+ { 0x1F59, { 0x1F51, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F5B, { 0x1F53, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F5D, { 0x1F55, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F5F, { 0x1F57, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F68, { 0x1F60, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F69, { 0x1F61, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F6A, { 0x1F62, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F6B, { 0x1F63, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F6C, { 0x1F64, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F6D, { 0x1F65, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F6E, { 0x1F66, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F6F, { 0x1F67, 0x0000, 0x0000, 0x0000 } },
+ { 0x1F80, { 0x1F00, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F81, { 0x1F01, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F82, { 0x1F02, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F83, { 0x1F03, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F84, { 0x1F04, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F85, { 0x1F05, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F86, { 0x1F06, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F87, { 0x1F07, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F88, { 0x1F00, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F89, { 0x1F01, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F8A, { 0x1F02, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F8B, { 0x1F03, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F8C, { 0x1F04, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F8D, { 0x1F05, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F8E, { 0x1F06, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F8F, { 0x1F07, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F90, { 0x1F20, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F91, { 0x1F21, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F92, { 0x1F22, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F93, { 0x1F23, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F94, { 0x1F24, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F95, { 0x1F25, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F96, { 0x1F26, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F97, { 0x1F27, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F98, { 0x1F20, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F99, { 0x1F21, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F9A, { 0x1F22, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F9B, { 0x1F23, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F9C, { 0x1F24, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F9D, { 0x1F25, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F9E, { 0x1F26, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1F9F, { 0x1F27, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FA0, { 0x1F60, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FA1, { 0x1F61, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FA2, { 0x1F62, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FA3, { 0x1F63, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FA4, { 0x1F64, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FA5, { 0x1F65, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FA6, { 0x1F66, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FA7, { 0x1F67, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FA8, { 0x1F60, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FA9, { 0x1F61, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FAA, { 0x1F62, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FAB, { 0x1F63, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FAC, { 0x1F64, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FAD, { 0x1F65, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FAE, { 0x1F66, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FAF, { 0x1F67, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FB2, { 0x1F70, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FB3, { 0x03B1, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FB4, { 0x03AC, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FB6, { 0x03B1, 0x0342, 0x0000, 0x0000 } },
+ { 0x1FB7, { 0x03B1, 0x0342, 0x03B9, 0x0000 } },
+ { 0x1FB8, { 0x1FB0, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FB9, { 0x1FB1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FBA, { 0x1F70, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FBB, { 0x1F71, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FBC, { 0x03B1, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FBE, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FC2, { 0x1F74, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FC3, { 0x03B7, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FC4, { 0x03AE, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FC6, { 0x03B7, 0x0342, 0x0000, 0x0000 } },
+ { 0x1FC7, { 0x03B7, 0x0342, 0x03B9, 0x0000 } },
+ { 0x1FC8, { 0x1F72, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FC9, { 0x1F73, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FCA, { 0x1F74, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FCB, { 0x1F75, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FCC, { 0x03B7, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FD2, { 0x03B9, 0x0308, 0x0300, 0x0000 } },
+ { 0x1FD3, { 0x03B9, 0x0308, 0x0301, 0x0000 } },
+ { 0x1FD6, { 0x03B9, 0x0342, 0x0000, 0x0000 } },
+ { 0x1FD7, { 0x03B9, 0x0308, 0x0342, 0x0000 } },
+ { 0x1FD8, { 0x1FD0, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FD9, { 0x1FD1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FDA, { 0x1F76, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FDB, { 0x1F77, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FE2, { 0x03C5, 0x0308, 0x0300, 0x0000 } },
+ { 0x1FE3, { 0x03C5, 0x0308, 0x0301, 0x0000 } },
+ { 0x1FE4, { 0x03C1, 0x0313, 0x0000, 0x0000 } },
+ { 0x1FE6, { 0x03C5, 0x0342, 0x0000, 0x0000 } },
+ { 0x1FE7, { 0x03C5, 0x0308, 0x0342, 0x0000 } },
+ { 0x1FE8, { 0x1FE0, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FE9, { 0x1FE1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FEA, { 0x1F7A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FEB, { 0x1F7B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FEC, { 0x1FE5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FF2, { 0x1F7C, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FF3, { 0x03C9, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FF4, { 0x03CE, 0x03B9, 0x0000, 0x0000 } },
+ { 0x1FF6, { 0x03C9, 0x0342, 0x0000, 0x0000 } },
+ { 0x1FF7, { 0x03C9, 0x0342, 0x03B9, 0x0000 } },
+ { 0x1FF8, { 0x1F78, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FF9, { 0x1F79, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FFA, { 0x1F7C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FFB, { 0x1F7D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1FFC, { 0x03C9, 0x03B9, 0x0000, 0x0000 } },
+ { 0x20A8, { 0x0072, 0x0073, 0x0000, 0x0000 } },
+ { 0x2102, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x2103, { 0x00B0, 0x0063, 0x0000, 0x0000 } },
+ { 0x2107, { 0x025B, 0x0000, 0x0000, 0x0000 } },
+ { 0x2109, { 0x00B0, 0x0066, 0x0000, 0x0000 } },
+ { 0x210B, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x210C, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x210D, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x2110, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x2111, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x2112, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x2115, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x2116, { 0x006E, 0x006F, 0x0000, 0x0000 } },
+ { 0x2119, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x211A, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x211B, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x211C, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x211D, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x2120, { 0x0073, 0x006D, 0x0000, 0x0000 } },
+ { 0x2121, { 0x0074, 0x0065, 0x006C, 0x0000 } },
+ { 0x2122, { 0x0074, 0x006D, 0x0000, 0x0000 } },
+ { 0x2124, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x2126, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
+ { 0x2128, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x212A, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x212B, { 0x00E5, 0x0000, 0x0000, 0x0000 } },
+ { 0x212C, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x212D, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x2130, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x2131, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x2133, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x213E, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
+ { 0x213F, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
+ { 0x2145, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x2160, { 0x2170, 0x0000, 0x0000, 0x0000 } },
+ { 0x2161, { 0x2171, 0x0000, 0x0000, 0x0000 } },
+ { 0x2162, { 0x2172, 0x0000, 0x0000, 0x0000 } },
+ { 0x2163, { 0x2173, 0x0000, 0x0000, 0x0000 } },
+ { 0x2164, { 0x2174, 0x0000, 0x0000, 0x0000 } },
+ { 0x2165, { 0x2175, 0x0000, 0x0000, 0x0000 } },
+ { 0x2166, { 0x2176, 0x0000, 0x0000, 0x0000 } },
+ { 0x2167, { 0x2177, 0x0000, 0x0000, 0x0000 } },
+ { 0x2168, { 0x2178, 0x0000, 0x0000, 0x0000 } },
+ { 0x2169, { 0x2179, 0x0000, 0x0000, 0x0000 } },
+ { 0x216A, { 0x217A, 0x0000, 0x0000, 0x0000 } },
+ { 0x216B, { 0x217B, 0x0000, 0x0000, 0x0000 } },
+ { 0x216C, { 0x217C, 0x0000, 0x0000, 0x0000 } },
+ { 0x216D, { 0x217D, 0x0000, 0x0000, 0x0000 } },
+ { 0x216E, { 0x217E, 0x0000, 0x0000, 0x0000 } },
+ { 0x216F, { 0x217F, 0x0000, 0x0000, 0x0000 } },
+ { 0x24B6, { 0x24D0, 0x0000, 0x0000, 0x0000 } },
+ { 0x24B7, { 0x24D1, 0x0000, 0x0000, 0x0000 } },
+ { 0x24B8, { 0x24D2, 0x0000, 0x0000, 0x0000 } },
+ { 0x24B9, { 0x24D3, 0x0000, 0x0000, 0x0000 } },
+ { 0x24BA, { 0x24D4, 0x0000, 0x0000, 0x0000 } },
+ { 0x24BB, { 0x24D5, 0x0000, 0x0000, 0x0000 } },
+ { 0x24BC, { 0x24D6, 0x0000, 0x0000, 0x0000 } },
+ { 0x24BD, { 0x24D7, 0x0000, 0x0000, 0x0000 } },
+ { 0x24BE, { 0x24D8, 0x0000, 0x0000, 0x0000 } },
+ { 0x24BF, { 0x24D9, 0x0000, 0x0000, 0x0000 } },
+ { 0x24C0, { 0x24DA, 0x0000, 0x0000, 0x0000 } },
+ { 0x24C1, { 0x24DB, 0x0000, 0x0000, 0x0000 } },
+ { 0x24C2, { 0x24DC, 0x0000, 0x0000, 0x0000 } },
+ { 0x24C3, { 0x24DD, 0x0000, 0x0000, 0x0000 } },
+ { 0x24C4, { 0x24DE, 0x0000, 0x0000, 0x0000 } },
+ { 0x24C5, { 0x24DF, 0x0000, 0x0000, 0x0000 } },
+ { 0x24C6, { 0x24E0, 0x0000, 0x0000, 0x0000 } },
+ { 0x24C7, { 0x24E1, 0x0000, 0x0000, 0x0000 } },
+ { 0x24C8, { 0x24E2, 0x0000, 0x0000, 0x0000 } },
+ { 0x24C9, { 0x24E3, 0x0000, 0x0000, 0x0000 } },
+ { 0x24CA, { 0x24E4, 0x0000, 0x0000, 0x0000 } },
+ { 0x24CB, { 0x24E5, 0x0000, 0x0000, 0x0000 } },
+ { 0x24CC, { 0x24E6, 0x0000, 0x0000, 0x0000 } },
+ { 0x24CD, { 0x24E7, 0x0000, 0x0000, 0x0000 } },
+ { 0x24CE, { 0x24E8, 0x0000, 0x0000, 0x0000 } },
+ { 0x24CF, { 0x24E9, 0x0000, 0x0000, 0x0000 } },
+ { 0x3371, { 0x0068, 0x0070, 0x0061, 0x0000 } },
+ { 0x3373, { 0x0061, 0x0075, 0x0000, 0x0000 } },
+ { 0x3375, { 0x006F, 0x0076, 0x0000, 0x0000 } },
+ { 0x3380, { 0x0070, 0x0061, 0x0000, 0x0000 } },
+ { 0x3381, { 0x006E, 0x0061, 0x0000, 0x0000 } },
+ { 0x3382, { 0x03BC, 0x0061, 0x0000, 0x0000 } },
+ { 0x3383, { 0x006D, 0x0061, 0x0000, 0x0000 } },
+ { 0x3384, { 0x006B, 0x0061, 0x0000, 0x0000 } },
+ { 0x3385, { 0x006B, 0x0062, 0x0000, 0x0000 } },
+ { 0x3386, { 0x006D, 0x0062, 0x0000, 0x0000 } },
+ { 0x3387, { 0x0067, 0x0062, 0x0000, 0x0000 } },
+ { 0x338A, { 0x0070, 0x0066, 0x0000, 0x0000 } },
+ { 0x338B, { 0x006E, 0x0066, 0x0000, 0x0000 } },
+ { 0x338C, { 0x03BC, 0x0066, 0x0000, 0x0000 } },
+ { 0x3390, { 0x0068, 0x007A, 0x0000, 0x0000 } },
+ { 0x3391, { 0x006B, 0x0068, 0x007A, 0x0000 } },
+ { 0x3392, { 0x006D, 0x0068, 0x007A, 0x0000 } },
+ { 0x3393, { 0x0067, 0x0068, 0x007A, 0x0000 } },
+ { 0x3394, { 0x0074, 0x0068, 0x007A, 0x0000 } },
+ { 0x33A9, { 0x0070, 0x0061, 0x0000, 0x0000 } },
+ { 0x33AA, { 0x006B, 0x0070, 0x0061, 0x0000 } },
+ { 0x33AB, { 0x006D, 0x0070, 0x0061, 0x0000 } },
+ { 0x33AC, { 0x0067, 0x0070, 0x0061, 0x0000 } },
+ { 0x33B4, { 0x0070, 0x0076, 0x0000, 0x0000 } },
+ { 0x33B5, { 0x006E, 0x0076, 0x0000, 0x0000 } },
+ { 0x33B6, { 0x03BC, 0x0076, 0x0000, 0x0000 } },
+ { 0x33B7, { 0x006D, 0x0076, 0x0000, 0x0000 } },
+ { 0x33B8, { 0x006B, 0x0076, 0x0000, 0x0000 } },
+ { 0x33B9, { 0x006D, 0x0076, 0x0000, 0x0000 } },
+ { 0x33BA, { 0x0070, 0x0077, 0x0000, 0x0000 } },
+ { 0x33BB, { 0x006E, 0x0077, 0x0000, 0x0000 } },
+ { 0x33BC, { 0x03BC, 0x0077, 0x0000, 0x0000 } },
+ { 0x33BD, { 0x006D, 0x0077, 0x0000, 0x0000 } },
+ { 0x33BE, { 0x006B, 0x0077, 0x0000, 0x0000 } },
+ { 0x33BF, { 0x006D, 0x0077, 0x0000, 0x0000 } },
+ { 0x33C0, { 0x006B, 0x03C9, 0x0000, 0x0000 } },
+ { 0x33C1, { 0x006D, 0x03C9, 0x0000, 0x0000 } },
+ { 0x33C3, { 0x0062, 0x0071, 0x0000, 0x0000 } },
+ { 0x33C6, { 0x0063, 0x2215, 0x006B, 0x0067 } },
+ { 0x33C7, { 0x0063, 0x006F, 0x002E, 0x0000 } },
+ { 0x33C8, { 0x0064, 0x0062, 0x0000, 0x0000 } },
+ { 0x33C9, { 0x0067, 0x0079, 0x0000, 0x0000 } },
+ { 0x33CB, { 0x0068, 0x0070, 0x0000, 0x0000 } },
+ { 0x33CD, { 0x006B, 0x006B, 0x0000, 0x0000 } },
+ { 0x33CE, { 0x006B, 0x006D, 0x0000, 0x0000 } },
+ { 0x33D7, { 0x0070, 0x0068, 0x0000, 0x0000 } },
+ { 0x33D9, { 0x0070, 0x0070, 0x006D, 0x0000 } },
+ { 0x33DA, { 0x0070, 0x0072, 0x0000, 0x0000 } },
+ { 0x33DC, { 0x0073, 0x0076, 0x0000, 0x0000 } },
+ { 0x33DD, { 0x0077, 0x0062, 0x0000, 0x0000 } },
+ { 0xFB00, { 0x0066, 0x0066, 0x0000, 0x0000 } },
+ { 0xFB01, { 0x0066, 0x0069, 0x0000, 0x0000 } },
+ { 0xFB02, { 0x0066, 0x006C, 0x0000, 0x0000 } },
+ { 0xFB03, { 0x0066, 0x0066, 0x0069, 0x0000 } },
+ { 0xFB04, { 0x0066, 0x0066, 0x006C, 0x0000 } },
+ { 0xFB05, { 0x0073, 0x0074, 0x0000, 0x0000 } },
+ { 0xFB06, { 0x0073, 0x0074, 0x0000, 0x0000 } },
+ { 0xFB13, { 0x0574, 0x0576, 0x0000, 0x0000 } },
+ { 0xFB14, { 0x0574, 0x0565, 0x0000, 0x0000 } },
+ { 0xFB15, { 0x0574, 0x056B, 0x0000, 0x0000 } },
+ { 0xFB16, { 0x057E, 0x0576, 0x0000, 0x0000 } },
+ { 0xFB17, { 0x0574, 0x056D, 0x0000, 0x0000 } },
+ { 0xFF21, { 0xFF41, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF22, { 0xFF42, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF23, { 0xFF43, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF24, { 0xFF44, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF25, { 0xFF45, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF26, { 0xFF46, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF27, { 0xFF47, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF28, { 0xFF48, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF29, { 0xFF49, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF2A, { 0xFF4A, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF2B, { 0xFF4B, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF2C, { 0xFF4C, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF2D, { 0xFF4D, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF2E, { 0xFF4E, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF2F, { 0xFF4F, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF30, { 0xFF50, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF31, { 0xFF51, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF32, { 0xFF52, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF33, { 0xFF53, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF34, { 0xFF54, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF35, { 0xFF55, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF36, { 0xFF56, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF37, { 0xFF57, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF38, { 0xFF58, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF39, { 0xFF59, 0x0000, 0x0000, 0x0000 } },
+ { 0xFF3A, { 0xFF5A, 0x0000, 0x0000, 0x0000 } },
+ { 0x10400, { 0xd801, 0xdc28, 0x0000, 0x0000 } },
+ { 0x10401, { 0xd801, 0xdc29, 0x0000, 0x0000 } },
+ { 0x10402, { 0xd801, 0xdc2A, 0x0000, 0x0000 } },
+ { 0x10403, { 0xd801, 0xdc2B, 0x0000, 0x0000 } },
+ { 0x10404, { 0xd801, 0xdc2C, 0x0000, 0x0000 } },
+ { 0x10405, { 0xd801, 0xdc2D, 0x0000, 0x0000 } },
+ { 0x10406, { 0xd801, 0xdc2E, 0x0000, 0x0000 } },
+ { 0x10407, { 0xd801, 0xdc2F, 0x0000, 0x0000 } },
+ { 0x10408, { 0xd801, 0xdc30, 0x0000, 0x0000 } },
+ { 0x10409, { 0xd801, 0xdc31, 0x0000, 0x0000 } },
+ { 0x1040A, { 0xd801, 0xdc32, 0x0000, 0x0000 } },
+ { 0x1040B, { 0xd801, 0xdc33, 0x0000, 0x0000 } },
+ { 0x1040C, { 0xd801, 0xdc34, 0x0000, 0x0000 } },
+ { 0x1040D, { 0xd801, 0xdc35, 0x0000, 0x0000 } },
+ { 0x1040E, { 0xd801, 0xdc36, 0x0000, 0x0000 } },
+ { 0x1040F, { 0xd801, 0xdc37, 0x0000, 0x0000 } },
+ { 0x10410, { 0xd801, 0xdc38, 0x0000, 0x0000 } },
+ { 0x10411, { 0xd801, 0xdc39, 0x0000, 0x0000 } },
+ { 0x10412, { 0xd801, 0xdc3A, 0x0000, 0x0000 } },
+ { 0x10413, { 0xd801, 0xdc3B, 0x0000, 0x0000 } },
+ { 0x10414, { 0xd801, 0xdc3C, 0x0000, 0x0000 } },
+ { 0x10415, { 0xd801, 0xdc3D, 0x0000, 0x0000 } },
+ { 0x10416, { 0xd801, 0xdc3E, 0x0000, 0x0000 } },
+ { 0x10417, { 0xd801, 0xdc3F, 0x0000, 0x0000 } },
+ { 0x10418, { 0xd801, 0xdc40, 0x0000, 0x0000 } },
+ { 0x10419, { 0xd801, 0xdc41, 0x0000, 0x0000 } },
+ { 0x1041A, { 0xd801, 0xdc42, 0x0000, 0x0000 } },
+ { 0x1041B, { 0xd801, 0xdc43, 0x0000, 0x0000 } },
+ { 0x1041C, { 0xd801, 0xdc44, 0x0000, 0x0000 } },
+ { 0x1041D, { 0xd801, 0xdc45, 0x0000, 0x0000 } },
+ { 0x1041E, { 0xd801, 0xdc46, 0x0000, 0x0000 } },
+ { 0x1041F, { 0xd801, 0xdc47, 0x0000, 0x0000 } },
+ { 0x10420, { 0xd801, 0xdc48, 0x0000, 0x0000 } },
+ { 0x10421, { 0xd801, 0xdc49, 0x0000, 0x0000 } },
+ { 0x10422, { 0xd801, 0xdc4A, 0x0000, 0x0000 } },
+ { 0x10423, { 0xd801, 0xdc4B, 0x0000, 0x0000 } },
+ { 0x10424, { 0xd801, 0xdc4C, 0x0000, 0x0000 } },
+ { 0x10425, { 0xd801, 0xdc4D, 0x0000, 0x0000 } },
+ { 0x1D400, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D401, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D402, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D403, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D404, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D405, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D406, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D407, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D408, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D409, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D40A, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D40B, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D40C, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D40D, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D40E, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D40F, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D410, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D411, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D412, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D413, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D414, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D415, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D416, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D417, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D418, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D419, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D434, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D435, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D436, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D437, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D438, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D439, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D43A, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D43B, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D43C, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D43D, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D43E, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D43F, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D440, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D441, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D442, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D443, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D444, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D445, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D446, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D447, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D448, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D449, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D44A, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D44B, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D44C, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D44D, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D468, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D469, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D46A, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D46B, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D46C, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D46D, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D46E, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D46F, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D470, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D471, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D472, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D473, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D474, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D475, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D476, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D477, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D478, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D479, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D47A, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D47B, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D47C, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D47D, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D47E, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D47F, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D480, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D481, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D49C, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D49E, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D49F, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4A2, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4A5, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4A6, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4A9, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4AA, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4AB, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4AC, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4AE, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4AF, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4B0, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4B1, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4B2, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4B3, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4B4, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4B5, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4D0, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4D1, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4D2, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4D3, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4D4, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4D5, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4D6, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4D7, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4D8, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4D9, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4DA, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4DB, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4DC, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4DD, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4DE, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4DF, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4E0, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4E1, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4E2, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4E3, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4E4, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4E5, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4E6, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4E7, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4E8, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D4E9, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D504, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D505, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D507, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D508, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D509, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D50A, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D50D, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D50E, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D50F, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D510, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D511, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D512, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D513, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D514, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D516, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D517, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D518, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D519, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D51A, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D51B, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D51C, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D538, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D539, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D53B, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D53C, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D53D, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D53E, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D540, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D541, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D542, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D543, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D544, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D546, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D54A, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D54B, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D54C, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D54D, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D54E, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D54F, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D550, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D56C, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D56D, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D56E, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D56F, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D570, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D571, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D572, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D573, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D574, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D575, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D576, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D577, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D578, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D579, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D57A, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D57B, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D57C, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D57D, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D57E, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D57F, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D580, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D581, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D582, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D583, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D584, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D585, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5A0, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5A1, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5A2, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5A3, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5A4, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5A5, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5A6, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5A7, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5A8, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5A9, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5AA, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5AB, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5AC, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5AD, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5AE, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5AF, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5B0, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5B1, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5B2, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5B3, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5B4, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5B5, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5B6, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5B7, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5B8, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5B9, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5D4, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5D5, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5D6, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5D7, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5D8, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5D9, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5DA, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5DB, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5DC, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5DD, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5DE, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5DF, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5E0, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5E1, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5E2, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5E3, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5E4, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5E5, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5E6, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5E7, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5E8, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5E9, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5EA, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5EB, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5EC, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D5ED, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D608, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D609, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D60A, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D60B, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D60C, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D60D, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D60E, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D60F, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D610, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D611, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D612, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D613, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D614, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D615, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D616, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D617, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D618, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D619, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D61A, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D61B, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D61C, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D61D, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D61E, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D61F, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D620, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D621, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D63C, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D63D, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D63E, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D63F, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D640, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D641, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D642, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D643, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D644, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D645, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D646, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D647, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D648, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D649, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D64A, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D64B, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D64C, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D64D, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D64E, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D64F, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D650, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D651, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D652, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D653, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D654, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D655, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D670, { 0x0061, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D671, { 0x0062, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D672, { 0x0063, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D673, { 0x0064, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D674, { 0x0065, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D675, { 0x0066, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D676, { 0x0067, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D677, { 0x0068, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D678, { 0x0069, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D679, { 0x006A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D67A, { 0x006B, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D67B, { 0x006C, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D67C, { 0x006D, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D67D, { 0x006E, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D67E, { 0x006F, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D67F, { 0x0070, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D680, { 0x0071, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D681, { 0x0072, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D682, { 0x0073, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D683, { 0x0074, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D684, { 0x0075, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D685, { 0x0076, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D686, { 0x0077, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D687, { 0x0078, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D688, { 0x0079, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D689, { 0x007A, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6A8, { 0x03B1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6A9, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6AA, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6AB, { 0x03B4, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6AC, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6AD, { 0x03B6, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6AE, { 0x03B7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6AF, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6B0, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6B1, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6B2, { 0x03BB, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6B3, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6B4, { 0x03BD, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6B5, { 0x03BE, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6B6, { 0x03BF, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6B7, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6B8, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6B9, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6BA, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6BB, { 0x03C4, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6BC, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6BD, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6BE, { 0x03C7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6BF, { 0x03C8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6C0, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6D3, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6E2, { 0x03B1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6E3, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6E4, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6E5, { 0x03B4, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6E6, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6E7, { 0x03B6, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6E8, { 0x03B7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6E9, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6EA, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6EB, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6EC, { 0x03BB, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6ED, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6EE, { 0x03BD, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6EF, { 0x03BE, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6F0, { 0x03BF, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6F1, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6F2, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6F3, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6F4, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6F5, { 0x03C4, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6F6, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6F7, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6F8, { 0x03C7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6F9, { 0x03C8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D6FA, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D70D, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D71C, { 0x03B1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D71D, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D71E, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D71F, { 0x03B4, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D720, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D721, { 0x03B6, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D722, { 0x03B7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D723, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D724, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D725, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D726, { 0x03BB, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D727, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D728, { 0x03BD, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D729, { 0x03BE, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D72A, { 0x03BF, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D72B, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D72C, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D72D, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D72E, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D72F, { 0x03C4, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D730, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D731, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D732, { 0x03C7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D733, { 0x03C8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D734, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D747, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D756, { 0x03B1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D757, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D758, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D759, { 0x03B4, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D75A, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D75B, { 0x03B6, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D75C, { 0x03B7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D75D, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D75E, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D75F, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D760, { 0x03BB, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D761, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D762, { 0x03BD, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D763, { 0x03BE, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D764, { 0x03BF, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D765, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D766, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D767, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D768, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D769, { 0x03C4, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D76A, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D76B, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D76C, { 0x03C7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D76D, { 0x03C8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D76E, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D781, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D790, { 0x03B1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D791, { 0x03B2, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D792, { 0x03B3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D793, { 0x03B4, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D794, { 0x03B5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D795, { 0x03B6, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D796, { 0x03B7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D797, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D798, { 0x03B9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D799, { 0x03BA, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D79A, { 0x03BB, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D79B, { 0x03BC, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D79C, { 0x03BD, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D79D, { 0x03BE, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D79E, { 0x03BF, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D79F, { 0x03C0, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D7A0, { 0x03C1, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D7A1, { 0x03B8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D7A2, { 0x03C3, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D7A3, { 0x03C4, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D7A4, { 0x03C5, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D7A5, { 0x03C6, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D7A6, { 0x03C7, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D7A7, { 0x03C8, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D7A8, { 0x03C9, 0x0000, 0x0000, 0x0000 } },
+ { 0x1D7BB, { 0x03C3, 0x0000, 0x0000, 0x0000 } }
+};
+
+static void mapToLowerCase(QString *str, int from)
+{
+ int N = sizeof(NameprepCaseFolding) / sizeof(NameprepCaseFolding[0]);
+
+ ushort *d = 0;
+ for (int i = from; i < str->size(); ++i) {
+ uint uc = str->at(i).unicode();
+ if (uc < 0x80) {
+ if (uc <= 'Z' && uc >= 'A') {
+ if (!d)
+ d = reinterpret_cast<ushort *>(str->data());
+ d[i] = (uc | 0x20);
+ }
+ } else {
+ if (QChar(uc).isHighSurrogate() && i < str->size() - 1) {
+ ushort low = str->at(i + 1).unicode();
+ if (QChar(low).isLowSurrogate()) {
+ uc = QChar::surrogateToUcs4(uc, low);
+ ++i;
+ }
+ }
+ const NameprepCaseFoldingEntry *entry = qBinaryFind(NameprepCaseFolding,
+ NameprepCaseFolding + N,
+ uc);
+ if ((entry - NameprepCaseFolding) != N) {
+ int l = 1;
+ while (l < 4 && entry->mapping[l])
+ ++l;
+ if (l > 1) {
+ if (uc <= 0xffff)
+ str->replace(i, 1, reinterpret_cast<const QChar *>(&entry->mapping[0]), l);
+ else
+ str->replace(i-1, 2, reinterpret_cast<const QChar *>(&entry->mapping[0]), l);
+ d = 0;
+ } else {
+ if (!d)
+ d = reinterpret_cast<ushort *>(str->data());
+ d[i] = entry->mapping[0];
+ }
+ }
+ }
+ }
+}
+
+static bool isMappedToNothing(uint uc)
+{
+ if (uc < 0xad)
+ return false;
+ switch (uc) {
+ case 0x00AD: case 0x034F: case 0x1806: case 0x180B: case 0x180C: case 0x180D:
+ case 0x200B: case 0x200C: case 0x200D: case 0x2060: case 0xFE00: case 0xFE01:
+ case 0xFE02: case 0xFE03: case 0xFE04: case 0xFE05: case 0xFE06: case 0xFE07:
+ case 0xFE08: case 0xFE09: case 0xFE0A: case 0xFE0B: case 0xFE0C: case 0xFE0D:
+ case 0xFE0E: case 0xFE0F: case 0xFEFF:
+ return true;
+ default:
+ return false;
+ }
+}
+
+
+static void stripProhibitedOutput(QString *str, int from)
+{
+ ushort *out = (ushort *)str->data() + from;
+ const ushort *in = out;
+ const ushort *end = (ushort *)str->data() + str->size();
+ while (in < end) {
+ uint uc = *in;
+ if (QChar(uc).isHighSurrogate() && in < end - 1) {
+ ushort low = *(in + 1);
+ if (QChar(low).isLowSurrogate()) {
+ ++in;
+ uc = QChar::surrogateToUcs4(uc, low);
+ }
+ }
+ if (uc <= 0xFFFF) {
+ if (uc < 0x80 ||
+ !(uc <= 0x009F
+ || uc == 0x00A0
+ || uc == 0x0340
+ || uc == 0x0341
+ || uc == 0x06DD
+ || uc == 0x070F
+ || uc == 0x1680
+ || uc == 0x180E
+ || (uc >= 0x2000 && uc <= 0x200F)
+ || (uc >= 0x2028 && uc <= 0x202F)
+ || uc == 0x205F
+ || (uc >= 0x2060 && uc <= 0x2063)
+ || (uc >= 0x206A && uc <= 0x206F)
+ || (uc >= 0x2FF0 && uc <= 0x2FFB)
+ || uc == 0x3000
+ || (uc >= 0xD800 && uc <= 0xDFFF)
+ || (uc >= 0xE000 && uc <= 0xF8FF)
+ || (uc >= 0xFDD0 && uc <= 0xFDEF)
+ || uc == 0xFEFF
+ || (uc >= 0xFFF9 && uc <= 0xFFFF))) {
+ *out++ = *in;
+ }
+ } else {
+ if (!((uc >= 0x1D173 && uc <= 0x1D17A)
+ || (uc >= 0x1FFFE && uc <= 0x1FFFF)
+ || (uc >= 0x2FFFE && uc <= 0x2FFFF)
+ || (uc >= 0x3FFFE && uc <= 0x3FFFF)
+ || (uc >= 0x4FFFE && uc <= 0x4FFFF)
+ || (uc >= 0x5FFFE && uc <= 0x5FFFF)
+ || (uc >= 0x6FFFE && uc <= 0x6FFFF)
+ || (uc >= 0x7FFFE && uc <= 0x7FFFF)
+ || (uc >= 0x8FFFE && uc <= 0x8FFFF)
+ || (uc >= 0x9FFFE && uc <= 0x9FFFF)
+ || (uc >= 0xAFFFE && uc <= 0xAFFFF)
+ || (uc >= 0xBFFFE && uc <= 0xBFFFF)
+ || (uc >= 0xCFFFE && uc <= 0xCFFFF)
+ || (uc >= 0xDFFFE && uc <= 0xDFFFF)
+ || uc == 0xE0001
+ || (uc >= 0xE0020 && uc <= 0xE007F)
+ || (uc >= 0xEFFFE && uc <= 0xEFFFF)
+ || (uc >= 0xF0000 && uc <= 0xFFFFD)
+ || (uc >= 0xFFFFE && uc <= 0xFFFFF)
+ || (uc >= 0x100000 && uc <= 0x10FFFD)
+ || (uc >= 0x10FFFE && uc <= 0x10FFFF))) {
+ *out++ = QChar::highSurrogate(uc);
+ *out++ = QChar::lowSurrogate(uc);
+ }
+ }
+ ++in;
+ }
+ if (in != out)
+ str->truncate(out - str->utf16());
+}
+
+static bool isBidirectionalRorAL(uint uc)
+{
+ if (uc < 0x5b0)
+ return false;
+ return uc == 0x05BE
+ || uc == 0x05C0
+ || uc == 0x05C3
+ || (uc >= 0x05D0 && uc <= 0x05EA)
+ || (uc >= 0x05F0 && uc <= 0x05F4)
+ || uc == 0x061B
+ || uc == 0x061F
+ || (uc >= 0x0621 && uc <= 0x063A)
+ || (uc >= 0x0640 && uc <= 0x064A)
+ || (uc >= 0x066D && uc <= 0x066F)
+ || (uc >= 0x0671 && uc <= 0x06D5)
+ || uc == 0x06DD
+ || (uc >= 0x06E5 && uc <= 0x06E6)
+ || (uc >= 0x06FA && uc <= 0x06FE)
+ || (uc >= 0x0700 && uc <= 0x070D)
+ || uc == 0x0710
+ || (uc >= 0x0712 && uc <= 0x072C)
+ || (uc >= 0x0780 && uc <= 0x07A5)
+ || uc == 0x07B1
+ || uc == 0x200F
+ || uc == 0xFB1D
+ || (uc >= 0xFB1F && uc <= 0xFB28)
+ || (uc >= 0xFB2A && uc <= 0xFB36)
+ || (uc >= 0xFB38 && uc <= 0xFB3C)
+ || uc == 0xFB3E
+ || (uc >= 0xFB40 && uc <= 0xFB41)
+ || (uc >= 0xFB43 && uc <= 0xFB44)
+ || (uc >= 0xFB46 && uc <= 0xFBB1)
+ || (uc >= 0xFBD3 && uc <= 0xFD3D)
+ || (uc >= 0xFD50 && uc <= 0xFD8F)
+ || (uc >= 0xFD92 && uc <= 0xFDC7)
+ || (uc >= 0xFDF0 && uc <= 0xFDFC)
+ || (uc >= 0xFE70 && uc <= 0xFE74)
+ || (uc >= 0xFE76 && uc <= 0xFEFC);
+}
+
+static bool isBidirectionalL(uint uc)
+{
+ if (uc < 0xaa)
+ return (uc >= 0x0041 && uc <= 0x005A)
+ || (uc >= 0x0061 && uc <= 0x007A);
+
+ if (uc == 0x00AA
+ || uc == 0x00B5
+ || uc == 0x00BA
+ || (uc >= 0x00C0 && uc <= 0x00D6)
+ || (uc >= 0x00D8 && uc <= 0x00F6)
+ || (uc >= 0x00F8 && uc <= 0x0220)
+ || (uc >= 0x0222 && uc <= 0x0233)
+ || (uc >= 0x0250 && uc <= 0x02AD)
+ || (uc >= 0x02B0 && uc <= 0x02B8)
+ || (uc >= 0x02BB && uc <= 0x02C1)
+ || (uc >= 0x02D0 && uc <= 0x02D1)
+ || (uc >= 0x02E0 && uc <= 0x02E4)
+ || uc == 0x02EE
+ || uc == 0x037A
+ || uc == 0x0386
+ || (uc >= 0x0388 && uc <= 0x038A)) {
+ return true;
+ }
+
+ if (uc == 0x038C
+ || (uc >= 0x038E && uc <= 0x03A1)
+ || (uc >= 0x03A3 && uc <= 0x03CE)
+ || (uc >= 0x03D0 && uc <= 0x03F5)
+ || (uc >= 0x0400 && uc <= 0x0482)
+ || (uc >= 0x048A && uc <= 0x04CE)
+ || (uc >= 0x04D0 && uc <= 0x04F5)
+ || (uc >= 0x04F8 && uc <= 0x04F9)
+ || (uc >= 0x0500 && uc <= 0x050F)
+ || (uc >= 0x0531 && uc <= 0x0556)
+ || (uc >= 0x0559 && uc <= 0x055F)
+ || (uc >= 0x0561 && uc <= 0x0587)
+ || uc == 0x0589
+ || uc == 0x0903
+ || (uc >= 0x0905 && uc <= 0x0939)
+ || (uc >= 0x093D && uc <= 0x0940)
+ || (uc >= 0x0949 && uc <= 0x094C)
+ || uc == 0x0950) {
+ return true;
+ }
+
+ if ((uc >= 0x0958 && uc <= 0x0961)
+ || (uc >= 0x0964 && uc <= 0x0970)
+ || (uc >= 0x0982 && uc <= 0x0983)
+ || (uc >= 0x0985 && uc <= 0x098C)
+ || (uc >= 0x098F && uc <= 0x0990)
+ || (uc >= 0x0993 && uc <= 0x09A8)
+ || (uc >= 0x09AA && uc <= 0x09B0)
+ || uc == 0x09B2
+ || (uc >= 0x09B6 && uc <= 0x09B9)
+ || (uc >= 0x09BE && uc <= 0x09C0)
+ || (uc >= 0x09C7 && uc <= 0x09C8)
+ || (uc >= 0x09CB && uc <= 0x09CC)
+ || uc == 0x09D7
+ || (uc >= 0x09DC && uc <= 0x09DD)
+ || (uc >= 0x09DF && uc <= 0x09E1)
+ || (uc >= 0x09E6 && uc <= 0x09F1)
+ || (uc >= 0x09F4 && uc <= 0x09FA)
+ || (uc >= 0x0A05 && uc <= 0x0A0A)
+ || (uc >= 0x0A0F && uc <= 0x0A10)
+ || (uc >= 0x0A13 && uc <= 0x0A28)
+ || (uc >= 0x0A2A && uc <= 0x0A30)
+ || (uc >= 0x0A32 && uc <= 0x0A33)) {
+ return true;
+ }
+
+ if ((uc >= 0x0A35 && uc <= 0x0A36)
+ || (uc >= 0x0A38 && uc <= 0x0A39)
+ || (uc >= 0x0A3E && uc <= 0x0A40)
+ || (uc >= 0x0A59 && uc <= 0x0A5C)
+ || uc == 0x0A5E
+ || (uc >= 0x0A66 && uc <= 0x0A6F)
+ || (uc >= 0x0A72 && uc <= 0x0A74)
+ || uc == 0x0A83
+ || (uc >= 0x0A85 && uc <= 0x0A8B)
+ || uc == 0x0A8D
+ || (uc >= 0x0A8F && uc <= 0x0A91)
+ || (uc >= 0x0A93 && uc <= 0x0AA8)
+ || (uc >= 0x0AAA && uc <= 0x0AB0)
+ || (uc >= 0x0AB2 && uc <= 0x0AB3)
+ || (uc >= 0x0AB5 && uc <= 0x0AB9)
+ || (uc >= 0x0ABD && uc <= 0x0AC0)
+ || uc == 0x0AC9
+ || (uc >= 0x0ACB && uc <= 0x0ACC)
+ || uc == 0x0AD0
+ || uc == 0x0AE0
+ || (uc >= 0x0AE6 && uc <= 0x0AEF)
+ || (uc >= 0x0B02 && uc <= 0x0B03)
+ || (uc >= 0x0B05 && uc <= 0x0B0C)
+ || (uc >= 0x0B0F && uc <= 0x0B10)
+ || (uc >= 0x0B13 && uc <= 0x0B28)
+ || (uc >= 0x0B2A && uc <= 0x0B30)) {
+ return true;
+ }
+
+ if ((uc >= 0x0B32 && uc <= 0x0B33)
+ || (uc >= 0x0B36 && uc <= 0x0B39)
+ || (uc >= 0x0B3D && uc <= 0x0B3E)
+ || uc == 0x0B40
+ || (uc >= 0x0B47 && uc <= 0x0B48)
+ || (uc >= 0x0B4B && uc <= 0x0B4C)
+ || uc == 0x0B57
+ || (uc >= 0x0B5C && uc <= 0x0B5D)
+ || (uc >= 0x0B5F && uc <= 0x0B61)
+ || (uc >= 0x0B66 && uc <= 0x0B70)
+ || uc == 0x0B83
+ || (uc >= 0x0B85 && uc <= 0x0B8A)
+ || (uc >= 0x0B8E && uc <= 0x0B90)
+ || (uc >= 0x0B92 && uc <= 0x0B95)
+ || (uc >= 0x0B99 && uc <= 0x0B9A)
+ || uc == 0x0B9C
+ || (uc >= 0x0B9E && uc <= 0x0B9F)
+ || (uc >= 0x0BA3 && uc <= 0x0BA4)
+ || (uc >= 0x0BA8 && uc <= 0x0BAA)
+ || (uc >= 0x0BAE && uc <= 0x0BB5)
+ || (uc >= 0x0BB7 && uc <= 0x0BB9)
+ || (uc >= 0x0BBE && uc <= 0x0BBF)
+ || (uc >= 0x0BC1 && uc <= 0x0BC2)
+ || (uc >= 0x0BC6 && uc <= 0x0BC8)
+ || (uc >= 0x0BCA && uc <= 0x0BCC)
+ || uc == 0x0BD7
+ || (uc >= 0x0BE7 && uc <= 0x0BF2)
+ || (uc >= 0x0C01 && uc <= 0x0C03)
+ || (uc >= 0x0C05 && uc <= 0x0C0C)
+ || (uc >= 0x0C0E && uc <= 0x0C10)
+ || (uc >= 0x0C12 && uc <= 0x0C28)
+ || (uc >= 0x0C2A && uc <= 0x0C33)
+ || (uc >= 0x0C35 && uc <= 0x0C39)) {
+ return true;
+ }
+ if ((uc >= 0x0C41 && uc <= 0x0C44)
+ || (uc >= 0x0C60 && uc <= 0x0C61)
+ || (uc >= 0x0C66 && uc <= 0x0C6F)
+ || (uc >= 0x0C82 && uc <= 0x0C83)
+ || (uc >= 0x0C85 && uc <= 0x0C8C)
+ || (uc >= 0x0C8E && uc <= 0x0C90)
+ || (uc >= 0x0C92 && uc <= 0x0CA8)
+ || (uc >= 0x0CAA && uc <= 0x0CB3)
+ || (uc >= 0x0CB5 && uc <= 0x0CB9)
+ || uc == 0x0CBE
+ || (uc >= 0x0CC0 && uc <= 0x0CC4)
+ || (uc >= 0x0CC7 && uc <= 0x0CC8)
+ || (uc >= 0x0CCA && uc <= 0x0CCB)
+ || (uc >= 0x0CD5 && uc <= 0x0CD6)
+ || uc == 0x0CDE
+ || (uc >= 0x0CE0 && uc <= 0x0CE1)
+ || (uc >= 0x0CE6 && uc <= 0x0CEF)
+ || (uc >= 0x0D02 && uc <= 0x0D03)
+ || (uc >= 0x0D05 && uc <= 0x0D0C)
+ || (uc >= 0x0D0E && uc <= 0x0D10)
+ || (uc >= 0x0D12 && uc <= 0x0D28)
+ || (uc >= 0x0D2A && uc <= 0x0D39)
+ || (uc >= 0x0D3E && uc <= 0x0D40)
+ || (uc >= 0x0D46 && uc <= 0x0D48)
+ || (uc >= 0x0D4A && uc <= 0x0D4C)
+ || uc == 0x0D57
+ || (uc >= 0x0D60 && uc <= 0x0D61)
+ || (uc >= 0x0D66 && uc <= 0x0D6F)
+ || (uc >= 0x0D82 && uc <= 0x0D83)
+ || (uc >= 0x0D85 && uc <= 0x0D96)
+ || (uc >= 0x0D9A && uc <= 0x0DB1)
+ || (uc >= 0x0DB3 && uc <= 0x0DBB)
+ || uc == 0x0DBD) {
+ return true;
+ }
+ if ((uc >= 0x0DC0 && uc <= 0x0DC6)
+ || (uc >= 0x0DCF && uc <= 0x0DD1)
+ || (uc >= 0x0DD8 && uc <= 0x0DDF)
+ || (uc >= 0x0DF2 && uc <= 0x0DF4)
+ || (uc >= 0x0E01 && uc <= 0x0E30)
+ || (uc >= 0x0E32 && uc <= 0x0E33)
+ || (uc >= 0x0E40 && uc <= 0x0E46)
+ || (uc >= 0x0E4F && uc <= 0x0E5B)
+ || (uc >= 0x0E81 && uc <= 0x0E82)
+ || uc == 0x0E84
+ || (uc >= 0x0E87 && uc <= 0x0E88)
+ || uc == 0x0E8A
+ || uc == 0x0E8D
+ || (uc >= 0x0E94 && uc <= 0x0E97)
+ || (uc >= 0x0E99 && uc <= 0x0E9F)
+ || (uc >= 0x0EA1 && uc <= 0x0EA3)
+ || uc == 0x0EA5
+ || uc == 0x0EA7
+ || (uc >= 0x0EAA && uc <= 0x0EAB)
+ || (uc >= 0x0EAD && uc <= 0x0EB0)
+ || (uc >= 0x0EB2 && uc <= 0x0EB3)
+ || uc == 0x0EBD
+ || (uc >= 0x0EC0 && uc <= 0x0EC4)
+ || uc == 0x0EC6
+ || (uc >= 0x0ED0 && uc <= 0x0ED9)
+ || (uc >= 0x0EDC && uc <= 0x0EDD)
+ || (uc >= 0x0F00 && uc <= 0x0F17)
+ || (uc >= 0x0F1A && uc <= 0x0F34)
+ || uc == 0x0F36
+ || uc == 0x0F38
+ || (uc >= 0x0F3E && uc <= 0x0F47)
+ || (uc >= 0x0F49 && uc <= 0x0F6A)
+ || uc == 0x0F7F
+ || uc == 0x0F85
+ || (uc >= 0x0F88 && uc <= 0x0F8B)
+ || (uc >= 0x0FBE && uc <= 0x0FC5)
+ || (uc >= 0x0FC7 && uc <= 0x0FCC)
+ || uc == 0x0FCF) {
+ return true;
+ }
+
+ if ((uc >= 0x1000 && uc <= 0x1021)
+ || (uc >= 0x1023 && uc <= 0x1027)
+ || (uc >= 0x1029 && uc <= 0x102A)
+ || uc == 0x102C
+ || uc == 0x1031
+ || uc == 0x1038
+ || (uc >= 0x1040 && uc <= 0x1057)
+ || (uc >= 0x10A0 && uc <= 0x10C5)
+ || (uc >= 0x10D0 && uc <= 0x10F8)
+ || uc == 0x10FB
+ || (uc >= 0x1100 && uc <= 0x1159)
+ || (uc >= 0x115F && uc <= 0x11A2)
+ || (uc >= 0x11A8 && uc <= 0x11F9)
+ || (uc >= 0x1200 && uc <= 0x1206)
+ || (uc >= 0x1208 && uc <= 0x1246)
+ || uc == 0x1248
+ || (uc >= 0x124A && uc <= 0x124D)
+ || (uc >= 0x1250 && uc <= 0x1256)
+ || uc == 0x1258
+ || (uc >= 0x125A && uc <= 0x125D)
+ || (uc >= 0x1260 && uc <= 0x1286)
+ || uc == 0x1288
+ || (uc >= 0x128A && uc <= 0x128D)
+ || (uc >= 0x1290 && uc <= 0x12AE)
+ || uc == 0x12B0
+ || (uc >= 0x12B2 && uc <= 0x12B5)
+ || (uc >= 0x12B8 && uc <= 0x12BE)
+ || uc == 0x12C0
+ || (uc >= 0x12C2 && uc <= 0x12C5)
+ || (uc >= 0x12C8 && uc <= 0x12CE)
+ || (uc >= 0x12D0 && uc <= 0x12D6)
+ || (uc >= 0x12D8 && uc <= 0x12EE)
+ || (uc >= 0x12F0 && uc <= 0x130E)
+ || uc == 0x1310) {
+ return true;
+ }
+
+ if ((uc >= 0x1312 && uc <= 0x1315)
+ || (uc >= 0x1318 && uc <= 0x131E)
+ || (uc >= 0x1320 && uc <= 0x1346)
+ || (uc >= 0x1348 && uc <= 0x135A)
+ || (uc >= 0x1361 && uc <= 0x137C)
+ || (uc >= 0x13A0 && uc <= 0x13F4)
+ || (uc >= 0x1401 && uc <= 0x1676)
+ || (uc >= 0x1681 && uc <= 0x169A)
+ || (uc >= 0x16A0 && uc <= 0x16F0)
+ || (uc >= 0x1700 && uc <= 0x170C)
+ || (uc >= 0x170E && uc <= 0x1711)
+ || (uc >= 0x1720 && uc <= 0x1731)
+ || (uc >= 0x1735 && uc <= 0x1736)
+ || (uc >= 0x1740 && uc <= 0x1751)
+ || (uc >= 0x1760 && uc <= 0x176C)
+ || (uc >= 0x176E && uc <= 0x1770)
+ || (uc >= 0x1780 && uc <= 0x17B6)
+ || (uc >= 0x17BE && uc <= 0x17C5)
+ || (uc >= 0x17C7 && uc <= 0x17C8)
+ || (uc >= 0x17D4 && uc <= 0x17DA)
+ || uc == 0x17DC
+ || (uc >= 0x17E0 && uc <= 0x17E9)
+ || (uc >= 0x1810 && uc <= 0x1819)
+ || (uc >= 0x1820 && uc <= 0x1877)
+ || (uc >= 0x1880 && uc <= 0x18A8)
+ || (uc >= 0x1E00 && uc <= 0x1E9B)
+ || (uc >= 0x1EA0 && uc <= 0x1EF9)
+ || (uc >= 0x1F00 && uc <= 0x1F15)
+ || (uc >= 0x1F18 && uc <= 0x1F1D)
+ || (uc >= 0x1F20 && uc <= 0x1F45)
+ || (uc >= 0x1F48 && uc <= 0x1F4D)
+ || (uc >= 0x1F50 && uc <= 0x1F57)
+ || uc == 0x1F59
+ || uc == 0x1F5B
+ || uc == 0x1F5D) {
+ return true;
+ }
+
+ if ((uc >= 0x1F5F && uc <= 0x1F7D)
+ || (uc >= 0x1F80 && uc <= 0x1FB4)
+ || (uc >= 0x1FB6 && uc <= 0x1FBC)
+ || uc == 0x1FBE
+ || (uc >= 0x1FC2 && uc <= 0x1FC4)
+ || (uc >= 0x1FC6 && uc <= 0x1FCC)
+ || (uc >= 0x1FD0 && uc <= 0x1FD3)
+ || (uc >= 0x1FD6 && uc <= 0x1FDB)
+ || (uc >= 0x1FE0 && uc <= 0x1FEC)
+ || (uc >= 0x1FF2 && uc <= 0x1FF4)
+ || (uc >= 0x1FF6 && uc <= 0x1FFC)
+ || uc == 0x200E
+ || uc == 0x2071
+ || uc == 0x207F
+ || uc == 0x2102
+ || uc == 0x2107
+ || (uc >= 0x210A && uc <= 0x2113)
+ || uc == 0x2115
+ || (uc >= 0x2119 && uc <= 0x211D)) {
+ return true;
+ }
+
+ if (uc == 0x2124
+ || uc == 0x2126
+ || uc == 0x2128
+ || (uc >= 0x212A && uc <= 0x212D)
+ || (uc >= 0x212F && uc <= 0x2131)
+ || (uc >= 0x2133 && uc <= 0x2139)
+ || (uc >= 0x213D && uc <= 0x213F)
+ || (uc >= 0x2145 && uc <= 0x2149)
+ || (uc >= 0x2160 && uc <= 0x2183)
+ || (uc >= 0x2336 && uc <= 0x237A)
+ || uc == 0x2395
+ || (uc >= 0x249C && uc <= 0x24E9)
+ || (uc >= 0x3005 && uc <= 0x3007)
+ || (uc >= 0x3021 && uc <= 0x3029)
+ || (uc >= 0x3031 && uc <= 0x3035)
+ || (uc >= 0x3038 && uc <= 0x303C)
+ || (uc >= 0x3041 && uc <= 0x3096)
+ || (uc >= 0x309D && uc <= 0x309F)
+ || (uc >= 0x30A1 && uc <= 0x30FA)) {
+ return true;
+ }
+
+ if ((uc >= 0x30FC && uc <= 0x30FF)
+ || (uc >= 0x3105 && uc <= 0x312C)
+ || (uc >= 0x3131 && uc <= 0x318E)
+ || (uc >= 0x3190 && uc <= 0x31B7)
+ || (uc >= 0x31F0 && uc <= 0x321C)
+ || (uc >= 0x3220 && uc <= 0x3243)) {
+ return true;
+ }
+
+ if ((uc >= 0x3260 && uc <= 0x327B)
+ || (uc >= 0x327F && uc <= 0x32B0)
+ || (uc >= 0x32C0 && uc <= 0x32CB)
+ || (uc >= 0x32D0 && uc <= 0x32FE)
+ || (uc >= 0x3300 && uc <= 0x3376)
+ || (uc >= 0x337B && uc <= 0x33DD)) {
+ return true;
+ }
+ if ((uc >= 0x33E0 && uc <= 0x33FE)
+ || (uc >= 0x3400 && uc <= 0x4DB5)
+ || (uc >= 0x4E00 && uc <= 0x9FA5)
+ || (uc >= 0xA000 && uc <= 0xA48C)
+ || (uc >= 0xAC00 && uc <= 0xD7A3)
+ || (uc >= 0xD800 && uc <= 0xFA2D)
+ || (uc >= 0xFA30 && uc <= 0xFA6A)
+ || (uc >= 0xFB00 && uc <= 0xFB06)
+ || (uc >= 0xFB13 && uc <= 0xFB17)
+ || (uc >= 0xFF21 && uc <= 0xFF3A)
+ || (uc >= 0xFF41 && uc <= 0xFF5A)
+ || (uc >= 0xFF66 && uc <= 0xFFBE)
+ || (uc >= 0xFFC2 && uc <= 0xFFC7)
+ || (uc >= 0xFFCA && uc <= 0xFFCF)
+ || (uc >= 0xFFD2 && uc <= 0xFFD7)
+ || (uc >= 0xFFDA && uc <= 0xFFDC)) {
+ return true;
+ }
+
+ if ((uc >= 0x10300 && uc <= 0x1031E)
+ || (uc >= 0x10320 && uc <= 0x10323)
+ || (uc >= 0x10330 && uc <= 0x1034A)
+ || (uc >= 0x10400 && uc <= 0x10425)
+ || (uc >= 0x10428 && uc <= 0x1044D)
+ || (uc >= 0x1D000 && uc <= 0x1D0F5)
+ || (uc >= 0x1D100 && uc <= 0x1D126)
+ || (uc >= 0x1D12A && uc <= 0x1D166)
+ || (uc >= 0x1D16A && uc <= 0x1D172)
+ || (uc >= 0x1D183 && uc <= 0x1D184)
+ || (uc >= 0x1D18C && uc <= 0x1D1A9)
+ || (uc >= 0x1D1AE && uc <= 0x1D1DD)
+ || (uc >= 0x1D400 && uc <= 0x1D454)
+ || (uc >= 0x1D456 && uc <= 0x1D49C)
+ || (uc >= 0x1D49E && uc <= 0x1D49F)
+ || uc == 0x1D4A2
+ || (uc >= 0x1D4A5 && uc <= 0x1D4A6)
+ || (uc >= 0x1D4A9 && uc <= 0x1D4AC)
+ || (uc >= 0x1D4AE && uc <= 0x1D4B9)
+ || uc == 0x1D4BB
+ || (uc >= 0x1D4BD && uc <= 0x1D4C0)
+ || (uc >= 0x1D4C2 && uc <= 0x1D4C3)
+ || (uc >= 0x1D4C5 && uc <= 0x1D505)
+ || (uc >= 0x1D507 && uc <= 0x1D50A)
+ || (uc >= 0x1D50D && uc <= 0x1D514)
+ || (uc >= 0x1D516 && uc <= 0x1D51C)
+ || (uc >= 0x1D51E && uc <= 0x1D539)
+ || (uc >= 0x1D53B && uc <= 0x1D53E)
+ || (uc >= 0x1D540 && uc <= 0x1D544)
+ || uc == 0x1D546
+ || (uc >= 0x1D54A && uc <= 0x1D550)
+ || (uc >= 0x1D552 && uc <= 0x1D6A3)
+ || (uc >= 0x1D6A8 && uc <= 0x1D7C9)
+ || (uc >= 0x20000 && uc <= 0x2A6D6)
+ || (uc >= 0x2F800 && uc <= 0x2FA1D)
+ || (uc >= 0xF0000 && uc <= 0xFFFFD)
+ || (uc >= 0x100000 && uc <= 0x10FFFD)) {
+ return true;
+ }
+
+ return false;
+}
+
+Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from)
+{
+ QChar *src = source->data(); // causes a detach, so we're sure the only one using it
+ QChar *out = src + from;
+ const QChar *e = src + source->size();
+
+ for ( ; out < e; ++out) {
+ register ushort uc = out->unicode();
+ if (uc > 0x80) {
+ break;
+ } else if (uc >= 'A' && uc <= 'Z') {
+ *out = QChar(uc | 0x20);
+ }
+ }
+ if (out == e)
+ return; // everything was mapped easily (lowercased, actually)
+ int firstNonAscii = out - src;
+
+ // Characters unassigned in Unicode 3.2 are not allowed in "stored string" scheme
+ // but allowed in "query" scheme
+ // (Table A.1)
+ const bool isUnassignedAllowed = false; // ###
+ // Characters commonly mapped to nothing are simply removed
+ // (Table B.1)
+ const QChar *in = out;
+ for ( ; in < e; ++in) {
+ uint uc = in->unicode();
+ if (QChar(uc).isHighSurrogate() && in < e - 1) {
+ ushort low = in[1].unicode();
+ if (QChar(low).isLowSurrogate()) {
+ ++in;
+ uc = QChar::surrogateToUcs4(uc, low);
+ }
+ }
+ if (!isUnassignedAllowed) {
+ QChar::UnicodeVersion version = QChar::unicodeVersion(uc);
+ if (version == QChar::Unicode_Unassigned || version > QChar::Unicode_3_2) {
+ source->resize(from); // not allowed, clear the label
+ return;
+ }
+ }
+ if (!isMappedToNothing(uc)) {
+ if (uc <= 0xFFFF) {
+ *out++ = *in;
+ } else {
+ *out++ = QChar::highSurrogate(uc);
+ *out++ = QChar::lowSurrogate(uc);
+ }
+ }
+ }
+ if (out != in)
+ source->truncate(out - src);
+
+ // Map to lowercase (Table B.2)
+ mapToLowerCase(source, firstNonAscii);
+
+ // Normalize to Unicode 3.2 form KC
+ extern void qt_string_normalize(QString *data, QString::NormalizationForm mode,
+ QChar::UnicodeVersion version, int from);
+ qt_string_normalize(source, QString::NormalizationForm_KC, QChar::Unicode_3_2,
+ firstNonAscii > from ? firstNonAscii - 1 : from);
+
+ // Strip prohibited output
+ stripProhibitedOutput(source, firstNonAscii);
+
+ // Check for valid bidirectional characters
+ bool containsLCat = false;
+ bool containsRandALCat = false;
+ src = source->data();
+ e = src + source->size();
+ for (in = src + from; in < e && (!containsLCat || !containsRandALCat); ++in) {
+ uint uc = in->unicode();
+ if (QChar(uc).isHighSurrogate() && in < e - 1) {
+ ushort low = in[1].unicode();
+ if (QChar(low).isLowSurrogate()) {
+ ++in;
+ uc = QChar::surrogateToUcs4(uc, low);
+ }
+ }
+ if (isBidirectionalL(uc))
+ containsLCat = true;
+ else if (isBidirectionalRorAL(uc))
+ containsRandALCat = true;
+ }
+ if (containsRandALCat) {
+ if (containsLCat || (!isBidirectionalRorAL(src[from].unicode())
+ || !isBidirectionalRorAL(e[-1].unicode())))
+ source->resize(from); // not allowed, clear the label
+ }
+}
+
+Q_AUTOTEST_EXPORT bool qt_check_std3rules(const QChar *uc, int len)
+{
+ if (len > 63)
+ return false;
+
+ for (int i = 0; i < len; ++i) {
+ register ushort c = uc[i].unicode();
+ if (c == '-' && (i == 0 || i == len - 1))
+ return false;
+
+ // verifying the absence of non-LDH is the same as verifying that
+ // only LDH is present
+ if (c == '-' || (c >= '0' && c <= '9')
+ || (c >= 'A' && c <= 'Z')
+ || (c >= 'a' && c <= 'z')
+ //underscore is not supposed to be allowed, but other browser accept it (QTBUG-7434)
+ || c == '_')
+ continue;
+
+ return false;
+ }
+
+ return true;
+}
+
+
+static inline uint encodeDigit(uint digit)
+{
+ return digit + 22 + 75 * (digit < 26);
+}
+
+static inline uint adapt(uint delta, uint numpoints, bool firsttime)
+{
+ delta /= (firsttime ? damp : 2);
+ delta += (delta / numpoints);
+
+ uint k = 0;
+ for (; delta > ((base - tmin) * tmax) / 2; k += base)
+ delta /= (base - tmin);
+
+ return k + (((base - tmin + 1) * delta) / (delta + skew));
+}
+
+static inline void appendEncode(QString* output, uint& delta, uint& bias, uint& b, uint& h)
+{
+ uint qq;
+ uint k;
+ uint t;
+
+ // insert the variable length delta integer; fail on
+ // overflow.
+ for (qq = delta, k = base;; k += base) {
+ // stop generating digits when the threshold is
+ // detected.
+ t = (k <= bias) ? tmin : (k >= bias + tmax) ? tmax : k - bias;
+ if (qq < t) break;
+
+ *output += QChar(encodeDigit(t + (qq - t) % (base - t)));
+ qq = (qq - t) / (base - t);
+ }
+
+ *output += QChar(encodeDigit(qq));
+ bias = adapt(delta, h + 1, h == b);
+ delta = 0;
+ ++h;
+}
+
+Q_AUTOTEST_EXPORT void qt_punycodeEncoder(const QChar *s, int ucLength, QString *output)
+{
+ uint n = initial_n;
+ uint delta = 0;
+ uint bias = initial_bias;
+
+ int outLen = output->length();
+ output->resize(outLen + ucLength);
+
+ QChar *d = output->data() + outLen;
+ bool skipped = false;
+ // copy all basic code points verbatim to output.
+ for (uint j = 0; j < (uint) ucLength; ++j) {
+ ushort js = s[j].unicode();
+ if (js < 0x80)
+ *d++ = js;
+ else
+ skipped = true;
+ }
+
+ // if there were only basic code points, just return them
+ // directly; don't do any encoding.
+ if (!skipped)
+ return;
+
+ output->truncate(d - output->constData());
+ int copied = output->size() - outLen;
+
+ // h and b now contain the number of basic code points in input.
+ uint b = copied;
+ uint h = copied;
+
+ // if basic code points were copied, add the delimiter character.
+ if (h > 0)
+ *output += QChar(0x2d);
+
+ // while there are still unprocessed non-basic code points left in
+ // the input string...
+ while (h < (uint) ucLength) {
+ // find the character in the input string with the lowest
+ // unicode value.
+ uint m = Q_MAXINT;
+ uint j;
+ for (j = 0; j < (uint) ucLength; ++j) {
+ if (s[j].unicode() >= n && s[j].unicode() < m)
+ m = (uint) s[j].unicode();
+ }
+
+ // reject out-of-bounds unicode characters
+ if (m - n > (Q_MAXINT - delta) / (h + 1)) {
+ output->truncate(outLen);
+ return; // punycode_overflow
+ }
+
+ delta += (m - n) * (h + 1);
+ n = m;
+
+ // for each code point in the input string
+ for (j = 0; j < (uint) ucLength; ++j) {
+
+ // increase delta until we reach the character with the
+ // lowest unicode code. fail if delta overflows.
+ if (s[j].unicode() < n) {
+ ++delta;
+ if (!delta) {
+ output->truncate(outLen);
+ return; // punycode_overflow
+ }
+ }
+
+ // if j is the index of the character with the lowest
+ // unicode code...
+ if (s[j].unicode() == n) {
+ appendEncode(output, delta, bias, b, h);
+ }
+ }
+
+ ++delta;
+ ++n;
+ }
+
+ // prepend ACE prefix
+ output->insert(outLen, QStringLiteral("xn--"));
+ return;
+}
+
+Q_AUTOTEST_EXPORT QString qt_punycodeDecoder(const QString &pc)
+{
+ uint n = initial_n;
+ uint i = 0;
+ uint bias = initial_bias;
+
+ // strip any ACE prefix
+ int start = pc.startsWith(QLatin1String("xn--")) ? 4 : 0;
+ if (!start)
+ return pc;
+
+ // find the last delimiter character '-' in the input array. copy
+ // all data before this delimiter directly to the output array.
+ int delimiterPos = pc.lastIndexOf(QChar(0x2d));
+ QString output = delimiterPos < 4 ?
+ QString() : pc.mid(start, delimiterPos - start);
+
+ // if a delimiter was found, skip to the position after it;
+ // otherwise start at the front of the input string. everything
+ // before the delimiter is assumed to be basic code points.
+ uint cnt = delimiterPos + 1;
+
+ // loop through the rest of the input string, inserting non-basic
+ // characters into output as we go.
+ while (cnt < (uint) pc.size()) {
+ uint oldi = i;
+ uint w = 1;
+
+ // find the next index for inserting a non-basic character.
+ for (uint k = base; cnt < (uint) pc.size(); k += base) {
+ // grab a character from the punycode input and find its
+ // delta digit (each digit code is part of the
+ // variable-length integer delta)
+ uint digit = pc.at(cnt++).unicode();
+ if (digit - 48 < 10) digit -= 22;
+ else if (digit - 65 < 26) digit -= 65;
+ else if (digit - 97 < 26) digit -= 97;
+ else digit = base;
+
+ // reject out of range digits
+ if (digit >= base || digit > (Q_MAXINT - i) / w)
+ return QStringLiteral("");
+
+ i += (digit * w);
+
+ // detect threshold to stop reading delta digits
+ uint t;
+ if (k <= bias) t = tmin;
+ else if (k >= bias + tmax) t = tmax;
+ else t = k - bias;
+ if (digit < t) break;
+
+ w *= (base - t);
+ }
+
+ // find new bias and calculate the next non-basic code
+ // character.
+ bias = adapt(i - oldi, output.length() + 1, oldi == 0);
+ n += i / (output.length() + 1);
+
+ // allow the deltas to wrap around
+ i %= (output.length() + 1);
+
+ // insert the character n at position i
+ output.insert((uint) i, QChar((ushort) n));
+ ++i;
+ }
+
+ return output;
+}
+
+static const char * const idn_whitelist[] = {
+ "ac", "ar", "at",
+ "biz", "br",
+ "cat", "ch", "cl", "cn",
+ "de", "dk",
+ "es",
+ "fi",
+ "gr",
+ "hu",
+ "info", "io", "is",
+ "jp",
+ "kr",
+ "li", "lt",
+ "museum",
+ "no",
+ "org",
+ "se", "sh",
+ "th", "tm", "tw",
+ "vn",
+ "xn--mgbaam7a8h", // UAE
+ "xn--mgberp4a5d4ar", // Saudi Arabia
+ "xn--wgbh1c" // Egypt
+};
+
+static QStringList *user_idn_whitelist = 0;
+
+static bool lessThan(const QChar *a, int l, const char *c)
+{
+ const ushort *uc = (const ushort *)a;
+ const ushort *e = uc + l;
+
+ if (!c || *c == 0)
+ return false;
+
+ while (*c) {
+ if (uc == e || *uc != *c)
+ break;
+ ++uc;
+ ++c;
+ }
+ return (uc == e ? *c : *uc < *c);
+}
+
+static bool equal(const QChar *a, int l, const char *b)
+{
+ while (l && a->unicode() && *b) {
+ if (*a != QLatin1Char(*b))
+ return false;
+ ++a;
+ ++b;
+ --l;
+ }
+ return l == 0;
+}
+
+static bool qt_is_idn_enabled(const QString &domain)
+{
+ int idx = domain.lastIndexOf(QLatin1Char('.'));
+ if (idx == -1)
+ return false;
+
+ int len = domain.size() - idx - 1;
+ QString tldString(domain.constData() + idx + 1, len);
+ qt_nameprep(&tldString, 0);
+
+ const QChar *tld = tldString.constData();
+
+ if (user_idn_whitelist)
+ return user_idn_whitelist->contains(tldString);
+
+ int l = 0;
+ int r = sizeof(idn_whitelist)/sizeof(const char *) - 1;
+ int i = (l + r + 1) / 2;
+
+ while (r != l) {
+ if (lessThan(tld, len, idn_whitelist[i]))
+ r = i - 1;
+ else
+ l = i;
+ i = (l + r + 1) / 2;
+ }
+ return equal(tld, len, idn_whitelist[i]);
+}
+
+static inline bool isDotDelimiter(ushort uc)
+{
+ // IDNA / rfc3490 describes these four delimiters used for
+ // separating labels in unicode international domain
+ // names.
+ return uc == 0x2e || uc == 0x3002 || uc == 0xff0e || uc == 0xff61;
+}
+
+static int nextDotDelimiter(const QString &domain, int from = 0)
+{
+ const QChar *b = domain.unicode();
+ const QChar *ch = b + from;
+ const QChar *e = b + domain.length();
+ while (ch < e) {
+ if (isDotDelimiter(ch->unicode()))
+ break;
+ else
+ ++ch;
+ }
+ return ch - b;
+}
+
+QString qt_ACE_do(const QString &domain, AceOperation op)
+{
+ if (domain.isEmpty())
+ return domain;
+
+ QString result;
+ result.reserve(domain.length());
+
+ const bool isIdnEnabled = op == NormalizeAce ? qt_is_idn_enabled(domain) : false;
+ int lastIdx = 0;
+ QString aceForm; // this variable is here for caching
+
+ while (1) {
+ int idx = nextDotDelimiter(domain, lastIdx);
+ int labelLength = idx - lastIdx;
+ if (labelLength == 0) {
+ if (idx == domain.length())
+ break;
+ return QString(); // two delimiters in a row -- empty label not allowed
+ }
+
+ // RFC 3490 says, about the ToASCII operation:
+ // 3. If the UseSTD3ASCIIRules flag is set, then perform these checks:
+ //
+ // (a) Verify the absence of non-LDH ASCII code points; that is, the
+ // absence of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F.
+ //
+ // (b) Verify the absence of leading and trailing hyphen-minus; that
+ // is, the absence of U+002D at the beginning and end of the
+ // sequence.
+ // and:
+ // 8. Verify that the number of code points is in the range 1 to 63
+ // inclusive.
+
+ // copy the label to the destination, which also serves as our scratch area, lowercasing it
+ int prevLen = result.size();
+ bool simple = true;
+ result.resize(prevLen + labelLength);
+ {
+ QChar *out = result.data() + prevLen;
+ const QChar *in = domain.constData() + lastIdx;
+ const QChar *e = in + labelLength;
+ for (; in < e; ++in, ++out) {
+ register ushort uc = in->unicode();
+ if (uc > 0x7f)
+ simple = false;
+ if (uc >= 'A' && uc <= 'Z')
+ *out = QChar(uc | 0x20);
+ else
+ *out = *in;
+ }
+ }
+
+ if (simple && labelLength > 6) {
+ // ACE form domains contain only ASCII characters, but we can't consider them simple
+ // is this an ACE form?
+ // the shortest valid ACE domain is 6 characters long (U+0080 would be 1, but it's not allowed)
+ static const ushort acePrefixUtf16[] = { 'x', 'n', '-', '-' };
+ if (memcmp(result.constData() + prevLen, acePrefixUtf16, sizeof acePrefixUtf16) == 0)
+ simple = false;
+ }
+
+ if (simple) {
+ // fastest case: this is the common case (non IDN-domains)
+ // so we're done
+ if (!qt_check_std3rules(result.constData() + prevLen, labelLength))
+ return QString();
+ } else {
+ // Punycode encoding and decoding cannot be done in-place
+ // That means we need one or two temporaries
+ qt_nameprep(&result, prevLen);
+ labelLength = result.length() - prevLen;
+ register int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes
+ aceForm.resize(0);
+ if (toReserve > aceForm.capacity())
+ aceForm.reserve(toReserve);
+ qt_punycodeEncoder(result.constData() + prevLen, result.size() - prevLen, &aceForm);
+
+ // We use resize()+memcpy() here because we're overwriting the data we've copied
+ if (isIdnEnabled) {
+ QString tmp = qt_punycodeDecoder(aceForm);
+ if (tmp.isEmpty())
+ return QString(); // shouldn't happen, since we've just punycode-encoded it
+ result.resize(prevLen + tmp.size());
+ memcpy(result.data() + prevLen, tmp.constData(), tmp.size() * sizeof(QChar));
+ } else {
+ result.resize(prevLen + aceForm.size());
+ memcpy(result.data() + prevLen, aceForm.constData(), aceForm.size() * sizeof(QChar));
+ }
+
+ if (!qt_check_std3rules(aceForm.constData(), aceForm.size()))
+ return QString();
+ }
+
+
+ lastIdx = idx + 1;
+ if (lastIdx < domain.size() + 1)
+ result += QLatin1Char('.');
+ else
+ break;
+ }
+ return result;
+}
+
+/*!
+ \since 4.2
+
+ Returns the current whitelist of top-level domains that are allowed
+ to have non-ASCII characters in their compositions.
+
+ See setIdnWhitelist() for the rationale of this list.
+*/
+QStringList QUrl::idnWhitelist()
+{
+ if (user_idn_whitelist)
+ return *user_idn_whitelist;
+ QStringList list;
+ unsigned int i = 0;
+ while (i < sizeof(idn_whitelist)/sizeof(const char *)) {
+ list << QLatin1String(idn_whitelist[i]);
+ ++i;
+ }
+ return list;
+}
+
+/*!
+ \since 4.2
+
+ Sets the whitelist of Top-Level Domains (TLDs) that are allowed to have
+ non-ASCII characters in domains to the value of \a list.
+
+ Qt has comes a default list that contains the Internet top-level domains
+ that have published support for Internationalized Domain Names (IDNs)
+ and rules to guarantee that no deception can happen between similarly-looking
+ characters (such as the Latin lowercase letter \c 'a' and the Cyrillic
+ equivalent, which in most fonts are visually identical).
+
+ This list is periodically maintained, as registrars publish new rules.
+
+ This function is provided for those who need to manipulate the list, in
+ order to add or remove a TLD. It is not recommended to change its value
+ for purposes other than testing, as it may expose users to security risks.
+*/
+void QUrl::setIdnWhitelist(const QStringList &list)
+{
+ if (!user_idn_whitelist)
+ user_idn_whitelist = new QStringList;
+ *user_idn_whitelist = list;
+}
+
+QT_END_NAMESPACE
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp
new file mode 100644
index 0000000000..ccb03611f5
--- /dev/null
+++ b/src/corelib/io/qurlquery.cpp
@@ -0,0 +1,729 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Intel Corporation.
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qurlquery.h"
+#include "qurl_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QUrlQuery
+
+ \brief The QUrlQuery class provides a way to manipulate a key-value pairs in
+ a URL's query.
+
+ \reentrant
+ \ingroup io
+ \ingroup network
+ \ingroup shared
+
+ It is used to parse the query strings found in URLs like the following:
+
+ \img qurl-querystring.png
+
+ Query strings like the above are used to transmit options in the URL and are
+ usually decoded into multiple key-value pairs. The one above would contain
+ two entries in its list, with keys "type" and "color". QUrlQuery can also be
+ used to create a query string suitable for use in QUrl::setQuery() from the
+ individual components of the query.
+
+ The most common way of parsing a query string is to initialize it in the
+ constructor by passing it the query string. Otherwise, the setQuery() method
+ can be used to set the query to be parsed. That method can also be used to
+ parse a query with non-standard delimiters, after having set them using the
+ setQueryDelimiters() function.
+
+ The encoded query string can be obtained again using query(). This will take
+ all the internally-stored items and encode the string using the delimiters.
+
+ \section1 Encoding
+
+ All of the getter methods in QUrlQuery support an optional parameter of type
+ QUrl::ComponentFormattingOptions, including query(), which dictate how to
+ encode the data in question. Regardless of the mode, the returned value must
+ still be considered a percent-encoded string, as there are certain values
+ which cannot be expressed in decoded form (like control characters, byte
+ sequences not decodable to UTF-8). For that reason, the percent character is
+ always represented by the string "%25".
+
+ \section2 Handling of spaces and plus ("+")
+
+ Web browsers usually encode spaces found in HTML FORM elements to a plus sign
+ ("+") and plus signs to its percent-encoded form (%2B). However, the Internet
+ specifications governing URLs do not consider spaces and the plus character
+ equivalent.
+
+ For that reason, QUrlQuery never encodes the space character to "+" and will
+ never decode "+" to a space character. Instead, space characters will be
+ rendered "%20" in encoded form.
+
+ To support encoding like that of HTML forms, QUrlQuery also never decodes the
+ "%2B" sequence to a plus sign nor encode a plus sign. In fact, any "%2B" or
+ "+" sequences found in the keys, values, or query string are left exactly
+ like written (except for the uppercasing of "%2b" to "%2B").
+
+ \section1 Non-standard delimiters
+
+ By default, QUrlQuery uses an equal sign ("=") to separate a key from its
+ value, and an ampersand ("&") to separate key-value pairs from each other. It
+ is possible to change the delimiters that QUrlQuery uses for parsing and for
+ reconstructing the query by calling setQueryDelimiters().
+
+ Non-standard delimiters should be chosen from among what RFC 3986 calls
+ "sub-delimiters". They are:
+
+ \code
+ sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ / "*" / "+" / "," / ";" / "="
+ \endcode
+
+ Use of other characters is not supported and may result in unexpected
+ behaviour. QUrlQuery does not verify that you passed a valid delimiter.
+
+ \sa QUrl
+*/
+
+typedef QList<QPair<QString, QString> > Map;
+
+class QUrlQueryPrivate : public QSharedData
+{
+public:
+ QUrlQueryPrivate(const QString &query = QString())
+ : valueDelimiter(QUrlQuery::defaultQueryValueDelimiter()),
+ pairDelimiter(QUrlQuery::defaultQueryPairDelimiter())
+ { if (!query.isEmpty()) setQuery(query); }
+
+ QString recodeFromUser(const QString &input) const;
+ QString recodeToUser(const QString &input, QUrl::ComponentFormattingOptions encoding) const;
+
+ void setQuery(const QString &query);
+
+ void addQueryItem(const QString &key, const QString &value)
+ { itemList.append(qMakePair(recodeFromUser(key), recodeFromUser(value))); }
+ int findRecodedKey(const QString &key, int from = 0) const
+ {
+ for (int i = from; i < itemList.size(); ++i)
+ if (itemList.at(i).first == key)
+ return i;
+ return itemList.size();
+ }
+ Map::const_iterator findKey(const QString &key) const
+ { return itemList.constBegin() + findRecodedKey(recodeFromUser(key)); }
+ Map::iterator findKey(const QString &key)
+ { return itemList.begin() + findRecodedKey(recodeFromUser(key)); }
+
+ // use QMap so we end up sorting the items by key
+ Map itemList;
+ QChar valueDelimiter;
+ QChar pairDelimiter;
+};
+
+template<> void QSharedDataPointer<QUrlQueryPrivate>::detach()
+{
+ if (d && d->ref.load() == 1)
+ return;
+ QUrlQueryPrivate *x = (d ? new QUrlQueryPrivate(*d)
+ : new QUrlQueryPrivate);
+ x->ref.ref();
+ if (d && !d->ref.deref())
+ delete d;
+ d = x;
+}
+
+// Here's how we do the encoding in QUrlQuery
+// The RFC says these are the delimiters:
+// gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
+// sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+// / "*" / "+" / "," / ";" / "="
+// And the definition of query is:
+// query = *( pchar / "/" / "?" )
+// pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+//
+// The strict definition of query says that it can have unencoded any
+// unreserved, sub-delim, ":", "@", "/" and "?". Or, by exclusion, excluded
+// delimiters are "#", "[" and "]" -- if those are present, they must be
+// percent-encoded. The fact that "[" and "]" should be encoded is probably a
+// mistake in the spec, so we ignore it and leave the decoded.
+//
+// The internal storage in the Map is equivalent to PrettyDecoded. That means
+// the getter methods, when called with the default encoding value, will not
+// have to recode anything (except for toString()).
+//
+// The "+" sub-delimiter is always left untouched. We never encode "+" to "%2B"
+// nor do we decode "%2B" to "+", no matter what the user asks.
+//
+// The rest of the delimiters are kept in their decoded forms and that's
+// considered non-ambiguous. That includes the pair and value delimiters
+// themselves.
+//
+// But when recreating the query string, in toString(), we must take care of
+// the special delimiters: the pair and value delimiters, as well as the "#"
+// character if unambiguous decoding is requested.
+
+#define decode(x) ushort(x)
+#define leave(x) ushort(0x100 | (x))
+#define encode(x) ushort(0x200 | (x))
+static const ushort prettyDecodedActions[] = { leave('+'), 0 };
+
+inline QString QUrlQueryPrivate::recodeFromUser(const QString &input) const
+{
+ // note: duplicated in setQuery()
+ QString output;
+ if (qt_urlRecode(output, input.constData(), input.constData() + input.length(),
+ QUrl::MostDecoded,
+ prettyDecodedActions))
+ return output;
+ return input;
+}
+
+inline bool idempotentRecodeToUser(QUrl::ComponentFormattingOptions encoding)
+{
+ return encoding == QUrl::PrettyDecoded;
+}
+
+inline QString QUrlQueryPrivate::recodeToUser(const QString &input, QUrl::ComponentFormattingOptions encoding) const
+{
+ // our internal formats are stored in "PrettyDecoded" form
+ // and there are no ambiguous characters
+ if (idempotentRecodeToUser(encoding))
+ return input;
+
+ if (!(encoding & QUrl::EncodeDelimiters)) {
+ QString output;
+ if (qt_urlRecode(output, input.constData(), input.constData() + input.length(),
+ encoding, prettyDecodedActions))
+ return output;
+ return input;
+ }
+
+ // re-encode the "#" character and the query delimiter pair
+ ushort actions[] = { encode(pairDelimiter.unicode()), encode(valueDelimiter.unicode()),
+ encode('#'), 0 };
+ QString output;
+ if (qt_urlRecode(output, input.constData(), input.constData() + input.length(), encoding, actions))
+ return output;
+ return input;
+}
+
+void QUrlQueryPrivate::setQuery(const QString &query)
+{
+ itemList.clear();
+ const QChar *pos = query.constData();
+ const QChar *const end = pos + query.size();
+ while (pos != end) {
+ const QChar *begin = pos;
+ const QChar *delimiter = 0;
+ while (pos != end) {
+ // scan for the component parts of this pair
+ if (!delimiter && pos->unicode() == valueDelimiter)
+ delimiter = pos;
+ if (pos->unicode() == pairDelimiter)
+ break;
+ ++pos;
+ }
+ if (!delimiter)
+ delimiter = pos;
+
+ // pos is the end of this pair (the end of the string or the pair delimiter)
+ // delimiter points to the value delimiter or to the end of this pair
+
+ QString key;
+ if (!qt_urlRecode(key, begin, delimiter,
+ QUrl::MostDecoded,
+ prettyDecodedActions))
+ key = QString(begin, delimiter - begin);
+
+ if (delimiter == pos) {
+ // the value delimiter wasn't found, store a null value
+ itemList.append(qMakePair(key, QString()));
+ } else if (delimiter + 1 == pos) {
+ // if the delimiter was found but the value is empty, store empty-but-not-null
+ itemList.append(qMakePair(key, QString(0, Qt::Uninitialized)));
+ } else {
+ QString value;
+ if (!qt_urlRecode(value, delimiter + 1, pos,
+ QUrl::MostDecoded,
+ prettyDecodedActions))
+ value = QString(delimiter + 1, pos - delimiter - 1);
+ itemList.append(qMakePair(key, value));
+ }
+
+ if (pos != end)
+ ++pos;
+ }
+}
+
+// allow QUrlQueryPrivate to detach from null
+template <> inline QUrlQueryPrivate *
+QSharedDataPointer<QUrlQueryPrivate>::clone()
+{
+ return d ? new QUrlQueryPrivate(*d) : new QUrlQueryPrivate;
+}
+
+/*!
+ Constructs an empty QUrlQuery object. A query can be set afterwards by
+ calling setQuery() or items can be added by using addQueryItem().
+
+ \sa setQuery(), addQueryItem()
+*/
+QUrlQuery::QUrlQuery()
+ : d(0)
+{
+}
+
+/*!
+ Constructs a QUrlQuery object and parses the \a queryString query string,
+ using the default query delimiters. To parse a query string using other
+ delimiters, you should first set them using setQueryDelimiters() and then
+ set the query with setQuery().
+*/
+QUrlQuery::QUrlQuery(const QString &queryString)
+ : d(queryString.isEmpty() ? 0 : new QUrlQueryPrivate(queryString))
+{
+}
+
+/*!
+ Constructs a QUrlQuery object and parses the query string found in the \a
+ url URL, using the default query delimiters. To parse a query string using
+ other delimiters, you should first set them using setQueryDelimiters() and
+ then set the query with setQuery().
+
+ \sa QUrl::query()
+*/
+QUrlQuery::QUrlQuery(const QUrl &url)
+ : d(0)
+{
+ // use internals to avoid unnecessary recoding
+ // ### FIXME: actually do it
+ if (url.hasQuery())
+ d = new QUrlQueryPrivate(url.query());
+}
+
+/*!
+ Copies the contents of the \a other QUrlQuery object, including the query
+ delimiters.
+*/
+QUrlQuery::QUrlQuery(const QUrlQuery &other)
+ : d(other.d)
+{
+}
+
+/*!
+ Copies the contents of the \a other QUrlQuery object, including the query
+ delimiters.
+*/
+QUrlQuery &QUrlQuery::operator =(const QUrlQuery &other)
+{
+ d = other.d;
+ return *this;
+}
+
+/*!
+ Destroys this QUrlQuery object.
+*/
+QUrlQuery::~QUrlQuery()
+{
+ // d auto-deletes
+}
+
+/*!
+ Returns true if this object and the \a other object contain the same
+ contents, in the same order, and use the same query delimiters.
+*/
+bool QUrlQuery::operator ==(const QUrlQuery &other) const
+{
+ if (d == other.d)
+ return true;
+ if (d && other.d)
+ return d->valueDelimiter == other.d->valueDelimiter &&
+ d->pairDelimiter == other.d->pairDelimiter &&
+ d->itemList == other.d->itemList;
+ return false;
+}
+
+/*!
+ Returns true if this QUrlQUery object contains no key-value pairs, such as
+ after being default-constructed or after parsing an empty query string.
+
+ \sa setQuery(), clear()
+*/
+bool QUrlQuery::isEmpty() const
+{
+ return d ? d->itemList.isEmpty() : true;
+}
+
+/*!
+ \internal
+*/
+bool QUrlQuery::isDetached() const
+{
+ return d && d->ref.load() == 1;
+}
+
+/*!
+ Clears this QUrlQuery object by removing all of the key-value pairs
+ currently stored. If the query delimiters have been changed, this function
+ will leave them with their changed values.
+
+ \sa isEmpty(), setQueryDelimiters()
+*/
+void QUrlQuery::clear()
+{
+ if (d.constData())
+ d->itemList.clear();
+}
+
+/*!
+ Parses the query string in \a queryString and sets the internal items to
+ the values found there. If any delimiters have been specified with
+ setQueryDelimiters(), this function will use them instead of the default
+ delimiters to parse the string.
+*/
+void QUrlQuery::setQuery(const QString &queryString)
+{
+ d->setQuery(queryString);
+}
+
+static void recodeAndAppend(QString &to, const QString &input,
+ QUrl::ComponentFormattingOptions encoding, const ushort *tableModifications)
+{
+ if (!qt_urlRecode(to, input.constData(), input.constData() + input.length(), encoding, tableModifications))
+ to += input;
+}
+
+/*!
+ Returns the reconstructed query string, formed from the key-value pairs
+ currently stored in this QUrlQuery object and separated by the query
+ delimiters chosen for this object. The keys and values are encoded using
+ the options given by the \a encoding paramter.
+
+ For this function, the only ambiguous delimiter is the hash ("#"), as in
+ URLs it is used to separate the query string from the fragment that may
+ follow.
+
+ The order of the key-value pairs in the returned string is exactly the same
+ as in the original query.
+
+ \sa setQuery(), QUrl::setQuery(), QUrl::fragment(), \l{#Encoding}{Encoding}
+*/
+QString QUrlQuery::query(QUrl::ComponentFormattingOptions encoding) const
+{
+ if (!d)
+ return QString();
+
+ // unlike the component encoding, for the whole query we need to modify a little:
+ // - the "#" character is ambiguous, so we decode it only in DecodeAllDelimiters mode
+ // - the query delimiter pair must always be encoded
+ // - the non-delimiters vary on DecodeUnambiguousDelimiters
+ // so:
+ // - full encoding: encode the non-delimiters, the pair, "#", "[" and "]"
+ // - pretty decode: decode the non-delimiters, "[" and "]"; encode the pair and "#"
+ // - decode all: decode the non-delimiters, "[", "]", "#"; encode the pair
+
+ // start with what's always encoded
+ ushort tableActions[] = {
+ leave('+'), // 0
+ encode(d->pairDelimiter.unicode()), // 1
+ encode(d->valueDelimiter.unicode()), // 2
+ decode('#'), // 3
+ 0
+ };
+ if (encoding & QUrl::EncodeDelimiters) {
+ tableActions[3] = encode('#');
+ }
+
+ QString result;
+ Map::const_iterator it = d->itemList.constBegin();
+ Map::const_iterator end = d->itemList.constEnd();
+
+ {
+ int size = 0;
+ for ( ; it != end; ++it)
+ size += it->first.length() + 1 + it->second.length() + 1;
+ result.reserve(size + size / 4);
+ }
+
+ for (it = d->itemList.constBegin(); it != end; ++it) {
+ if (!result.isEmpty())
+ result += QChar(d->pairDelimiter);
+ recodeAndAppend(result, it->first, encoding, tableActions);
+ if (!it->second.isNull()) {
+ result += QChar(d->valueDelimiter);
+ recodeAndAppend(result, it->second, encoding, tableActions);
+ }
+ }
+ return result;
+}
+
+/*!
+ Sets the characters used for delimiting between keys and values,
+ and between key-value pairs in the URL's query string. The default
+ value delimiter is '=' and the default pair delimiter is '&'.
+
+ \img qurl-querystring.png
+
+ \a valueDelimiter will be used for separating keys from values,
+ and \a pairDelimiter will be used to separate key-value pairs.
+ Any occurrences of these delimiting characters in the encoded
+ representation of the keys and values of the query string are
+ percent encoded when returned in query().
+
+ If \a valueDelimiter is set to '(' and \a pairDelimiter is ')',
+ the above query string would instead be represented like this:
+
+ \snippet doc/src/snippets/code/src_corelib_io_qurl.cpp 4
+
+ \note Non-standard delimiters should be chosen from among what RFC 3986 calls
+ "sub-delimiters". They are:
+
+ \code
+ sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ / "*" / "+" / "," / ";" / "="
+ \endcode
+
+ Use of other characters is not supported and may result in unexpected
+ behaviour. This method does not verify that you passed a valid delimiter.
+
+ \sa queryValueDelimiter(), queryPairDelimiter()
+*/
+void QUrlQuery::setQueryDelimiters(QChar valueDelimiter, QChar pairDelimiter)
+{
+ d->valueDelimiter = valueDelimiter.unicode();
+ d->pairDelimiter = pairDelimiter.unicode();
+}
+
+/*!
+ Returns the character used to delimit between keys and values when
+ reconstructing the query string in query() or when parsing in setQuery().
+
+ \sa setQueryDelimiters(), queryPairDelimiter()
+*/
+QChar QUrlQuery::queryValueDelimiter() const
+{
+ return d ? d->valueDelimiter : defaultQueryValueDelimiter();
+}
+
+/*!
+ Returns the character used to delimit between keys-value pairs when
+ reconstructing the query string in query() or when parsing in setQuery().
+
+ \sa setQueryDelimiters(), queryValueDelimiter()
+*/
+QChar QUrlQuery::queryPairDelimiter() const
+{
+ return d ? d->pairDelimiter : defaultQueryPairDelimiter();
+}
+
+/*!
+ Sets the items in this QUrlQuery object to \a query. The order of the
+ elements in \a query is preserved.
+
+ \note This method does not treat spaces (ASCII 0x20) and plus ("+") signs
+ as the same, like HTML forms do. If you need spaces to be represented as
+ plus signs, use actual plus signs.
+
+ \sa queryItems(), isEmpty()
+*/
+void QUrlQuery::setQueryItems(const QList<QPair<QString, QString> > &query)
+{
+ clear();
+ if (query.isEmpty())
+ return;
+
+ QUrlQueryPrivate *dd = d;
+ QList<QPair<QString, QString> >::const_iterator it = query.constBegin(),
+ end = query.constEnd();
+ for ( ; it != end; ++it)
+ dd->addQueryItem(it->first, it->second);
+}
+
+/*!
+ Returns the query string of the URL, as a map of keys and values, using the
+ options specified in \a encoding to encode the items. The order of the
+ elements is the same as the one found in the query string or set with
+ setQueryItems().
+
+ \sa setQueryItems(), \l{#Encoding}{Encoding}
+*/
+QList<QPair<QString, QString> > QUrlQuery::queryItems(QUrl::ComponentFormattingOptions encoding) const
+{
+ if (!d)
+ return QList<QPair<QString, QString> >();
+ if (idempotentRecodeToUser(encoding))
+ return d->itemList;
+
+ QList<QPair<QString, QString> > result;
+ Map::const_iterator it = d->itemList.constBegin();
+ Map::const_iterator end = d->itemList.constEnd();
+ for ( ; it != end; ++it)
+ result << qMakePair(d->recodeToUser(it->first, encoding),
+ d->recodeToUser(it->second, encoding));
+ return result;
+}
+
+/*!
+ Returns true if there is a query string pair whose key is equal
+ to \a key from the URL.
+
+ \sa addQueryItem(), queryItemValue()
+*/
+bool QUrlQuery::hasQueryItem(const QString &key) const
+{
+ if (!d)
+ return false;
+ return d->findKey(key) != d->itemList.constEnd();
+}
+
+/*!
+ Appends the pair \a key = \a value to the end of the query string of the
+ URL. This method does not overwrite existing items that might exist with
+ the same key.
+
+ \note This method does not treat spaces (ASCII 0x20) and plus ("+") signs
+ as the same, like HTML forms do. If you need spaces to be represented as
+ plus signs, use actual plus signs.
+
+ \sa hasQueryItem(), queryItemValue()
+*/
+void QUrlQuery::addQueryItem(const QString &key, const QString &value)
+{
+ d->addQueryItem(key, value);
+}
+
+/*!
+ Returns the query value associated with key \a key from the URL, using the
+ options specified in \a encoding to encode the return value. If the key \a
+ key is not found, this function returns an empty string. If you need to
+ distinguish between an empty value and a non-existent key, you should check
+ for the key's presence first using hasQueryItem().
+
+ If the key \a key is multiply defined, this function will return the first
+ one found, in the order they were present in the query string or added
+ using addQueryItem().
+
+ \sa addQueryItem(), allQueryItemValues(), \l{#Encoding}{Encoding}
+*/
+QString QUrlQuery::queryItemValue(const QString &key, QUrl::ComponentFormattingOptions encoding) const
+{
+ QString result;
+ if (d) {
+ Map::const_iterator it = d->findKey(key);
+ if (it != d->itemList.constEnd())
+ result = d->recodeToUser(it->second, encoding);
+ }
+ return result;
+}
+
+/*!
+ Returns the a list of query string values whose key is equal to \a key from
+ the URL, using the options specified in \a encoding to encode the return
+ value. If the key \a key is not found, this function returns an empty list.
+
+ \sa queryItemValue(), addQueryItem()
+*/
+QStringList QUrlQuery::allQueryItemValues(const QString &key, QUrl::ComponentFormattingOptions encoding) const
+{
+ QStringList result;
+ if (d) {
+ QString encodedKey = d->recodeFromUser(key);
+ int idx = d->findRecodedKey(encodedKey);
+ while (idx < d->itemList.size()) {
+ result << d->recodeToUser(d->itemList.at(idx).second, encoding);
+ idx = d->findRecodedKey(encodedKey, idx + 1);
+ }
+ }
+ return result;
+}
+
+/*!
+ Removes the query string pair whose key is equal to \a key from the URL. If
+ there are multiple items with a key equal to \a key, it removes the first
+ item in the order they were present in the query string or added with
+ addQueryItem().
+
+ \sa removeAllQueryItems()
+*/
+void QUrlQuery::removeQueryItem(const QString &key)
+{
+ if (d) {
+ Map::iterator it = d->findKey(key);
+ if (it != d->itemList.end())
+ d->itemList.erase(it);
+ }
+}
+
+/*!
+ Removes all the query string pairs whose key is equal to \a key
+ from the URL.
+
+ \sa removeQueryItem()
+*/
+void QUrlQuery::removeAllQueryItems(const QString &key)
+{
+ if (d.constData()) {
+ QString encodedKey = d->recodeFromUser(key);
+ Map::iterator it = d->itemList.begin();
+ while (it != d->itemList.end()) {
+ if (it->first == encodedKey)
+ it = d->itemList.erase(it);
+ else
+ ++it;
+ }
+ }
+}
+
+/*!
+ \fn QChar QUrlQuery::defaultQueryValueDelimiter()
+ Returns the default character for separating keys from values in the query,
+ an equal sign ("=").
+
+ \sa setQueryDelimiters(), queryValueDelimiter(), defaultQueryPairDelimiter()
+*/
+
+/*!
+ \fn QChar QUrlQuery::defaultQueryPairDelimiter()
+ Returns the default character for separating keys-value pairs from each
+ other, an ampersand ("&").
+
+ \sa setQueryDelimiters(), queryPairDelimiter(), defaultQueryValueDelimiter()
+*/
+
+QT_END_NAMESPACE
diff --git a/src/corelib/io/qurlquery.h b/src/corelib/io/qurlquery.h
new file mode 100644
index 0000000000..4b9d104498
--- /dev/null
+++ b/src/corelib/io/qurlquery.h
@@ -0,0 +1,179 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Intel Corporation.
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QURLQUERY_H
+#define QURLQUERY_H
+
+#include <QtCore/qpair.h>
+#include <QtCore/qshareddata.h>
+#include <QtCore/qurl.h>
+
+#if QT_DEPRECATED_SINCE(5,0)
+#include <QtCore/qstringlist.h>
+#endif
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QUrlQueryPrivate;
+class Q_CORE_EXPORT QUrlQuery
+{
+public:
+ QUrlQuery();
+ explicit QUrlQuery(const QUrl &url);
+ explicit QUrlQuery(const QString &queryString);
+ QUrlQuery(const QUrlQuery &other);
+ QUrlQuery &operator=(const QUrlQuery &other);
+#ifdef Q_COMPILER_RVALUE_REFS
+ QUrlQuery &operator=(QUrlQuery &&other)
+ { qSwap(d, other.d); return *this; }
+#endif
+ ~QUrlQuery();
+
+ bool operator==(const QUrlQuery &other) const;
+ bool operator!=(const QUrlQuery &other) const
+ { return !(*this == other); }
+
+ void swap(QUrlQuery &other) { qSwap(d, other.d); }
+
+ bool isEmpty() const;
+ bool isDetached() const;
+ void clear();
+
+ QString query(QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const;
+ void setQuery(const QString &queryString);
+ QString toString(QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const
+ { return query(encoding); }
+
+ void setQueryDelimiters(QChar valueDelimiter, QChar pairDelimiter);
+ QChar queryValueDelimiter() const;
+ QChar queryPairDelimiter() const;
+
+ void setQueryItems(const QList<QPair<QString, QString> > &query);
+ QList<QPair<QString, QString> > queryItems(QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const;
+
+ bool hasQueryItem(const QString &key) const;
+ void addQueryItem(const QString &key, const QString &value);
+ void removeQueryItem(const QString &key);
+ QString queryItemValue(const QString &key, QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const;
+ QStringList allQueryItemValues(const QString &key, QUrl::ComponentFormattingOptions encoding = QUrl::PrettyDecoded) const;
+ void removeAllQueryItems(const QString &key);
+
+ static QChar defaultQueryValueDelimiter()
+ { return QChar(ushort('=')); }
+ static QChar defaultQueryPairDelimiter()
+ { return QChar(ushort('&')); }
+
+private:
+ friend class QUrl;
+ QSharedDataPointer<QUrlQueryPrivate> d;
+public:
+ typedef QSharedDataPointer<QUrlQueryPrivate> DataPtr;
+ inline DataPtr &data_ptr() { return d; }
+};
+
+Q_DECLARE_TYPEINFO(QUrlQuery, Q_MOVABLE_TYPE);
+Q_DECLARE_SHARED(QUrlQuery)
+
+#if QT_DEPRECATED_SINCE(5,0)
+inline void QUrl::setQueryItems(const QList<QPair<QString, QString> > &qry)
+{ QUrlQuery q(*this); q.setQueryItems(qry); setQuery(q); }
+inline void QUrl::addQueryItem(const QString &key, const QString &value)
+{ QUrlQuery q(*this); q.addQueryItem(key, value); setQuery(q); }
+inline QList<QPair<QString, QString> > QUrl::queryItems() const
+{ return QUrlQuery(*this).queryItems(); }
+inline bool QUrl::hasQueryItem(const QString &key) const
+{ return QUrlQuery(*this).hasQueryItem(key); }
+inline QString QUrl::queryItemValue(const QString &key) const
+{ return QUrlQuery(*this).queryItemValue(key); }
+inline QStringList QUrl::allQueryItemValues(const QString &key) const
+{ return QUrlQuery(*this).allQueryItemValues(key); }
+inline void QUrl::removeQueryItem(const QString &key)
+{ QUrlQuery q(*this); q.removeQueryItem(key); setQuery(q); }
+inline void QUrl::removeAllQueryItems(const QString &key)
+{ QUrlQuery q(*this); q.removeAllQueryItems(key); }
+
+inline void QUrl::addEncodedQueryItem(const QByteArray &key, const QByteArray &value)
+{ QUrlQuery q(*this); q.addQueryItem(QString::fromUtf8(key), QString::fromUtf8(value)); setQuery(q); }
+inline bool QUrl::hasEncodedQueryItem(const QByteArray &key) const
+{ return QUrlQuery(*this).hasQueryItem(QString::fromUtf8(key)); }
+inline QByteArray QUrl::encodedQueryItemValue(const QByteArray &key) const
+{ return QUrlQuery(*this).queryItemValue(QString::fromUtf8(key), QUrl::FullyEncoded).toLatin1(); }
+inline void QUrl::removeEncodedQueryItem(const QByteArray &key)
+{ QUrlQuery q(*this); q.removeQueryItem(QString::fromUtf8(key)); setQuery(q); }
+inline void QUrl::removeAllEncodedQueryItems(const QByteArray &key)
+{ QUrlQuery q(*this); q.removeAllQueryItems(QString::fromUtf8(key)); }
+
+inline void QUrl::setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray> > &qry)
+{
+ QUrlQuery q(*this);
+ QList<QPair<QByteArray, QByteArray> >::ConstIterator it = qry.constBegin();
+ for ( ; it != qry.constEnd(); ++it)
+ q.addQueryItem(QString::fromUtf8(it->first), QString::fromUtf8(it->second));
+ setQuery(q);
+}
+inline QList<QPair<QByteArray, QByteArray> > QUrl::encodedQueryItems() const
+{
+ QList<QPair<QString, QString> > items = QUrlQuery(*this).queryItems(QUrl::FullyEncoded);
+ QList<QPair<QString, QString> >::ConstIterator it = items.constBegin();
+ QList<QPair<QByteArray, QByteArray> > result;
+ result.reserve(items.size());
+ for ( ; it != items.constEnd(); ++it)
+ result << qMakePair(it->first.toLatin1(), it->second.toLatin1());
+ return result;
+}
+inline QList<QByteArray> QUrl::allEncodedQueryItemValues(const QByteArray &key) const
+{
+ QStringList items = QUrlQuery(*this).allQueryItemValues(QString::fromUtf8(key), QUrl::FullyEncoded);
+ QList<QByteArray> result;
+ result.reserve(items.size());
+ Q_FOREACH (const QString &item, items)
+ result << item.toLatin1();
+ return result;
+}
+#endif
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QURLQUERY_H
diff --git a/src/corelib/io/qurlrecode.cpp b/src/corelib/io/qurlrecode.cpp
new file mode 100644
index 0000000000..b586bd7a1e
--- /dev/null
+++ b/src/corelib/io/qurlrecode.cpp
@@ -0,0 +1,644 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Intel Corporation
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qurl.h"
+
+QT_BEGIN_NAMESPACE
+
+// ### move to qurl_p.h
+enum EncodingAction {
+ DecodeCharacter = 0,
+ LeaveCharacter = 1,
+ EncodeCharacter = 2
+};
+
+// From RFC 3896, Appendix A Collected ABNF for URI
+// unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+// reserved = gen-delims / sub-delims
+// gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
+// sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+// / "*" / "+" / "," / ";" / "="
+static const uchar defaultActionTable[96] = {
+ 2, // space
+ 1, // '!' (sub-delim)
+ 2, // '"'
+ 1, // '#' (gen-delim)
+ 1, // '$' (gen-delim)
+ 2, // '%' (percent)
+ 1, // '&' (gen-delim)
+ 1, // "'" (sub-delim)
+ 1, // '(' (sub-delim)
+ 1, // ')' (sub-delim)
+ 1, // '*' (sub-delim)
+ 1, // '+' (sub-delim)
+ 1, // ',' (sub-delim)
+ 0, // '-' (unreserved)
+ 0, // '.' (unreserved)
+ 1, // '/' (gen-delim)
+
+ 0, 0, 0, 0, 0, // '0' to '4' (unreserved)
+ 0, 0, 0, 0, 0, // '5' to '9' (unreserved)
+ 1, // ':' (gen-delim)
+ 1, // ';' (sub-delim)
+ 2, // '<'
+ 1, // '=' (sub-delim)
+ 2, // '>'
+ 1, // '?' (gen-delim)
+
+ 1, // '@' (gen-delim)
+ 0, 0, 0, 0, 0, // 'A' to 'E' (unreserved)
+ 0, 0, 0, 0, 0, // 'F' to 'J' (unreserved)
+ 0, 0, 0, 0, 0, // 'K' to 'O' (unreserved)
+ 0, 0, 0, 0, 0, // 'P' to 'T' (unreserved)
+ 0, 0, 0, 0, 0, 0, // 'U' to 'Z' (unreserved)
+ 1, // '[' (gen-delim)
+ 2, // '\'
+ 1, // ']' (gen-delim)
+ 2, // '^'
+ 0, // '_' (unreserved)
+
+ 2, // '`'
+ 0, 0, 0, 0, 0, // 'a' to 'e' (unreserved)
+ 0, 0, 0, 0, 0, // 'f' to 'j' (unreserved)
+ 0, 0, 0, 0, 0, // 'k' to 'o' (unreserved)
+ 0, 0, 0, 0, 0, // 'p' to 't' (unreserved)
+ 0, 0, 0, 0, 0, 0, // 'u' to 'z' (unreserved)
+ 2, // '{'
+ 2, // '|'
+ 2, // '}'
+ 0, // '~' (unreserved)
+
+ 2 // BSKP
+};
+
+// mask tables, in negative polarity
+// 0x00 if it belongs to this category
+// 0xff if it doesn't
+
+static const uchar delimsMask[96] = {
+ 0xff, // space
+ 0x00, // '!' (sub-delim)
+ 0xff, // '"'
+ 0x00, // '#' (gen-delim)
+ 0x00, // '$' (gen-delim)
+ 0xff, // '%' (percent)
+ 0x00, // '&' (gen-delim)
+ 0x00, // "'" (sub-delim)
+ 0x00, // '(' (sub-delim)
+ 0x00, // ')' (sub-delim)
+ 0x00, // '*' (sub-delim)
+ 0x00, // '+' (sub-delim)
+ 0x00, // ',' (sub-delim)
+ 0xff, // '-' (unreserved)
+ 0xff, // '.' (unreserved)
+ 0x00, // '/' (gen-delim)
+
+ 0xff, 0xff, 0xff, 0xff, 0xff, // '0' to '4' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // '5' to '9' (unreserved)
+ 0x00, // ':' (gen-delim)
+ 0x00, // ';' (sub-delim)
+ 0xff, // '<'
+ 0x00, // '=' (sub-delim)
+ 0xff, // '>'
+ 0x00, // '?' (gen-delim)
+
+ 0x00, // '@' (gen-delim)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'A' to 'E' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'F' to 'J' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'K' to 'O' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'P' to 'T' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'U' to 'Z' (unreserved)
+ 0x00, // '[' (gen-delim)
+ 0xff, // '\'
+ 0x00, // ']' (gen-delim)
+ 0xff, // '^'
+ 0xff, // '_' (unreserved)
+
+ 0xff, // '`'
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'a' to 'e' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'f' to 'j' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'k' to 'o' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'p' to 't' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'u' to 'z' (unreserved)
+ 0xff, // '{'
+ 0xff, // '|'
+ 0xff, // '}'
+ 0xff, // '~' (unreserved)
+
+ 0xff // BSKP
+};
+
+static const uchar reservedMask[96] = {
+ 0xff, // space
+ 0xff, // '!' (sub-delim)
+ 0x00, // '"'
+ 0xff, // '#' (gen-delim)
+ 0xff, // '$' (gen-delim)
+ 0xff, // '%' (percent)
+ 0xff, // '&' (gen-delim)
+ 0xff, // "'" (sub-delim)
+ 0xff, // '(' (sub-delim)
+ 0xff, // ')' (sub-delim)
+ 0xff, // '*' (sub-delim)
+ 0xff, // '+' (sub-delim)
+ 0xff, // ',' (sub-delim)
+ 0xff, // '-' (unreserved)
+ 0xff, // '.' (unreserved)
+ 0xff, // '/' (gen-delim)
+
+ 0xff, 0xff, 0xff, 0xff, 0xff, // '0' to '4' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // '5' to '9' (unreserved)
+ 0xff, // ':' (gen-delim)
+ 0xff, // ';' (sub-delim)
+ 0x00, // '<'
+ 0xff, // '=' (sub-delim)
+ 0x00, // '>'
+ 0xff, // '?' (gen-delim)
+
+ 0xff, // '@' (gen-delim)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'A' to 'E' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'F' to 'J' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'K' to 'O' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'P' to 'T' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'U' to 'Z' (unreserved)
+ 0xff, // '[' (gen-delim)
+ 0x00, // '\'
+ 0xff, // ']' (gen-delim)
+ 0x00, // '^'
+ 0xff, // '_' (unreserved)
+
+ 0x00, // '`'
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'a' to 'e' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'f' to 'j' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'k' to 'o' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, // 'p' to 't' (unreserved)
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // 'u' to 'z' (unreserved)
+ 0x00, // '{'
+ 0x00, // '|'
+ 0x00, // '}'
+ 0xff, // '~' (unreserved)
+
+ 0xff // BSKP
+};
+
+static inline bool isHex(ushort c)
+{
+ return (c >= 'a' && c <= 'f') ||
+ (c >= 'A' && c <= 'F') ||
+ (c >= '0' && c <= '9');
+}
+
+static inline bool isUpperHex(ushort c)
+{
+ // undefined behaviour if c isn't an hex char!
+ return c < 0x60;
+}
+
+static inline ushort toUpperHex(ushort c)
+{
+ return isUpperHex(c) ? c : c - 0x20;
+}
+
+static inline ushort decodeNibble(ushort c)
+{
+ return c >= 'a' ? c - 'a' + 0xA :
+ c >= 'A' ? c - 'A' + 0xA : c - '0';
+}
+
+// if the sequence at input is 2*HEXDIG, returns its decoding
+// returns -1 if it isn't.
+// assumes that the range has been checked already
+static inline ushort decodePercentEncoding(const ushort *input)
+{
+ ushort c1 = input[1];
+ ushort c2 = input[2];
+ if (!isHex(c1) || !isHex(c2))
+ return ushort(-1);
+ return decodeNibble(c1) << 4 | decodeNibble(c2);
+}
+
+static inline ushort encodeNibble(ushort c)
+{
+ static const uchar hexnumbers[] = "0123456789ABCDEF";
+ return hexnumbers[c & 0xf];
+}
+
+static void ensureDetached(QString &result, ushort *&output, const ushort *begin, const ushort *input, const ushort *end,
+ int add = 0)
+{
+ if (!output) {
+ // now detach
+ // create enough space if the rest of the string needed to be percent-encoded
+ int charsProcessed = input - begin;
+ int charsRemaining = end - input;
+ int spaceNeeded = end - begin + 2 * charsRemaining + add;
+ int origSize = result.size();
+ result.resize(origSize + spaceNeeded);
+
+ // we know that resize() above detached, so we bypass the reference count check
+ output = const_cast<ushort *>(reinterpret_cast<const ushort *>(result.constData()))
+ + origSize;
+
+ // copy the chars we've already processed
+ int i;
+ for (i = 0; i < charsProcessed; ++i)
+ output[i] = begin[i];
+ output += i;
+ }
+}
+
+static inline bool isUnicodeNonCharacter(uint ucs4)
+{
+ // Unicode has a couple of "non-characters" that one can use internally,
+ // but are not allowed to be used for text interchange.
+ //
+ // Those are the last two entries each Unicode Plane (U+FFFE, U+FFFF,
+ // U+1FFFE, U+1FFFF, etc.) as well as the entries between U+FDD0 and
+ // U+FDEF (inclusive)
+
+ return (ucs4 & 0xfffe) == 0xfffe
+ || (ucs4 - 0xfdd0U) < 16;
+}
+
+// returns true if we performed an UTF-8 decoding
+static bool encodedUtf8ToUtf16(QString &result, ushort *&output, const ushort *begin, const ushort *&input,
+ const ushort *end, ushort decoded)
+{
+ int charsNeeded;
+ uint min_uc;
+ uint uc;
+
+ if (decoded <= 0xC1) {
+ // an UTF-8 first character must be at least 0xC0
+ // however, all 0xC0 and 0xC1 first bytes can only produce overlong sequences
+ return false;
+ } else if (decoded < 0xe0) {
+ charsNeeded = 2;
+ min_uc = 0x80;
+ uc = decoded & 0x1f;
+ } else if (decoded < 0xf0) {
+ charsNeeded = 3;
+ min_uc = 0x800;
+ uc = decoded & 0x0f;
+ } else if (decoded < 0xf5) {
+ charsNeeded = 4;
+ min_uc = 0x10000;
+ uc = decoded & 0x07;
+ } else {
+ // the last Unicode character is U+10FFFF
+ // it's encoded in UTF-8 as "\xF4\x8F\xBF\xBF"
+ // therefore, a byte higher than 0xF4 is not the UTF-8 first byte
+ return false;
+ }
+
+ // are there enough remaining?
+ if (end - input < 3*charsNeeded)
+ return false;
+
+ if (input[3] != '%')
+ return false;
+
+ // first continuation character
+ decoded = decodePercentEncoding(input + 3);
+ if ((decoded & 0xc0) != 0x80)
+ return false;
+ uc <<= 6;
+ uc |= decoded & 0x3f;
+
+ if (charsNeeded > 2) {
+ if (input[6] != '%')
+ return false;
+
+ // second continuation character
+ decoded = decodePercentEncoding(input + 6);
+ if ((decoded & 0xc0) != 0x80)
+ return false;
+ uc <<= 6;
+ uc |= decoded & 0x3f;
+
+ if (charsNeeded > 3) {
+ if (input[9] != '%')
+ return false;
+
+ // third continuation character
+ decoded = decodePercentEncoding(input + 9);
+ if ((decoded & 0xc0) != 0x80)
+ return false;
+ uc <<= 6;
+ uc |= decoded & 0x3f;
+ }
+ }
+
+ // we've decoded something; safety-check it
+ if (uc < min_uc)
+ return false;
+ if (isUnicodeNonCharacter(uc) || (uc >= 0xD800 && uc <= 0xDFFF) || uc >= 0x110000)
+ return false;
+
+ if (!QChar::requiresSurrogates(uc)) {
+ // UTF-8 decoded and no surrogates are required
+ // detach if necessary
+ ensureDetached(result, output, begin, input, end, -9 * charsNeeded + 1);
+ *output++ = uc;
+ } else {
+ // UTF-8 decoded to something that requires a surrogate pair
+ ensureDetached(result, output, begin, input, end, -9 * charsNeeded + 2);
+ *output++ = QChar::highSurrogate(uc);
+ *output++ = QChar::lowSurrogate(uc);
+ }
+ input += charsNeeded * 3 - 1;
+ return true;
+}
+
+static void unicodeToEncodedUtf8(QString &result, ushort *&output, const ushort *begin,
+ const ushort *&input, const ushort *end, ushort decoded)
+{
+ uint uc = decoded;
+ if (QChar::isHighSurrogate(uc)) {
+ if (input < end && QChar::isLowSurrogate(input[1]))
+ uc = QChar::surrogateToUcs4(uc, input[1]);
+ }
+
+ // note: we will encode bad UTF-16 to UTF-8
+ // but they don't get decoded back
+
+ // calculate the utf8 length
+ int utf8len = uc >= 0x10000 ? 4 : uc >= 0x800 ? 3 : 2;
+
+ // detach
+ if (!output) {
+ // we need 3 * utf8len for the encoded UTF-8 sequence
+ // but ensureDetached already adds 3 for the char we're processing
+ ensureDetached(result, output, begin, input, end, 3*utf8len - 3);
+ } else {
+ // verify that there's enough space or expand
+ int charsRemaining = end - input - 1; // not including this one
+ int pos = output - reinterpret_cast<const ushort *>(result.constData());
+ int spaceRemaining = result.size() - pos;
+ if (spaceRemaining < 3*charsRemaining + 3*utf8len) {
+ // must resize
+ result.resize(result.size() + 3*utf8len);
+
+ // we know that resize() above detached, so we bypass the reference count check
+ output = const_cast<ushort *>(reinterpret_cast<const ushort *>(result.constData()));
+ output += pos;
+ }
+ }
+
+ // write the sequence
+ if (uc < 0x800) {
+ // first of two bytes
+ uchar c = 0xc0 | uchar(uc >> 6);
+ *output++ = '%';
+ *output++ = encodeNibble(c >> 4);
+ *output++ = encodeNibble(c & 0xf);
+ } else {
+ uchar c;
+ if (uc > 0xFFFF) {
+ // first two of four bytes
+ c = 0xf0 | uchar(uc >> 18);
+ *output++ = '%';
+ *output++ = 'F';
+ *output++ = encodeNibble(c & 0xf);
+
+ // continuation byte
+ c = 0x80 | (uchar(uc >> 12) & 0x3f);
+ *output++ = '%';
+ *output++ = encodeNibble(c >> 4);
+ *output++ = encodeNibble(c & 0xf);
+
+ // this was a surrogate pair
+ ++input;
+ } else {
+ // first of three bytes
+ c = 0xe0 | uchar(uc >> 12);
+ *output++ = '%';
+ *output++ = 'E';
+ *output++ = encodeNibble(c & 0xf);
+ }
+
+ // continuation byte
+ c = 0x80 | (uchar(uc >> 6) & 0x3f);
+ *output++ = '%';
+ *output++ = encodeNibble(c >> 4);
+ *output++ = encodeNibble(c & 0xf);
+ }
+
+ // continuation byte
+ uchar c = 0x80 | (uc & 0x3f);
+ *output++ = '%';
+ *output++ = encodeNibble(c >> 4);
+ *output++ = encodeNibble(c & 0xf);
+}
+
+static int recode(QString &result, const ushort *begin, const ushort *end, QUrl::ComponentFormattingOptions encoding,
+ const uchar *actionTable, bool retryBadEncoding)
+{
+ const int origSize = result.size();
+ const ushort *input = begin;
+ ushort *output = 0;
+
+ for ( ; input != end; ++input) {
+ register ushort c;
+ EncodingAction action;
+
+ // try a run where no change is necessary
+ for ( ; input != end; ++input) {
+ c = *input;
+ if (c < 0x20U || c >= 0x80U) // also: (c - 0x20 < 0x60U)
+ goto non_trivial;
+ action = EncodingAction(actionTable[c - ' ']);
+ if (action == EncodeCharacter)
+ goto non_trivial;
+ if (output)
+ *output++ = c;
+ }
+ break;
+
+non_trivial:
+ register uint decoded;
+ if (c == '%' && retryBadEncoding) {
+ // always write "%25"
+ ensureDetached(result, output, begin, input, end);
+ *output++ = '%';
+ *output++ = '2';
+ *output++ = '5';
+ continue;
+ } else if (c == '%') {
+ // check if the input is valid
+ if (input + 2 >= end || (decoded = decodePercentEncoding(input)) == ushort(-1)) {
+ // not valid, retry
+ result.resize(origSize);
+ return recode(result, begin, end, encoding, actionTable, true);
+ }
+
+ if (decoded >= 0x80) {
+ // decode the UTF-8 sequence
+ if (!(encoding & QUrl::EncodeUnicode) &&
+ encodedUtf8ToUtf16(result, output, begin, input, end, decoded))
+ continue;
+
+ // decoding the encoded UTF-8 failed
+ action = LeaveCharacter;
+ } else if (decoded >= 0x20) {
+ action = EncodingAction(actionTable[decoded - ' ']);
+ }
+ } else {
+ decoded = c;
+ if (decoded >= 0x80 && encoding & QUrl::EncodeUnicode) {
+ // encode the UTF-8 sequence
+ unicodeToEncodedUtf8(result, output, begin, input, end, decoded);
+ continue;
+ } else if (decoded >= 0x80) {
+ if (output)
+ *output++ = c;
+ continue;
+ }
+ }
+
+ if (decoded < 0x20)
+ action = EncodeCharacter;
+
+ // there are six possibilities:
+ // current \ action | DecodeCharacter | LeaveCharacter | EncodeCharacter
+ // decoded | 1:leave | 2:leave | 3:encode
+ // encoded | 4:decode | 5:leave | 6:leave
+ // cases 1 and 2 were handled before this section
+
+ if (c == '%' && action != DecodeCharacter) {
+ // cases 5 and 6: it's encoded and we're leaving it as it is
+ // except we're pedantic and we'll uppercase the hex
+ if (output || !isUpperHex(input[1]) || !isUpperHex(input[2])) {
+ ensureDetached(result, output, begin, input, end);
+ *output++ = '%';
+ *output++ = toUpperHex(*++input);
+ *output++ = toUpperHex(*++input);
+ }
+ } else if (c == '%' && action == DecodeCharacter) {
+ // case 4: we need to decode
+ ensureDetached(result, output, begin, input, end);
+ *output++ = decoded;
+ input += 2;
+ } else {
+ // must be case 3: we need to encode
+ ensureDetached(result, output, begin, input, end);
+ *output++ = '%';
+ *output++ = encodeNibble(c >> 4);
+ *output++ = encodeNibble(c & 0xf);
+ }
+ }
+
+ if (output) {
+ int len = output - reinterpret_cast<const ushort *>(result.constData());
+ result.truncate(len);
+ return len - origSize;
+ }
+ return 0;
+}
+
+template <size_t N>
+static void maskTable(uchar (&table)[N], const uchar (&mask)[N])
+{
+ for (size_t i = 0; i < N; ++i)
+ table[i] &= mask[i];
+}
+
+/*!
+ \internal
+
+ Recodes the string from \a begin to \a end. If any transformations are
+ done, append them to \a appendTo and return the number of characters added.
+ If no transformations were required, return 0.
+
+ The \a encoding option modifies the default behaviour:
+ \list
+ \li QUrl::EncodeDelimiters: if set, delimiters will be left untransformed (note: not encoded!);
+ if unset, delimiters will be decoded
+ \li QUrl::DecodeReserved: if set, reserved characters will be decoded;
+ if unset, reserved characters will be encoded
+ \li QUrl::EncodeSpaces: if set, spaces will be encoded to "%20"; if unset, they will be " "
+ \li QUrl::EncodeUnicode: if set, characters above U+0080 will be encoded to their UTF-8
+ percent-encoded form; if unset, they will be decoded to UTF-16
+ \endlist
+
+ Other flags are ignored (including QUrl::EncodeReserved).
+
+ The \a tableModifications argument can be used to supply extra
+ modifications to the tables, to be applied after the flags above are
+ handled. It consists of a sequence of 16-bit values, where the low 8 bits
+ indicate the character in question and the high 8 bits are either \c
+ EncodeCharacter, \c LeaveCharacter or \c DecodeCharacter.
+ */
+
+Q_AUTOTEST_EXPORT int
+qt_urlRecode(QString &appendTo, const QChar *begin, const QChar *end,
+ QUrl::ComponentFormattingOptions encoding, const ushort *tableModifications)
+{
+ uchar actionTable[sizeof defaultActionTable];
+ if (!(encoding & QUrl::EncodeDelimiters) && encoding & QUrl::DecodeReserved) {
+ // reset the table
+ memset(actionTable, DecodeCharacter, sizeof actionTable);
+ if (encoding & QUrl::EncodeSpaces)
+ actionTable[0] = EncodeCharacter;
+
+ // these are always encoded
+ actionTable['%' - ' '] = EncodeCharacter;
+ actionTable[0x7F - ' '] = EncodeCharacter;
+ } else {
+ memcpy(actionTable, defaultActionTable, sizeof actionTable);
+ if (!(encoding & QUrl::EncodeDelimiters))
+ maskTable(actionTable, delimsMask);
+ if (encoding & QUrl::DecodeReserved)
+ maskTable(actionTable, reservedMask);
+ if (!(encoding & QUrl::EncodeSpaces))
+ actionTable[0] = DecodeCharacter; // decode
+ }
+
+ if (tableModifications) {
+ for (const ushort *p = tableModifications; *p; ++p)
+ actionTable[uchar(*p) - ' '] = *p >> 8;
+ }
+
+ return recode(appendTo, reinterpret_cast<const ushort *>(begin), reinterpret_cast<const ushort *>(end),
+ encoding, actionTable, false);
+}
+
+QT_END_NAMESPACE