From 4edff7ddd4a13f54a071687ba9c539d92d88c331 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 12 Jan 2024 17:34:06 -0800 Subject: Fix 20 out of 23 -Wshadow warnings Signed-off-by: Alan Coopersmith --- src/initextx.c | 25 +++++----- src/sis310_accel.c | 3 -- src/sis_cursor.h | 144 ++++++++++++++++++++++++++--------------------------- src/sis_driver.c | 2 +- src/sis_utility.c | 3 +- 5 files changed, 86 insertions(+), 91 deletions(-) diff --git a/src/initextx.c b/src/initextx.c index 7286b16..833f569 100644 --- a/src/initextx.c +++ b/src/initextx.c @@ -746,11 +746,11 @@ SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS) BOOLEAN checkexpand = FALSE; BOOLEAN havesync = FALSE; BOOLEAN indb = FALSE; - int retry, i; + int retry; int panel1280x960 = (pSiS->VGAEngine == SIS_315_VGA) ? Panel310_1280x960 : Panel300_1280x960; unsigned char buffer[256]; - for(i=0; i<7; i++) SiS_Pr->CP_DataValid[i] = FALSE; + for (int i=0; i<7; i++) SiS_Pr->CP_DataValid[i] = FALSE; SiS_Pr->CP_HaveCustomData = FALSE; SiS_Pr->CP_MaxX = SiS_Pr->CP_MaxY = SiS_Pr->CP_MaxClock = 0; SiS_Pr->CP_PreferredX = SiS_Pr->CP_PreferredY = 0; @@ -806,7 +806,7 @@ SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS) } while(1); #ifdef TWDEBUG - for(i=0; i<256; i+=16) { + for (int i=0; i<256; i+=16) { xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED, "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", buffer[i], buffer[i+1], buffer[i+2], buffer[i+3], @@ -951,7 +951,7 @@ SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS) */ if(paneltype == Panel_Custom) { - int i, temp, base = 0x36; + int temp, base = 0x36; unsigned long estpack; static const unsigned short estx[] = { 720, 720, 640, 640, 640, 640, 800, 800, @@ -976,7 +976,7 @@ SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS) /* 1. From Established timings */ estpack = (buffer[0x23] << 9) | (buffer[0x24] << 1) | ((buffer[0x25] >> 7) & 0x01); - for(i=16; i>=0; i--) { + for (int i=16; i>=0; i--) { if(estpack & (1 << i)) { if(estx[16 - i] > SiS_Pr->CP_MaxX) SiS_Pr->CP_MaxX = estx[16 - i]; if(esty[16 - i] > SiS_Pr->CP_MaxY) SiS_Pr->CP_MaxY = esty[16 - i]; @@ -990,7 +990,7 @@ SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS) if(!(buffer[0x23] & 0x04)) SiS_Pr->CP_Supports64048075 = FALSE; /* 2. From Standard Timings */ - for(i=0x26; i < 0x36; i+=2) { + for (int i=0x26; i < 0x36; i+=2) { if((buffer[i] != 0x01) && (buffer[i+1] != 0x01)) { temp = (buffer[i] + 31) * 8; if(temp > SiS_Pr->CP_MaxX) SiS_Pr->CP_MaxX = temp; @@ -1005,7 +1005,7 @@ SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS) /* Now extract the Detailed Timings and convert them into modes */ - for(i = 0; i < 4; i++, base += 18) { + for (int i = 0; i < 4; i++, base += 18) { /* Is this a detailed timing block or a monitor descriptor? */ if(buffer[base] || buffer[base+1] || buffer[base+2]) { @@ -1206,7 +1206,7 @@ SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS) } #if 0 /* "pixel rate" = pixel clock? */ if(buffer[0x7e] & 0x1c) { - for(i=0; i<((buffer[0x7e] & 0x1c) >> 2); i++) { + for (int i=0; i<((buffer[0x7e] & 0x1c) >> 2); i++) { if(buffer[index + (i*8) + 6] && (buffer[index + (i*8) + 7] & 0x0f)) { int clk = (buffer[index + (i*8) + 6] | ((buffer[index + (i*8) + 7] & 0x0f) << 4)) * 1000; if(clk > SiS_Pr->CP_MaxClock) SiS_Pr->CP_MaxClock = clk; @@ -1216,7 +1216,7 @@ SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS) #endif index += (((buffer[0x7e] & 0x1c) >> 2) * 8); /* skip Frequency Ranges */ if(buffer[0x7e] & 0x03) { - for(i=0; i<(buffer[0x7e] & 0x03); i++) { + for (int i=0; i<(buffer[0x7e] & 0x03); i++) { if((buffer[index + (i*27) + 9]) || (buffer[index + (i*27) + 10])) { int clk = ((buffer[index + (i*27) + 9]) | ((buffer[index + (i*27) + 9]) << 8)) * 10; if(clk > SiS_Pr->CP_MaxClock) SiS_Pr->CP_MaxClock = clk; @@ -1228,7 +1228,7 @@ SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS) if(numcodes) { myindex = index; seekcode = (xres - 256) / 16; - for(i=0; iCP_MaxX = maxx; @@ -1266,7 +1265,7 @@ SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS) index += (numcodes * 4); numcodes = buffer[0x7f] & 0x07; - for(i=0; iCP_DataValid[i]) { xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED, "Non-standard LCD/DVI-D timing data no. %d:\n", i); diff --git a/src/sis310_accel.c b/src/sis310_accel.c index 0c6f959..a264e55 100644 --- a/src/sis310_accel.c +++ b/src/sis310_accel.c @@ -1927,15 +1927,12 @@ SiSUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst) void SISWriteBlitPacket(SISPtr pSiS, CARD32 *packet) { - CARD32 dummybuf; - SiSWritePacketPart(packet[0], packet[1], packet[2], packet[3]); SiSWritePacketPart(packet[4], packet[5], packet[6], packet[7]); SiSWritePacketPart(packet[8], packet[9], packet[10], packet[11]); SiSWritePacketPart(packet[12], packet[13], packet[14], packet[15]); SiSWritePacketPart(packet[16], packet[17], packet[18], packet[19]); SiSSyncWP; - (void)dummybuf; /* Suppress compiler warning */ } #endif diff --git a/src/sis_cursor.h b/src/sis_cursor.h index 17a1970..d7e6a90 100644 --- a/src/sis_cursor.h +++ b/src/sis_cursor.h @@ -47,61 +47,61 @@ #define sis300SetCursorStatus(status) \ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0xbfffffff; \ - temp |= status; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ + templ &= 0xbfffffff; \ + templ |= status; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), templ); \ } #define sis300EnableHWCursor() \ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0x0fffffff; \ - temp |= 0x40000000; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ + templ &= 0x0fffffff; \ + templ |= 0x40000000; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), templ); \ } #define sis300EnableHWARGBCursor() \ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp |= 0xF0000000; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ + templ |= 0xF0000000; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), templ); \ } #define sis300EnableHWARGB16Cursor() \ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0x0fffffff; \ - temp |= 0xD0000000; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ + templ &= 0x0fffffff; \ + templ |= 0xD0000000; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), templ); \ } #define sis300SwitchToMONOCursor() \ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0x4fffffff; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ + templ &= 0x4fffffff; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), templ); \ } #define sis300SwitchToRGBCursor() \ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp |= 0xB0000000; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ + templ |= 0xB0000000; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), templ); \ } #define sis300DisableHWCursor()\ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0xbFFFFFFF; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ + templ &= 0xbFFFFFFF; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), templ); \ } #define sis300SetCursorBGColor(color)\ @@ -116,11 +116,11 @@ #define sis300SetCursorAddress(address)\ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0xF0FF0000; \ - temp |= address; \ - SIS_MMIO_OUT32(pSiS->IOBase,CS(0),temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ + templ &= 0xF0FF0000; \ + templ |= address; \ + SIS_MMIO_OUT32(pSiS->IOBase,CS(0),templ); \ } /* 300 series, CRT2 */ @@ -136,61 +136,61 @@ #define sis301SetCursorStatus(status) \ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xbfffffff; \ - temp |= status; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ + templ &= 0xbfffffff; \ + templ |= status; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), templ); \ } #define sis301EnableHWCursor()\ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0x0fffffff; \ - temp |= 0x40000000; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ + templ &= 0x0fffffff; \ + templ |= 0x40000000; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), templ); \ } #define sis301EnableHWARGBCursor()\ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp |= 0xF0000000; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ + templ |= 0xF0000000; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), templ); \ } #define sis301EnableHWARGB16Cursor()\ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0x0FFFFFFF; \ - temp |= 0xD0000000; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ + templ &= 0x0FFFFFFF; \ + templ |= 0xD0000000; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), templ); \ } #define sis301SwitchToRGBCursor() \ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp |= 0xB0000000; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ + templ |= 0xB0000000; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), templ); \ } #define sis301SwitchToMONOCursor() \ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0x4fffffff; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ + templ &= 0x4fffffff; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), templ); \ } #define sis301DisableHWCursor()\ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xbFFFFFFF; \ - SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ + templ &= 0xbFFFFFFF; \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), templ); \ } #define sis301SetCursorBGColor(color)\ @@ -205,11 +205,11 @@ #define sis301SetCursorAddress(address)\ { \ - ULong temp; \ - temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xF0FF0000; \ - temp |= address; \ - SIS_MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ + ULong templ; \ + templ = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ + templ &= 0xF0FF0000; \ + templ |= address; \ + SIS_MMIO_OUT32(pSiS->IOBase,CS(8),templ); \ } /* 315/330 series CRT1 */ diff --git a/src/sis_driver.c b/src/sis_driver.c index 570c004..851bb86 100644 --- a/src/sis_driver.c +++ b/src/sis_driver.c @@ -5901,7 +5901,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Read the current EMI (if not overruled) */ if(pSiS->VBFlags2 & VB2_SISEMIBRIDGE) { - MessageType from = X_PROBED; + from = X_PROBED; if(pSiS->EMI != -1) { pSiS->SiS_Pr->EMI_30 = (pSiS->EMI >> 24) & 0x60; pSiS->SiS_Pr->EMI_31 = (pSiS->EMI >> 16) & 0xff; diff --git a/src/sis_utility.c b/src/sis_utility.c index 22f3d7e..6c5b3cd 100644 --- a/src/sis_utility.c +++ b/src/sis_utility.c @@ -872,7 +872,6 @@ SiSHandleSiSDirectCommand(xSiSCtrlCommandReply *sdcbuf) SISEntPtr pSiSEnt = pSiS->entityPrivate; #endif SISPortPrivPtr pPriv = NULL; - int i; ULong j; if(sdcbuf->sdc_id != SDC_ID) return BadMatch; @@ -882,7 +881,7 @@ SiSHandleSiSDirectCommand(xSiSCtrlCommandReply *sdcbuf) } j = sdcbuf->sdc_command; - for(i = 0; i < SDC_NUM_PARM_RESULT; i++) { + for(int i = 0; i < SDC_NUM_PARM_RESULT; i++) { j += sdcbuf->sdc_parm[i]; } -- cgit v1.2.3