contrib/python-zstandard/c-ext/compressionchunker.c
changeset 42070 675775c33ab6
parent 40121 73fef626dae3
child 46374 e92ca942ddca
equal deleted inserted replaced
42069:668eff08387f 42070:675775c33ab6
    41 	}
    41 	}
    42 
    42 
    43 	/* If we have data left in the input, consume it. */
    43 	/* If we have data left in the input, consume it. */
    44 	while (chunker->input.pos < chunker->input.size) {
    44 	while (chunker->input.pos < chunker->input.size) {
    45 		Py_BEGIN_ALLOW_THREADS
    45 		Py_BEGIN_ALLOW_THREADS
    46 		zresult = ZSTD_compress_generic(chunker->compressor->cctx, &chunker->output,
    46 		zresult = ZSTD_compressStream2(chunker->compressor->cctx, &chunker->output,
    47 			&chunker->input, ZSTD_e_continue);
    47 			&chunker->input, ZSTD_e_continue);
    48 		Py_END_ALLOW_THREADS
    48 		Py_END_ALLOW_THREADS
    49 
    49 
    50 		/* Input is fully consumed. */
    50 		/* Input is fully consumed. */
    51 		if (chunker->input.pos == chunker->input.size) {
    51 		if (chunker->input.pos == chunker->input.size) {
   102 		PyErr_SetString(ZstdError, "unhandled compression mode; this should never happen");
   102 		PyErr_SetString(ZstdError, "unhandled compression mode; this should never happen");
   103 		return NULL;
   103 		return NULL;
   104 	}
   104 	}
   105 
   105 
   106 	Py_BEGIN_ALLOW_THREADS
   106 	Py_BEGIN_ALLOW_THREADS
   107 	zresult = ZSTD_compress_generic(chunker->compressor->cctx, &chunker->output,
   107 	zresult = ZSTD_compressStream2(chunker->compressor->cctx, &chunker->output,
   108 		&chunker->input, zFlushMode);
   108 		&chunker->input, zFlushMode);
   109 	Py_END_ALLOW_THREADS
   109 	Py_END_ALLOW_THREADS
   110 
   110 
   111 	if (ZSTD_isError(zresult)) {
   111 	if (ZSTD_isError(zresult)) {
   112 		PyErr_Format(ZstdError, "zstd compress error: %s",
   112 		PyErr_Format(ZstdError, "zstd compress error: %s",