|
7 | 7 | class IterImpl { |
8 | 8 |
|
9 | 9 | public static final int readObjectFieldAsHash(JsonIterator iter) throws IOException { |
10 | | - if (IterImpl.nextToken(iter) != '"') { |
| 10 | + if (nextToken(iter) != '"') { |
11 | 11 | throw iter.reportError("readObjectFieldAsHash", "expect \""); |
12 | 12 | } |
13 | 13 | long hash = 0x811c9dc5; |
14 | | - for (; ; ) { |
15 | | - byte c = 0; |
16 | | - int i = iter.head; |
17 | | - for (; i < iter.tail; i++) { |
18 | | - c = iter.buf[i]; |
19 | | - if (c == '"') { |
20 | | - break; |
21 | | - } |
22 | | - hash ^= c; |
23 | | - hash *= 0x1000193; |
24 | | - } |
| 14 | + for (int i = iter.head; i < iter.tail; i++) { |
| 15 | + byte c = iter.buf[i]; |
25 | 16 | if (c == '"') { |
26 | 17 | iter.head = i + 1; |
27 | | - if (IterImpl.nextToken(iter) != ':') { |
| 18 | + if (nextToken(iter) != ':') { |
28 | 19 | throw iter.reportError("readObjectFieldAsHash", "expect :"); |
29 | 20 | } |
30 | 21 | return (int) hash; |
31 | 22 | } |
32 | | - throw iter.reportError("readObjectFieldAsHash", "unmatched quote"); |
| 23 | + hash ^= c; |
| 24 | + hash *= 0x1000193; |
33 | 25 | } |
| 26 | + throw iter.reportError("readObjectFieldAsHash", "unmatched quote"); |
34 | 27 | } |
35 | 28 |
|
36 | 29 | public static final Slice readObjectFieldAsSlice(JsonIterator iter) throws IOException { |
@@ -76,7 +69,7 @@ final static void skipObject(JsonIterator iter) throws IOException { |
76 | 69 | switch (iter.buf[i]) { |
77 | 70 | case '"': // If inside string, skip it |
78 | 71 | iter.head = i + 1; |
79 | | - IterImpl.skipString(iter); |
| 72 | + skipString(iter); |
80 | 73 | i = iter.head - 1; // it will be i++ soon |
81 | 74 | break; |
82 | 75 | case '{': // If open symbol, increase level |
@@ -190,7 +183,7 @@ public static Any readAny(JsonIterator iter) throws IOException { |
190 | 183 | return Any.wrap(false); |
191 | 184 | case 'n': |
192 | 185 | skipUntilBreak(iter); |
193 | | - return Any.wrap((Object)null); |
| 186 | + return Any.wrap((Object) null); |
194 | 187 | case '[': |
195 | 188 | skipArray(iter); |
196 | 189 | return Any.lazyArray(iter.buf, start, iter.head); |
|
0 commit comments