Skip to content

Commit

Permalink
Quite some very minor static analysis warnings in libmythui
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartm committed Dec 31, 2010
1 parent f86d872 commit 32183c5
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 23 deletions.
10 changes: 5 additions & 5 deletions mythtv/libs/libmythui/DisplayResScreen.cpp
Expand Up @@ -109,7 +109,7 @@ DisplayResVector DisplayResScreen::Convert(const QStringList& slist)
//compares if the double f1 is equal with f2 and returns 1 if true and 0 if false
bool DisplayResScreen::compare_rates(double f1, double f2, double precision)
{
if (((f1 - precision) < f2) &&
if (((f1 - precision) < f2) &&
((f1 + precision) > f2))
return true;
else
Expand All @@ -130,7 +130,7 @@ int DisplayResScreen::FindBestMatch(const DisplayResVector& dsr,
rate2x = true;
videorate *= 2.0;
}

// Amend vector with custom list
for (uint i=0; i<dsr.size(); ++i)
{
Expand Down Expand Up @@ -211,19 +211,19 @@ uint64_t DisplayResScreen::FindBestScreen(const DisplayResMap& resmap,
// 3. search for matching height and rate (or any rate if rate = 0)
// 4. search for 2x rate
// 5. search for 1x rate
for (it = resmap.begin(); it != resmap.end(); it++)
for (it = resmap.begin(); it != resmap.end(); ++it)
{
extract_key(it->first);
if (w == iwidth && h == iheight && compare_rates(frate, r, 0.01))
return it->first;
}
for (it = resmap.begin(); it != resmap.end(); it++)
for (it = resmap.begin(); it != resmap.end(); ++it)
{
extract_key(it->first);
if (w == iwidth && h == iheight && r == 0)
return it->first;
}
for (it = resmap.begin(); it != resmap.end(); it++)
for (it = resmap.begin(); it != resmap.end(); ++it)
{
extract_key(it->first);
if ((w == 0 && h == iheight &&
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythui/mythgesture.cpp
Expand Up @@ -235,9 +235,9 @@ QString MythGesture::translate(void)
/* if this is the first point, consider it the previous bin, too. */
prev_bin = (prev_bin == 0) ? current_bin : prev_bin;

if (prev_bin == current_bin)
if (prev_bin == current_bin)
bin_count++;
else
else
{

/* we are moving to a new bin -- consider adding to the
Expand All @@ -258,9 +258,9 @@ QString MythGesture::translate(void)
/* add the last run of points to the sequence */
sequence += '0' + current_bin;
sequence_count++;

/* bail out on error cases */
if (sequence_count > max_sequence)
if (sequence_count > max_sequence)
sequence = '0';

return sequence;
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythui/mythgesture.h
Expand Up @@ -42,6 +42,7 @@ class MythGestureEvent : public QEvent
* \brief The types of gestures supported by myth
*/
enum Gesture {
Unknown,

/* Horizontal and vertical lines */
Up,
Expand Down Expand Up @@ -87,7 +88,7 @@ class MythGestureEvent : public QEvent
* \sa Type
*/
MythGestureEvent(Gesture gesture, Button button = LeftButton) :
QEvent(kEventType)
QEvent(kEventType), m_gesture(Unknown)
{
m_position = QPoint(0,0);
m_button = button;
Expand Down
6 changes: 5 additions & 1 deletion mythtv/libs/libmythui/mythmainwindow.cpp
Expand Up @@ -164,7 +164,9 @@ class MythMainWindowPrivate

AllowInput(true),

gesture(MythGesture()),
gestureTimer(NULL),
hideMouseTimer(NULL),

paintwin(NULL),

Expand All @@ -174,7 +176,9 @@ class MythMainWindowPrivate
m_drawDisabledDepth(0),
m_drawEnabled(true),

m_themeBase(NULL)
m_themeBase(NULL),

m_udpListener(NULL)
{
}

Expand Down
5 changes: 3 additions & 2 deletions mythtv/libs/libmythui/mythpainter_d3d9.cpp
Expand Up @@ -87,10 +87,11 @@ void MythD3D9Painter::Begin(QPaintDevice *parent)

DeleteBitmaps();

bool dummy;

if (!m_target)
{
bool dummy;
m_render->Test(dummy); // TODO recreate if necessary
}
else if (!m_target->SetAsRenderTarget())
{
VERBOSE(VB_IMPORTANT, "Failed to enable offscreen buffer.");
Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythui/mythpainter_qimage.cpp
Expand Up @@ -138,7 +138,7 @@ void MythQImagePainter::Clear(QPaintDevice *device, const QRegion &region)
bwidth = (bwidth - rects[i].left()) << 2;

for (int row = rects[i].top(); row < bottom; row++)
bzero(dev->scanLine(row) + (rects[i].left() << 2), bwidth);
memset(dev->scanLine(row) + (rects[i].left() << 2), 0, bwidth);
}
}

Expand All @@ -150,7 +150,7 @@ void MythQImagePainter::DrawImage(const QRect &r, MythImage *im,
VERBOSE(VB_IMPORTANT, "FATAL ERROR: DrawImage called with no painter");
return;
}

(void)alpha;

CheckPaintMode(QRect(r.topLeft(), src.size()));
Expand Down Expand Up @@ -230,8 +230,8 @@ void MythQImagePainter::DrawRect(const QRect &area, bool drawFill,
painter->setBrush(QBrush(Qt::NoBrush));
}

void MythQImagePainter::DrawRoundRect(const QRect &area, int radius,
bool drawFill, const QColor &fillColor,
void MythQImagePainter::DrawRoundRect(const QRect &area, int radius,
bool drawFill, const QColor &fillColor,
bool drawLine, int lineWidth,
const QColor &lineColor)
{
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythui/mythrender_opengl.cpp
Expand Up @@ -66,7 +66,7 @@ static inline int __glCheck__(const QString &loc, const char* fileName, int n)
{
int error = glGetError();
if (error)
{
{
VERBOSE(VB_IMPORTANT, QString("%1: %2 @ %3, %4")
.arg(loc).arg((const char*)gluErrorString(error))
.arg(fileName).arg(n));
Expand Down Expand Up @@ -275,7 +275,7 @@ void MythRenderOpenGL::Flush(bool use_fence)
{
glFlush();
}

doneCurrent();
}

Expand Down Expand Up @@ -1790,7 +1790,7 @@ void MythRenderOpenGL::DeleteDefaultShaders(void)
}
}

uint MythRenderOpenGL::CreateShader(int type, const QString source)
uint MythRenderOpenGL::CreateShader(int type, const QString &source)
{
uint result = m_glCreateShaderObject(type);
QByteArray src = source.toAscii();
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythui/mythrender_opengl.h
Expand Up @@ -171,7 +171,7 @@ class MPUBLIC MythRenderOpenGL : public QGLContext, public MythRender

void CreateDefaultShaders(void);
void DeleteDefaultShaders(void);
uint CreateShader(int type, const QString source);
uint CreateShader(int type, const QString &source);
bool ValidateShaderObject(uint obj);
bool CheckObjectStatus(uint obj);
void OptimiseShaderSource(QString &source);
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythui/mythrender_vdpau.cpp
Expand Up @@ -1337,7 +1337,7 @@ void MythRenderVDPAU::ClearVideoSurface(uint id)
if (!tmp)
return;

bzero(tmp, width * height);
memset(tmp, 0, width * height);
memset(tmp + (width * height), 127, (width * height)>>1);
uint32_t pitches[3] = {width, width, width>>1};
void* const planes[3] = {tmp, tmp + (width * height), tmp + (width * height)};
Expand Down Expand Up @@ -1574,10 +1574,10 @@ bool MythRenderVDPAU::CheckHardwareSupport(void)
else
VERBOSE(VB_PLAYBACK, LOC + QString("HQ Scaling not supported."));

INIT_ST
VdpBool supported = false;

#ifdef VDP_DECODER_PROFILE_MPEG4_PART2_ASP
INIT_ST
uint32_t tmp1, tmp2, tmp3, tmp4;
vdp_st = vdp_decoder_query_capabilities(m_device,
VDP_DECODER_PROFILE_MPEG4_PART2_ASP, &supported,
Expand Down

0 comments on commit 32183c5

Please sign in to comment.