Skip to content

Commit

Permalink
cppcheck: Fix "local variable shadows outer function" warnings.
Browse files Browse the repository at this point in the history
Use more specific names for these functions instead of generic names
that conflict with variable names.
  • Loading branch information
linuxdude42 committed Oct 2, 2020
1 parent 96fe887 commit 3d9e87e
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions mythtv/libs/libmythtv/captions/xine_demux_sputext.cpp
Expand Up @@ -61,7 +61,7 @@
* Demuxer code start
*/

static bool eol(char p) {
static bool isEol(char p) {
return (p=='\r' || p=='\n' || p=='\0');
}

Expand Down Expand Up @@ -204,7 +204,7 @@ static char *sub_readtext(char *source, std::string& dest) {
int len=0;
char *p=source;

while ( !eol(*p) && *p!= '|' ) {
while ( !isEol(*p) && *p!= '|' ) {
p++,len++;
}

Expand Down Expand Up @@ -558,14 +558,14 @@ static subtitle_t *sub_read_line_mpsub (demux_sputext_t *demuxstr, subtitle_t *c
if (mark != std::string::npos)
line.erase(0, mark);

if (eol(line[0]) && !current->text.empty())
if (isEol(line[0]) && !current->text.empty())
return current;

if (eol(line[0]))
if (isEol(line[0]))
return nullptr;

char *q = nullptr;
for (q=line.data(); !eol(*q); q++);
for (q=line.data(); !isEol(*q); q++);
*q='\0';
line.resize(strlen(line.c_str()));
if (!line.empty()) {
Expand Down Expand Up @@ -746,7 +746,7 @@ static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *demuxstr, subtitle_t
line2 = line1;
p = line2.data();
}
for (q = line1.data(); (!eol(*p)); ++p) {
for (q = line1.data(); (!isEol(*p)); ++p) {
switch (*p) {
case '{':
comment++;
Expand Down Expand Up @@ -801,7 +801,7 @@ static subtitle_t *sub_read_line_jacobsub(demux_sputext_t *demuxstr, subtitle_t
if ((*(p + 1) == '\\') ||
(*(p + 1) == '~') || (*(p + 1) == '{')) {
++p;
} else if (eol(*(p + 1))) {
} else if (isEol(*(p + 1))) {
std::string tmpstr {};
if (!read_line_from_input(demuxstr, tmpstr))
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
Expand Up @@ -5191,7 +5191,7 @@ bool AvFormatDecoder::GenerateDummyVideoFrames(void)
if (!frame)
return false;

clear(frame);
clear_vf(frame);
frame->dummy = true;
m_parent->ReleaseNextVideoFrame(frame, m_lastVPts);
m_parent->DeLimboFrame(frame);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mythframe.h
Expand Up @@ -486,7 +486,7 @@ static inline int height_for_plane(VideoFrameType Type, int Height, uint Plane)
}
return 0;
}
static inline void clear(VideoFrame *vf)
static inline void clear_vf(VideoFrame *vf)
{
if (!vf || (vf && !vf->buf))
return;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mythvideooutnull.cpp
Expand Up @@ -84,7 +84,7 @@ void MythVideoOutputNull::CreatePauseFrame(void)

m_avPauseFrame.frameNumber = m_videoBuffers.GetScratchFrame()->frameNumber;
m_avPauseFrame.frameCounter = m_videoBuffers.GetScratchFrame()->frameCounter;
clear(&m_avPauseFrame);
clear_vf(&m_avPauseFrame);
}

bool MythVideoOutputNull::InputChanged(const QSize& VideoDim,
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -8364,7 +8364,7 @@ PictureAttribute TV::NextPictureAdjustType(PictureAdjustType Type, MythPlayer *P
kPictureAttributeSupported_Hue);
}

return ::next(static_cast<PictureAttributeSupported>(sup), Attr);
return ::next_picattr(static_cast<PictureAttributeSupported>(sup), Attr);
}

void TV::DoToggleNightMode()
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/videobuffers.cpp
Expand Up @@ -1099,7 +1099,7 @@ bool VideoBuffers::ReinitBuffer(VideoFrame *Frame, VideoFrameType Type, MythCode
init(Frame, Type, buf, Width, Height, static_cast<int>(size));
// retain deinterlacer settings and update restrictions based on new frame type
SetDeinterlacingFlags(*Frame, singler, doubler, CodecID);
clear(Frame);
clear_vf(Frame);
return true;
}

Expand Down Expand Up @@ -1156,7 +1156,7 @@ QString VideoBuffers::GetStatus(uint Num) const

void VideoBuffers::Clear(uint FrameNum)
{
clear(At(FrameNum));
clear_vf(At(FrameNum));
}

void VideoBuffers::Clear(void)
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/videoouttypes.h
Expand Up @@ -313,8 +313,8 @@ inline PictureAttributeSupported toMask(PictureAttribute PictureAttribute)
return kPictureAttributeSupported_None;
}

inline PictureAttribute next(PictureAttributeSupported Supported,
PictureAttribute Attribute)
inline PictureAttribute next_picattr(PictureAttributeSupported Supported,
PictureAttribute Attribute)
{
int i = static_cast<int>(Attribute + 1) % static_cast<int>(kPictureAttribute_MAX);
for (int j = 0; j < kPictureAttribute_MAX; (i = (i +1 ) % kPictureAttribute_MAX), j++)
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/visualisations/videovisualdefs.h
Expand Up @@ -30,7 +30,7 @@ class LogScale
delete [] m_indices;

auto domain = (long double) maxscale;
auto range = (long double) maxrange;
auto drange = (long double) maxrange;
long double x = 1.0;
long double dx = 1.0;
long double e4 = 1.0E-8;
Expand All @@ -43,7 +43,7 @@ class LogScale
for (uint i = 0; i < 10000 && (std::abs(dx) > e4); i++)
{
long double t = std::log((domain + x) / x);
long double y = (x * t) - range;
long double y = (x * t) - drange;
long double yy = t - (domain / (x + domain));
dx = y / yy;
x -= dx;
Expand Down

0 comments on commit 3d9e87e

Please sign in to comment.