OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
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 29 matching lines...) Expand all Loading... |
40 #include "import/cross/memory_buffer.h" | 40 #include "import/cross/memory_buffer.h" |
41 #include "import/cross/memory_stream.h" | 41 #include "import/cross/memory_stream.h" |
42 #include "zutil.h" | 42 #include "zutil.h" |
43 | 43 |
44 const size_t kChunkSize = 16384; | 44 const size_t kChunkSize = 16384; |
45 | 45 |
46 namespace o3d { | 46 namespace o3d { |
47 | 47 |
48 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 48 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
49 GzCompressor::GzCompressor(StreamProcessor *callback_client) | 49 GzCompressor::GzCompressor(StreamProcessor *callback_client) |
50 : callback_client_(callback_client), | 50 : stream_is_closed_(false), |
51 stream_is_closed_(false) { | 51 callback_client_(callback_client) { |
52 strm_.zalloc = Z_NULL; | 52 strm_.zalloc = Z_NULL; |
53 strm_.zfree = Z_NULL; | 53 strm_.zfree = Z_NULL; |
54 strm_.opaque = Z_NULL; | 54 strm_.opaque = Z_NULL; |
55 | 55 |
56 // Store this, so we can later check if it's OK to start processing | 56 // Store this, so we can later check if it's OK to start processing |
57 init_result_ = deflateInit2( | 57 init_result_ = deflateInit2( |
58 &strm_, | 58 &strm_, |
59 Z_DEFAULT_COMPRESSION, | 59 Z_DEFAULT_COMPRESSION, |
60 Z_DEFLATED, | 60 Z_DEFLATED, |
61 MAX_WBITS + 16, // 16 means write out gzip header/trailer | 61 MAX_WBITS + 16, // 16 means write out gzip header/trailer |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 if (client_result != 0) { | 140 if (client_result != 0) { |
141 return client_result; // propagate callback errors | 141 return client_result; // propagate callback errors |
142 } | 142 } |
143 } | 143 } |
144 } while (strm_.avail_out == 0); | 144 } while (strm_.avail_out == 0); |
145 | 145 |
146 return result; | 146 return result; |
147 } | 147 } |
148 | 148 |
149 } // namespace o3d | 149 } // namespace o3d |
OLD | NEW |