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

Side by Side Diff: third_party/protobuf/src/google/protobuf/io/gzip_stream.cc

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years 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 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 DoNextOutput(data, size); 162 DoNextOutput(data, size);
163 return true; 163 return true;
164 } 164 }
165 void GzipInputStream::BackUp(int count) { 165 void GzipInputStream::BackUp(int count) {
166 output_position_ = reinterpret_cast<void*>( 166 output_position_ = reinterpret_cast<void*>(
167 reinterpret_cast<uintptr_t>(output_position_) - count); 167 reinterpret_cast<uintptr_t>(output_position_) - count);
168 } 168 }
169 bool GzipInputStream::Skip(int count) { 169 bool GzipInputStream::Skip(int count) {
170 const void* data; 170 const void* data;
171 int size; 171 int size = 0;
172 bool ok = Next(&data, &size); 172 bool ok = Next(&data, &size);
173 while (ok && (size < count)) { 173 while (ok && (size < count)) {
174 count -= size; 174 count -= size;
175 ok = Next(&data, &size); 175 ok = Next(&data, &size);
176 } 176 }
177 if (size > count) { 177 if (size > count) {
178 BackUp(size - count); 178 BackUp(size - count);
179 } 179 }
180 return ok; 180 return ok;
181 } 181 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 bool ok = zerror_ == Z_OK; 321 bool ok = zerror_ == Z_OK;
322 zerror_ = Z_STREAM_END; 322 zerror_ = Z_STREAM_END;
323 return ok; 323 return ok;
324 } 324 }
325 325
326 } // namespace io 326 } // namespace io
327 } // namespace protobuf 327 } // namespace protobuf
328 } // namespace google 328 } // namespace google
329 329
330 #endif // HAVE_ZLIB 330 #endif // HAVE_ZLIB
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698