aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2017-05-03 12:00:39 -0400
committerJiri Kosina <jkosina@suse.cz>2017-10-12 09:10:12 -0400
commit5a244f48ecbbd03a11eb84819c5c599db81823ee (patch)
treeff10adbcb7cc2677570de9f610716732e37228bf
parentff5abbe799e29099695cb8b5b2f198dd8b8bdf26 (diff)
lib/xz: Add fall-through comments to a switch statement
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 <lasse.collin@tukaani.org> Suggested-by: Andrei Borzenkov <arvidjaar@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--lib/xz/xz_dec_stream.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
index ac809b1e64f7..bd1d182419d7 100644
--- a/lib/xz/xz_dec_stream.c
+++ b/lib/xz/xz_dec_stream.c
@@ -583,6 +583,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
583 if (ret != XZ_OK) 583 if (ret != XZ_OK)
584 return ret; 584 return ret;
585 585
586 /* Fall through */
587
586 case SEQ_BLOCK_START: 588 case SEQ_BLOCK_START:
587 /* We need one byte of input to continue. */ 589 /* We need one byte of input to continue. */
588 if (b->in_pos == b->in_size) 590 if (b->in_pos == b->in_size)
@@ -606,6 +608,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
606 s->temp.pos = 0; 608 s->temp.pos = 0;
607 s->sequence = SEQ_BLOCK_HEADER; 609 s->sequence = SEQ_BLOCK_HEADER;
608 610
611 /* Fall through */
612
609 case SEQ_BLOCK_HEADER: 613 case SEQ_BLOCK_HEADER:
610 if (!fill_temp(s, b)) 614 if (!fill_temp(s, b))
611 return XZ_OK; 615 return XZ_OK;
@@ -616,6 +620,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
616 620
617 s->sequence = SEQ_BLOCK_UNCOMPRESS; 621 s->sequence = SEQ_BLOCK_UNCOMPRESS;
618 622
623 /* Fall through */
624
619 case SEQ_BLOCK_UNCOMPRESS: 625 case SEQ_BLOCK_UNCOMPRESS:
620 ret = dec_block(s, b); 626 ret = dec_block(s, b);
621 if (ret != XZ_STREAM_END) 627 if (ret != XZ_STREAM_END)
@@ -623,6 +629,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
623 629
624 s->sequence = SEQ_BLOCK_PADDING; 630 s->sequence = SEQ_BLOCK_PADDING;
625 631
632 /* Fall through */
633
626 case SEQ_BLOCK_PADDING: 634 case SEQ_BLOCK_PADDING:
627 /* 635 /*
628 * Size of Compressed Data + Block Padding 636 * Size of Compressed Data + Block Padding
@@ -643,6 +651,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
643 651
644 s->sequence = SEQ_BLOCK_CHECK; 652 s->sequence = SEQ_BLOCK_CHECK;
645 653
654 /* Fall through */
655
646 case SEQ_BLOCK_CHECK: 656 case SEQ_BLOCK_CHECK:
647 if (s->check_type == XZ_CHECK_CRC32) { 657 if (s->check_type == XZ_CHECK_CRC32) {
648 ret = crc32_validate(s, b); 658 ret = crc32_validate(s, b);
@@ -665,6 +675,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
665 675
666 s->sequence = SEQ_INDEX_PADDING; 676 s->sequence = SEQ_INDEX_PADDING;
667 677
678 /* Fall through */
679
668 case SEQ_INDEX_PADDING: 680 case SEQ_INDEX_PADDING:
669 while ((s->index.size + (b->in_pos - s->in_start)) 681 while ((s->index.size + (b->in_pos - s->in_start))
670 & 3) { 682 & 3) {
@@ -687,6 +699,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
687 699
688 s->sequence = SEQ_INDEX_CRC32; 700 s->sequence = SEQ_INDEX_CRC32;
689 701
702 /* Fall through */
703
690 case SEQ_INDEX_CRC32: 704 case SEQ_INDEX_CRC32:
691 ret = crc32_validate(s, b); 705 ret = crc32_validate(s, b);
692 if (ret != XZ_STREAM_END) 706 if (ret != XZ_STREAM_END)
@@ -695,6 +709,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
695 s->temp.size = STREAM_HEADER_SIZE; 709 s->temp.size = STREAM_HEADER_SIZE;
696 s->sequence = SEQ_STREAM_FOOTER; 710 s->sequence = SEQ_STREAM_FOOTER;
697 711
712 /* Fall through */
713
698 case SEQ_STREAM_FOOTER: 714 case SEQ_STREAM_FOOTER:
699 if (!fill_temp(s, b)) 715 if (!fill_temp(s, b))
700 return XZ_OK; 716 return XZ_OK;