src/corelib/io/qurl.cpp
changeset 25 e24348a560a6
parent 19 fcece45ef507
child 29 b72c6db6890b
equal deleted inserted replaced
23:89e065397ea6 25:e24348a560a6
  3127     return;
  3127     return;
  3128 }
  3128 }
  3129 
  3129 
  3130 
  3130 
  3131 static const char * const idn_whitelist[] = {
  3131 static const char * const idn_whitelist[] = {
  3132     "ac", "at",
  3132     "ac", "ar", "at",
  3133     "br",
  3133     "biz", "br",
  3134     "cat", "ch", "cl", "cn",
  3134     "cat", "ch", "cl", "cn",
  3135     "de", "dk",
  3135     "de", "dk",
       
  3136     "es",
  3136     "fi",
  3137     "fi",
  3137     "gr",
  3138     "gr",
  3138     "hu",
  3139     "hu",
  3139     "info", "io", "is",
  3140     "info", "io", "is",
  3140     "jp",
  3141     "jp",
  3144     "no",
  3145     "no",
  3145     "org",
  3146     "org",
  3146     "se", "sh",
  3147     "se", "sh",
  3147     "th", "tm", "tw",
  3148     "th", "tm", "tw",
  3148     "vn",
  3149     "vn",
       
  3150     "xn--mgbaam7a8h",           // UAE
       
  3151     "xn--mgberp4a5d4ar",        // Saudi Arabia
       
  3152     "xn--wgbh1c"                // Egypt
  3149 };
  3153 };
  3150 
  3154 
  3151 static QStringList *user_idn_whitelist = 0;
  3155 static QStringList *user_idn_whitelist = 0;
  3152 
  3156 
  3153 static bool lessThan(const QChar *a, int l, const char *c)
  3157 static bool lessThan(const QChar *a, int l, const char *c)
  3302             // Punycode encoding and decoding cannot be done in-place
  3306             // Punycode encoding and decoding cannot be done in-place
  3303             // That means we need one or two temporaries
  3307             // That means we need one or two temporaries
  3304             qt_nameprep(&result, prevLen);
  3308             qt_nameprep(&result, prevLen);
  3305             labelLength = result.length() - prevLen;
  3309             labelLength = result.length() - prevLen;
  3306             register int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes
  3310             register int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes
       
  3311             aceForm.resize(0);
  3307             if (toReserve > aceForm.capacity())
  3312             if (toReserve > aceForm.capacity())
  3308                 aceForm.reserve(toReserve);
  3313                 aceForm.reserve(toReserve);
  3309             toPunycodeHelper(result.constData() + prevLen, result.size() - prevLen, &aceForm);
  3314             toPunycodeHelper(result.constData() + prevLen, result.size() - prevLen, &aceForm);
  3310 
  3315 
  3311             // We use resize()+memcpy() here because we're overwriting the data we've copied
  3316             // We use resize()+memcpy() here because we're overwriting the data we've copied