~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebCore/platform/qt/KURLQt.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-08-01 11:30:30 UTC
  • mto: (15.1.1 lenny) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 55.
  • Revision ID: james.westby@ubuntu.com-20080801113030-c33y1z0l21t6cj5r
Tags: upstream-4.4.1
ImportĀ upstreamĀ versionĀ 4.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    QByteArray ba;
41
41
    ba.reserve(s.length());
42
42
 
43
 
    for (const char *src = s.ascii(); *src; ++src) {
 
43
    const char *src = s.ascii();
 
44
    const char *host = strstr(src, "://");
 
45
    if (host)
 
46
        host += 3;
 
47
 
 
48
    const char *path = host ? strstr(host, "/") : 0;
 
49
 
 
50
    for (; *src; ++src) {
44
51
        const char chr = *src;
45
52
 
46
53
        switch (chr) {
 
54
            encode:
47
55
            case '{':
48
56
            case '}':
49
57
            case '|':
50
58
            case '\\':
51
59
            case '^':
52
 
            case '[':
53
 
            case ']':
54
60
            case '`':
55
61
                ba.append('%');
56
62
                ba.append(toHex((chr & 0xf0) >> 4));
57
63
                ba.append(toHex(chr & 0xf));
58
64
                break;
 
65
            case '[':
 
66
            case ']':
 
67
                // special case: if this is the host part, don't encode
 
68
                // otherwise, encode
 
69
                if (!host || (path && src >= path))
 
70
                    goto encode;
 
71
                // fall through
59
72
            default:
60
73
                ba.append(chr);
61
74
                break;