Project Name | CID | Checker | Category | Developer Description |
---|---|---|---|---|
vitamin-caig/zxtune | 24399 | UNUSED_VALUE | Code maintainability issues | Unused value and previous write overwriting found in the defect meant error in algorithm. |
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 |
{ dst.Lines.resize(dst.Lines.size() + toSkip, line); devSkip -= toSkip; volSkip -= toSkip; } } Ranges.Add(start, cursor - start); dst.Loop = std::min<uint_t>(dst.Loop, dst.Lines.size()); } static void DecodeLevel(uint_t val, Sample::Line& line) { line.LeftLevel = val & 15; line.RightLevel = val >> 4; } void ParseOrnament(std::size_t start, Ornament& dst) const { dst.Lines.clear(); dst.Loop = ~uint_t(0); std::size_t cursor = start; uint_t line = 0; for (uint_t skip = 0;;) { |
<< Overwriting previous write to "skip" with value "1U".
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 |
skip = 1; const uint_t val = PeekByte(cursor++); if (val < 0x60) { line = val; } else if (val == 0xff) { break; } else if (val == 0xfe) { dst.Loop = dst.Lines.size(); continue; } else if (val >= 0x60) { |
<<< CID 24399: Code maintainability issues UNUSED_VALUE <<< Assigning value from "val - 96U" to "skip" here, but that stored value is overwritten before it can be used.
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 |
skip = val - 0x60; continue; } if (skip) { dst.Lines.resize(dst.Lines.size() + skip, line); skip = 0; } } Ranges.Add(start, cursor - start); dst.Loop = std::min<uint_t>(dst.Loop, dst.Lines.size()); } private: const Binary::TypedContainer& Delegate; RangesMap Ranges; const RawHeader& Source; DecodeTable SampleDecodeTable; }; enum AreaTypes { HEADER, SAMPLES_TABLE, ORNAMENTS_TABLE, SAMPLESDECODE_TABLE, POSITIONS_TABLE, PATTERNS_TABLE, |
value_overwrite | etracker.cpp:734 | |
assigned_value | etracker.cpp:751 |