Skip to content

Commit

Permalink
Fixed disk spanning failures due to changes in #799.
Browse files Browse the repository at this point in the history
At the end of a disk, we return any bytes read before proceeding to
the next disk. This allows us to return MZ_EXIST_ERROR when the next
disk is not found.
  • Loading branch information
nmoinvaz committed Oct 30, 2024
1 parent b2691a0 commit 18ddbf9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mz_strm_split.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,11 @@ int32_t mz_stream_split_read(void *stream, void *buf, int32_t size) {
if (read == 0) {
if (split->current_disk < 0) /* No more disks to goto */
break;
if (size != bytes_left) /* Report read from previous disk before switching */
break;
err = mz_stream_split_goto_disk(stream, split->current_disk + 1);
if (err == MZ_EXIST_ERROR) {
if (err == MZ_EXIST_ERROR)
split->current_disk = -1;
}
if (err != MZ_OK)
return err;
}
Expand Down

0 comments on commit 18ddbf9

Please sign in to comment.