Commit c78be3a4 authored by Keith Packard's avatar Keith Packard

xfree86 warning reduction

This gets the easy warnings, mostly constant string problems.
Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
parent 1ce15ed5
......@@ -299,7 +299,7 @@ xf86DoEDID_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDC1SetSpeed,
/* DDC2 */
static I2CDevPtr
DDC2MakeDevice(I2CBusPtr pBus, int address, char *name)
DDC2MakeDevice(I2CBusPtr pBus, int address, const char *name)
{
I2CDevPtr dev = NULL;
......
......@@ -1563,8 +1563,6 @@ DRI2CloseScreen(ScreenPtr pScreen)
dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, NULL);
}
extern Bool DRI2ModuleSetup(void);
/* Called by InitExtensions() */
Bool
DRI2ModuleSetup(void)
......
......@@ -66,7 +66,7 @@ extern _X_EXPORT int xf86I2CGetScreenBuses(int scrnIndex,
/* I2C slave devices */
typedef struct _I2CDevRec {
char *DevName;
const char *DevName;
int BitTimeout; /* usec */
int ByteTimeout; /* usec */
......
......@@ -170,7 +170,7 @@ dump_code(xf86Int10InfoPtr pInt)
CARD32 lina = SEG_ADR((CARD32), X86_CS, IP);
xf86DrvMsgVerb(pInt->pScrn->scrnIndex, X_INFO, 3, "code at 0x%8.8" PRIx32 ":\n",
lina);
(unsigned) lina);
for (i = 0; i < 0x10; i++)
xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
xf86ErrorFVerb(3, "\n");
......@@ -229,7 +229,7 @@ port_rep_inb(xf86Int10InfoPtr pInt,
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" rep_insb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
port, count, base, d_f ? "up" : "down");
port, (unsigned) count, (unsigned) base, d_f ? "up" : "down");
while (count--) {
MEM_WB(pInt, dst, x_inb(port));
dst += inc;
......@@ -246,7 +246,7 @@ port_rep_inw(xf86Int10InfoPtr pInt,
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" rep_insw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
port, count, base, d_f ? "up" : "down");
port, (unsigned) count, (unsigned) base, d_f ? "up" : "down");
while (count--) {
MEM_WW(pInt, dst, x_inw(port));
dst += inc;
......@@ -263,7 +263,7 @@ port_rep_inl(xf86Int10InfoPtr pInt,
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" rep_insl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
port, count, base, d_f ? "up" : "down");
port, (unsigned) count, (unsigned) base, d_f ? "up" : "down");
while (count--) {
MEM_WL(pInt, dst, x_inl(port));
dst += inc;
......@@ -280,7 +280,7 @@ port_rep_outb(xf86Int10InfoPtr pInt,
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" rep_outb(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
port, count, base, d_f ? "up" : "down");
port, (unsigned) count, (unsigned) base, d_f ? "up" : "down");
while (count--) {
x_outb(port, MEM_RB(pInt, dst));
dst += inc;
......@@ -297,7 +297,7 @@ port_rep_outw(xf86Int10InfoPtr pInt,
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" rep_outw(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
port, count, base, d_f ? "up" : "down");
port, (unsigned) count, (unsigned) base, d_f ? "up" : "down");
while (count--) {
x_outw(port, MEM_RW(pInt, dst));
dst += inc;
......@@ -314,7 +314,7 @@ port_rep_outl(xf86Int10InfoPtr pInt,
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" rep_outl(%#x) %" PRIu32 " bytes at %8.8" PRIx32 " %s\n",
port, count, base, d_f ? "up" : "down");
port, (unsigned) count, (unsigned) base, d_f ? "up" : "down");
while (count--) {
x_outl(port, MEM_RL(pInt, dst));
dst += inc;
......@@ -429,7 +429,7 @@ x_inl(CARD16 port)
if (!pciCfg1in(port, &val)) {
val = pci_io_read32(Int10Current->io, port);
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" inl(%#x) = %8.8" PRIx32 "\n", port, val);
ErrorF(" inl(%#x) = %8.8" PRIx32 "\n", port, (unsigned) val);
}
return val;
}
......@@ -439,7 +439,7 @@ x_outl(CARD16 port, CARD32 val)
{
if (!pciCfg1out(port, val)) {
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" outl(%#x, %8.8" PRIx32 ")\n", port, val);
ErrorF(" outl(%#x, %8.8" PRIx32 ")\n", port, (unsigned) val);
pci_io_write32(Int10Current->io, port, val);
}
}
......@@ -526,8 +526,8 @@ pciCfg1in(CARD16 addr, CARD32 *val)
pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr),
(uint32_t *) val, PCI_OFFSET(PciCfg1Addr));
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_inl(%#" PRIx32 ") = %8.8" PRIx32 "\n", PciCfg1Addr,
*val);
ErrorF(" cfg_inl(%#" PRIx32 ") = %8.8" PRIx32 "\n", (unsigned) PciCfg1Addr,
(unsigned) *val);
return 1;
}
return 0;
......@@ -542,8 +542,8 @@ pciCfg1out(CARD16 addr, CARD32 val)
}
if (addr == 0xCFC) {
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_outl(%#" PRIx32 ", %8.8" PRIx32 ")\n", PciCfg1Addr,
val);
ErrorF(" cfg_outl(%#" PRIx32 ", %8.8" PRIx32 ")\n", (unsigned) PciCfg1Addr,
(unsigned) val);
pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr), val,
PCI_OFFSET(PciCfg1Addr));
return 1;
......@@ -567,8 +567,8 @@ pciCfg1inw(CARD16 addr, CARD16 *val)
pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr),
val, PCI_OFFSET(PciCfg1Addr) + offset);
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_inw(%#" PRIx32 ") = %4.4x\n", PciCfg1Addr + offset,
*val);
ErrorF(" cfg_inw(%#" PRIx32 ") = %4.4x\n", (unsigned) (PciCfg1Addr + offset),
(unsigned) *val);
return 1;
}
return 0;
......@@ -589,8 +589,8 @@ pciCfg1outw(CARD16 addr, CARD16 val)
const unsigned offset = addr - 0xCFC;
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_outw(%#" PRIx32 ", %4.4x)\n", PciCfg1Addr + offset,
val);
ErrorF(" cfg_outw(%#" PRIx32 ", %4.4x)\n", (unsigned) (PciCfg1Addr + offset),
(unsigned) val);
pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr), val,
PCI_OFFSET(PciCfg1Addr) + offset);
return 1;
......@@ -614,8 +614,8 @@ pciCfg1inb(CARD16 addr, CARD8 *val)
pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr),
val, PCI_OFFSET(PciCfg1Addr) + offset);
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_inb(%#" PRIx32 ") = %2.2x\n", PciCfg1Addr + offset,
*val);
ErrorF(" cfg_inb(%#" PRIx32 ") = %2.2x\n", (unsigned) (PciCfg1Addr + offset),
(unsigned) *val);
return 1;
}
return 0;
......@@ -636,8 +636,8 @@ pciCfg1outb(CARD16 addr, CARD8 val)
const unsigned offset = addr - 0xCFC;
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_outb(%#" PRIx32 ", %2.2x)\n", PciCfg1Addr + offset,
val);
ErrorF(" cfg_outb(%#" PRIx32 ", %2.2x)\n", (unsigned) (PciCfg1Addr + offset),
(unsigned) val);
pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr), val,
PCI_OFFSET(PciCfg1Addr) + offset);
return 1;
......
......@@ -379,7 +379,7 @@ xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
crtc->transformPresent = saved_transform_present;
}
free(adjusted_mode->name);
free((void *) adjusted_mode->name);
free(adjusted_mode);
if (didLock)
......@@ -564,8 +564,8 @@ static const char *direction[4] = {
static Rotation
xf86OutputInitialRotation(xf86OutputPtr output)
{
char *rotate_name = xf86GetOptValString(output->options,
OPTION_ROTATE);
const char *rotate_name = xf86GetOptValString(output->options,
OPTION_ROTATE);
int i;
if (!rotate_name) {
......@@ -926,7 +926,6 @@ xf86PickCrtcs(ScrnInfoPtr scrn,
xf86OutputPtr output;
xf86CrtcPtr crtc;
xf86CrtcPtr *crtcs;
xf86CrtcPtr best_crtc;
int best_score;
int score;
int my_score;
......@@ -939,7 +938,6 @@ xf86PickCrtcs(ScrnInfoPtr scrn,
* Compute score with this output disabled
*/
best_crtcs[n] = NULL;
best_crtc = NULL;
best_score = xf86PickCrtcs(scrn, best_crtcs, modes, n + 1, width, height);
if (modes[n] == NULL)
return best_score;
......@@ -993,7 +991,6 @@ xf86PickCrtcs(ScrnInfoPtr scrn,
score =
my_score + xf86PickCrtcs(scrn, crtcs, modes, n + 1, width, height);
if (score > best_score) {
best_crtc = crtc;
best_score = score;
memcpy(best_crtcs, crtcs, config->num_output * sizeof(xf86CrtcPtr));
}
......@@ -1087,8 +1084,8 @@ xf86UserConfiguredOutputs(ScrnInfoPtr scrn, DisplayModePtr * modes)
for (o = 0; o < config->num_output; o++) {
xf86OutputPtr output = config->output[o];
char *position;
char *relative_name;
const char *position;
const char *relative_name;
OutputOpts relation;
int r;
......@@ -1145,8 +1142,8 @@ xf86InitialOutputPositions(ScrnInfoPtr scrn, DisplayModePtr * modes)
};
xf86OutputPtr output = config->output[o];
xf86OutputPtr relative;
char *relative_name;
char *position;
const char *relative_name;
const char *position;
OutputOpts relation;
int r;
......@@ -1306,7 +1303,7 @@ xf86InitialPanning(ScrnInfoPtr scrn)
for (o = 0; o < config->num_output; o++) {
xf86OutputPtr output = config->output[o];
char *panning = xf86GetOptValString(output->options, OPTION_PANNING);
const char *panning = xf86GetOptValString(output->options, OPTION_PANNING);
int width, height, left, top;
int track_width, track_height, track_left, track_top;
int brdr[4];
......@@ -1389,7 +1386,7 @@ xf86SortModes(DisplayModePtr input)
for (o = output; o && (n = o->next); o = n) {
if (!strcmp(o->name, n->name) && xf86ModesEqual(o, n)) {
o->next = n->next;
free(n->name);
free((void *) n->name);
free(n);
n = o;
}
......@@ -1403,10 +1400,10 @@ xf86SortModes(DisplayModePtr input)
return output;
}
static char *
static const char *
preferredMode(ScrnInfoPtr pScrn, xf86OutputPtr output)
{
char *preferred_mode = NULL;
const char *preferred_mode = NULL;
/* Check for a configured preference for a particular mode */
preferred_mode = xf86GetOptValString(output->options,
......@@ -1610,7 +1607,7 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
xf86OutputPtr output = config->output[o];
DisplayModePtr mode;
DisplayModePtr config_modes = NULL, output_modes, default_modes = NULL;
char *preferred_mode;
const char *preferred_mode;
xf86MonPtr edid_monitor;
XF86ConfMonitorPtr conf_monitor;
MonRec mon_rec;
......@@ -1833,10 +1830,6 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
* Copy one of the output mode lists to the ScrnInfo record
*/
/* XXX where does this function belong? Here? */
void
xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
static DisplayModePtr
biggestMode(DisplayModePtr a, DisplayModePtr b)
{
......
......@@ -129,11 +129,13 @@ void
xf86SetModeDefaultName(DisplayModePtr mode)
{
Bool interlaced = ! !(mode->Flags & V_INTERLACE);
char *tmp;
free(mode->name);
free((void *) mode->name);
XNFasprintf(&mode->name, "%dx%d%s", mode->HDisplay, mode->VDisplay,
XNFasprintf(&tmp, "%dx%d%s", mode->HDisplay, mode->VDisplay,
interlaced ? "i" : "");
mode->name = tmp;
}
/*
......
......@@ -454,7 +454,6 @@ xf86RandR12GetInfo(ScreenPtr pScreen, Rotation * rotations)
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode;
int refresh0 = 60;
int maxX = 0, maxY = 0;
*rotations = randrp->supported_rotations;
......@@ -479,8 +478,6 @@ xf86RandR12GetInfo(ScreenPtr pScreen, Rotation * rotations)
if (maxY < mode->VDisplay)
maxY = mode->VDisplay;
}
if (mode == scrp->modes)
refresh0 = refresh;
pSize = RRRegisterSize(pScreen,
mode->HDisplay, mode->VDisplay,
randrp->mmWidth, randrp->mmHeight);
......@@ -684,7 +681,6 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
WindowPtr pRoot = pScreen->root;
PixmapPtr pScrnPix;
Bool ret = FALSE;
Bool panning = FALSE;
int c;
if (xf86RandR12Key) {
......@@ -716,7 +712,6 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
crtc->panningTrackingArea.y2 += height - pScreen->height;
xf86RandR13VerifyPanningArea(crtc, width, height);
xf86RandR13Pan(crtc, randrp->pointerX, randrp->pointerY);
panning = TRUE;
}
}
......@@ -946,8 +941,6 @@ xf86RandR12SetRotations(ScreenPtr pScreen, Rotation rotations)
void
xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms)
{
XF86RandRInfoPtr randrp;
#if RANDR_13_INTERFACE
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
int c;
......@@ -957,7 +950,6 @@ xf86RandR12SetTransformSupport(ScreenPtr pScreen, Bool transforms)
if (xf86RandR12Key == NULL)
return;
randrp = XF86RANDRINFO(pScreen);
#if RANDR_13_INTERFACE
for (c = 0; c < config->num_crtc; c++) {
xf86CrtcPtr crtc = config->crtc[c];
......@@ -1455,7 +1447,6 @@ xf86RandR12SetInfo12(ScreenPtr pScreen)
RRCrtcPtr *crtcs;
int ncrtc;
int o, c, l;
RRCrtcPtr randr_crtc;
int nclone;
clones = malloc(config->num_output * sizeof(RROutputPtr));
......@@ -1468,11 +1459,6 @@ xf86RandR12SetInfo12(ScreenPtr pScreen)
if (output->possible_crtcs & (1 << c))
crtcs[ncrtc++] = config->crtc[c]->randr_crtc;
if (output->crtc)
randr_crtc = output->crtc->randr_crtc;
else
randr_crtc = NULL;
if (!RROutputSetCrtcs(output->randr_output, crtcs, ncrtc)) {
free(crtcs);
free(clones);
......
......@@ -233,9 +233,8 @@ xf86RotateBlockHandler(ScreenPtr pScreen,
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
Bool rotation_active;
rotation_active = xf86RotateRedisplay(pScreen);
xf86RotateRedisplay(pScreen);
pScreen->BlockHandler = xf86_config->BlockHandler;
(*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);
/* cannot avoid re-wrapping until all wrapping is audited */
......@@ -247,7 +246,6 @@ void
xf86RotateDestroy(xf86CrtcPtr crtc)
{
ScrnInfoPtr pScrn = crtc->scrn;
ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int c;
......@@ -267,9 +265,6 @@ xf86RotateDestroy(xf86CrtcPtr crtc)
* Clean up damage structures when no crtcs are rotated
*/
if (xf86_config->rotation_damage) {
DrawablePtr screenDrawable = NULL;
if (pScreen && pScreen->root)
screenDrawable = &pScreen->root->drawable;
/* Free damage structure */
if (xf86_config->rotation_damage_registered) {
xf86_config->rotation_damage_registered = FALSE;
......
......@@ -89,6 +89,7 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
int HDisplayRnd, HMargin;
int VDisplayRnd, VMargin, VSync;
float Interlace; /* Please rename this */
char *tmp;
/* CVT default is 60.0Hz */
if (!VRefresh)
......@@ -177,6 +178,7 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
/* 10. Find number of lines in back porch */
VBackPorch = VSyncAndBackPorch - VSync;
(void) VBackPorch;
/* 11. Find total number of lines in vertical field */
Mode->VTotal = VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace
......@@ -282,7 +284,8 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
if (Interlaced)
Mode->VTotal *= 2;
XNFasprintf(&Mode->name, "%dx%d", HDisplay, VDisplay);
XNFasprintf(&tmp, "%dx%d", HDisplay, VDisplay);
Mode->name = tmp;
if (Reduced)
Mode->Flags |= V_PHSYNC | V_NVSYNC;
......
......@@ -215,6 +215,7 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
*/
v_back_porch = vsync_plus_bp - V_SYNC_RQD;
(void) v_back_porch;
/* 10. Find the total number of lines in Vertical field period:
*
......@@ -253,6 +254,7 @@ xf86GTFMode(int h_pixels, int v_lines, float freq, int interlaced, int margins)
*/
v_frame_rate = interlaced ? v_field_rate / 2.0 : v_field_rate;
(void) v_frame_rate;
/* 15. Find number of pixels in left margin:
*
......
......@@ -74,13 +74,12 @@ lnxACPIGetEventFromOs(int fd, pmEvent * events, int num)
/* Check that we have a video event */
if (!strncmp(ev, "video", 5)) {
char *video = NULL;
char *GFX = NULL;
char *notify = NULL;
char *data = NULL; /* doesn't appear to be used in the kernel */
unsigned long int notify_l, data_l;
unsigned long int notify_l;
video = strtok(ev, " ");
strtok(ev, " ");
if (!(GFX = strtok(NULL, " ")))
return 0;
......@@ -97,8 +96,8 @@ lnxACPIGetEventFromOs(int fd, pmEvent * events, int num)
if (!(data = strtok(NULL, " ")))
return 0;
data_l = strtoul(data, NULL, 16);
#if 0
data_l = strtoul(data, NULL, 16);
ErrorF("data: 0x%lx\n", data_l);
#endif
......
......@@ -83,8 +83,8 @@ xf86OpenConsole(void)
struct vt_mode VT;
struct vt_stat vts;
MessageType from = X_PROBED;
char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
const char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
const char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
if (serverGeneration == 1) {
......
......@@ -37,7 +37,7 @@ int
xf86LoadKernelModule(const char *modName)
{
char mpPath[MAX_PATH] = "";
int fd = -1, status, n;
int fd = -1, status;
pid_t pid;
/* get the path to the modprobe program */
......@@ -76,7 +76,7 @@ xf86LoadKernelModule(const char *modName)
"Setting of real/effective user Id to 0/0 failed");
}
setenv("PATH", "/sbin", 1);
n = execl(mpPath, "modprobe", modName, NULL);
execl(mpPath, "modprobe", modName, NULL);
xf86Msg(X_WARNING, "LoadKernelModule %s\n", strerror(errno));
exit(EXIT_FAILURE); /* if we get here the child's exec failed */
break;
......
......@@ -261,6 +261,7 @@ cat > sdksyms.c << EOF
#include "dix.h"
#include "dixaccess.h"
#include "dixevents.h"
#define _FONTPROTO_H
#include "dixfont.h"
#include "dixfontstr.h"
#include "dixfontstubs.h"
......
......@@ -10189,8 +10189,8 @@ Handles opcode 0xe8
static void
x86emuOp_call_near_IMM(u8 X86EMU_UNUSED(op1))
{
s16 ip16;
s32 ip32;
s16 ip16 = 0;
s32 ip32 = 0;
START_OF_INSTR();
DECODE_PRINTF("CALL\t");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment