From e1e8c7ddd7fdbfd674361364295fb1cbd5f28b45 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 3 Jun 2009 13:37:32 -0400 Subject: [PATCH] s/MIN/min/, s/MAX/max/ (#2968) --- dix/dispatch.c | 4 ---- hw/xfree86/shadowfb/shadow.c | 23 ++++++++++------------- hw/xwin/wincursor.c | 10 +++------- miext/rootless/rootlessCommon.c | 4 ++-- miext/rootless/rootlessCommon.h | 7 +------ miext/rootless/rootlessScreen.c | 16 ++++++++-------- 6 files changed, 24 insertions(+), 40 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index dbb97e05f..86db92f1e 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3935,10 +3935,6 @@ static int indexForScanlinePad[ 65 ] = { 3 /* 64 bits per scanline pad unit */ }; -#ifndef MIN -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#endif - /* grow the array of screenRecs if necessary. call the device-supplied initialization procedure diff --git a/hw/xfree86/shadowfb/shadow.c b/hw/xfree86/shadowfb/shadow.c index ea6a2a0bb..9c9aa0d55 100644 --- a/hw/xfree86/shadowfb/shadow.c +++ b/hw/xfree86/shadowfb/shadow.c @@ -31,9 +31,6 @@ # include "picturestr.h" #endif -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - static Bool ShadowCloseScreen (int i, ScreenPtr pScreen); static void ShadowCopyWindow( WindowPtr pWin, @@ -1364,44 +1361,44 @@ ShadowFontToBox(BoxPtr BB, DrawablePtr pDrawable, GCPtr pGC, int x, int y, if (pFont->info.constantWidth) { int ascent, descent, left, right = 0; - ascent = MAX(pFont->info.fontAscent, pFont->info.maxbounds.ascent); - descent = MAX(pFont->info.fontDescent, pFont->info.maxbounds.descent); + ascent = max(pFont->info.fontAscent, pFont->info.maxbounds.ascent); + descent = max(pFont->info.fontDescent, pFont->info.maxbounds.descent); left = pFont->info.maxbounds.leftSideBearing; if (count > 0) { right = (count - 1) * pFont->info.maxbounds.characterWidth; } right += pFont->info.maxbounds.rightSideBearing; BB->x1 = - MAX(pDrawable->x + x - left, (REGION_EXTENTS(pGC->pScreen, + max(pDrawable->x + x - left, (REGION_EXTENTS(pGC->pScreen, &((WindowPtr) pDrawable)->winSize))->x1); BB->y1 = - MAX(pDrawable->y + y - ascent, + max(pDrawable->y + y - ascent, (REGION_EXTENTS(pGC->pScreen, &((WindowPtr) pDrawable)->winSize))->y1); BB->x2 = - MIN(pDrawable->x + x + right, + min(pDrawable->x + x + right, (REGION_EXTENTS(pGC->pScreen, &((WindowPtr) pDrawable)->winSize))->x2); BB->y2 = - MIN(pDrawable->y + y + descent, + min(pDrawable->y + y + descent, (REGION_EXTENTS(pGC->pScreen, &((WindowPtr) pDrawable)->winSize))->y2); } else { ShadowTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit : Linear8Bit, BB); BB->x1 = - MAX(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen, + max(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen, &((WindowPtr) pDrawable)->winSize))->x1); BB->y1 = - MAX(pDrawable->y + y + BB->y1, + max(pDrawable->y + y + BB->y1, (REGION_EXTENTS(pGC->pScreen, &((WindowPtr) pDrawable)->winSize))->y1); BB->x2 = - MIN(pDrawable->x + x + BB->x2, + min(pDrawable->x + x + BB->x2, (REGION_EXTENTS(pGC->pScreen, &((WindowPtr) pDrawable)->winSize))->x2); BB->y2 = - MIN(pDrawable->y + y + BB->y2, + min(pDrawable->y + y + BB->y2, (REGION_EXTENTS(pGC->pScreen, &((WindowPtr) pDrawable)->winSize))->y2); } diff --git a/hw/xwin/wincursor.c b/hw/xwin/wincursor.c index fcd156e50..952560844 100644 --- a/hw/xwin/wincursor.c +++ b/hw/xwin/wincursor.c @@ -39,14 +39,10 @@ #include #include #include +#include "misc.h" extern Bool g_fSoftwareCursor; - -#ifndef MIN -#define MIN(x,y) ((x)<(y)?(x):(y)) -#endif - #define BYTE_COUNT(x) (((x) + 7) / 8) #define BRIGHTNESS(x) (x##Red * 0.299 + x##Green * 0.587 + x##Blue * 0.114) @@ -198,8 +194,8 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen) nBytes = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * pScreenPriv->cursor.sm_cy; /* Get the effective width and height */ - nCX = MIN(pScreenPriv->cursor.sm_cx, pCursor->bits->width); - nCY = MIN(pScreenPriv->cursor.sm_cy, pCursor->bits->height); + nCX = min(pScreenPriv->cursor.sm_cx, pCursor->bits->width); + nCY = min(pScreenPriv->cursor.sm_cy, pCursor->bits->height); /* Allocate memory for the bitmaps */ pAnd = malloc (nBytes); diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c index 97c92d309..e3dd9d97c 100644 --- a/miext/rootless/rootlessCommon.c +++ b/miext/rootless/rootlessCommon.c @@ -109,8 +109,8 @@ RootlessResolveColormap (ScreenPtr pScreen, int first_color, map = RootlessGetColormap (pScreen); if (map == NULL || map->class != PseudoColor) return FALSE; - last = MIN (map->pVisual->ColormapEntries, first_color + n_colors); - for (i = MAX (0, first_color); i < last; i++) { + last = min (map->pVisual->ColormapEntries, first_color + n_colors); + for (i = max (0, first_color); i < last; i++) { Entry *ent = map->red + i; uint16_t red, green, blue; diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h index a92f1f1e4..ba121c0f4 100644 --- a/miext/rootless/rootlessCommon.h +++ b/miext/rootless/rootlessCommon.h @@ -36,6 +36,7 @@ #ifndef _ROOTLESSCOMMON_H #define _ROOTLESSCOMMON_H +#include "misc.h" #include "rootless.h" #include "fb.h" @@ -120,12 +121,6 @@ typedef struct _RootlessScreenRec { unsigned int colormap_changed :1; } RootlessScreenRec, *RootlessScreenPtr; - -#undef MIN -#define MIN(x,y) ((x) < (y) ? (x) : (y)) -#undef MAX -#define MAX(x,y) ((x) > (y) ? (x) : (y)) - // "Definition of the Porting Layer for the X11 Sample Server" says // unwrap and rewrap of screen functions is unnecessary, but // screen->CreateGC changes after a call to cfbCreateGC. diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c index 88d38698b..b10ca70eb 100644 --- a/miext/rootless/rootlessScreen.c +++ b/miext/rootless/rootlessScreen.c @@ -200,10 +200,10 @@ RootlessGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, x1 = x0 + w; y1 = y0 + h; - x0 = MAX (x0, winRec->x); - y0 = MAX (y0, winRec->y); - x1 = MIN (x1, winRec->x + winRec->width); - y1 = MIN (y1, winRec->y + winRec->height); + x0 = max (x0, winRec->x); + y0 = max (y0, winRec->y); + x1 = min (x1, winRec->x + winRec->width); + y1 = min (y1, winRec->y + winRec->height); sx = x0 - pDrawable->x; sy = y0 - pDrawable->y; @@ -347,10 +347,10 @@ RootlessGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, x2 = x1 + glyph->info.width; y2 = y1 + glyph->info.height; - box.x1 = MAX (box.x1, x1); - box.y1 = MAX (box.y1, y1); - box.x2 = MAX (box.x2, x2); - box.y2 = MAX (box.y2, y2); + box.x1 = max (box.x1, x1); + box.y1 = max (box.y1, y1); + box.x2 = max (box.x2, x2); + box.y2 = max (box.y2, y2); x += glyph->info.xOff; y += glyph->info.yOff;