Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Side by Side Diff: net/base/registry_controlled_domains/effective_tld_names_unittest1.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* C++ code produced by gperf version 3.0.3 */ 1 /* C++ code produced by gperf version 3.0.3 */
2 /* Command-line: gperf -a -L C++ -C -c -o -t -k '*' -NFindDomain -ZPerfect_Hash_ Test1 -P -K name_offset -Q stringpool1 -D effective_tld_names_unittest1.gperf * / 2 /* Command-line: gperf -a -L C++ -C -c -o -t -k '*' -NFindDomain
3 * -ZPerfect_Hash_Test1 -P -K name_offset -Q stringpool1 -D
4 * effective_tld_names_unittest1.gperf */
3 5
4 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ 6 #if !( \
5 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ 7 (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) && ('%' == 37) && \
6 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ 8 ('&' == 38) && ('\'' == 39) && ('(' == 40) && (')' == 41) && \
7 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ 9 ('*' == 42) && ('+' == 43) && (',' == 44) && ('-' == 45) && ('.' == 46) && \
8 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ 10 ('/' == 47) && ('0' == 48) && ('1' == 49) && ('2' == 50) && ('3' == 51) && \
9 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ 11 ('4' == 52) && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) && \
10 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ 12 ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) && ('=' == 61) && \
11 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ 13 ('>' == 62) && ('?' == 63) && ('A' == 65) && ('B' == 66) && ('C' == 67) && \
12 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ 14 ('D' == 68) && ('E' == 69) && ('F' == 70) && ('G' == 71) && ('H' == 72) && \
13 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ 15 ('I' == 73) && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) && \
14 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ 16 ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) && ('R' == 82) && \
15 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ 17 ('S' == 83) && ('T' == 84) && ('U' == 85) && ('V' == 86) && ('W' == 87) && \
16 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ 18 ('X' == 88) && ('Y' == 89) && ('Z' == 90) && ('[' == 91) && \
17 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ 19 ('\\' == 92) && (']' == 93) && ('^' == 94) && ('_' == 95) && \
18 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ 20 ('a' == 97) && ('b' == 98) && ('c' == 99) && ('d' == 100) && \
19 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ 21 ('e' == 101) && ('f' == 102) && ('g' == 103) && ('h' == 104) && \
20 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ 22 ('i' == 105) && ('j' == 106) && ('k' == 107) && ('l' == 108) && \
21 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ 23 ('m' == 109) && ('n' == 110) && ('o' == 111) && ('p' == 112) && \
22 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ 24 ('q' == 113) && ('r' == 114) && ('s' == 115) && ('t' == 116) && \
23 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ 25 ('u' == 117) && ('v' == 118) && ('w' == 119) && ('x' == 120) && \
24 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ 26 ('y' == 121) && ('z' == 122) && ('{' == 123) && ('|' == 124) && \
25 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ 27 ('}' == 125) && ('~' == 126))
26 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
27 /* The character set is not based on ISO-646. */ 28 /* The character set is not based on ISO-646. */
28 #error "gperf generated tables don't work with this execution character set. Ple ase report a bug to <bug-gnu-gperf@gnu.org>." 29 #error \
30 "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
29 #endif 31 #endif
30 32
31 #line 1 "effective_tld_names_unittest1.gperf" 33 #line 1 "effective_tld_names_unittest1.gperf"
32 34
33 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 35 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
34 // Use of this source code is governed by a BSD-style license that can be 36 // Use of this source code is governed by a BSD-style license that can be
35 // found in the LICENSE file. 37 // found in the LICENSE file.
36 // Test file used by registry_controlled_domain_unittest. 38 // Test file used by registry_controlled_domain_unittest.
37 // We edit this file manually, then run 39 // We edit this file manually, then run
38 // gperf -a -L "C++" -C -c -o -t -k '*' -NFindDomain -ZPerfect_Hash_Test1 -P -K name_offset -Q stringpool1 -D effective_tld_names_unittest1.gperf > effective_t ld_names_unittest1.cc 40 // gperf -a -L "C++" -C -c -o -t -k '*' -NFindDomain -ZPerfect_Hash_Test1 -P -K
41 // name_offset -Q stringpool1 -D effective_tld_names_unittest1.gperf >
42 // effective_tld_names_unittest1.cc
39 // to generate the perfect hashmap. 43 // to generate the perfect hashmap.
40 #line 10 "effective_tld_names_unittest1.gperf" 44 #line 10 "effective_tld_names_unittest1.gperf"
41 struct DomainRule { 45 struct DomainRule {
42 int name_offset; 46 int name_offset;
43 int type; // 1: exception, 2: wildcard, 4: private 47 int type; // 1: exception, 2: wildcard, 4: private
44 }; 48 };
45 49
46 #define TOTAL_KEYWORDS 11 50 #define TOTAL_KEYWORDS 11
47 #define MIN_WORD_LENGTH 1 51 #define MIN_WORD_LENGTH 1
48 #define MAX_WORD_LENGTH 11 52 #define MAX_WORD_LENGTH 11
49 #define MIN_HASH_VALUE 1 53 #define MIN_HASH_VALUE 1
50 #define MAX_HASH_VALUE 17 54 #define MAX_HASH_VALUE 17
51 /* maximum key range = 17, duplicates = 0 */ 55 /* maximum key range = 17, duplicates = 0 */
52 56
53 class Perfect_Hash_Test1 57 class Perfect_Hash_Test1 {
54 { 58 private:
55 private: 59 static inline unsigned int hash(const char* str, unsigned int len);
56 static inline unsigned int hash (const char *str, unsigned int len); 60
57 public: 61 public:
58 static const struct DomainRule *FindDomain (const char *str, unsigned int len) ; 62 static const struct DomainRule* FindDomain(const char* str, unsigned int len);
59 }; 63 };
60 64
61 inline unsigned int 65 inline unsigned int Perfect_Hash_Test1::hash(register const char* str,
62 Perfect_Hash_Test1::hash (register const char *str, register unsigned int len) 66 register unsigned int len) {
63 { 67 static const unsigned char asso_values[] = {
64 static const unsigned char asso_values[] = 68 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
65 { 69 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
66 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 70 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 18, 18, 18, 18, 18, 18, 18,
67 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 71 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
68 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 72 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
69 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 73 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 18, 5, 0, 18, 18, 0, 0, 18,
70 18, 18, 18, 18, 18, 18, 0, 18, 18, 18, 74 18, 0, 5, 0, 0, 18, 0, 18, 5, 18, 0, 18, 18, 18, 0, 18, 18, 18,
71 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 75 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
72 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 76 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
73 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 77 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
74 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 78 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
75 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 79 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
76 18, 5, 0, 18, 18, 0, 0, 18, 18, 0, 80 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
77 5, 0, 0, 18, 0, 18, 5, 18, 0, 18, 81 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
78 18, 18, 0, 18, 18, 18, 18, 18, 18, 18, 82 18, 18, 18, 18};
79 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
80 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
81 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
82 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
83 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
84 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
85 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
86 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
87 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
88 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
89 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
90 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
91 18, 18, 18, 18, 18, 18
92 };
93 register int hval = len; 83 register int hval = len;
94 84
95 switch (hval) 85 switch (hval) {
96 { 86 default:
97 default: 87 hval += asso_values[(unsigned char)str[10]];
98 hval += asso_values[(unsigned char)str[10]]; 88 /*FALLTHROUGH*/
99 /*FALLTHROUGH*/ 89 case 10:
100 case 10: 90 hval += asso_values[(unsigned char)str[9]];
101 hval += asso_values[(unsigned char)str[9]]; 91 /*FALLTHROUGH*/
102 /*FALLTHROUGH*/ 92 case 9:
103 case 9: 93 hval += asso_values[(unsigned char)str[8]];
104 hval += asso_values[(unsigned char)str[8]]; 94 /*FALLTHROUGH*/
105 /*FALLTHROUGH*/ 95 case 8:
106 case 8: 96 hval += asso_values[(unsigned char)str[7]];
107 hval += asso_values[(unsigned char)str[7]]; 97 /*FALLTHROUGH*/
108 /*FALLTHROUGH*/ 98 case 7:
109 case 7: 99 hval += asso_values[(unsigned char)str[6]];
110 hval += asso_values[(unsigned char)str[6]]; 100 /*FALLTHROUGH*/
111 /*FALLTHROUGH*/ 101 case 6:
112 case 6: 102 hval += asso_values[(unsigned char)str[5]];
113 hval += asso_values[(unsigned char)str[5]]; 103 /*FALLTHROUGH*/
114 /*FALLTHROUGH*/ 104 case 5:
115 case 5: 105 hval += asso_values[(unsigned char)str[4]];
116 hval += asso_values[(unsigned char)str[4]]; 106 /*FALLTHROUGH*/
117 /*FALLTHROUGH*/ 107 case 4:
118 case 4: 108 hval += asso_values[(unsigned char)str[3]];
119 hval += asso_values[(unsigned char)str[3]]; 109 /*FALLTHROUGH*/
120 /*FALLTHROUGH*/ 110 case 3:
121 case 3: 111 hval += asso_values[(unsigned char)str[2]];
122 hval += asso_values[(unsigned char)str[2]]; 112 /*FALLTHROUGH*/
123 /*FALLTHROUGH*/ 113 case 2:
124 case 2: 114 hval += asso_values[(unsigned char)str[1]];
125 hval += asso_values[(unsigned char)str[1]]; 115 /*FALLTHROUGH*/
126 /*FALLTHROUGH*/ 116 case 1:
127 case 1: 117 hval += asso_values[(unsigned char)str[0]];
128 hval += asso_values[(unsigned char)str[0]]; 118 break;
129 break; 119 }
130 }
131 return hval; 120 return hval;
132 } 121 }
133 122
134 struct stringpool1_t 123 struct stringpool1_t {
135 { 124 char stringpool1_str0[sizeof("c")];
136 char stringpool1_str0[sizeof("c")]; 125 char stringpool1_str1[sizeof("jp")];
137 char stringpool1_str1[sizeof("jp")]; 126 char stringpool1_str2[sizeof("b.c")];
138 char stringpool1_str2[sizeof("b.c")]; 127 char stringpool1_str3[sizeof("ac.jp")];
139 char stringpool1_str3[sizeof("ac.jp")]; 128 char stringpool1_str4[sizeof("bar.jp")];
140 char stringpool1_str4[sizeof("bar.jp")]; 129 char stringpool1_str5[sizeof("no")];
141 char stringpool1_str5[sizeof("no")]; 130 char stringpool1_str6[sizeof("baz.bar.jp")];
142 char stringpool1_str6[sizeof("baz.bar.jp")]; 131 char stringpool1_str7[sizeof("bar.baz.com")];
143 char stringpool1_str7[sizeof("bar.baz.com")]; 132 char stringpool1_str8[sizeof("priv.no")];
144 char stringpool1_str8[sizeof("priv.no")]; 133 char stringpool1_str9[sizeof("pref.bar.jp")];
145 char stringpool1_str9[sizeof("pref.bar.jp")]; 134 char stringpool1_str10[sizeof("private")];
146 char stringpool1_str10[sizeof("private")]; 135 };
147 }; 136 static const struct stringpool1_t stringpool1_contents = {
148 static const struct stringpool1_t stringpool1_contents = 137 "c", "jp", "b.c", "ac.jp", "bar.jp", "no",
149 { 138 "baz.bar.jp", "bar.baz.com", "priv.no", "pref.bar.jp", "private"};
150 "c", 139 #define stringpool1 ((const char*)&stringpool1_contents)
151 "jp", 140 const struct DomainRule* Perfect_Hash_Test1::FindDomain(
152 "b.c", 141 register const char* str,
153 "ac.jp", 142 register unsigned int len) {
154 "bar.jp", 143 static const struct DomainRule wordlist[] = {
155 "no",
156 "baz.bar.jp",
157 "bar.baz.com",
158 "priv.no",
159 "pref.bar.jp",
160 "private"
161 };
162 #define stringpool1 ((const char *) &stringpool1_contents)
163 const struct DomainRule *
164 Perfect_Hash_Test1::FindDomain (register const char *str, register unsigned int len)
165 {
166 static const struct DomainRule wordlist[] =
167 {
168 #line 21 "effective_tld_names_unittest1.gperf" 144 #line 21 "effective_tld_names_unittest1.gperf"
169 {(int)(long)&((struct stringpool1_t *)0)->stringpool1_str0, 2}, 145 {(int)(long)&((struct stringpool1_t*)0)->stringpool1_str0, 2},
170 #line 15 "effective_tld_names_unittest1.gperf" 146 #line 15 "effective_tld_names_unittest1.gperf"
171 {(int)(long)&((struct stringpool1_t *)0)->stringpool1_str1, 0}, 147 {(int)(long)&((struct stringpool1_t*)0)->stringpool1_str1, 0},
172 #line 22 "effective_tld_names_unittest1.gperf" 148 #line 22 "effective_tld_names_unittest1.gperf"
173 {(int)(long)&((struct stringpool1_t *)0)->stringpool1_str2, 1}, 149 {(int)(long)&((struct stringpool1_t*)0)->stringpool1_str2, 1},
174 #line 16 "effective_tld_names_unittest1.gperf" 150 #line 16 "effective_tld_names_unittest1.gperf"
175 {(int)(long)&((struct stringpool1_t *)0)->stringpool1_str3, 0}, 151 {(int)(long)&((struct stringpool1_t*)0)->stringpool1_str3, 0},
176 #line 17 "effective_tld_names_unittest1.gperf" 152 #line 17 "effective_tld_names_unittest1.gperf"
177 {(int)(long)&((struct stringpool1_t *)0)->stringpool1_str4, 2}, 153 {(int)(long)&((struct stringpool1_t*)0)->stringpool1_str4, 2},
178 #line 23 "effective_tld_names_unittest1.gperf" 154 #line 23 "effective_tld_names_unittest1.gperf"
179 {(int)(long)&((struct stringpool1_t *)0)->stringpool1_str5, 0}, 155 {(int)(long)&((struct stringpool1_t*)0)->stringpool1_str5, 0},
180 #line 18 "effective_tld_names_unittest1.gperf" 156 #line 18 "effective_tld_names_unittest1.gperf"
181 {(int)(long)&((struct stringpool1_t *)0)->stringpool1_str6, 2}, 157 {(int)(long)&((struct stringpool1_t*)0)->stringpool1_str6, 2},
182 #line 20 "effective_tld_names_unittest1.gperf" 158 #line 20 "effective_tld_names_unittest1.gperf"
183 {(int)(long)&((struct stringpool1_t *)0)->stringpool1_str7, 0}, 159 {(int)(long)&((struct stringpool1_t*)0)->stringpool1_str7, 0},
184 #line 24 "effective_tld_names_unittest1.gperf" 160 #line 24 "effective_tld_names_unittest1.gperf"
185 {(int)(long)&((struct stringpool1_t *)0)->stringpool1_str8, 4}, 161 {(int)(long)&((struct stringpool1_t*)0)->stringpool1_str8, 4},
186 #line 19 "effective_tld_names_unittest1.gperf" 162 #line 19 "effective_tld_names_unittest1.gperf"
187 {(int)(long)&((struct stringpool1_t *)0)->stringpool1_str9, 1}, 163 {(int)(long)&((struct stringpool1_t*)0)->stringpool1_str9, 1},
188 #line 25 "effective_tld_names_unittest1.gperf" 164 #line 25 "effective_tld_names_unittest1.gperf"
189 {(int)(long)&((struct stringpool1_t *)0)->stringpool1_str10, 4} 165 {(int)(long)&((struct stringpool1_t*)0)->stringpool1_str10, 4}};
190 };
191 166
192 static const signed char lookup[] = 167 static const signed char lookup[] = {-1, 0, 1, 2, -1, 3, 4, 5, -1,
193 { 168 -1, 6, 7, 8, -1, -1, -1, 9, 10};
194 -1, 0, 1, 2, -1, 3, 4, 5, -1, -1, 6, 7, 8, -1,
195 -1, -1, 9, 10
196 };
197 169
198 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 170 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) {
199 { 171 register int key = hash(str, len);
200 register int key = hash (str, len);
201 172
202 if (key <= MAX_HASH_VALUE && key >= 0) 173 if (key <= MAX_HASH_VALUE && key >= 0) {
203 { 174 register int index = lookup[key];
204 register int index = lookup[key];
205 175
206 if (index >= 0) 176 if (index >= 0) {
207 { 177 register const char* s = wordlist[index].name_offset + stringpool1;
208 register const char *s = wordlist[index].name_offset + stringpool1 ;
209 178
210 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') 179 if (*str == *s && !strncmp(str + 1, s + 1, len - 1) && s[len] == '\0')
211 return &wordlist[index]; 180 return &wordlist[index];
212 } 181 }
213 }
214 } 182 }
183 }
215 return 0; 184 return 0;
216 } 185 }
217 #line 26 "effective_tld_names_unittest1.gperf" 186 #line 26 "effective_tld_names_unittest1.gperf"
218
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698