From 1245c4eeb1eea7a5301f500d001b6db91c3f1283 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 5 Sep 2019 15:39:47 +0200 Subject: Minor cleanup: remove if (...) goto skip construct from data reader Signed-off-by: David Oberhollenzer --- lib/sqfshelper/data_writer.c | 48 +++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/lib/sqfshelper/data_writer.c b/lib/sqfshelper/data_writer.c index 4838f9a..6a0ef17 100644 --- a/lib/sqfshelper/data_writer.c +++ b/lib/sqfshelper/data_writer.c @@ -104,34 +104,32 @@ static int block_callback(void *user, block_t *blk) fi->startblock = data->super->bytes_used; } - if (blk->size == 0) - goto skip_sentinel; - - out = blk->size; - if (!(blk->flags & BLK_IS_COMPRESSED)) - out |= 1 << 24; - - if (blk->flags & BLK_FRAGMENT_BLOCK) { - offset = htole64(data->super->bytes_used); - data->fragments[blk->index].start_offset = offset; - data->fragments[blk->index].pad0 = 0; - data->fragments[blk->index].size = htole32(out); - - data->super->flags &= ~SQFS_FLAG_NO_FRAGMENTS; - data->super->flags |= SQFS_FLAG_ALWAYS_FRAGMENTS; - } else { - fi->blocks[blk->index].chksum = blk->checksum; - fi->blocks[blk->index].size = htole32(out); - } + if (blk->size != 0) { + out = blk->size; + if (!(blk->flags & BLK_IS_COMPRESSED)) + out |= 1 << 24; + + if (blk->flags & BLK_FRAGMENT_BLOCK) { + offset = htole64(data->super->bytes_used); + data->fragments[blk->index].start_offset = offset; + data->fragments[blk->index].pad0 = 0; + data->fragments[blk->index].size = htole32(out); + + data->super->flags &= ~SQFS_FLAG_NO_FRAGMENTS; + data->super->flags |= SQFS_FLAG_ALWAYS_FRAGMENTS; + } else { + fi->blocks[blk->index].chksum = blk->checksum; + fi->blocks[blk->index].size = htole32(out); + } - if (write_data("writing data block", data->outfd, - blk->data, blk->size)) { - return -1; - } + if (write_data("writing data block", data->outfd, + blk->data, blk->size)) { + return -1; + } - data->super->bytes_used += blk->size; + data->super->bytes_used += blk->size; + } -skip_sentinel: if (blk->flags & BLK_LAST_BLOCK) { if ((blk->flags & BLK_ALLIGN) && allign_file(data) != 0) return -1; -- cgit v1.2.3