cloop.c (32cc71def9e3885f9527af713e6d8dc7521ddc08) cloop.c (353a5d84b25c335b259f37c4f43dad96e6d60ba8)
1/*
2 * QEMU Block driver for CLOOP images
3 *
4 * Copyright (c) 2004 Johannes E. Schindelin
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 208 unchanged lines hidden (view full) ---

217 BDRVCloopState *s = bs->opaque;
218
219 if (s->current_block != block_num) {
220 int ret;
221 uint32_t bytes = s->offsets[block_num + 1] - s->offsets[block_num];
222
223 ret = bdrv_pread(bs->file, s->offsets[block_num], bytes,
224 s->compressed_block, 0);
1/*
2 * QEMU Block driver for CLOOP images
3 *
4 * Copyright (c) 2004 Johannes E. Schindelin
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 208 unchanged lines hidden (view full) ---

217 BDRVCloopState *s = bs->opaque;
218
219 if (s->current_block != block_num) {
220 int ret;
221 uint32_t bytes = s->offsets[block_num + 1] - s->offsets[block_num];
222
223 ret = bdrv_pread(bs->file, s->offsets[block_num], bytes,
224 s->compressed_block, 0);
225 if (ret != bytes) {
225 if (ret < 0) {
226 return -1;
227 }
228
229 s->zstream.next_in = s->compressed_block;
230 s->zstream.avail_in = bytes;
231 s->zstream.next_out = s->uncompressed_block;
232 s->zstream.avail_out = s->block_size;
233 ret = inflateReset(&s->zstream);

--- 75 unchanged lines hidden ---
226 return -1;
227 }
228
229 s->zstream.next_in = s->compressed_block;
230 s->zstream.avail_in = bytes;
231 s->zstream.next_out = s->uncompressed_block;
232 s->zstream.avail_out = s->block_size;
233 ret = inflateReset(&s->zstream);

--- 75 unchanged lines hidden ---