diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2010-09-07 12:17:46 +0200 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2010-09-07 12:19:21 +0200 |
commit | dfb062e024dfd20789ee8d43c7f94640faa5ea9f (patch) | |
tree | 11a3062c54ffd4927e63104962f7c3b89e7180f4 | |
parent | 12e4577c020c6905d09459d833fd1c5313f1647b (diff) |
vmware/vmwlegacy: Silence compilation errors and -warnings.
Silence warnings and errors on various server versions due to incorrect
usage of libc functions.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/vmware.c | 37 | ||||
-rw-r--r-- | src/vmwarectrl.c | 10 | ||||
-rw-r--r-- | src/vmwaremodule.c | 7 | ||||
-rw-r--r-- | src/vmwarevideo.c | 15 | ||||
-rw-r--r-- | src/vmwarexinerama.c | 7 |
6 files changed, 54 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac index 7249ca1..0ea3472 100644 --- a/configure.ac +++ b/configure.ac @@ -89,6 +89,10 @@ PKG_CHECK_EXISTS([xorg-server >= 1.2.0], [AC_DEFINE([HAVE_XORG_SERVER_1_2_0], 1, [Has version 1.2.0 or greater of the Xserver])]) +PKG_CHECK_EXISTS([xorg-server >= 1.5.0], + [AC_DEFINE([HAVE_XORG_SERVER_1_5_0], 1, + [Has version 1.5.0 or greater of the Xserver])]) + PKG_CHECK_EXISTS([xorg-server >= 1.7.0], [AC_DEFINE([HAVE_XORG_SERVER_1_7_0], 1, [Has version 1.7.0 or greater of the Xserver])]) diff --git a/src/vmware.c b/src/vmware.c index 599ac07..a4e4d08 100644 --- a/src/vmware.c +++ b/src/vmware.c @@ -41,6 +41,11 @@ char rcsId_vmware[] = #include "vm_device_version.h" #include "svga_modes.h" +#ifndef HAVE_XORG_SERVER_1_5_0 +#include <xf86_ansic.h> +#include <xf86_libc.h> +#endif + #ifdef HaveDriverFuncs #define VMWARE_DRIVER_FUNC HaveDriverFuncs #else @@ -247,7 +252,7 @@ static void VMWAREFreeRec(ScrnInfoPtr pScrn) { if (pScrn->driverPrivate) { - xfree(pScrn->driverPrivate); + free(pScrn->driverPrivate); pScrn->driverPrivate = NULL; } } @@ -560,7 +565,7 @@ VMWAREParseTopologyString(ScrnInfoPtr pScrn, numOutputs, width, height, x, y); numOutputs++; - extents = xrealloc(extents, numOutputs * sizeof (xXineramaScreenInfo)); + extents = realloc(extents, numOutputs * sizeof (xXineramaScreenInfo)); extents[numOutputs - 1].x_org = x; extents[numOutputs - 1].y_org = y; extents[numOutputs - 1].width = width; @@ -573,7 +578,7 @@ VMWAREParseTopologyString(ScrnInfoPtr pScrn, error: xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Parsing static Xinerama topology: Failed.\n"); - xfree(extents); + free(extents); extents = NULL; numOutputs = 0; @@ -877,7 +882,7 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags) #endif xf86CollectOptions(pScrn, NULL); - if (!(options = xalloc(sizeof(VMWAREOptions)))) + if (!(options = malloc(sizeof(VMWAREOptions)))) return FALSE; memcpy(options, VMWAREOptions, sizeof(VMWAREOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); @@ -909,7 +914,7 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags) pScrn->videoRam = pVMWARE->videoRam / 1024; pScrn->memPhysBase = pVMWARE->memPhysBase; - xfree(options); + free(options); { Gamma zeros = { 0.0, 0.0, 0.0 }; @@ -922,7 +927,7 @@ VMWAREPreInit(ScrnInfoPtr pScrn, int flags) /* print error message */ VMWAREFreeRec(pScrn); if (i > 0) { - xfree(pciList); + free(pciList); } return FALSE; } @@ -1218,7 +1223,7 @@ vmwareNextXineramaState(VMWAREPtr pVMWARE) */ if (pVMWARE->xinerama && !pVMWARE->xineramaStatic) { if (pVMWARE->xineramaNextState) { - xfree(pVMWARE->xineramaState); + free(pVMWARE->xineramaState); pVMWARE->xineramaState = pVMWARE->xineramaNextState; pVMWARE->xineramaNumOutputs = pVMWARE->xineramaNextNumOutputs; @@ -1233,14 +1238,14 @@ vmwareNextXineramaState(VMWAREPtr pVMWARE) * follow a VMwareCtrlDoSetTopology call. */ VMWAREXineramaPtr basicState = - (VMWAREXineramaPtr)xcalloc(1, sizeof (VMWAREXineramaRec)); + (VMWAREXineramaPtr)calloc(1, sizeof (VMWAREXineramaRec)); if (basicState) { basicState->x_org = 0; basicState->y_org = 0; basicState->width = vmwareReg->svga_reg_width; basicState->height = vmwareReg->svga_reg_height; - xfree(pVMWARE->xineramaState); + free(pVMWARE->xineramaState); pVMWARE->xineramaState = basicState; pVMWARE->xineramaNumOutputs = 1; } @@ -1488,10 +1493,10 @@ VMWAREAddDisplayMode(ScrnInfoPtr pScrn, { DisplayModeRec *mode; - mode = xalloc(sizeof(DisplayModeRec)); + mode = malloc(sizeof(DisplayModeRec)); memset(mode, 0, sizeof *mode); - mode->name = xalloc(strlen(name) + 1); + mode->name = malloc(strlen(name) + 1); strcpy(mode->name, name); mode->status = MODE_OK; mode->type = M_T_DEFAULT; @@ -1614,7 +1619,7 @@ VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86CollectOptions(pScrn, NULL); - if (!(options = xalloc(sizeof(VMWAREOptions)))) + if (!(options = malloc(sizeof(VMWAREOptions)))) return FALSE; memcpy(options, VMWAREOptions, sizeof(VMWAREOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); @@ -1639,11 +1644,11 @@ VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pVMWARE->xineramaStatic = pVMWARE->xineramaState != NULL; - xfree(topology); + free(topology); } } - xfree(options); + free(options); /* Initialise VMWARE_CTRL extension. */ VMwareCtrl_ExtInit(pScrn); @@ -1993,7 +1998,7 @@ VMWAREProbe(DriverPtr drv, int flags) numUsed = xf86MatchPciInstances(VMWARE_NAME, PCI_VENDOR_VMWARE, VMWAREChipsets, VMWAREPciChipsets, devSections, numDevSections, drv, &usedChips); - xfree(devSections); + free(devSections); if (numUsed <= 0) return FALSE; if (flags & PROBE_DETECT) @@ -2023,7 +2028,7 @@ VMWAREProbe(DriverPtr drv, int flags) foundScreen = TRUE; } } - xfree(usedChips); + free(usedChips); } return foundScreen; } diff --git a/src/vmwarectrl.c b/src/vmwarectrl.c index d0aace5..acaa856 100644 --- a/src/vmwarectrl.c +++ b/src/vmwarectrl.c @@ -45,6 +45,10 @@ #include "vmware.h" #include "vmwarectrlproto.h" +#ifndef HAVE_XORG_SERVER_1_5_0 +#include <xf86_ansic.h> +#include <xf86_libc.h> +#endif /* *---------------------------------------------------------------------------- @@ -122,7 +126,7 @@ VMwareCtrlDoSetRes(ScrnInfoPtr pScrn, VmwareLog(("DoSetRes: %d %d\n", x, y)); if (resetXinerama) { - xfree(pVMWARE->xineramaNextState); + free(pVMWARE->xineramaNextState); pVMWARE->xineramaNextState = NULL; pVMWARE->xineramaNextNumOutputs = 0; } @@ -276,7 +280,7 @@ VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn, VmwareLog(("DoSetTopology: %d %d\n", maxX, maxY)); - xineramaState = (VMWAREXineramaPtr)xcalloc(number, sizeof(VMWAREXineramaRec)); + xineramaState = (VMWAREXineramaPtr)calloc(number, sizeof(VMWAREXineramaRec)); if (xineramaState) { memcpy(xineramaState, extents, number * sizeof (VMWAREXineramaRec)); @@ -289,7 +293,7 @@ VMwareCtrlDoSetTopology(ScrnInfoPtr pScrn, * will be no mode change. In this case, push it out * immediately. */ - xfree(pVMWARE->xineramaNextState); + free(pVMWARE->xineramaNextState); pVMWARE->xineramaNextState = xineramaState; pVMWARE->xineramaNextNumOutputs = number; diff --git a/src/vmwaremodule.c b/src/vmwaremodule.c index caa7d68..392062f 100644 --- a/src/vmwaremodule.c +++ b/src/vmwaremodule.c @@ -34,6 +34,11 @@ #include <xf86drm.h> #endif +#ifndef HAVE_XORG_SERVER_1_5_0 +#include <xf86_ansic.h> +#include <xf86_libc.h> +#endif + /* * Defines and exported module info. */ @@ -188,7 +193,7 @@ vmware_chain_module(pointer opts) gdev->driver = driver_name; } - xfree(gdevs); + free(gdevs); if (!matched) { if (xf86LoadOneModule(driver_name, opts) == NULL) { diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c index 8522383..7f78887 100644 --- a/src/vmwarevideo.c +++ b/src/vmwarevideo.c @@ -46,6 +46,11 @@ #include <X11/extensions/Xv.h> +#ifndef HAVE_XORG_SERVER_1_5_0 +#include <xf86_ansic.h> +#include <xf86_libc.h> +#endif + #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) /* @@ -334,7 +339,7 @@ vmwareOffscreenAllocate(VMWAREPtr pVMWARE, uint32 size) return NULL; } - memptr = xalloc(sizeof(VMWAREOffscreenRec)); + memptr = malloc(sizeof(VMWAREOffscreenRec)); if (!memptr) { return NULL; } @@ -443,7 +448,7 @@ vmwareVideoInit(ScreenPtr pScreen) numAdaptors = 1; overlayAdaptors = &newAdaptor; } else { - newAdaptors = xalloc((numAdaptors + 1) * + newAdaptors = malloc((numAdaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); if (!newAdaptors) { xf86XVFreeVideoAdaptorRec(newAdaptor); @@ -463,7 +468,7 @@ vmwareVideoInit(ScreenPtr pScreen) } if (newAdaptors) { - xfree(newAdaptors); + free(newAdaptors); } xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -545,7 +550,7 @@ vmwareVideoSetup(ScrnInfoPtr pScrn) VmwareLog(("Not enough memory\n")); return NULL; } - du = xcalloc(1, VMWARE_VID_NUM_PORTS * + du = calloc(1, VMWARE_VID_NUM_PORTS * (sizeof(DevUnion) + sizeof(VMWAREVideoRec))); if (!du) { @@ -704,7 +709,7 @@ vmwareVideoInitAttributes(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid, TRACEPOINT - fmtData = xcalloc(1, sizeof(VMWAREVideoFmtData)); + fmtData = calloc(1, sizeof(VMWAREVideoFmtData)); if (!fmtData) { return -1; } diff --git a/src/vmwarexinerama.c b/src/vmwarexinerama.c index 8b82eea..3476f43 100644 --- a/src/vmwarexinerama.c +++ b/src/vmwarexinerama.c @@ -43,6 +43,11 @@ #include "vmware.h" +#ifndef HAVE_XORG_SERVER_1_5_0 +#include <xf86_ansic.h> +#include <xf86_libc.h> +#endif + /* *---------------------------------------------------------------------------- @@ -629,7 +634,7 @@ VMwareXineramaResetProc(ExtensionEntry* extEntry) VMWAREPtr pVMWARE = VMWAREPTR(pScrn); if (pVMWARE->xineramaState) { - xfree(pVMWARE->xineramaState); + free(pVMWARE->xineramaState); pVMWARE->xineramaState = NULL; pVMWARE->xineramaNumOutputs = 0; pVMWARE->xinerama = FALSE; |