vmware/vmwlegacy: Silence compilation errors and -warnings.
authorThomas Hellstrom <thellstrom@vmware.com>
Tue, 7 Sep 2010 10:17:46 +0000 (12:17 +0200)
committerThomas Hellstrom <thellstrom@vmware.com>
Tue, 7 Sep 2010 10:19:21 +0000 (12:19 +0200)
Silence warnings and errors on various server versions due to incorrect
usage of libc functions.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
configure.ac
src/vmware.c
src/vmwarectrl.c
src/vmwaremodule.c
src/vmwarevideo.c
src/vmwarexinerama.c

index 7249ca1..0ea3472 100644 (file)
@@ -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])])
index 599ac07..a4e4d08 100644 (file)
@@ -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;
 }
index d0aace5..acaa856 100644 (file)
 #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;
 
index caa7d68..392062f 100644 (file)
 #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) {
index 8522383..7f78887 100644 (file)
 
 #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;
     }
index 8b82eea..3476f43 100644 (file)
 
 #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;