Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qurlidna.cpp File Reference

(b2764f780261f365005a80f5381925152df11bfb)

#include "qurl_p.h"
#include <QtCore/qstringlist.h>
#include <QtCore/private/qnumeric_p.h>
#include <QtCore/private/qoffsetstringarray_p.h>
#include <QtCore/private/qstringiterator_p.h>
#include <QtCore/private/qunicodetables_p.h>
#include <algorithm>
+ Include dependency graph for qurlidna.cpp:

Go to the source code of this file.

Functions

static uint encodeDigit (uint digit)
 
static uint adapt (uint delta, uint numpoints, bool firsttime)
 
static void appendEncode (QString *output, uint delta, uint bias)
 
Q_AUTOTEST_EXPORT void qt_punycodeEncoder (QStringView in, QString *output)
 
Q_AUTOTEST_EXPORT QString qt_punycodeDecoder (const QString &pc)
 
static bool lessThan (const QChar *a, int l, const char *c)
 
static bool equal (const QChar *a, int l, const char *b)
 
static bool qt_is_idn_enabled (QStringView aceDomain)
 
template<typename C >
static bool isValidInNormalizedAsciiLabel (C c)
 
template<typename C >
static bool isValidInNormalizedAsciiName (C c)
 
static QString mapDomainName (const QString &in, QUrl::AceProcessingOptions options, bool *resultIsAscii)
 
static bool validateAsciiLabel (QStringView label)
 
static QString convertToAscii (QStringView normalizedDomain, AceLeadingDot dot)
 
static bool checkAsciiDomainName (QStringView normalizedDomain, AceLeadingDot dot, bool *usesPunycode)
 
static QString convertToUnicode (const QString &asciiDomain, QUrl::AceProcessingOptions options)
 
static bool checkUnicodeName (const QString &domainName, QUrl::AceProcessingOptions options)
 
QString qt_ACE_do (const QString &domain, AceOperation op, AceLeadingDot dot, QUrl::AceProcessingOptions options)
 

Variables

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
 
static constexpr qsizetype MaxDomainLabelLength = 63
 
static constexpr auto idn_whitelist
 
static Q_CONSTINIT QStringListuser_idn_whitelist = nullptr
 

Function Documentation

◆ adapt()

static uint adapt ( uint delta,
uint numpoints,
bool firsttime )
inlinestatic

Definition at line 35 of file qurlidna.cpp.

References base, damp, skew, tmax, and tmin.

Referenced by qt_punycodeDecoder(), and qt_punycodeEncoder().

+ Here is the caller graph for this function:

◆ appendEncode()

static void appendEncode ( QString * output,
uint delta,
uint bias )
inlinestatic

Definition at line 47 of file qurlidna.cpp.

References base, encodeDigit(), output, tmax, and tmin.

Referenced by qt_punycodeEncoder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAsciiDomainName()

static bool checkAsciiDomainName ( QStringView normalizedDomain,
AceLeadingDot dot,
bool * usesPunycode )
static

Definition at line 821 of file qurlidna.cpp.

References dot(), ForbidLeadingDot, and validateAsciiLabel().

Referenced by qt_ACE_do().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkUnicodeName()

static bool checkUnicodeName ( const QString & domainName,
QUrl::AceProcessingOptions options )
static

Definition at line 893 of file qurlidna.cpp.

Referenced by qt_ACE_do().

+ Here is the caller graph for this function:

◆ convertToAscii()

static QString convertToAscii ( QStringView normalizedDomain,
AceLeadingDot dot )
static

Definition at line 786 of file qurlidna.cpp.

References dot(), ForbidLeadingDot, QString::indexOf(), and qt_punycodeEncoder().

Referenced by qt_ACE_do().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convertToUnicode()

static QString convertToUnicode ( const QString & asciiDomain,
QUrl::AceProcessingOptions options )
static

Definition at line 854 of file qurlidna.cpp.

