Skip to content

Commit

Permalink
Convert post-increment to pre-increment (cppcheck).
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-kristjansson committed Aug 24, 2011
1 parent cce8751 commit 55eb681
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 27 deletions.
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/metaio.cpp
Expand Up @@ -47,11 +47,11 @@ void MetaIO::readFromFilename(const QString &filename,
QStringList::iterator fmt_it = fmt_list.begin();

// go through loop once to get minimum part number
for (; fmt_it != fmt_list.end(); fmt_it++, part_num--) {}
for (; fmt_it != fmt_list.end(); ++fmt_it, --part_num) {}

// reset to go through loop for real
fmt_it = fmt_list.begin();
for(; fmt_it != fmt_list.end(); fmt_it++, part_num++)
for(; fmt_it != fmt_list.end(); ++fmt_it, ++part_num)
{
QString part_str = lfilename.section( "/", part_num, part_num);

Expand Down
5 changes: 3 additions & 2 deletions mythplugins/mythzoneminder/mythzmserver/zmserver.cpp
Expand Up @@ -1196,15 +1196,16 @@ void ZMServer::handleDeleteEventList(vector<string> tokens)
string outStr("");

vector<string>::iterator it = tokens.begin();
it++;
if (it != tokens.end())
++it;
while (it != tokens.end())
{
if (eventList == "")
eventList = (*it);
else
eventList += "," + (*it);

it++;
++it;
}

if (m_debug)
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythzoneminder/mythzoneminder/zmclient.cpp
Expand Up @@ -429,7 +429,7 @@ void ZMClient::deleteEventList(vector<Event*> *eventList)
QStringList strList("DELETE_EVENT_LIST");
int count = 0;
vector<Event*>::iterator it;
for (it = eventList->begin(); it != eventList->end(); it++)
for (it = eventList->begin(); it != eventList->end(); ++it)
{
strList << QString::number((*it)->eventID);

Expand Down
12 changes: 6 additions & 6 deletions mythplugins/mythzoneminder/mythzoneminder/zmliveplayer.cpp
Expand Up @@ -142,7 +142,7 @@ ZMLivePlayer::~ZMLivePlayer()
QString s = "";
Player *p;
vector<Player*>::iterator i = m_players->begin();
for (; i != m_players->end(); i++)
for (; i != m_players->end(); ++i)
{
p = *i;
if (s != "")
Expand Down Expand Up @@ -223,7 +223,7 @@ void ZMLivePlayer::changePlayerMonitor(int playerNo)

// find the old monitor ID in the list of available monitors
vector<Monitor*>::iterator i = m_monitors->begin();
for (; i != m_monitors->end(); i++)
for (; i != m_monitors->end(); ++i)
{
mon = *i;
if (oldMonID == mon->id)
Expand All @@ -234,7 +234,7 @@ void ZMLivePlayer::changePlayerMonitor(int playerNo)

// get the next monitor in the list
if (i != m_monitors->end())
i++;
++i;

// wrap around to the start if we've reached the end
if (i == m_monitors->end())
Expand All @@ -261,7 +261,7 @@ void ZMLivePlayer::updateFrame()
QList<int> monList;
Player *p;
vector<Player*>::iterator i = m_players->begin();
for (; i != m_players->end(); i++)
for (; i != m_players->end(); ++i)
{
p = *i;
if (!monList.contains(p->getMonitor()->id))
Expand All @@ -278,7 +278,7 @@ void ZMLivePlayer::updateFrame()
// update each player that is displaying this monitor
Player *p;
vector<Player*>::iterator i = m_players->begin();
for (; i != m_players->end(); i++)
for (; i != m_players->end(); ++i)
{
p = *i;
if (p->getMonitor()->id == monList[x])
Expand Down Expand Up @@ -342,7 +342,7 @@ void ZMLivePlayer::setMonitorLayout(int layout, bool restore)

// try to find a monitor that matches the monID
vector<Monitor*>::iterator i = m_monitors->begin();
for (; i != m_monitors->end(); i++)
for (; i != m_monitors->end(); ++i)
{
if ((*i)->id == monID)
{
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmyth/mediamonitor-unix.cpp
Expand Up @@ -768,7 +768,7 @@ bool MediaMonitorUnix::FindPartitions(const QString &dev, bool checkPartitions)
bool found_partitions = false;
QStringList parts = sysfs.entryList();
for (QStringList::iterator pit = parts.begin();
pit != parts.end(); pit++)
pit != parts.end(); ++pit)
{
if (*pit == "." || *pit == "..")
continue;
Expand Down Expand Up @@ -843,7 +843,7 @@ void MediaMonitorUnix::CheckDeviceNotifications(void)
const QStringList list = qBuffer.split('\n', QString::SkipEmptyParts);

QStringList::const_iterator it = list.begin();
for (; it != list.end(); it++)
for (; it != list.end(); ++it)
{
if ((*it).startsWith("add"))
{
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythprotoserver/mythsocketmanager.cpp
Expand Up @@ -232,12 +232,12 @@ void MythSocketManager::ProcessRequestWork(MythSocket *sock)
QString("Attempting to handle annouce with: %1")
.arg((*i)->GetHandlerName()));
handled = (*i)->HandleAnnounce(sock, tokens, listline);
i++;
++i;
}

if (handled)
{
i--;
--i;
LOG(VB_SOCKET, LOG_DEBUG, LOC +
QString("Socket announce handled by: %1")
.arg((*i)->GetHandlerName()));
Expand Down Expand Up @@ -297,7 +297,7 @@ void MythSocketManager::ProcessRequestWork(MythSocket *sock)
while (!handled && (i != m_handlerMap.constEnd()))
{
handled = (*i)->HandleQuery(handler, tokens, listline);
i++;
++i;
}

if (handled)
Expand Down
12 changes: 6 additions & 6 deletions mythtv/libs/libmythtv/cc608reader.cpp
Expand Up @@ -269,7 +269,7 @@ int CC608Reader::Update(unsigned char *inpos)
if (m_state[streamIdx].m_outputRow > 15)
{
ccp = ccbuf->begin();
for (; ccp != ccbuf->end(); ccp++)
for (; ccp != ccbuf->end(); ++ccp)
{
tmpcc = *ccp;
tmpcc->y -= (m_state[streamIdx].m_outputRow - 15);
Expand Down Expand Up @@ -391,7 +391,7 @@ void CC608Reader::Update608Text(
{
// scroll up
cc->y -= (scroll + ymove);
i++;
++i;
}
else
{
Expand All @@ -401,7 +401,9 @@ void CC608Reader::Update608Text(
}
}
else
i++;
{
++i;
}
}
}

Expand All @@ -410,15 +412,13 @@ void CC608Reader::Update608Text(
if (ccbuf)
{
// add new text
i = ccbuf->begin();
while (i < ccbuf->end())
for (i = ccbuf->begin(); i != ccbuf->end(); ++i)
{
if (*i)
{
visible++;
m_state[streamIdx].m_output.buffers.push_back(*i);
}
i++;
}
}
m_state[streamIdx].m_changed = visible;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/cc608reader.h
Expand Up @@ -39,7 +39,7 @@ class CC608Buffer
{
lock.lock();
vector<CC608Text*>::iterator i = buffers.begin();
for (; i != buffers.end(); i++)
for (; i != buffers.end(); ++i)
{
CC608Text *cc = (*i);
if (cc)
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythtv/channelbase.cpp
Expand Up @@ -95,7 +95,7 @@ bool ChannelBase::Init(QString &inputname, QString &startchannel, bool setchan)
DBChanList channels = GetChannels(*it);

DBChanList::const_iterator cit = channels.begin();
for (; cit != channels.end(); cit++)
for (; cit != channels.end(); ++cit)
{
if ((*cit).channum == startchannel &&
IsTunable(*it, startchannel))
Expand All @@ -108,7 +108,7 @@ bool ChannelBase::Init(QString &inputname, QString &startchannel, bool setchan)
}
}

it++;
++it;
it = (it == inputs.end()) ? inputs.begin() : it;
if (it == start)
break;
Expand Down Expand Up @@ -155,7 +155,7 @@ bool ChannelBase::Init(QString &inputname, QString &startchannel, bool setchan)
}
}

it++;
++it;
it = (it == inputs.end()) ? inputs.begin() : it;
if (it == start)
break;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -1491,7 +1491,7 @@ void TV::ShowOSDAskAllow(PlayerContext *ctx)
QMap<QString,AskProgramInfo>::iterator next = it;
while (it != askAllowPrograms.end())
{
next = it; next++;
next = it; ++next;
if ((*it).expiry <= timeNow)
{
#if 0
Expand Down

0 comments on commit 55eb681

Please sign in to comment.