Skip to content

Commit

Permalink
Fix several gcc warnings having to do with signedness and narrowing.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-kristjansson committed Nov 30, 2012
1 parent 90cbc2c commit 217e4a2
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions mythtv/libs/libmythtv/videooutbase.cpp
Expand Up @@ -1131,22 +1131,25 @@ void VideoOutput::ShowPIP(VideoFrame *frame,
}
}

int xoff = position.left();
int yoff = position.top();
uint xoff2[3] = { xoff, xoff>>1, xoff>>1 };
uint yoff2[3] = { yoff, yoff>>1, yoff>>1 };
if ((position.left() >= 0) && (position.top() >= 0))
{
int xoff = position.left();
int yoff = position.top();
int xoff2[3] = { xoff, xoff>>1, xoff>>1 };
int yoff2[3] = { yoff, yoff>>1, yoff>>1 };

uint pip_height = pip_tmp_image.height;
uint height[3] = { pip_height, pip_height>>1, pip_height>>1 };
int pip_height = pip_tmp_image.height;
int height[3] = { pip_height, pip_height>>1, pip_height>>1 };

for (int p = 0; p < 3; p++)
{
for (uint h = 2; h < height[p]; h++)
for (int p = 0; p < 3; p++)
{
memcpy((frame->buf + frame->offsets[p]) + (h + yoff2[p]) *
frame->pitches[p] + xoff2[p],
(pip_tmp_image.buf + pip_tmp_image.offsets[p]) + h *
pip_tmp_image.pitches[p], pip_tmp_image.pitches[p]);
for (int h = 2; h < height[p]; h++)
{
memcpy((frame->buf + frame->offsets[p]) + (h + yoff2[p]) *
frame->pitches[p] + xoff2[p],
(pip_tmp_image.buf + pip_tmp_image.offsets[p]) + h *
pip_tmp_image.pitches[p], pip_tmp_image.pitches[p]);
}
}
}

Expand Down Expand Up @@ -1503,14 +1506,14 @@ void VideoOutput::CopyFrame(VideoFrame *to, const VideoFrame *from)
memcpy(to->buf + to->offsets[2], from->buf + from->offsets[2],
from->pitches[2] * (from->height>>1));
}
else
else if ((from->height >= 0) && (to->height >= 0))
{
uint f[3] = { from->height, from->height>>1, from->height>>1, };
uint t[3] = { to->height, to->height>>1, to->height>>1, };
uint h[3] = { min(f[0],t[0]), min(f[1],t[1]), min(f[2],t[2]), };
int f[3] = { from->height, from->height>>1, from->height>>1, };
int t[3] = { to->height, to->height>>1, to->height>>1, };
int h[3] = { min(f[0],t[0]), min(f[1],t[1]), min(f[2],t[2]), };
for (uint i = 0; i < 3; i++)
{
for (uint j = 0; j < h[i]; j++)
for (int j = 0; j < h[i]; j++)
{
memcpy(to->buf + to->offsets[i] + (j * to->pitches[i]),
from->buf + from->offsets[i] + (j * from->pitches[i]),
Expand Down

0 comments on commit 217e4a2

Please sign in to comment.