From: Andre Noll Date: Sat, 3 Oct 2015 17:52:12 +0000 (+0000) Subject: play: Fix off-by-one in jmp 100. X-Git-Tag: v0.5.6~61^2~1 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=73f00df1d8dea3793c9f436b9348074bc6f9aaba;p=paraslash.git 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". --- 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;