Chromium Code Reviews| Index: remoting/client/plugin/compression.cc |
| =================================================================== |
| --- remoting/client/plugin/compression.cc (revision 49842) |
| +++ remoting/client/plugin/compression.cc (working copy) |
| @@ -29,8 +29,13 @@ |
| stream_.avail_out = kZLIB_CHUNK; |
| stream_.next_out = reinterpret_cast<Bytef*>(&buffer_[last_size]); |
| int ret = deflate(&stream_, flush); |
| - assert(ret != Z_STREAM_ERROR); |
| + // Check ret before the assert so that we don't get an unused variable |
| + // warning in release builds. |
| + if (ret == Z_STREAM_ERROR) { |
| + assert(ret != Z_STREAM_ERROR); |
|
Sergey Ulanov
2010/06/15 22:50:03
This should be replaced with DCHECK. I think, it w
|
| + } |
| + |
| // Shrink the size of the vector. It doesn't alter the capacity. |
| int compressed = kZLIB_CHUNK - stream_.avail_out; |
| buffer_.resize(last_size + compressed); |
| @@ -81,8 +86,13 @@ |
| stream_.avail_out = kZLIB_CHUNK; |
| stream_.next_out = reinterpret_cast<Bytef*>(&buffer_[last_size]); |
| int ret = inflate(&stream_, flush); |
| - assert(ret != Z_STREAM_ERROR); |
| + // Check ret before the assert so that we don't get an unused variable |
| + // warning in release builds. |
| + if (ret == Z_STREAM_ERROR) { |
| + assert(ret != Z_STREAM_ERROR); |
| + } |
| + |
| // Shrink the size of the vector. It doesn't alter the capacity. |
| int decompressed = kZLIB_CHUNK - stream_.avail_out; |
| buffer_.resize(last_size + decompressed); |