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

Side by Side Diff: net/http2/hpack/huffman/http2_hpack_huffman_decoder.cc

Issue 2691393002: Fix auto raw pointer deduction on linux (Closed)
Patch Set: rebase Created 3 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/http2/hpack/huffman/http2_hpack_huffman_decoder.h" 5 #include "net/http2/hpack/huffman/http2_hpack_huffman_decoder.h"
6 6
7 #include <bitset> 7 #include <bitset>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 361
362 size_t HuffmanBitBuffer::AppendBytes(StringPiece input) { 362 size_t HuffmanBitBuffer::AppendBytes(StringPiece input) {
363 HuffmanAccumulatorBitCount free_cnt = free_count(); 363 HuffmanAccumulatorBitCount free_cnt = free_count();
364 size_t bytes_available = input.size(); 364 size_t bytes_available = input.size();
365 if (free_cnt < 8 || bytes_available == 0) { 365 if (free_cnt < 8 || bytes_available == 0) {
366 return 0; 366 return 0;
367 } 367 }
368 368
369 // Top up |accumulator_| until there isn't room for a whole byte. 369 // Top up |accumulator_| until there isn't room for a whole byte.
370 size_t bytes_used = 0; 370 size_t bytes_used = 0;
371 auto ptr = reinterpret_cast<const uint8_t*>(input.data()); 371 auto* ptr = reinterpret_cast<const uint8_t*>(input.data());
372 do { 372 do {
373 auto b = static_cast<HuffmanAccumulator>(*ptr++); 373 auto b = static_cast<HuffmanAccumulator>(*ptr++);
374 free_cnt -= 8; 374 free_cnt -= 8;
375 accumulator_ |= (b << free_cnt); 375 accumulator_ |= (b << free_cnt);
376 ++bytes_used; 376 ++bytes_used;
377 } while (free_cnt >= 8 && bytes_used < bytes_available); 377 } while (free_cnt >= 8 && bytes_used < bytes_available);
378 count_ += (bytes_used * 8); 378 count_ += (bytes_used * 8);
379 return bytes_used; 379 return bytes_used;
380 } 380 }
381 381
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 } 533 }
534 input.remove_prefix(byte_count); 534 input.remove_prefix(byte_count);
535 } 535 }
536 } 536 }
537 537
538 string HpackHuffmanDecoder::DebugString() const { 538 string HpackHuffmanDecoder::DebugString() const {
539 return bit_buffer_.DebugString(); 539 return bit_buffer_.DebugString();
540 } 540 }
541 541
542 } // namespace net 542 } // namespace net
OLDNEW
« no previous file with comments | « net/http2/hpack/decoder/hpack_decoder_tables.cc ('k') | net/proxy/mojo_proxy_resolver_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698