Skip to content

Commit

Permalink
cppcheck: Fix unused variable warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxdude42 committed Apr 4, 2019
1 parent 5e3b912 commit ee3906f
Show file tree
Hide file tree
Showing 40 changed files with 57 additions and 84 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/audiooutputca.cpp
Expand Up @@ -937,7 +937,7 @@ int *CoreAudioData::RatesList(AudioDeviceID d)
}

// iterate through the ranges and add the minimum, maximum, and common rates in between
UInt32 theFirstIndex = 0, theLastIndex = 0;
UInt32 theFirstIndex, theLastIndex = 0;
for(UInt32 i = 0; i < listSize / sizeof(AudioValueRange); i++)
{
theFirstIndex = theLastIndex;
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythbase/dbutil.cpp
Expand Up @@ -520,7 +520,6 @@ bool DBUtil::CreateTemporaryDBConf(
bool ok = true;
filename = createTempFile("/tmp/mythtv_db_backup_conf_XXXXXX");
const QByteArray tmpfile = filename.toLocal8Bit();
const DatabaseParams dbParams = gCoreContext->GetDatabaseParams();

FILE *fp = fopen(tmpfile.constData(), "w");
if (!fp)
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythbase/portchecker.cpp
Expand Up @@ -100,6 +100,7 @@ bool PortChecker::checkPort(QString &host, int port, int timeLimit, bool linkLoc
else
return false;
}
// cppcheck-suppress unreadVariable
QList<QNetworkInterface> cards = QNetworkInterface::allInterfaces();
#ifndef _WIN32
QListIterator<QNetworkInterface> iCard = cards;
Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmythtv/Bluray/mythbdplayer.cpp
Expand Up @@ -414,7 +414,6 @@ uint64_t MythBDPlayer::GetBookmark(void)
if (gCoreContext->IsDatabaseIgnored() || !player_ctx->m_buffer->IsBD())
return 0;

QStringList bdbookmark = QStringList();
QString name;
QString serialid;
uint64_t frames = 0;
Expand All @@ -429,7 +428,7 @@ uint64_t MythBDPlayer::GetBookmark(void)
return 0;
}

bdbookmark = player_ctx->m_playingInfo->QueryBDBookmark(serialid);
QStringList bdbookmark = player_ctx->m_playingInfo->QueryBDBookmark(serialid);

if (!bdbookmark.empty())
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/DVD/dvdringbuffer.cpp
Expand Up @@ -680,7 +680,7 @@ int DVDRingBuffer::safe_read(void *data, uint sz)
int needed = sz;
char *dest = (char*) data;
int offset = 0;
bool bReprocessing = false;
bool bReprocessing;
bool waiting = false;

if (m_gotStop)
Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmythtv/DVD/mythdvdplayer.cpp
Expand Up @@ -379,7 +379,6 @@ uint64_t MythDVDPlayer::GetBookmark(void)
if (gCoreContext->IsDatabaseIgnored() || !player_ctx->m_buffer->IsDVD())
return 0;

QStringList dvdbookmark = QStringList();
QString name;
QString serialid;
uint64_t frames = 0;
Expand All @@ -392,7 +391,7 @@ uint64_t MythDVDPlayer::GetBookmark(void)
return 0;
}

dvdbookmark = player_ctx->m_playingInfo->QueryDVDBookmark(serialid);
QStringList dvdbookmark = player_ctx->m_playingInfo->QueryDVDBookmark(serialid);

if (!dvdbookmark.empty())
{
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythtv/avformatdecoder.cpp
Expand Up @@ -2552,6 +2552,7 @@ int AvFormatDecoder::ScanStreams(bool novideo)
if (codec_is_vdpau(vdpau_mcid))
{
m_video_codec_id = vdpau_mcid;
// cppcheck-suppress unreadVariable
foundgpudecoder = true;
}
#endif // USING_VDPAU
Expand Down Expand Up @@ -2587,6 +2588,7 @@ int AvFormatDecoder::ScanStreams(bool novideo)
{
m_video_codec_id = dxva2_mcid;
enc->pix_fmt = pix_fmt;
// cppcheck-suppress unreadVariable
foundgpudecoder = true;
}
}
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/channelscan/channelimporter.cpp
Expand Up @@ -1318,6 +1318,7 @@ QString ChannelImporter::ComputeSuggestedChannelNum(
if (!ChannelUtil::IsConflicting(chan_num, chan.m_source_id))
break;
}
// cppcheck-suppress unreadVariable
last_free_chan_num_map[chan.m_source_id] = last_free_chan_num;

