comparison contrib/python-zstandard/c-ext/compressoriterator.c @ 42070:675775c33ab6

zstandard: vendor python-zstandard 0.11 The upstream source distribution from PyPI was extracted. Unwanted files were removed. The clang-format ignore list was updated to reflect the new source of files. The project contains a vendored copy of zstandard 1.3.8. The old version was 1.3.6. This should result in some minor performance wins. test-check-py3-compat.t was updated to reflect now-passing tests on Python 3.8. Some HTTP tests were updated to reflect new zstd compression output. # no-check-commit because 3rd party code has different style guidelines Differential Revision: https://phab.mercurial-scm.org/D6199
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 04 Apr 2019 17:34:43 -0700
parents b1fb341d8a61
children e92ca942ddca
comparison
equal deleted inserted replaced
42069:668eff08387f 42070:675775c33ab6
55 feedcompressor: 55 feedcompressor:
56 56
57 /* If we have data left in the input, consume it. */ 57 /* If we have data left in the input, consume it. */
58 if (self->input.pos < self->input.size) { 58 if (self->input.pos < self->input.size) {
59 Py_BEGIN_ALLOW_THREADS 59 Py_BEGIN_ALLOW_THREADS
60 zresult = ZSTD_compress_generic(self->compressor->cctx, &self->output, 60 zresult = ZSTD_compressStream2(self->compressor->cctx, &self->output,
61 &self->input, ZSTD_e_continue); 61 &self->input, ZSTD_e_continue);
62 Py_END_ALLOW_THREADS 62 Py_END_ALLOW_THREADS
63 63
64 /* Release the Python object holding the input buffer. */ 64 /* Release the Python object holding the input buffer. */
65 if (self->input.pos == self->input.size) { 65 if (self->input.pos == self->input.size) {
125 if (0 == readSize) { 125 if (0 == readSize) {
126 self->input.src = NULL; 126 self->input.src = NULL;
127 self->input.size = 0; 127 self->input.size = 0;
128 self->input.pos = 0; 128 self->input.pos = 0;
129 129
130 zresult = ZSTD_compress_generic(self->compressor->cctx, &self->output, 130 zresult = ZSTD_compressStream2(self->compressor->cctx, &self->output,
131 &self->input, ZSTD_e_end); 131 &self->input, ZSTD_e_end);
132 if (ZSTD_isError(zresult)) { 132 if (ZSTD_isError(zresult)) {
133 PyErr_Format(ZstdError, "error ending compression stream: %s", 133 PyErr_Format(ZstdError, "error ending compression stream: %s",
134 ZSTD_getErrorName(zresult)); 134 ZSTD_getErrorName(zresult));
135 return NULL; 135 return NULL;
150 self->input.src = readBuffer; 150 self->input.src = readBuffer;
151 self->input.size = readSize; 151 self->input.size = readSize;
152 self->input.pos = 0; 152 self->input.pos = 0;
153 153
154 Py_BEGIN_ALLOW_THREADS 154 Py_BEGIN_ALLOW_THREADS
155 zresult = ZSTD_compress_generic(self->compressor->cctx, &self->output, 155 zresult = ZSTD_compressStream2(self->compressor->cctx, &self->output,
156 &self->input, ZSTD_e_continue); 156 &self->input, ZSTD_e_continue);
157 Py_END_ALLOW_THREADS 157 Py_END_ALLOW_THREADS
158 158
159 /* The input buffer currently points to memory managed by Python 159 /* The input buffer currently points to memory managed by Python
160 (readBuffer). This object was allocated by this function. If it wasn't 160 (readBuffer). This object was allocated by this function. If it wasn't