Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <limits.h> | 5 #include <limits.h> |
| 6 #include <ctype.h> | 6 #include <ctype.h> |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 if (!ret) { | 243 if (!ret) { |
| 244 vcdiff_streaming_decoder_.reset(NULL); // Don't call it again. | 244 vcdiff_streaming_decoder_.reset(NULL); // Don't call it again. |
| 245 decoding_status_ = DECODING_ERROR; | 245 decoding_status_ = DECODING_ERROR; |
| 246 SdchManager::SdchErrorRecovery(SdchManager::DECODE_BODY_ERROR); | 246 SdchManager::SdchErrorRecovery(SdchManager::DECODE_BODY_ERROR); |
| 247 return FILTER_ERROR; | 247 return FILTER_ERROR; |
| 248 } | 248 } |
| 249 | 249 |
| 250 amount = OutputBufferExcess(dest_buffer, available_space); | 250 amount = OutputBufferExcess(dest_buffer, available_space); |
| 251 *dest_len += amount; | 251 *dest_len += amount; |
| 252 dest_buffer += amount; | 252 dest_buffer += amount; |
| 253 available_space -= amount; | |
| 253 if (0 == available_space && !dest_buffer_excess_.empty()) | 254 if (0 == available_space && !dest_buffer_excess_.empty()) |
| 254 return FILTER_OK; | 255 return FILTER_OK; |
|
huanr
2009/02/26 19:08:08
2 space indent.
| |
| 255 return FILTER_NEED_MORE_DATA; | 256 return FILTER_NEED_MORE_DATA; |
| 256 } | 257 } |
| 257 | 258 |
| 258 Filter::FilterStatus SdchFilter::InitializeDictionary() { | 259 Filter::FilterStatus SdchFilter::InitializeDictionary() { |
| 259 const size_t kServerIdLength = 9; // Dictionary hash plus null from server. | 260 const size_t kServerIdLength = 9; // Dictionary hash plus null from server. |
| 260 size_t bytes_needed = kServerIdLength - dictionary_hash_.size(); | 261 size_t bytes_needed = kServerIdLength - dictionary_hash_.size(); |
| 261 DCHECK(bytes_needed > 0); | 262 DCHECK(bytes_needed > 0); |
| 262 if (!next_stream_data_) | 263 if (!next_stream_data_) |
| 263 return FILTER_NEED_MORE_DATA; | 264 return FILTER_NEED_MORE_DATA; |
| 264 if (static_cast<size_t>(stream_data_len_) < bytes_needed) { | 265 if (static_cast<size_t>(stream_data_len_) < bytes_needed) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 memcpy(dest_buffer, dest_buffer_excess_.data() + dest_buffer_excess_index_, | 321 memcpy(dest_buffer, dest_buffer_excess_.data() + dest_buffer_excess_index_, |
| 321 amount); | 322 amount); |
| 322 dest_buffer_excess_index_ += amount; | 323 dest_buffer_excess_index_ += amount; |
| 323 if (dest_buffer_excess_.size() <= dest_buffer_excess_index_) { | 324 if (dest_buffer_excess_.size() <= dest_buffer_excess_index_) { |
| 324 DCHECK(dest_buffer_excess_.size() == dest_buffer_excess_index_); | 325 DCHECK(dest_buffer_excess_.size() == dest_buffer_excess_index_); |
| 325 dest_buffer_excess_.clear(); | 326 dest_buffer_excess_.clear(); |
| 326 dest_buffer_excess_index_ = 0; | 327 dest_buffer_excess_index_ = 0; |
| 327 } | 328 } |
| 328 return amount; | 329 return amount; |
| 329 } | 330 } |
| OLD | NEW |