1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed a possible endless loop in a menu with no selectable items if Setup.MenuScrollWrap is true

This commit is contained in:
Klaus Schmidinger 2005-10-09 10:45:48 +02:00
parent 6a8e2a99cb
commit ccaa4e961e
3 changed files with 16 additions and 6 deletions

View File

@ -1508,3 +1508,6 @@ Philip Prindeville <philipp_subx@redfish-solutions.com>
Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
for making VDR use use daemon() instead of fork() to run in daemon mode for making VDR use use daemon() instead of fork() to run in daemon mode
for fixing a possible endless loop in a menu with no selectable items if
Setup.MenuScrollWrap
is true (thanks to Enrico Scholz).

View File

@ -3889,4 +3889,7 @@ Video Disk Recorder Revision History
2005-10-09: Version 1.3.35 2005-10-09: Version 1.3.35
- Updated 'sources.conf' (thanks to Philip Prindeville). - Updated 'sources.conf' (thanks to Philip Prindeville).
- Now using daemon() instead of fork() to run VDR in daemon mode (thanks to Enrico Scholz). - Now using daemon() instead of fork() to run VDR in daemon mode (thanks to
Enrico Scholz).
- Fixed a possible endless loop in a menu with no selectable items if
Setup.MenuScrollWrap is true (thanks to Enrico Scholz).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osdbase.c 1.22 2005/10/02 15:00:40 kls Exp $ * $Id: osdbase.c 1.23 2005/10/09 10:42:35 kls Exp $
*/ */
#include "osdbase.h" #include "osdbase.h"
@ -268,14 +268,16 @@ void cOsdMenu::CursorUp(void)
int tmpCurrent = current; int tmpCurrent = current;
int lastOnScreen = first + displayMenuItems - 1; int lastOnScreen = first + displayMenuItems - 1;
int last = Count() - 1; int last = Count() - 1;
if (last < 0)
return;
while (--tmpCurrent != current) { while (--tmpCurrent != current) {
if (tmpCurrent < 0) { if (tmpCurrent < 0) {
if (Setup.MenuScrollWrap) if (Setup.MenuScrollWrap)
tmpCurrent = last; tmpCurrent = last + 1;
else else
return; return;
} }
if (SelectableItem(tmpCurrent)) else if (SelectableItem(tmpCurrent))
break; break;
} }
if (first <= tmpCurrent && tmpCurrent <= lastOnScreen) if (first <= tmpCurrent && tmpCurrent <= lastOnScreen)
@ -298,14 +300,16 @@ void cOsdMenu::CursorDown(void)
int tmpCurrent = current; int tmpCurrent = current;
int lastOnScreen = first + displayMenuItems - 1; int lastOnScreen = first + displayMenuItems - 1;
int last = Count() - 1; int last = Count() - 1;
if (last < 0)
return;
while (++tmpCurrent != current) { while (++tmpCurrent != current) {
if (tmpCurrent > last) { if (tmpCurrent > last) {
if (Setup.MenuScrollWrap) if (Setup.MenuScrollWrap)
tmpCurrent = 0; tmpCurrent = -1;
else else
return; return;
} }
if (SelectableItem(tmpCurrent)) else if (SelectableItem(tmpCurrent))
break; break;
} }
if (first <= tmpCurrent && tmpCurrent <= lastOnScreen) if (first <= tmpCurrent && tmpCurrent <= lastOnScreen)