References qt_punycodeDecoder().

Referenced by qt_ACE_do().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ encodeDigit()

static uint encodeDigit ( uint digit)
inlinestatic

Definition at line 30 of file qurlidna.cpp.

Referenced by appendEncode().

+ Here is the caller graph for this function:

◆ equal()

static bool equal ( const QChar * a,
int l,
const char * b )
static

Definition at line 338 of file qurlidna.cpp.

Referenced by Object::equivalent(), parseHttpOptionHeader(), and qt_is_idn_enabled().

+ Here is the caller graph for this function:

◆ isValidInNormalizedAsciiLabel()

template<typename C >
static bool isValidInNormalizedAsciiLabel ( C c)
inlinestatic

Definition at line 379 of file qurlidna.cpp.

Referenced by isValidInNormalizedAsciiName().

+ Here is the caller graph for this function:

◆ isValidInNormalizedAsciiName()

template<typename C >
static bool isValidInNormalizedAsciiName ( C c)
inlinestatic

Definition at line 385 of file qurlidna.cpp.

References isValidInNormalizedAsciiLabel().

Referenced by mapDomainName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lessThan()

static bool lessThan ( const QChar * a,
int l,
const char * c )
static

Definition at line 321 of file qurlidna.cpp.

Referenced by QV4::PropertyListPrototype::method_sort(), qt_is_idn_enabled(), QV4::ArrayData::sort(), and QV4::sortHelper().

+ Here is the caller graph for this function:

◆ mapDomainName()

static QString mapDomainName ( const QString & in,
QUrl::AceProcessingOptions options,
bool * resultIsAscii )
static

Definition at line 397 of file qurlidna.cpp.

References QUrl::AceTransitionalProcessing, QUnicodeTables::Deviation, QUnicodeTables::Disallowed, i, QUnicodeTables::idnaMapping(), QUnicodeTables::idnaStatus(), QUnicodeTables::Ignored, isValidInNormalizedAsciiName(), iter, QUnicodeTables::Mapped, Q_LIKELY, and QUnicodeTables::Valid.

Referenced by qt_ACE_do().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_ACE_do()

QString qt_ACE_do ( const QString & domain,
AceOperation op,
AceLeadingDot dot,
QUrl::AceProcessingOptions options )

Definition at line 920 of file qurlidna.cpp.

References checkAsciiDomainName(), checkUnicodeName(), convertToAscii(), convertToUnicode(), dot(), QUrl::IgnoreIDNWhitelist, QString::isEmpty(), mapDomainName(), QString::NormalizationForm_C, qt_is_idn_enabled(), and ToAceOnly.

Referenced by QUrlPrivate::appendHost(), encodeLabel(), QUrl::fromAce(), qDBusInterfaceFromMetaObject(), QUrlPrivate::setHost(), and QUrl::toAce().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_is_idn_enabled()

static bool qt_is_idn_enabled ( QStringView aceDomain)
static

Definition at line 350 of file qurlidna.cpp.

References equal(), i, idn_whitelist, lessThan(), and user_idn_whitelist.

Referenced by qt_ACE_do().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_punycodeDecoder()

Q_AUTOTEST_EXPORT QString qt_punycodeDecoder ( const QString & pc)

Definition at line 171 of file qurlidna.cpp.

References adapt(), QString::at(), base, QString::fromStdU32String(), i, initial_bias, initial_n, QString::lastIndexOf(), MaxDomainLabelLength, QString::mid(), output, qWarning, QString::size(), QString::startsWith(), tmax, tmin, and QString::toStdU32String().

Referenced by convertToUnicode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_punycodeEncoder()

Q_AUTOTEST_EXPORT void qt_punycodeEncoder ( QStringView in,
QString * output )

Definition at line 67 of file qurlidna.cpp.

References adapt(), appendEncode(), d, initial_bias, initial_n, iter, MaxDomainLabelLength, and output.

