mirror of
https://github.com/X11Libre/xf86-video-i740.git
synced 2026-03-24 01:24:56 +00:00
Variable scope reductions as suggested by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
@@ -132,14 +132,11 @@ I740UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
|
||||
static void
|
||||
I740LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
|
||||
{
|
||||
I740Ptr pI740;
|
||||
int x, y;
|
||||
CARD8 *pcurs;
|
||||
I740Ptr pI740 = I740PTR(pScrn);
|
||||
CARD8 *pcurs = (CARD8 *) (pI740->FbBase + pI740->CursorStart);
|
||||
|
||||
pI740 = I740PTR(pScrn);
|
||||
pcurs = (CARD8 *) (pI740->FbBase + pI740->CursorStart);
|
||||
for (y = 0; y < 64; y++) {
|
||||
for (x = 0; x < 64 / 4; x++) {
|
||||
for (int y = 0; y < 64; y++) {
|
||||
for (int x = 0; x < 64 / 4; x++) {
|
||||
*pcurs++ = *src++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ I740DGAInit(ScreenPtr pScreen)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
I740Ptr pI740 = I740PTR(pScrn);
|
||||
DGAModePtr modes = NULL, newmodes = NULL, currentMode;
|
||||
DGAModePtr modes = NULL, currentMode;
|
||||
DisplayModePtr pMode, firstMode;
|
||||
int Bpp = pScrn->bitsPerPixel >> 3;
|
||||
int num = 0;
|
||||
@@ -88,7 +88,7 @@ I740DGAInit(ScreenPtr pScreen)
|
||||
|
||||
while (pMode) {
|
||||
|
||||
newmodes = realloc(modes, (num + 1) * sizeof(DGAModeRec));
|
||||
DGAModePtr newmodes = realloc(modes, (num + 1) * sizeof(DGAModeRec));
|
||||
|
||||
if (!newmodes) {
|
||||
free(modes);
|
||||
|
||||
@@ -289,7 +289,7 @@ I740Identify(int flags)
|
||||
static Bool
|
||||
I740Probe(DriverPtr drv, int flags)
|
||||
{
|
||||
int i, numUsed, numDevSections, *usedChips;
|
||||
int numUsed, numDevSections, *usedChips;
|
||||
GDevPtr *devSections;
|
||||
Bool foundScreen = FALSE;
|
||||
|
||||
@@ -321,7 +321,7 @@ I740Probe(DriverPtr drv, int flags)
|
||||
if (flags & PROBE_DETECT)
|
||||
foundScreen = TRUE;
|
||||
else {
|
||||
for (i = 0; i < numUsed; i++) {
|
||||
for (int i = 0; i < numUsed; i++) {
|
||||
ScrnInfoPtr pScrn = NULL;
|
||||
|
||||
/* Allocate new ScrnInfoRec and claim the slot */
|
||||
@@ -357,7 +357,7 @@ I740Probe(DriverPtr drv, int flags)
|
||||
if (flags & PROBE_DETECT)
|
||||
foundScreen = TRUE;
|
||||
else {
|
||||
for (i = 0; i < numUsed; i++) {
|
||||
for (int i = 0; i < numUsed; i++) {
|
||||
ScrnInfoPtr pScrn = NULL;
|
||||
|
||||
if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
|
||||
@@ -1512,17 +1512,13 @@ static void
|
||||
I740LoadPalette15(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
|
||||
VisualPtr pVisual)
|
||||
{
|
||||
vgaHWPtr hwp;
|
||||
int i, index;
|
||||
unsigned char r, g, b;
|
||||
vgaHWPtr hwp = VGAHWPTR(pScrn);
|
||||
|
||||
hwp = VGAHWPTR(pScrn);
|
||||
|
||||
for (i = 0; i < numColors; i++) {
|
||||
index = indices[i / 2];
|
||||
r = colors[index].red;
|
||||
b = colors[index].blue;
|
||||
g = colors[index].green;
|
||||
for (int i = 0; i < numColors; i++) {
|
||||
int index = indices[i / 2];
|
||||
unsigned char r = colors[index].red;
|
||||
unsigned char b = colors[index].blue;
|
||||
unsigned char g = colors[index].green;
|
||||
|
||||
hwp->writeDacWriteAddr(hwp, index << 2);
|
||||
hwp->writeDacData(hwp, r);
|
||||
@@ -1541,12 +1537,12 @@ static void
|
||||
I740LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
|
||||
VisualPtr pVisual)
|
||||
{
|
||||
vgaHWPtr hwp;
|
||||
int i, index;
|
||||
unsigned char r, g, b;
|
||||
vgaHWPtr hwp = VGAHWPTR(pScrn);
|
||||
|
||||
for (int i = 0; i < numColors; i++) {
|
||||
int index;
|
||||
unsigned char r, g, b;
|
||||
|
||||
hwp = VGAHWPTR(pScrn);
|
||||
for (i = 0; i < numColors; i++) {
|
||||
index = indices[i / 2];
|
||||
r = colors[index].red;
|
||||
b = colors[index].blue;
|
||||
@@ -1570,12 +1566,12 @@ static void
|
||||
I740LoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
|
||||
VisualPtr pVisual)
|
||||
{
|
||||
vgaHWPtr hwp;
|
||||
int i, index;
|
||||
unsigned char r, g, b;
|
||||
vgaHWPtr hwp = VGAHWPTR(pScrn);
|
||||
|
||||
for (int i = 0; i < numColors; i++) {
|
||||
int index;
|
||||
unsigned char r, g, b;
|
||||
|
||||
hwp = VGAHWPTR(pScrn);
|
||||
for (i = 0; i < numColors; i++) {
|
||||
index = indices[i];
|
||||
r = colors[index].red;
|
||||
b = colors[index].blue;
|
||||
|
||||
@@ -522,7 +522,6 @@ I740CopyMungedData(ScrnInfoPtr pScrn,
|
||||
I740Ptr pI740 = I740PTR(pScrn);
|
||||
I740PortPrivPtr pPriv = pI740->adaptor->pPortPrivates[0].ptr;
|
||||
CARD32 *dst;
|
||||
int i, j;
|
||||
|
||||
if (pPriv->currentBuf == 0)
|
||||
dst = (CARD32 *) (pI740->FbBase + pPriv->YBuf0offset);
|
||||
@@ -539,7 +538,7 @@ I740CopyMungedData(ScrnInfoPtr pScrn,
|
||||
long halfx = scalex / 2;
|
||||
long dstj = 0;
|
||||
|
||||
for (j = 0; j < dsth; j++) {
|
||||
for (int j = 0; j < dsth; j++) {
|
||||
int dstj_rnd = dstj >> 16;
|
||||
unsigned char *src1_ = src1 + (dstj_rnd * srcPitch);
|
||||
unsigned char *src2_ = src2 + ((dstj_rnd / 2) * srcPitch2);
|
||||
@@ -547,7 +546,7 @@ I740CopyMungedData(ScrnInfoPtr pScrn,
|
||||
int dstw = ((long) w * 0x10000L + halfx - 1) / scalex;
|
||||
long srci = 0;
|
||||
|
||||
for (i = 0; i < dstw; i++) {
|
||||
for (int i = 0; i < dstw; i++) {
|
||||
long srci_rnd = srci >> 16;
|
||||
long srci2_rnd = (srci + halfx) >> 16;
|
||||
|
||||
@@ -567,8 +566,8 @@ I740CopyMungedData(ScrnInfoPtr pScrn,
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (j = 0; j < h; j++) {
|
||||
for (i = 0; i < w; i++) {
|
||||
for (int j = 0; j < h; j++) {
|
||||
for (int i = 0; i < w; i++) {
|
||||
dst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) |
|
||||
(src3[i] << 8) | (src2[i] << 24);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user