Skip to content

Commit

Permalink
lib/xz: Add fall-through comments to a switch statement
Browse files Browse the repository at this point in the history
It's good style. I was also told that GCC 7 is more strict and might
give a warning when such comments are missing.

Signed-off-by: Lasse Collin <[email protected]>
Suggested-by: Andrei Borzenkov <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
Larhzu authored and Jiri Kosina committed Oct 12, 2017
1 parent ff5abbe commit 5a244f4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/xz/xz_dec_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
if (ret != XZ_OK)
return ret;

/* Fall through */

case SEQ_BLOCK_START:
/* We need one byte of input to continue. */
if (b->in_pos == b->in_size)
Expand All @@ -606,6 +608,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
s->temp.pos = 0;
s->sequence = SEQ_BLOCK_HEADER;

/* Fall through */

case SEQ_BLOCK_HEADER:
if (!fill_temp(s, b))
return XZ_OK;
Expand All @@ -616,13 +620,17 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)

s->sequence = SEQ_BLOCK_UNCOMPRESS;

/* Fall through */

case SEQ_BLOCK_UNCOMPRESS:
ret = dec_block(s, b);
if (ret != XZ_STREAM_END)
return ret;

s->sequence = SEQ_BLOCK_PADDING;

/* Fall through */

case SEQ_BLOCK_PADDING:
/*
* Size of Compressed Data + Block Padding
Expand All @@ -643,6 +651,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)

s->sequence = SEQ_BLOCK_CHECK;

/* Fall through */

case SEQ_BLOCK_CHECK:
if (s->check_type == XZ_CHECK_CRC32) {
ret = crc32_validate(s, b);
Expand All @@ -665,6 +675,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)

s->sequence = SEQ_INDEX_PADDING;

/* Fall through */

case SEQ_INDEX_PADDING:
while ((s->index.size + (b->in_pos - s->in_start))
& 3) {
Expand All @@ -687,6 +699,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)

s->sequence = SEQ_INDEX_CRC32;

/* Fall through */

case SEQ_INDEX_CRC32:
ret = crc32_validate(s, b);
if (ret != XZ_STREAM_END)
Expand All @@ -695,6 +709,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
s->temp.size = STREAM_HEADER_SIZE;
s->sequence = SEQ_STREAM_FOOTER;

/* Fall through */

case SEQ_STREAM_FOOTER:
if (!fill_temp(s, b))
return XZ_OK;
Expand Down

0 comments on commit 5a244f4

Please sign in to comment.