aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xnest
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-05-26 19:43:34 +0200
committermarha <marha@users.sourceforge.net>2015-05-26 19:43:34 +0200
commit912e881bec8b16f2331225960645c3bdf5a8ba2d (patch)
tree92afd568d4b3eaab1faf26d8d95d8c6df0173079 /xorg-server/hw/xnest
parent2e00f3764228cfc91180bbe9375a8d85e0e65a5b (diff)
parent843964ee791452b197e41dacb0146f5b456ffaa5 (diff)
downloadvcxsrv-912e881bec8b16f2331225960645c3bdf5a8ba2d.tar.gz
vcxsrv-912e881bec8b16f2331225960645c3bdf5a8ba2d.tar.bz2
vcxsrv-912e881bec8b16f2331225960645c3bdf5a8ba2d.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mapi/glapi/glapi_priv.h mesalib/src/mesa/drivers/dri/swrast/swrast.c xorg-server/dix/dispatch.c xorg-server/os/utils.c xorg-server/record/record.c
Diffstat (limited to 'xorg-server/hw/xnest')
-rw-r--r--xorg-server/hw/xnest/Color.c17
-rw-r--r--xorg-server/hw/xnest/Display.c4
-rw-r--r--xorg-server/hw/xnest/GC.c5
-rw-r--r--xorg-server/hw/xnest/Keyboard.c6
-rw-r--r--xorg-server/hw/xnest/Screen.c4
5 files changed, 18 insertions, 18 deletions
diff --git a/xorg-server/hw/xnest/Color.c b/xorg-server/hw/xnest/Color.c
index 8d9d35621..3a9e42203 100644
--- a/xorg-server/hw/xnest/Color.c
+++ b/xorg-server/hw/xnest/Color.c
@@ -62,7 +62,7 @@ xnestCreateColormap(ColormapPtr pCmap)
switch (pVisual->class) {
case StaticGray: /* read only */
- colors = (XColor *) malloc(ncolors * sizeof(XColor));
+ colors = xallocarray(ncolors, sizeof(XColor));
for (i = 0; i < ncolors; i++)
colors[i].pixel = i;
XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
@@ -75,7 +75,7 @@ xnestCreateColormap(ColormapPtr pCmap)
break;
case StaticColor: /* read only */
- colors = (XColor *) malloc(ncolors * sizeof(XColor));
+ colors = xallocarray(ncolors, sizeof(XColor));
for (i = 0; i < ncolors; i++)
colors[i].pixel = i;
XQueryColors(xnestDisplay, xnestColormap(pCmap), colors, ncolors);
@@ -88,7 +88,7 @@ xnestCreateColormap(ColormapPtr pCmap)
break;
case TrueColor: /* read only */
- colors = (XColor *) malloc(ncolors * sizeof(XColor));
+ colors = xallocarray(ncolors, sizeof(XColor));
red = green = blue = 0L;
redInc = lowbit(pVisual->redMask);
greenInc = lowbit(pVisual->greenMask);
@@ -194,14 +194,12 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
xnestInstalledColormapWindows icws;
int numWindows;
- icws.cmapIDs = (Colormap *) malloc(pScreen->maxInstalledCmaps *
- sizeof(Colormap));
+ icws.cmapIDs = xallocarray(pScreen->maxInstalledCmaps, sizeof(Colormap));
icws.numCmapIDs = xnestListInstalledColormaps(pScreen, icws.cmapIDs);
icws.numWindows = 0;
WalkTree(pScreen, xnestCountInstalledColormapWindows, (void *) &icws);
if (icws.numWindows) {
- icws.windows =
- (Window *) malloc((icws.numWindows + 1) * sizeof(Window));
+ icws.windows = xallocarray(icws.numWindows + 1, sizeof(Window));
icws.index = 0;
WalkTree(pScreen, xnestGetInstalledColormapWindows, (void *) &icws);
icws.windows[icws.numWindows] = xnestDefaultWindows[pScreen->myNum];
@@ -220,8 +218,7 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
#ifdef _XSERVER64
{
int i;
- Window64 *windows =
- (Window64 *) malloc(numWindows * sizeof(Window64));
+ Window64 *windows = xallocarray(numWindows, sizeof(Window64));
for (i = 0; i < numWindows; ++i)
windows[i] = icws.windows[i];
@@ -393,7 +390,7 @@ xnestStoreColors(ColormapPtr pCmap, int nColors, xColorItem * pColors)
#ifdef _XSERVER64
{
int i;
- XColor *pColors64 = (XColor *) malloc(nColors * sizeof(XColor));
+ XColor *pColors64 = xallocarray(nColors, sizeof(XColor));
for (i = 0; i < nColors; ++i) {
pColors64[i].pixel = pColors[i].pixel;
diff --git a/xorg-server/hw/xnest/Display.c b/xorg-server/hw/xnest/Display.c
index a2f8acbaa..e6d07dfd1 100644
--- a/xorg-server/hw/xnest/Display.c
+++ b/xorg-server/hw/xnest/Display.c
@@ -121,8 +121,8 @@ xnestOpenDisplay(int argc, char *argv[])
}
xnestNumDefaultColormaps = xnestNumVisuals;
- xnestDefaultColormaps = (Colormap *) malloc(xnestNumDefaultColormaps *
- sizeof(Colormap));
+ xnestDefaultColormaps = xallocarray(xnestNumDefaultColormaps,
+ sizeof(Colormap));
for (i = 0; i < xnestNumDefaultColormaps; i++)
xnestDefaultColormaps[i] = XCreateColormap(xnestDisplay,
DefaultRootWindow
diff --git a/xorg-server/hw/xnest/GC.c b/xorg-server/hw/xnest/GC.c
index 96af6eb91..ecfa61e39 100644
--- a/xorg-server/hw/xnest/GC.c
+++ b/xorg-server/hw/xnest/GC.c
@@ -190,7 +190,7 @@ xnestDestroyGC(GCPtr pGC)
void
xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
{
- int i, size;
+ int i;
BoxPtr pBox;
XRectangle *pRects;
@@ -204,8 +204,7 @@ xnestChangeClip(GCPtr pGC, int type, void *pValue, int nRects)
case CT_REGION:
nRects = RegionNumRects((RegionPtr) pValue);
- size = nRects * sizeof(*pRects);
- pRects = (XRectangle *) malloc(size);
+ pRects = xallocarray(nRects, sizeof(*pRects));
pBox = RegionRects((RegionPtr) pValue);
for (i = nRects; i-- > 0;) {
pRects[i].x = pBox[i].x1;
diff --git a/xorg-server/hw/xnest/Keyboard.c b/xorg-server/hw/xnest/Keyboard.c
index ee3f68e3f..7ee7a7c3c 100644
--- a/xorg-server/hw/xnest/Keyboard.c
+++ b/xorg-server/hw/xnest/Keyboard.c
@@ -16,6 +16,10 @@ is" without express or implied warranty.
#include <xnest-config.h>
#endif
+#ifdef WIN32
+#include <X11/Xwindows.h>
+#endif
+
#include <X11/X.h>
#include <X11/Xproto.h>
#include <xcb/xcb_keysyms.h>
@@ -134,7 +138,7 @@ xnestKeyboardProc(DeviceIntPtr pDev, int onoff)
max_keycode - min_keycode + 1,
&mapWidth);
len = (max_keycode - min_keycode + 1) * mapWidth;
- keymap = (KeySym *) malloc(len * sizeof(KeySym));
+ keymap = xallocarray(len, sizeof(KeySym));
for (i = 0; i < len; ++i)
keymap[i] = keymap64[i];
XFree(keymap64);
diff --git a/xorg-server/hw/xnest/Screen.c b/xorg-server/hw/xnest/Screen.c
index abb4d372d..214b55015 100644
--- a/xorg-server/hw/xnest/Screen.c
+++ b/xorg-server/hw/xnest/Screen.c
@@ -158,7 +158,7 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
if (!dixRegisterPrivateKey(&xnestCursorScreenKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
- visuals = (VisualPtr) malloc(xnestNumVisuals * sizeof(VisualRec));
+ visuals = xallocarray(xnestNumVisuals, sizeof(VisualRec));
numVisuals = 0;
depths = (DepthPtr) malloc(MAXDEPTH * sizeof(DepthRec));
@@ -224,7 +224,7 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
numVisuals++;
}
- visuals = (VisualPtr) realloc(visuals, numVisuals * sizeof(VisualRec));
+ visuals = reallocarray(visuals, numVisuals, sizeof(VisualRec));
defaultVisual = visuals[xnestDefaultVisualIndex].vid;
rootDepth = visuals[xnestDefaultVisualIndex].nplanes;