1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

Use LZMA_PROG_ERROR in lzma_code() as documented in base.h.

This commit is contained in:
Lasse Collin 2009-01-20 10:35:15 +02:00
parent 2f1a8e8eb8
commit 0c09810cb3

View file

@ -192,34 +192,26 @@ lzma_code(lzma_stream *strm, lzma_action action)
break; break;
case ISEQ_SYNC_FLUSH: case ISEQ_SYNC_FLUSH:
if (action != LZMA_SYNC_FLUSH) // The same action must be used until we return
// LZMA_STREAM_END, and the amount of input must not change.
if (action != LZMA_SYNC_FLUSH
|| strm->internal->avail_in != strm->avail_in)
return LZMA_PROG_ERROR; return LZMA_PROG_ERROR;
// Check that application doesn't change avail_in once
// LZMA_SYNC_FLUSH has been used.
if (strm->internal->avail_in != strm->avail_in)
return LZMA_DATA_ERROR;
break; break;
case ISEQ_FULL_FLUSH: case ISEQ_FULL_FLUSH:
if (action != LZMA_FULL_FLUSH) if (action != LZMA_FULL_FLUSH
|| strm->internal->avail_in != strm->avail_in)
return LZMA_PROG_ERROR; return LZMA_PROG_ERROR;
// Check that application doesn't change avail_in once
// LZMA_FULL_FLUSH has been used.
if (strm->internal->avail_in != strm->avail_in)
return LZMA_DATA_ERROR;
break; break;
case ISEQ_FINISH: case ISEQ_FINISH:
if (action != LZMA_FINISH) if (action != LZMA_FINISH
|| strm->internal->avail_in != strm->avail_in)
return LZMA_PROG_ERROR; return LZMA_PROG_ERROR;
if (strm->internal->avail_in != strm->avail_in)
return LZMA_DATA_ERROR;
break; break;
case ISEQ_END: case ISEQ_END: