164 lines
5.6 KiB
Diff
164 lines
5.6 KiB
Diff
Fix various warnings regarding mixture of const vs. non-const
|
|
pointers, cast of pointers to integers of different size
|
|
and referencing const pointers in non-const struct members.
|
|
|
|
--- src/mga_merge.c 2017-01-18 13:40:25.071924814 +0100
|
|
+++ src/mga_merge.c 2017-01-18 13:44:25.432988563 +0100
|
|
@@ -18,12 +18,12 @@
|
|
#include "fbdevhw.h"
|
|
|
|
static int
|
|
-StrToRanges(range* r, char* s) {
|
|
+StrToRanges(range* r, const char* s) {
|
|
float num=0.0;
|
|
int rangenum=0;
|
|
Bool gotdash = FALSE;
|
|
Bool nextdash = FALSE;
|
|
- char* strnum=NULL;
|
|
+ const char* strnum=NULL;
|
|
do {
|
|
switch(*s) {
|
|
case '0': case '1': case '2': case '3': case '4': case '5':
|
|
@@ -130,9 +130,9 @@
|
|
|
|
/* takes a config file string of MetaModes and generates a MetaModeList */
|
|
static DisplayModePtr
|
|
-GenerateModeList(ScrnInfoPtr pScrn, char* str,
|
|
+GenerateModeList(ScrnInfoPtr pScrn, const char* str,
|
|
DisplayModePtr i, DisplayModePtr j, MgaScrn2Rel srel) {
|
|
- char* strmode = str;
|
|
+ const char* strmode = str;
|
|
char modename[256];
|
|
Bool gotdash = FALSE;
|
|
MgaScrn2Rel sr;
|
|
Use const char* instead of char* where appropriate.
|
|
|
|
--- src/mga_merge.c 2017-01-17 23:40:29.000000000 +0100
|
|
+++ src/mga_merge.c 2017-01-18 13:22:37.819740652 +0100
|
|
@@ -117,7 +117,7 @@
|
|
}
|
|
|
|
static DisplayModePtr
|
|
-GetModeFromName(char* str, DisplayModePtr i)
|
|
+GetModeFromName(const char* str, DisplayModePtr i)
|
|
{
|
|
DisplayModePtr c = i;
|
|
if(!i) return NULL;
|
|
@@ -165,7 +165,7 @@
|
|
} else {
|
|
mode1 = GetModeFromName(modename,i);
|
|
if(!mode1) {
|
|
- char* tmps = str;
|
|
+ const char* tmps = str;
|
|
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
|
|
"Mode: \"%s\" is not a supported mode for monitor 1\n",modename);
|
|
/* find if a monitor2 mode follows */
|
|
@@ -232,7 +232,7 @@
|
|
MGAPtr pMga1;
|
|
MessageType from;
|
|
int i;
|
|
- char* s;
|
|
+ const char* s;
|
|
ClockRangePtr clockRanges;
|
|
MgaScrn2Rel Monitor2Pos;
|
|
|
|
--- src/mga_dacG.c 2017-01-17 23:40:29.000000000 +0100
|
|
+++ src/mga_dacG.c 2017-01-18 13:39:10.951904459 +0100
|
|
@@ -1853,9 +1853,9 @@
|
|
mgaReg->PIXPLLCSaved = TRUE;
|
|
|
|
#ifdef XSERVER_LIBPCIACCESS
|
|
- pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option,
|
|
+ pci_device_cfg_read_u32(pMga->PciInfo, (uint32_t *)& mgaReg->Option,
|
|
PCI_OPTION_REG);
|
|
- pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option2,
|
|
+ pci_device_cfg_read_u32(pMga->PciInfo, (uint32_t *)& mgaReg->Option2,
|
|
PCI_MGA_OPTION2);
|
|
#else
|
|
mgaReg->Option = pciReadLong(pMga->PciTag, PCI_OPTION_REG);
|
|
@@ -1864,7 +1864,7 @@
|
|
#endif
|
|
if (pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550)
|
|
#ifdef XSERVER_LIBPCIACCESS
|
|
- pci_device_cfg_read_u32(pMga->PciInfo, & mgaReg->Option3,
|
|
+ pci_device_cfg_read_u32(pMga->PciInfo, (uint32_t *)& mgaReg->Option3,
|
|
PCI_MGA_OPTION3);
|
|
#else
|
|
mgaReg->Option3 = pciReadLong(pMga->PciTag, PCI_MGA_OPTION3);
|
|
@@ -2029,7 +2029,7 @@
|
|
#define DDC_P1_SDA_MASK (1 << 1)
|
|
#define DDC_P1_SCL_MASK (1 << 3)
|
|
|
|
-static const struct mgag_i2c_private {
|
|
+static struct mgag_i2c_private {
|
|
unsigned sda_mask;
|
|
unsigned scl_mask;
|
|
} i2c_priv[] = {
|
|
@@ -2121,10 +2121,14 @@
|
|
static I2CBusPtr
|
|
mgag_create_i2c_bus(const char *name, unsigned bus_index, unsigned scrn_index)
|
|
{
|
|
+ static char name_buff[4][256];
|
|
+ static int which = 0;
|
|
I2CBusPtr I2CPtr = xf86CreateI2CBusRec();
|
|
|
|
if (I2CPtr != NULL) {
|
|
- I2CPtr->BusName = name;
|
|
+ which = (which + 1) % 4;
|
|
+ snprintf(name_buff[which], sizeof(name_buff[which]), "%s", name);
|
|
+ I2CPtr->BusName = name_buff[which];
|
|
I2CPtr->scrnIndex = scrn_index;
|
|
I2CPtr->I2CPutBits = MGAG_I2CPutBits;
|
|
I2CPtr->I2CGetBits = MGAG_I2CGetBits;
|
|
--- src/mga_driver.c 2017-01-17 23:40:29.000000000 +0100
|
|
+++ src/mga_driver.c 2017-01-18 13:30:12.991807437 +0100
|
|
@@ -1138,7 +1138,7 @@
|
|
CARD32 Option, MaxMapSize;
|
|
|
|
#ifdef XSERVER_LIBPCIACCESS
|
|
- pci_device_cfg_read_u32(pMga->PciInfo, &Option,
|
|
+ pci_device_cfg_read_u32(pMga->PciInfo, (uint32_t *)&Option,
|
|
PCI_OPTION_REG);
|
|
MaxMapSize = pMga->PciInfo->regions[0].size;
|
|
#else
|
|
@@ -1933,7 +1933,7 @@
|
|
} else {
|
|
int from = X_DEFAULT;
|
|
#ifdef USE_EXA
|
|
- char *s = xf86GetOptValString(pMga->Options, OPTION_ACCELMETHOD);
|
|
+ const char *s = xf86GetOptValString(pMga->Options, OPTION_ACCELMETHOD);
|
|
#endif
|
|
pMga->NoAccel = FALSE;
|
|
pMga->Exa = FALSE;
|
|
@@ -2635,9 +2635,8 @@
|
|
}
|
|
else
|
|
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
|
- "MAPPED Framebuffer %08llX %llx to %08llX.\n",
|
|
- (long long)fbaddr, (long long)fbsize,
|
|
- (long long)pMga->FbBase);
|
|
+ "MAPPED Framebuffer %p %llx to %p.\n",
|
|
+ fbaddr, (long long)fbsize, pMga->FbBase);
|
|
|
|
if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedIOUsage == 0) {
|
|
region = &dev->regions[pMga->io_bar];
|
|
@@ -2644,7 +2644,7 @@
|
|
err = pci_device_map_range(dev,
|
|
region->base_addr, region->size,
|
|
PCI_DEV_MAP_FLAG_WRITABLE,
|
|
- &pMga->IOBase);
|
|
+ (void **)&pMga->IOBase);
|
|
|
|
if (err) {
|
|
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
|
@@ -2773,7 +2773,8 @@
|
|
pMga->entityPrivate->mappedIOBase = NULL;
|
|
}
|
|
|
|
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "UNMAPPING framebuffer 0x%08llX, 0x%llX.\n", (long long)pMga->FbBase, (long long)pMga->FbMapSize);
|
|
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "UNMAPPING framebuffer %p, 0x%llX.\n",
|
|
+ pMga->FbBase, (long long)pMga->FbMapSize);
|
|
pci_device_unmap_range(dev, pMga->FbBase,
|
|
pMga->FbMapSize);
|
|
#else
|