Referenced by convertToAscii().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validateAsciiLabel()

static bool validateAsciiLabel ( QStringView label)
static

Definition at line 474 of file qurlidna.cpp.

References MaxDomainLabelLength.

Referenced by checkAsciiDomainName().

+ Here is the caller graph for this function:

Variable Documentation

◆ base

const uint base = 36
static

Definition at line 20 of file qurlidna.cpp.

Referenced by QV4::Function::Function(), QV4::MemorySegment::MemorySegment(), QV4::MemorySegment::MemorySegment(), qfloat16::qfloat16(), QQmlOpenMetaObject::QQmlOpenMetaObject(), QQmlOpenMetaObjectType::QQmlOpenMetaObjectType(), QV4::MemorySegment::~MemorySegment(), adapt(), QV4::MemorySegment::allocate(), appendEncode(), QApplicationPrivate::applyQIconStyleHelper(), QString::arg(), QString::arg(), QString::arg(), QString::arg(), QString::arg(), QString::arg(), QString::arg(), QString::arg(), QQmlJS::Dom::DomItem::as(), QPdf::ascii85Encode(), QQmlType::attachedPropertiesFunction(), QQmlType::attachedPropertiesType(), QQmlJSScope::augmentedInternalName(), QV4::HeapValue< o >::base(), QV4::ValueArray< o >::base(), QV4::Heap::Pointer< T, o >::base(), QQmlLSUtils::baseObject(), QLocaleData::bytearrayToLongLong(), QLocaleData::bytearrayToUnsLongLong(), calculateCoarseTimerTimeout(), QV4::Runtime::Exp::call(), QV4::Runtime::LoadSuperProperty::call(), QV4::Runtime::StoreSuperProperty::call(), QV4::Runtime::DeleteProperty_NoThrow::call(), QV4::Runtime::CallProperty::call(), QV4::Runtime::CallPropertyLookup::call(), QV4::Runtime::DeleteProperty::call(), QV4::Runtime::GetLookup::call(), QV4::Runtime::SetLookupStrict::call(), QV4::Runtime::SetLookupSloppy::call(), callWithContextObject(), callWithScopeObject(), QQmlJSTypeResolver::canHold(), QQmlJSTypePropagator::checkForEnumProblems(), QBenchmarkValgrindUtils::cleanup(), QRasterPaintEngine::clip(), QQmlJS::Dom::DomBase::containingObject(), QV4::MemorySegment::contains(), convertPath(), QQmlJSCodeGenerator::convertStored(), QQmlJS::Dom::DomItem::copy(), QQmlJS::Dom::DomItem::copy(), QQmlJS::Dom::ScriptElements::ScriptElementBase< type >::createFileLocations(), QQmlJS::Dom::ScriptElements::ScriptList::createFileLocations(), QQmlJS::Dom::ScriptElements::GenericScriptElement::createFileLocations(), QQmlJS::Dom::ScriptElements::BlockStatement::createFileLocations(), QQmlJS::Dom::ScriptElements::ForStatement::createFileLocations(), QQmlJS::Dom::ScriptElements::IfStatement::createFileLocations(), QQmlJS::Dom::ScriptElements::ReturnStatement::createFileLocations(), QQmlJS::Dom::ScriptElements::BinaryExpression::createFileLocations(), QQmlJS::Dom::ScriptElements::VariableDeclarationEntry::createFileLocations(), QQmlJS::Dom::ScriptElements::VariableDeclaration::createFileLocations(), QV4::createStackProperties(), QV4::Heap::DECLARE_EXPORTED_HEAP_OBJECT(), QV4::Heap::DECLARE_HEAP_OBJECT(), QV4::decrementStackPointer(), double2string(), QTextLayout::drawCursor(), QV4::Moth::dumpBytecode(), QQmlJS::Dom::UpdatedScriptExpression::ensure(), QQmlJS::Dom::FileLocations::ensure(), fallback_fill(), QImageTextureGlyphCache::fillTexture(), QQmlJS::AST::ArrayMemberExpression::firstSourceLocation(), QQmlJS::AST::FieldMemberExpression::firstSourceLocation(), QQmlJS::AST::TaggedTemplate::firstSourceLocation(), QQmlJS::AST::CallExpression::firstSourceLocation(), QQmlJS::AST::PostIncrementExpression::firstSourceLocation(), QQmlJS::AST::PostDecrementExpression::firstSourceLocation(), language::formatEscapedNumber(), QLocale::formattedDataSize(), QV4::MemorySegment::free(), func(), QQmlJSTypePropagator::generate_CallProperty(), QQmlJSShadowCheck::generate_CallProperty(), QQmlJSCodeGenerator::generate_CallPropertyLookup(), QQmlJSTypePropagator::generate_CallPropertyLookup(), QQmlJSShadowCheck::generate_CallPropertyLookup(), QQmlJSCodeGenerator::generate_DeleteProperty(), QQmlJSTypePropagator::generate_DeleteProperty(), QQmlJSCodeGenerator::generate_LoadElement(), QQmlJSTypePropagator::generate_LoadElement(), QQmlJSCodeGenerator::generate_SetLookup(), QQmlJSShadowCheck::generate_SetLookup(), QQmlJSTypePropagator::generate_SetLookup(), QQmlJSCodeGenerator::generate_StoreElement(), QQmlJSTypePropagator::generate_StoreElement(), QQmlJSTypePropagator::generate_StoreProperty(), QQmlJSShadowCheck::generate_StoreProperty(), QQmlJSTypeResolver::genericType(), QBenchmarkValgrindUtils::getNewestFileName(), QTextStreamPrivate::getNumber(), QV4::QQmlContextWrapper::getPropertyAndBase(), QV4::ExecutionContext::getPropertyAndBase(), QOpenGLFunctions_1_0::glListBase(), QOpenGLFunctions_1_1::glListBase(), QOpenGLFunctions_1_2::glListBase(), QOpenGLFunctions_1_3::glListBase(), QOpenGLFunctions_1_4::glListBase(), QOpenGLFunctions_1_5::glListBase(), QOpenGLFunctions_2_0::glListBase(), QOpenGLFunctions_2_1::glListBase(), QOpenGLFunctions_3_0::glListBase(), QOpenGLFunctions_3_2_Compatibility::glListBase(), QOpenGLFunctions_3_3_Compatibility::glListBase(), QOpenGLFunctions_4_0_Compatibility::glListBase(), QOpenGLFunctions_4_1_Compatibility::glListBase(), QOpenGLFunctions_4_2_Compatibility::glListBase(), QOpenGLFunctions_4_3_Compatibility::glListBase(), QOpenGLFunctions_4_4_Compatibility::glListBase(), QOpenGLFunctions_4_5_Compatibility::glListBase(), gray_split_conic(), gray_split_cubic(), QV4::Compiler::Codegen::handleCall(), QV4::Compiler::Codegen::handleTaggedTemplate(), handleTranslationBinding(), QQmlJSUtils::hasCompositeBase(), QQmlConnectionSlotDispatcher::impl(), QV4::incrementStackPointer(), QWaylandInputMethodEventBuilder::indexFromWayland(), QWaylandInputMethodEventBuilder::indexToWayland(), QQmlJSScope::inherits(), QQmlJSTypeResolver::inherits(), QQuickIOSTheme::initialize(), QV4::Compiler::Codegen::initializeAndDestructureBindingElement(), QQmlJS::Dom::inQString(), QQmlJS::Dom::inQString(), int2string(), QGraphicsAnchorLayoutPrivate::interpolateEdge(), QV4::Moth::VME::interpret(), QQmlJSScope::isComponentRootElement(), isDigitForBase(), QQmlJS::Dom::DomEnvironment::iterateDirectSubpaths(), QQmlPrivate::jsExponentiate(), QLocaleData::longLongToString(), QV4::QQmlContextWrapper::lookupContextObjectMethod(), QV4::QQmlContextWrapper::lookupContextObjectProperty(), QV4::QQmlTypeWrapper::lookupEnumValue(), QV4::QQmlContextWrapper::lookupIdObject(), QV4::QQmlContextWrapper::lookupIdObjectInParentContext(), QV4::QQmlContextWrapper::lookupInGlobalObject(), QV4::QQmlContextWrapper::lookupInParentContextHierarchy(), QV4::QQmlTypeWrapper::lookupScopedEnum(), QV4::QQmlContextWrapper::lookupScopeFallbackProperty(), QV4::QQmlContextWrapper::lookupScopeObjectMethod(), QV4::QQmlContextWrapper::lookupScopeObjectProperty(), QV4::QQmlContextWrapper::lookupScript(), QV4::QQmlContextWrapper::lookupSingleton(), QV4::QQmlContextWrapper::lookupType(), QV4::QQmlContextWrapper::lookupValueSingleton(), QT_BEGIN_NAMESPACE::markHeapBase(), message(), methodIndexToSignalIndex(), nameForCompressedIcon(), QQmlJSScope::nonCompositeBaseRevision(), QQmlJSScope::nonCompositeBaseType(), QByteArray::number(), QString::number(), QByteArray::number(), QString::number(), QByteArray::number(), QString::number(), QByteArray::number(), QString::number(), QByteArray::number(), QString::number(), QByteArray::number(), QString::number(), QQmlJS::Dom::FieldFilter::operator()(), QShapedPixmapWindow::paintEvent(), QPlainTextEdit::paintEvent(), QQmlJSImportVisitor::parseBindingExpression(), QTextHtmlParser::parseEntity(), QmlGoToTypeDefinitionSupport::process(), QTextStreamPrivate::putNumber(), qDBusGenerateMetaObjectXml(), qFindInlineComponents(), QTest::qFindTestData(), QTest::qFindTestData(), qstrntoll(), qstrntoull(), qt_fusionPalette(), qt_punycodeDecoder(), qtiffMapProc(), qtiffUnmapProc(), qulltoa(), qulltoa2(), qulltoBasicLatin(), qulltoString_helper(), QV4::ExecutionEngine::resolvedUrl(), QV4::QQmlContextWrapper::resolveQmlContextPropertyLookupGetter(), QQmlImportInstance::resolveType(), QQmlImportNamespace::resolveType(), revertObjectMethodLookup(), revertObjectPropertyLookup(), round_up_scanline(), QQmlJSShadowCheck::run(), scanPrefix(), QQmlJSTypeResolver::scopedType(), searchContextProperties(), QV4::HeapValue< o >::set(), QV4::HeapValue< o >::set(), QV4::ValueArray< o >::set(), QV4::ValueArray< o >::set(), QmlIR::IRBuilder::setBindingValue(), QSpinBox::setDisplayIntegerBase(), QQmlComponentPrivate::setInitialProperty(), QByteArray::setNum(), QString::setNum(), QByteArray::setNum(), QString::setNum(), QByteArray::setNum(), QString::setNum(), QByteArray::setNum(), QString::setNum(), QByteArray::setNum(), QString::setNum(), QByteArray::setNum(), QString::setNum(), QByteArray::setNum(), QString::setNum(), QByteArray::setNum(), QString::setNum(), QObjectPrivate::signalIndex(), QV4::Chunk::sortIntoBins(), QLocaleData::stringToLongLong(), QV4::RuntimeHelpers::stringToNumber(), QLocaleData::stringToUnsLongLong(), thresholdFunc(), QFFmpeg::timeStampMs(), QFFmpeg::timeStampUs(), QByteArray::toInt(), QByteArrayView::toInt(), QLatin1StringView::toInt(), QString::toInt(), QStringView::toInt(), QtPrivate::toIntegral(), toIntegral(), JsonOutput::toList(), QByteArray::toLong(), QByteArrayView::toLong(), QLatin1StringView::toLong(), QString::toLong(), QStringView::toLong(), QByteArray::toLongLong(), QByteArrayView::toLongLong(), QLatin1StringView::toLongLong(), QStringView::toLongLong(), QByteArray::toShort(), QByteArrayView::toShort(), QLatin1StringView::toShort(), QString::toShort(), QStringView::toShort(), QtPrivate::toSignedInteger(), QByteArray::toUInt(), QByteArrayView::toUInt(), QLatin1StringView::toUInt(), QString::toUInt(), QStringView::toUInt(), QByteArray::toULong(), QByteArrayView::toULong(), QLatin1StringView::toULong(), QString::toULong(), QStringView::toULong(), QByteArray::toULongLong(), QByteArrayView::toULongLong(), QLatin1StringView::toULongLong(), QStringView::toULongLong(), QtPrivate::toUnsignedInteger(), QByteArray::toUShort(), QByteArrayView::toUShort(), QLatin1StringView::toUShort(), QString::toUShort(), QStringView::toUShort(), QWaylandInputMethodEventBuilder::trimmedIndexFromWayland(), QmlIR::IRBuilder::tryGeneratingTranslationBinding(), QmlIR::tryGeneratingTranslationBindingBase(), Driver::unique(), QLocaleData::unsLongLongToString(), QQmlJS::Dom::ScriptElements::ScriptList::updatePathFromOwner(), QAndroidPlatformTheme::updateStyle(), QSGDistanceFieldTextMaterialRhiShader::updateUniformData(), DistanceFieldOutlineTextMaterialRhiShader::updateUniformData(), QQuickTimeLinePrivate::value(), QString::vasprintf(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), QQmlJSImportVisitor::visit(), QQmlJS::Dom::AttachedInfoT< Info >::visitTree(), QQmlJS::Dom::UpdatedScriptExpression::visitTree(), QTreeWidget::visualItemRect(), QV4::WriteBarrier::write(), QV4::WriteBarrier::write(), QV4::WriteBarrier::write_slowpath(), and QV4::WriteBarrier::write_slowpath().

