summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 15:39:47 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 15:39:47 +0200
commit1245c4eeb1eea7a5301f500d001b6db91c3f1283 (patch)
treeedb1b5b88db5ed098ac941863409aa5aa7110ec3
parentc2b37956b0c32c78ec017617509038e051bb08fb (diff)
Minor cleanup: remove if (...) goto skip construct from data reader
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--lib/sqfshelper/data_writer.c48
1 files 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;