OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/spdy/hpack/hpack_huffman_table.h" | 5 #include "net/spdy/hpack/hpack_huffman_table.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 for (size_t i = 0; i != decode_tables_.size(); i++) { | 162 for (size_t i = 0; i != decode_tables_.size(); i++) { |
163 const DecodeTable& table = decode_tables_[i]; | 163 const DecodeTable& table = decode_tables_[i]; |
164 uint8_t total_indexed = table.prefix_length + table.indexed_length; | 164 uint8_t total_indexed = table.prefix_length + table.indexed_length; |
165 | 165 |
166 size_t j = 0; | 166 size_t j = 0; |
167 while (j != table.size()) { | 167 while (j != table.size()) { |
168 const DecodeEntry& entry = Entry(table, j); | 168 const DecodeEntry& entry = Entry(table, j); |
169 if (entry.length != 0 && entry.length < total_indexed) { | 169 if (entry.length != 0 && entry.length < total_indexed) { |
170 // The difference between entry & table bit counts tells us how | 170 // The difference between entry & table bit counts tells us how |
171 // many additional entries map to this one. | 171 // many additional entries map to this one. |
172 size_t fill_count = 1 << (total_indexed - entry.length); | 172 size_t fill_count = static_cast<size_t>(1) |
| 173 << (total_indexed - entry.length); |
173 CHECK_LE(j + fill_count, table.size()); | 174 CHECK_LE(j + fill_count, table.size()); |
174 | 175 |
175 for (size_t k = 1; k != fill_count; k++) { | 176 for (size_t k = 1; k != fill_count; k++) { |
176 CHECK_EQ(Entry(table, j + k).length, 0); | 177 CHECK_EQ(Entry(table, j + k).length, 0); |
177 SetEntry(table, j + k, entry); | 178 SetEntry(table, j + k, entry); |
178 } | 179 } |
179 j += fill_count; | 180 j += fill_count; |
180 } else { | 181 } else { |
181 j++; | 182 j++; |
182 } | 183 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 bits = bits << entry.length; | 317 bits = bits << entry.length; |
317 bits_available -= entry.length; | 318 bits_available -= entry.length; |
318 } | 319 } |
319 peeked_success = in->PeekBits(&bits_available, &bits); | 320 peeked_success = in->PeekBits(&bits_available, &bits); |
320 } | 321 } |
321 NOTREACHED(); | 322 NOTREACHED(); |
322 return false; | 323 return false; |
323 } | 324 } |
324 | 325 |
325 } // namespace net | 326 } // namespace net |
OLD | NEW |