shithub: mp3dec

Download patch

ref: 1518f298b35feecf2f6e5c0aae83e4eab64b3e72
parent: 4ba08c0199f2c2b016ca9d3ac0c799e3ed6836bd
author: lieff <lieff@users.noreply.github.com>
date: Sat Feb 22 19:02:08 EST 2020

test: improve coverage

--- a/minimp3_test.c
+++ b/minimp3_test.c
@@ -210,7 +210,7 @@
         info.hz      = dec.info.hz;
         info.layer   = dec.info.layer;
         info.channels = dec.info.channels;
-        if (position < 0)
+        if (position < 0 && -2 != position)
         {
 #ifdef _WIN32
             LARGE_INTEGER t;
@@ -224,6 +224,8 @@
         }
         if (position)
         {
+            if (-2 == position)
+                position = 0;
             info.samples -= MINIMP3_MIN(info.samples, (size_t)position);
             int skip_ref = MINIMP3_MIN((size_t)ref_size, position*sizeof(int16_t));
             buf_ref  += skip_ref;
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -27,6 +27,9 @@
 scripts/test_mode.sh 6 -1 -1
 scripts/test_mode.sh 7 -1 -1
 scripts/test_mode.sh 8 -1 -1
+scripts/test_mode.sh 6 -2 -1
+scripts/test_mode.sh 7 -2 -1
+scripts/test_mode.sh 8 -2 -1
 set +e
 [[ "$(./minimp3)" != "error: no file names given" ]] && echo fail && exit 1 || echo pass
 [[ "$(./minimp3 do_not_exist)" != "error: read function failed, code=-3" ]] && echo fail && exit 1 || echo pass