OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "pdf/chunk_stream.h" | 5 #include "pdf/chunk_stream.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <string.h> |
| 9 |
7 #define __STDC_LIMIT_MACROS | 10 #define __STDC_LIMIT_MACROS |
8 #ifdef _WIN32 | 11 #ifdef _WIN32 |
9 #include <limits.h> | 12 #include <limits.h> |
10 #else | 13 #else |
11 #include <stdint.h> | 14 #include <stdint.h> |
12 #endif | 15 #endif |
13 | 16 |
14 #include <algorithm> | 17 #include <algorithm> |
15 | 18 |
16 #include "base/basictypes.h" | |
17 | |
18 namespace chrome_pdf { | 19 namespace chrome_pdf { |
19 | 20 |
20 ChunkStream::ChunkStream() : stream_size_(0) { | 21 ChunkStream::ChunkStream() : stream_size_(0) { |
21 } | 22 } |
22 | 23 |
23 ChunkStream::~ChunkStream() { | 24 ChunkStream::~ChunkStream() { |
24 } | 25 } |
25 | 26 |
26 void ChunkStream::Clear() { | 27 void ChunkStream::Clear() { |
27 chunks_.clear(); | 28 chunks_.clear(); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 size_t ChunkStream::GetLastMissingByteInInterval(size_t offset) const { | 166 size_t ChunkStream::GetLastMissingByteInInterval(size_t offset) const { |
166 if (chunks_.empty()) | 167 if (chunks_.empty()) |
167 return stream_size_ - 1; | 168 return stream_size_ - 1; |
168 std::map<size_t, size_t>::const_iterator it = chunks_.upper_bound(offset); | 169 std::map<size_t, size_t>::const_iterator it = chunks_.upper_bound(offset); |
169 if (it == chunks_.end()) | 170 if (it == chunks_.end()) |
170 return stream_size_ - 1; | 171 return stream_size_ - 1; |
171 return it->first - 1; | 172 return it->first - 1; |
172 } | 173 } |
173 | 174 |
174 } // namespace chrome_pdf | 175 } // namespace chrome_pdf |
OLD | NEW |