◆ damp

const uint damp = 700
static

Definition at line 24 of file qurlidna.cpp.

Referenced by adapt().

◆ idn_whitelist

constexpr auto idn_whitelist
staticconstexpr

Definition at line 280 of file qurlidna.cpp.

Referenced by QUrl::idnWhitelist(), and qt_is_idn_enabled().

◆ initial_bias

const uint initial_bias = 72
static

Definition at line 25 of file qurlidna.cpp.

Referenced by qt_punycodeDecoder(), and qt_punycodeEncoder().

◆ initial_n

const uint initial_n = 128
static

Definition at line 26 of file qurlidna.cpp.

Referenced by qt_punycodeDecoder(), and qt_punycodeEncoder().

◆ MaxDomainLabelLength

constexpr qsizetype MaxDomainLabelLength = 63
staticconstexpr

Definition at line 28 of file qurlidna.cpp.

Referenced by qt_punycodeDecoder(), qt_punycodeEncoder(), and validateAsciiLabel().

◆ skew

const uint skew = 38
static

Definition at line 23 of file qurlidna.cpp.

Referenced by adapt().

◆ tmax

const uint tmax = 26
static

◆ tmin

const uint tmin = 1
static

◆ user_idn_whitelist

Q_CONSTINIT QStringList* user_idn_whitelist = nullptr
static

Definition at line 319 of file qurlidna.cpp.

Referenced by QUrl::idnWhitelist(), qt_is_idn_enabled(), and QUrl::setIdnWhitelist().