return chan_num;
Expand Down
7 changes: 3 additions & 4 deletions mythtv/libs/libmythtv/channelutil.cpp
Expand Up @@ -2143,8 +2143,6 @@ inline bool lt_smart(const ChannelInfo &a, const ChannelInfo &b)
static QMutex sepExprLock;
static const QRegExp sepExpr(ChannelUtil::kATSCSeparators);

int cmp = 0;

bool isIntA, isIntB;
int a_int = a.m_channum.toUInt(&isIntA);
int b_int = b.m_channum.toUInt(&isIntB);
Expand Down Expand Up @@ -2197,6 +2195,7 @@ inline bool lt_smart(const ChannelInfo &a, const ChannelInfo &b)
{
int a_maj = (!a_minor && isIntA) ? a_int : a_major;
int b_maj = (!b_minor && isIntB) ? b_int : b_major;
int cmp;
if ((cmp = a_maj - b_maj))
return cmp < 0;

Expand All @@ -2207,7 +2206,7 @@ inline bool lt_smart(const ChannelInfo &a, const ChannelInfo &b)
if (isIntA && isIntB)
{
// both channels have a numeric channum
cmp = a_int - b_int;
int cmp = a_int - b_int;
if (cmp)
return cmp < 0;
}
Expand All @@ -2219,7 +2218,7 @@ inline bool lt_smart(const ChannelInfo &a, const ChannelInfo &b)
else
{
// neither of channels have a numeric channum
cmp = naturalCompare(a.m_channum, b.m_channum);
int cmp = naturalCompare(a.m_channum, b.m_channum);
if (cmp)
return cmp < 0;
}
Expand Down
5 changes: 1 addition & 4 deletions mythtv/libs/libmythtv/eitfixup.cpp
Expand Up @@ -430,8 +430,6 @@ QString EITFixUp::AddDVBEITAuthority(uint chanid, const QString &id)
*/
void EITFixUp::FixBellExpressVu(DBEventEIT &event) const
{
QString tmp;

// A 0x0D character is present between the content
// and the subtitle if its present
int position = event.m_description.indexOf(0x0D);
Expand Down Expand Up @@ -508,7 +506,6 @@ void EITFixUp::FixBellExpressVu(DBEventEIT &event) const
position = event.m_description.indexOf(m_bellYear);
if (position != -1 && !event.m_category.isEmpty())
{
tmp = "";
// Parse out the year
bool ok;
uint y = event.m_description.mid(position + 1, 4).toUInt(&ok);
Expand All @@ -522,7 +519,7 @@ void EITFixUp::FixBellExpressVu(DBEventEIT &event) const
// Get the actors if they exist
if (position > 3)
{
tmp = event.m_description.left(position-3);
QString tmp = event.m_description.left(position-3);
QStringList actors =
tmp.split(m_bellActors, QString::SkipEmptyParts);
QStringList::const_iterator it = actors.begin();
Expand Down
6 changes: 2 additions & 4 deletions mythtv/libs/libmythtv/fileringbuffer.cpp
Expand Up @@ -343,16 +343,14 @@ bool FileRingBuffer::OpenFile(const QString &lfilename, uint retry_ms)
dirName = m_filename.left(dirPos);
}

QString baseName = tmpSubName;
QString extension = tmpSubName;
QStringList auxFiles;

int suffixPos = tmpSubName.lastIndexOf(QChar('.'));
if (suffixPos > 0)
{
baseName = tmpSubName.left(suffixPos);
QString baseName = tmpSubName.left(suffixPos);
int extnleng = tmpSubName.size() - baseName.size() - 1;
extension = tmpSubName.right(extnleng);
QString extension = tmpSubName.right(extnleng);

if (is_subtitle_possible(extension))
{
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/jobqueue.cpp
Expand Up @@ -1687,7 +1687,6 @@ bool JobQueue::InJobRunWindow(QDateTime jobstarttsRaw)
void JobQueue::ProcessJob(const JobQueueEntry& job)
{
int jobID = job.id;
QString name = QString("jobqueue%1%2").arg(jobID).arg(random());

if (!MSqlQuery::testDBConnection())
{
Expand Down
3 changes: 3 additions & 0 deletions mythtv/libs/libmythtv/mpeg/H264Parser.cpp
Expand Up @@ -1124,8 +1124,11 @@ void H264Parser::decode_SEI(GetBitContext *gb)
{
case SEI_TYPE_RECOVERY_POINT:
recovery_frame_cnt = get_ue_golomb(gb);
// cppcheck-suppress unreadVariable
exact_match_flag = (get_bits1(gb) != 0u);
// cppcheck-suppress unreadVariable
broken_link_flag = (get_bits1(gb) != 0u);
// cppcheck-suppress unreadVariable
changing_group_slice_idc = get_bits(gb, 2);
au_contains_keyframe_message = (recovery_frame_cnt == 0);
if ((size - 12) > 0)
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/mpeg/sctetables.cpp
Expand Up @@ -269,7 +269,6 @@ QString NetworkTextTable::toString(void) const
QString NetworkTextTable::toStringXML(uint indent_level) const
{
QString indent_0 = xml_indent(indent_level);
QString indent_1 = xml_indent(indent_level + 1);

QString str = indent_0 + "<NetworkTextSection ";
str += QString("iso_639_language_code=\"%1\" ").arg(LanguageString());
Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmythtv/mythcommflagplayer.cpp
Expand Up @@ -65,7 +65,6 @@ QMap<DecoderBase*,uint> RebuildSaver::s_cnt;
bool MythCommFlagPlayer::RebuildSeekTable(
bool showPercentage, StatusCallback cb, void* cbData)
{
int percentage = 0;
uint64_t myFramesPlayed = 0, pmap_first = 0, pmap_last = 0;

killdecoder = false;
Expand Down Expand Up @@ -151,7 +150,7 @@ bool MythCommFlagPlayer::RebuildSeekTable(
int flagFPS = (elapsed > 0.0F) ?
(int)(myFramesPlayed / elapsed) : 0;

percentage = myFramesPlayed * 100 / totalFrames;
int percentage = myFramesPlayed * 100 / totalFrames;
if (cb)
(*cb)(percentage, cbData);

Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmythtv/openglvideo.cpp
Expand Up @@ -485,7 +485,6 @@ bool OpenGLVideo::AddFilter(OpenGLFilterType filter)
OpenGLFilter *temp = new OpenGLFilter();

temp->numInputs = 1;
GLuint program = 0;

if (filter == kGLFilterBicubic)
{
Expand All @@ -501,7 +500,7 @@ bool OpenGLVideo::AddFilter(OpenGLFilterType filter)
(((filter != kGLFilterNone) && (filter != kGLFilterResize)) ||
((gl_features & kGLSL) && (filter == kGLFilterResize))))
{
program = AddFragmentProgram(filter);
GLuint program = AddFragmentProgram(filter);
if (!program)
success = false;
else
Expand Down
4 changes: 3 additions & 1 deletion mythtv/libs/libmythtv/playercontext.cpp
Expand Up @@ -418,6 +418,7 @@ bool PlayerContext::CreatePlayer(TV *tv, QWidget *widget,
{
if (IsAudioNeeded())
{
// cppcheck-suppress unreadVariable
QString errMsg = audio->ReinitAudio();
}
}
Expand Down Expand Up @@ -820,13 +821,14 @@ void PlayerContext::SetTVChain(LiveTVChain *chain)

if (m_tvchain)
{
#if 0
QString seed = QString("");

if (IsPIP())
seed = "PIP";

seed += gCoreContext->GetHostName();

#endif
m_tvchain->InitializeNewChain(gCoreContext->GetHostName());
}
}
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/previewgenerator.cpp
Expand Up @@ -206,7 +206,6 @@ bool PreviewGenerator::RunReal(void)
bool PreviewGenerator::Run(void)
{
QString msg;
QDateTime dtm = MythDate::current();
QTime tm = QTime::currentTime();
bool ok = false;
QString command = GetAppBinDir() + "mythpreviewgen";
Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmythtv/previewgeneratorqueue.cpp
Expand Up @@ -245,11 +245,10 @@ bool PreviewGeneratorQueue::event(QEvent *e)
outputfile = (*it++);
if (it != list.end())
time = (*it++).toLongLong();
QString fn;
if (it != list.end())
{
bool time_fmt_sec = (*it++).toInt() != 0;
fn = GeneratePreviewImage(evinfo, outputsize, outputfile,
GeneratePreviewImage(evinfo, outputsize, outputfile,
time, time_fmt_sec, token);
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/programdata.cpp
Expand Up @@ -485,7 +485,6 @@ int DBEvent::GetMatch(const vector<DBEvent> &programs, int &bestmatch) const
{
bestmatch = -1;
int match_val = INT_MIN;
int overlap = 0;
int duration = m_starttime.secsTo(m_endtime);

for (size_t i = 0; i < programs.size(); i++)
Expand All @@ -502,6 +501,7 @@ int DBEvent::GetMatch(const vector<DBEvent> &programs, int &bestmatch) const

/* determine overlap of both programs
* we don't know which one starts first */
int overlap;
if (m_starttime < programs[i].m_starttime)
overlap = programs[i].m_starttime.secsTo(m_endtime);
else if (m_starttime > programs[i].m_starttime)
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/recorders/ExternalStreamHandler.cpp
Expand Up @@ -491,7 +491,6 @@ void ExternalStreamHandler::Return(ExternalStreamHandler * & ref,
{
QMutexLocker locker(&s_handlers_lock);

QString devname = ref->m_device;
int majorid = ref->m_majorid;

QMap<int, uint>::iterator rit = s_handlers_refcnt.find(majorid);
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/recorders/channelbase.cpp
Expand Up @@ -797,7 +797,6 @@ ChannelBase *ChannelBase::CreateChannel(
return nullptr;
}

QString input = CardUtil::GetInputName(tvrec->GetInputId());
QString channum = startchannel;
channel->Init(channum, setchan);

Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -2158,8 +2158,6 @@ void TV::HandleStateChange(PlayerContext *mctx, PlayerContext *ctx)
bool ok = false;
if (TRANSITION(kState_None, kState_WatchingLiveTV))
{
QString name = "";

ctx->m_lastSignalUIInfo.clear();

ctx->m_recorder->Setup();
Expand Down Expand Up @@ -10401,7 +10399,9 @@ bool TV::HandleOSDChannelEdit(PlayerContext *ctx, const QString& action)
*/
void TV::ChannelEditAutoFill(const PlayerContext *ctx, InfoMap &infoMap) const
{
#if 0
const QString keys[4] = { "XMLTV", "callsign", "channame", "channum", };
#endif

// fill in uninitialized and unchanged fields from XDS
ChannelEditXDSFill(ctx, infoMap);
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/tv_rec.cpp
Expand Up @@ -3696,7 +3696,6 @@ void TVRec::TuningFrequency(const TuningRequest &request)
return;
}

QString input = request.input;
QString channum = request.channel;

bool ok1;
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/tvbrowsehelper.cpp
Expand Up @@ -178,7 +178,6 @@ void TVBrowseHelper::BrowseChannel(PlayerContext *ctx, const QString &channum)
if (!ctx->m_recorder || !ctx->m_lastCardid)
return;

QString inputname = ctx->m_recorder->GetInput();
uint inputid = ctx->m_lastCardid;
uint sourceid = CardUtil::GetSourceID(inputid);
if (sourceid)
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/videoout_d3d.cpp
Expand Up @@ -600,7 +600,6 @@ void VideoOutputD3D::ShowPIP(VideoFrame */*frame*/,
}

QRect position = GetPIPRect(loc, pipplayer);
QRect dvr = window.GetDisplayVisibleRect();

m_pip_ready[pipplayer] = false;
D3D9Image *m_pip = m_pips[pipplayer];
Expand Down
3 changes: 0 additions & 3 deletions mythtv/libs/libmythtv/videosource.cpp
Expand Up @@ -2489,9 +2489,7 @@ void CaptureCard::deleteEntry(void)
void CaptureCard::Save(void)
{
uint init_cardid = getCardID();
QString init_type = CardUtil::GetRawInputType(init_cardid);
QString init_dev = CardUtil::GetVideoDevice(init_cardid);
QString init_input = CardUtil::GetInputName(init_cardid);

////////

Expand Down Expand Up @@ -3322,7 +3320,6 @@ void CardInput::loadByInput(int _cardid, const QString& _inputname)
void CardInput::Save(void)
{
uint cardid = m_id->getValue().toUInt();
QString init_input = CardUtil::GetInputName(cardid);
GroupSetting::Save();
m_externalInputSettings->Store(getInputID());

Expand Down
13 changes: 4 additions & 9 deletions mythtv/libs/libmythtv/yuv2rgb.cpp
Expand Up @@ -792,11 +792,6 @@ static void mmx_i420_2vuy(
int y_stride, int u_stride, int v_stride,
int h_size, int v_size)
{
const uint8_t *py1 = py;
const uint8_t *py2 = py;
const uint8_t *pu1 = pu;
const uint8_t *pv1 = pv;

int x,y;

if ((h_size % 16) || (v_size % 2))
Expand All @@ -813,10 +808,10 @@ static void mmx_i420_2vuy(
{
uint8_t *pi1 = image + 2*y * vuy_stride;
uint8_t *pi2 = image + 2*y * vuy_stride + vuy_stride;
py1 = py + 2*y * y_stride;
py2 = py + 2*y * y_stride + y_stride;
pu1 = pu + y * u_stride;
pv1 = pv + y * v_stride;
const uint8_t *py1 = py + 2*y * y_stride;
const uint8_t *py2 = py + 2*y * y_stride + y_stride;
const uint8_t *pu1 = pu + y * u_stride;
const uint8_t *pv1 = pv + y * v_stride;

for (x = 0; x < h_size / 16; x++)
{
Expand Down

0 comments on commit ee3906f

Please sign in to comment.