[Openchrome-devel] [patch] openchrome: fix some build warnings
Jan Engelhardt
jengelh
Thu Feb 5 08:45:29 PST 2009
openchrome: fix some build warnings
Fix the following warnings that indicate real problems,
especially on architectures with sizeof(int) != sizeof(void *):
CC via_accel.lo
via_accel.c: At top level:
via_accel.c:1938: warning: ?viaExaUploadToScreen? defined but not used
CC via_ch7xxx.lo
via_ch7xxx.c: In function ?CH7019LCDPower?:
via_ch7xxx.c:545: warning: implicit declaration of function ?usleep?
CC via_dga.lo
via_dga.c: In function ?VIADGASetMode?:
via_dga.c:251: warning: implicit declaration of function ?viaShowCursor?
via_dga.c:264: warning: implicit declaration of function ?viaHideCursor?
CC via_driver.lo
via_driver.c: In function ?VIAScreenInit?:
via_driver.c:2756: warning: implicit declaration of function ?viaHWCursorInit?
via_driver.c: In function ?VIACloseScreen?:
via_driver.c:3000: warning: implicit declaration of function ?viaHideCursor?
CC via_lvds.lo
via_lvds.c: In function ?ViaLVDSPowerFirstSequence?:
via_lvds.c:55: warning: implicit declaration of function ?usleep?
CC via_mode.lo
via_mode.c: In function ?ViaLCDPowerSequence?:
via_mode.c:1438: warning: implicit declaration of function ?usleep?
via_mode.c: In function ?ViaModeSet?:
via_mode.c:1580: warning: implicit declaration of function ?ViaDisplaySetStreamOnCRT?
CC via_panel.lo
via_panel.c: In function ?ViaPanelGetSizeFromEDID?:
via_panel.c:334: warning: ?vsize? may be used uninitialized in this function
CC via_swov.lo
via_swov.c: In function ?Upd_Video?:
via_swov.c:2049: warning: implicit declaration of function ?usleep?
CC via_video.lo
via_video.c: In function ?viaPaintColorkey?:
via_video.c:752: warning: implicit declaration of function ?DamageDamageRegion?
CC via_dri.lo
via_dri.c: In function ?VIADRIFBInit?:
via_dri.c:384: warning: implicit declaration of function ?viaOffScreenLinear?
via_dri.c: In function ?VIADRIKernelInit?:
via_dri.c:885: warning: cast from pointer to integer of different size
CC via_xvmc.lo
CCLD openchrome_drv.la
Signed-off-by: Jan Engelhardt <jengelh at medozas.de>
---
src/via_accel.c | 3 ++-
src/via_ch7xxx.c | 1 +
src/via_cursor.c | 3 +--
src/via_cursor.h | 10 ++++++++++
src/via_dga.c | 1 +
src/via_display.c | 1 +
src/via_display.h | 8 ++++++++
src/via_dri.c | 5 +++--
src/via_driver.c | 3 ++-
src/via_lvds.c | 1 +
src/via_memory.c | 1 +
src/via_memory.h | 8 ++++++++
src/via_mode.c | 6 ++++--
src/via_panel.c | 2 +-
src/via_priv.h | 2 ++
src/via_swov.c | 1 +
src/via_video.c | 1 +
17 files changed, 48 insertions(+), 9 deletions(-)
Index: openchrome/src/via_accel.c
===================================================================
--- openchrome.orig/src/via_accel.c
+++ openchrome/src/via_accel.c
@@ -2015,7 +2015,8 @@ viaExaUploadToScratch(PixmapPtr pSrc, Pi
dstPitch = 8;
if (dstPitch * h > pVia->exaScratchSize * 1024) {
ErrorF("EXA UploadToScratch Failed %u %u %u %u\n",
- dstPitch, h, dstPitch * h, pVia->exaScratchSize * 1024);
+ (unsigned int)dstPitch, h, (unsigned int)(dstPitch * h),
+ pVia->exaScratchSize * 1024);
return FALSE;
}
Index: openchrome/src/via_ch7xxx.c
===================================================================
--- openchrome.orig/src/via_ch7xxx.c
+++ openchrome/src/via_ch7xxx.c
@@ -33,6 +33,7 @@
#include "via_vgahw.h"
#include "via_ch7xxx.h"
#include "via_id.h"
+#include <unistd.h>
#ifdef HAVE_DEBUG
/*
Index: openchrome/src/via_cursor.c
===================================================================
--- openchrome.orig/src/via_cursor.c
+++ openchrome/src/via_cursor.c
@@ -38,9 +38,8 @@
#include "via_driver.h"
#include "via_id.h"
#include "cursorstr.h"
+#include "via_cursor.h"
-void viaShowCursor(ScrnInfoPtr pScrn);
-void viaHideCursor(ScrnInfoPtr pScrn);
static void viaSetCursorPosition(ScrnInfoPtr pScrn, int x, int y);
static Bool viaUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs);
static Bool viaUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs);
Index: openchrome/src/via_cursor.h
===================================================================
--- /dev/null
+++ openchrome/src/via_cursor.h
@@ -0,0 +1,10 @@
+#ifndef VIA_CURSOR_H
+#define VIA_CURSOR_H 1
+
+#include "via_priv.h"
+
+extern void viaShowCursor(ScrnInfoPtr);
+extern void viaHideCursor(ScrnInfoPtr);
+extern Bool viaHWCursorInit(ScreenPtr);
+
+#endif /* VIA_CURSOR_H */
Index: openchrome/src/via_dga.c
===================================================================
--- openchrome.orig/src/via_dga.c
+++ openchrome/src/via_dga.c
@@ -29,6 +29,7 @@
#include "xaalocal.h"
#include "via_driver.h"
#include "dgaproc.h"
+#include "via_cursor.h"
static Bool VIADGAOpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
Index: openchrome/src/via_display.c
===================================================================
--- openchrome.orig/src/via_display.c
+++ openchrome/src/via_display.c
@@ -6,6 +6,7 @@
#include "via_driver.h"
#include "via_vgahw.h"
#include "via_id.h"
+#include "via_display.h"
/*
* Enables the second display channel.
Index: openchrome/src/via_display.h
===================================================================
--- /dev/null
+++ openchrome/src/via_display.h
@@ -0,0 +1,8 @@
+#ifndef VIA_DISPLAY_H
+#define VIA_DISPLAY_H 1
+
+#include "via_priv.h"
+
+extern void ViaDisplaySetStreamOnCRT(ScrnInfoPtr, Bool);
+
+#endif /* VIA_DISPLAY_H */
Index: openchrome/src/via_dri.c
===================================================================
--- openchrome.orig/src/via_dri.c
+++ openchrome/src/via_dri.c
@@ -44,6 +44,7 @@
#include "via_dri.h"
#include "via_id.h"
#include "xf86drm.h"
+#include "via_memory.h"
#ifndef DRIINFO_MAJOR_VERSION
#define DRIINFO_MAJOR_VERSION 4
@@ -882,9 +883,9 @@ VIADRIKernelInit(ScreenPtr pScreen, VIAP
drmInfo.fb_offset = pVia->frameBufferHandle;
drmInfo.mmio_offset = pVia->registerHandle;
if (pVia->IsPCI)
- drmInfo.agpAddr = (CARD32) NULL;
+ drmInfo.agpAddr = 0;
else
- drmInfo.agpAddr = (CARD32) pVia->agpAddr;
+ drmInfo.agpAddr = pVia->agpAddr;
if ((drmCommandWrite(pVia->drmFD, DRM_VIA_MAP_INIT, &drmInfo,
sizeof(drm_via_init_t))) < 0)
Index: openchrome/src/via_driver.c
===================================================================
--- openchrome.orig/src/via_driver.c
+++ openchrome/src/via_driver.c
@@ -47,6 +47,7 @@
#endif
#include "via_vgahw.h"
#include "via_id.h"
+#include "via_cursor.h"
/* Prototypes. */
static void VIAIdentify(int flags);
@@ -933,7 +934,7 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
char *mod = NULL;
const char *reqSym = NULL;
#endif
- vgaHWPtr hwp;
+ vgaHWPtr hwp = NULL;
int i, bMemSize = 0;
#ifdef XSERVER_LIBPCIACCESS
Index: openchrome/src/via_lvds.c
===================================================================
--- openchrome.orig/src/via_lvds.c
+++ openchrome/src/via_lvds.c
@@ -35,6 +35,7 @@
#include "via_driver.h"
#include "via_vgahw.h"
#include "via_id.h"
+#include <unistd.h>
static void
Index: openchrome/src/via_memory.c
===================================================================
--- openchrome.orig/src/via_memory.c
+++ openchrome/src/via_memory.c
@@ -41,6 +41,7 @@
#ifdef XF86DRI
#include "via_drm.h"
#endif
+#include "via_memory.h"
/*
* Isolate the wonders of X memory allocation and DRI memory allocation
Index: openchrome/src/via_memory.h
===================================================================
--- /dev/null
+++ openchrome/src/via_memory.h
@@ -0,0 +1,8 @@
+#ifndef VIA_MEMORY_H
+#define VIA_MEMORY_H 1
+
+#include "via_priv.h"
+
+extern int viaOffScreenLinear(VIAMemPtr, ScrnInfoPtr, unsigned long);
+
+#endif /* VIA_MEMORY_H */
Index: openchrome/src/via_mode.c
===================================================================
--- openchrome.orig/src/via_mode.c
+++ openchrome/src/via_mode.c
@@ -45,6 +45,8 @@
*
*/
#include "via_mode.h"
+#include "via_display.h"
+#include <unistd.h>
static void
ViaPrintMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
@@ -642,7 +644,7 @@ ViaPanelGetIndex(ScrnInfoPtr pScrn, Disp
return FALSE;
}
- for (i = 0; i < VIA_BIOS_NUM_PANEL; i++)
+ for (i = 0; i < VIA_BIOS_NUM_PANEL && i < ARRAY_SIZE(lcdTable); i++)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaPanelGetIndex:"
"Match Debug: %d == %d)\n", pBIOSInfo->Panel->NativeModeIndex,
lcdTable[i].fpSize));
@@ -1289,7 +1291,7 @@ ViaModeDotClockTranslate(ScrnInfoPtr pSc
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"ViaComputeDotClock %d : %04x : %04x\n",
- mode->Clock, best1, best2));
+ mode->Clock, (unsigned int)best1, (unsigned int)best2));
return best2;
} else {
for (i = 0; ViaDotClocks[i].DotClock; i++)
Index: openchrome/src/via_panel.c
===================================================================
--- openchrome.orig/src/via_panel.c
+++ openchrome/src/via_panel.c
@@ -331,7 +331,7 @@ Bool
ViaPanelGetSizeFromEDID(ScrnInfoPtr pScrn, xf86MonPtr pMon,
int *width, int *height)
{
- int i, max = 0, vsize;
+ int i, max = 0, vsize = -1;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAGetPanelSizeFromEDID\n"));
Index: openchrome/src/via_priv.h
===================================================================
--- openchrome.orig/src/via_priv.h
+++ openchrome/src/via_priv.h
@@ -192,4 +192,6 @@ typedef struct {
} swovRec, *swovPtr;
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
+
#endif /* _VIA_PRIV_H_ */
Index: openchrome/src/via_swov.c
===================================================================
--- openchrome.orig/src/via_swov.c
+++ openchrome/src/via_swov.c
@@ -46,6 +46,7 @@
#include "via_id.h"
#include <math.h>
+#include <unistd.h>
/*
* Warning: this file contains revision checks which are CLE266-specific.
Index: openchrome/src/via_video.c
===================================================================
--- openchrome.orig/src/via_video.c
+++ openchrome/src/via_video.c
@@ -53,6 +53,7 @@
#include "via_memcpy.h"
#include "via_id.h"
#include "fourcc.h"
+#include <xorg/damage.h>
/*
* D E F I N E
More information about the Openchrome-devel
mailing list