X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglx%2FXF86dri.c;h=b39fb2053886fddfe579c1f40be95e5a8ca53aa8;hb=5e639a5f59a348abddff8f2cd475c00ef79c8776;hp=36b43f0f84af100a26e9868c7f8fc37f54bb8125;hpb=d2fe97a209134ff5267e8aa065865c3398bfb280;p=mesa.git diff --git a/src/glx/XF86dri.c b/src/glx/XF86dri.c index 36b43f0f84a..b39fb205388 100644 --- a/src/glx/XF86dri.c +++ b/src/glx/XF86dri.c @@ -29,7 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: * Kevin E. Martin - * Jens Owen + * Jens Owen * Rickard E. (Rik) Faith * */ @@ -39,20 +39,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) #include +#include #include #include #include "xf86dristr.h" - - -#if defined(__GNUC__) -# define PUBLIC __attribute__((visibility("default"))) -# define USED __attribute__((used)) -#else -# define PUBLIC -# define USED -#endif - - +#include static XExtensionInfo _xf86dri_info_data; static XExtensionInfo *xf86dri_info = &_xf86dri_info_data; @@ -211,7 +202,11 @@ XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA, } if (rep.length) { - if (!(*busIdString = (char *) Xcalloc(rep.busIdStringLength + 1, 1))) { + if (rep.busIdStringLength < INT_MAX) + *busIdString = calloc(rep.busIdStringLength + 1, 1); + else + *busIdString = NULL; + if (*busIdString == NULL) { _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3)); UnlockDisplay(dpy); SyncHandle(); @@ -310,9 +305,11 @@ XF86DRIGetClientDriverName(Display * dpy, int screen, *ddxDriverPatchVersion = rep.ddxDriverPatchVersion; if (rep.length) { - if (! - (*clientDriverName = - (char *) Xcalloc(rep.clientDriverNameLength + 1, 1))) { + if (rep.clientDriverNameLength < INT_MAX) + *clientDriverName = calloc(rep.clientDriverNameLength + 1, 1); + else + *clientDriverName = NULL; + if (*clientDriverName == NULL) { _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3)); UnlockDisplay(dpy); SyncHandle(); @@ -531,7 +528,7 @@ XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, if (*numClipRects) { int len = sizeof(drm_clip_rect_t) * (*numClipRects); - *pClipRects = (drm_clip_rect_t *) Xcalloc(len, 1); + *pClipRects = calloc(len, 1); if (*pClipRects) _XRead(dpy, (char *) *pClipRects, len); } @@ -542,7 +539,7 @@ XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, if (*numBackClipRects) { int len = sizeof(drm_clip_rect_t) * (*numBackClipRects); - *pBackClipRects = (drm_clip_rect_t *) Xcalloc(len, 1); + *pBackClipRects = calloc(len, 1); if (*pBackClipRects) _XRead(dpy, (char *) *pBackClipRects, len); } @@ -592,7 +589,7 @@ XF86DRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer, *devPrivateSize = rep.devPrivateSize; if (rep.length) { - if (!(*pDevPrivate = (void *) Xcalloc(rep.devPrivateSize, 1))) { + if (!(*pDevPrivate = calloc(rep.devPrivateSize, 1))) { _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3)); UnlockDisplay(dpy); SyncHandle();