From e77045ac8a12318b4a30c4b55ae3a373d16a4c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Sepp=C3=A4l=C3=A4?= Date: Mon, 1 Oct 2007 15:30:22 +0000 Subject: [PATCH] Zero the Rid when trying the incrementation of it at first --- setup.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/setup.c b/setup.c index d656b92..43a0479 100644 --- a/setup.c +++ b/setup.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: setup.c,v 1.16 2007/09/30 21:38:31 rahrenbe Exp $ + * $Id: setup.c,v 1.17 2007/10/01 15:30:22 ajhseppa Exp $ */ #include @@ -205,6 +205,7 @@ eOSState cIptvMenuEditChannel::ProcessKey(eKeys Key) cChannel newchannel; SetChannelData(&newchannel); bool uniquityFailed = false; + bool firstIteration = true; // Search for identical channels as these will be ignored by vdr for (cChannel *iteratorChannel = Channels.First(); iteratorChannel; iteratorChannel = Channels.Next(iteratorChannel)) { @@ -226,7 +227,13 @@ eOSState cIptvMenuEditChannel::ProcessKey(eKeys Key) iteratorChannel->SetId(iteratorChannel->Nid(), iteratorChannel->Tid(), iteratorChannel->Sid(), - iteratorChannel->Rid() + 1); + firstIteration ? + 0 : iteratorChannel->Rid() + 1); + + // The first iteration prevents Rid:s from creeping slowly + // towards maximum value because they are always zeroed first + firstIteration = false; + // Re-set the search and start again iteratorChannel = Channels.First(); continue;