replace vec.truncate(0) with vec.clear()
[nihav.git] / nihav-llaudio / src / codecs / ape.rs
index 773c116024e51ce8402de771c46ab5612d60dc76..8a9073dda5228da15e7ac9c097246cefd8e762f9 100644 (file)
@@ -126,7 +126,7 @@ impl NADecoder for APEDecoder {
             validate!(nblocks > 0);
             let bits                    = u32::from(pktbuf[4]);
             validate!(bits < 32);
-            self.data.truncate(0);
+            self.data.clear();
             self.data.reserve((pktbuf.len() & !3) + 2);
             for word in pktbuf[8..].chunks_exact(4) {
                 self.data.push(word[3]);
@@ -169,7 +169,7 @@ impl NADecoder for APEDecoder {
             if self.is_stereo {
                 self.right.resize(nblocks, 0);
             }
-            if (fflags & 3) == 0 {
+            if (!self.is_stereo && (fflags & 1) == 0) || (self.is_stereo && (fflags & 3) != 3) {
                 if !self.is_stereo || (fflags & 4) != 0 {
                     (self.decode_mono)(&mut coder, &mut self.left)?;
                     self.fmode.filter_mono(&mut self.left);