| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |