From 73f00df1d8dea3793c9f436b9348074bc6f9aaba Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 3 Oct 2015 17:52:12 +0000 Subject: [PATCH] play: Fix off-by-one in jmp 100. The command "jmp 100" did not work as expected (switch to the next file) but caused the following error repos failed: Invalid argument The problem was that ->start_chunk was set to pt->num_chunks which exceeds the maximal valid chunk number by one. This commit special cases the value 100 to make "jmp 100" equivalent to "next". --- play.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/play.c b/play.c index 61c30aed..7593a69b 100644 --- a/play.c +++ b/play.c @@ -921,6 +921,8 @@ static int com_jmp(struct play_task *pt, int argc, char **argv) return ret; if (percent < 0 || percent > 100) return -ERRNO_TO_PARA_ERROR(EINVAL); + if (percent == 100) + return com_next(pt, 1, (char *[]){"next", NULL}); if (pt->playing && !pt->fn.btrn) return 0; pt->start_chunk = percent * pt->num_chunks / 100; -- 2.39.5