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

Side by Side Diff: courgette/streams.cc

Issue 613893002: Fix more MSVC warnings, courgette/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« courgette/encoded_program.cc ('K') | « courgette/encoded_program.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Streams classes. 5 // Streams classes.
6 // 6 //
7 // These memory-resident streams are used for serializing data into a sequential 7 // These memory-resident streams are used for serializing data into a sequential
8 // region of memory. 8 // region of memory.
9 // 9 //
10 // Streams are divided into SourceStreams for reading and SinkStreams for 10 // Streams are divided into SourceStreams for reading and SinkStreams for
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 return source; 108 return source;
109 } 109 }
110 110
111 return NULL; // Value is too long to be a Varint32. 111 return NULL; // Value is too long to be a Varint32.
112 } 112 }
113 113
114 // Write the base-128 digits in little-endian order. All except the last digit 114 // Write the base-128 digits in little-endian order. All except the last digit
115 // have the high bit set to indicate more digits. 115 // have the high bit set to indicate more digits.
116 inline uint8* Varint::Encode32(uint8* destination, uint32 value) { 116 inline uint8* Varint::Encode32(uint8* destination, uint32 value) {
117 while (value >= 128) { 117 while (value >= 128) {
118 *(destination++) = value | 128; 118 *(destination++) = static_cast<uint8>(value) | 128;
119 value = value >> 7; 119 value = value >> 7;
120 } 120 }
121 *(destination++) = value; 121 *(destination++) = static_cast<uint8>(value);
122 return destination; 122 return destination;
123 } 123 }
124 124
125 void SourceStream::Init(const SinkStream& sink) { 125 void SourceStream::Init(const SinkStream& sink) {
126 Init(sink.Buffer(), sink.Length()); 126 Init(sink.Buffer(), sink.Length());
127 } 127 }
128 128
129 bool SourceStream::Read(void* destination, size_t count) { 129 bool SourceStream::Read(void* destination, size_t count) {
130 if (current_ + count > end_) 130 if (current_ + count > end_)
131 return false; 131 return false;
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 ret = control_stream->WriteSizeVarint32(lengths[i]); 381 ret = control_stream->WriteSizeVarint32(lengths[i]);
382 } 382 }
383 383
384 for (size_t i = 0; ret && i < stream_count; ++i) { 384 for (size_t i = 0; ret && i < stream_count; ++i) {
385 ret = this->stream(i)->Append(set->stream(i)); 385 ret = this->stream(i)->Append(set->stream(i));
386 } 386 }
387 return ret; 387 return ret;
388 } 388 }
389 389
390 } // namespace 390 } // namespace
OLDNEW
« courgette/encoded_program.cc ('K') | « courgette/encoded_program.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698