Use min/max instead of MIN/MAX.

oldstable
Francois Gouget 2000-03-25 21:44:35 +00:00 committed by Alexandre Julliard
parent 77c30552aa
commit 6d77d3a1df
51 changed files with 192 additions and 203 deletions

View File

@ -977,7 +977,7 @@ static void EDIT_BuildLineDefs_ML(WND *wnd, EDITSTATE *es)
current_def->length = current_def->net_length;
break;
}
es->text_width = MAX(es->text_width, current_def->width);
es->text_width = max(es->text_width, current_def->width);
start += current_def->length;
*previous_next = current_def;
previous_next = &current_def->next;
@ -1138,8 +1138,8 @@ static INT EDIT_CharFromPos(WND *wnd, EDITSTATE *es, INT x, INT y, LPBOOL after_
*/
static void EDIT_ConfinePoint(WND *wnd, EDITSTATE *es, LPINT x, LPINT y)
{
*x = MIN(MAX(*x, es->format_rect.left), es->format_rect.right - 1);
*y = MIN(MAX(*y, es->format_rect.top), es->format_rect.bottom - 1);
*x = min(max(*x, es->format_rect.left), es->format_rect.right - 1);
*y = min(max(*y, es->format_rect.top), es->format_rect.bottom - 1);
}
@ -1351,20 +1351,20 @@ static BOOL EDIT_MakeFit(WND *wnd, EDITSTATE *es, INT size)
EDIT_UnlockBuffer(wnd, es, TRUE);
if (es->text) {
if ((es->text = HeapReAlloc(es->heap, 0, es->text, size + 1)))
es->buffer_size = MIN(HeapSize(es->heap, 0, es->text) - 1, es->buffer_limit);
es->buffer_size = min(HeapSize(es->heap, 0, es->text) - 1, es->buffer_limit);
else
es->buffer_size = 0;
} else if (es->hloc32) {
if ((hNew32 = LocalReAlloc(es->hloc32, size + 1, 0))) {
TRACE("Old 32 bit handle %08x, new handle %08x\n", es->hloc32, hNew32);
es->hloc32 = hNew32;
es->buffer_size = MIN(LocalSize(es->hloc32) - 1, es->buffer_limit);
es->buffer_size = min(LocalSize(es->hloc32) - 1, es->buffer_limit);
}
} else if (es->hloc16) {
if ((hNew16 = LOCAL_ReAlloc(wnd->hInstance, es->hloc16, size + 1, LMEM_MOVEABLE))) {
TRACE("Old 16 bit handle %08x, new handle %08x\n", es->hloc16, hNew16);
es->hloc16 = hNew16;
es->buffer_size = MIN(LOCAL_Size(wnd->hInstance, es->hloc16) - 1, es->buffer_limit);
es->buffer_size = min(LOCAL_Size(wnd->hInstance, es->hloc16) - 1, es->buffer_limit);
}
}
if (es->buffer_size < size) {
@ -1698,8 +1698,8 @@ static void EDIT_PaintLine(WND *wnd, EDITSTATE *es, HDC dc, INT line, BOOL rev)
s = es->selection_start;
e = es->selection_end;
ORDER_INT(s, e);
s = MIN(li + ll, MAX(li, s));
e = MIN(li + ll, MAX(li, e));
s = min(li + ll, max(li, s));
e = min(li + ll, max(li, e));
if (rev && (s != e) &&
((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL))) {
x += EDIT_PaintText(wnd, es, dc, x, y, line, 0, s - li, FALSE);
@ -1798,10 +1798,10 @@ static void EDIT_SetRectNP(WND *wnd, EDITSTATE *es, LPRECT rc)
}
es->format_rect.left += es->left_margin;
es->format_rect.right -= es->right_margin;
es->format_rect.right = MAX(es->format_rect.right, es->format_rect.left + es->char_width);
es->format_rect.right = max(es->format_rect.right, es->format_rect.left + es->char_width);
if (es->style & ES_MULTILINE)
es->format_rect.bottom = es->format_rect.top +
MAX(1, (es->format_rect.bottom - es->format_rect.top) / es->line_height) * es->line_height;
max(1, (es->format_rect.bottom - es->format_rect.top) / es->line_height) * es->line_height;
else
es->format_rect.bottom = es->format_rect.top + es->line_height;
if ((es->style & ES_MULTILINE) && !(es->style & ES_AUTOHSCROLL))
@ -1988,7 +1988,7 @@ static HLOCAL EDIT_EM_GetHandle(WND *wnd, EDITSTATE *es)
ERR("could not allocate new 32 bit buffer\n");
return 0;
}
newSize = MIN(LocalSize(newBuf) - 1, es->buffer_limit);
newSize = min(LocalSize(newBuf) - 1, es->buffer_limit);
if (!(newText = LocalLock(newBuf))) {
ERR("could not lock new 32 bit buffer\n");
LocalFree(newBuf);
@ -2048,7 +2048,7 @@ static HLOCAL16 EDIT_EM_GetHandle16(WND *wnd, EDITSTATE *es)
ERR("could not allocate new 16 bit buffer\n");
return 0;
}
newSize = MIN(LOCAL_Size(wnd->hInstance, newBuf) - 1, es->buffer_limit);
newSize = min(LOCAL_Size(wnd->hInstance, newBuf) - 1, es->buffer_limit);
if (!(newText = LOCAL_Lock(wnd->hInstance, newBuf))) {
ERR("could not lock new 16 bit buffer\n");
LOCAL_Free(wnd->hInstance, newBuf);
@ -2091,7 +2091,7 @@ static INT EDIT_EM_GetLine(WND *wnd, EDITSTATE *es, INT line, LPSTR lpch)
line = 0;
i = EDIT_EM_LineIndex(wnd, es, line);
src = es->text + i;
len = MIN(*(WORD *)lpch, EDIT_EM_LineLength(wnd, es, i));
len = min(*(WORD *)lpch, EDIT_EM_LineLength(wnd, es, i));
for (i = 0 ; i < len ; i++) {
*lpch = *src;
src++;
@ -2155,7 +2155,7 @@ static INT EDIT_EM_LineFromChar(WND *wnd, EDITSTATE *es, INT index)
if (index > lstrlenA(es->text))
return es->line_count - 1;
if (index == -1)
index = MIN(es->selection_start, es->selection_end);
index = min(es->selection_start, es->selection_end);
line = 0;
line_def = es->first_line_def;
@ -2256,7 +2256,7 @@ static BOOL EDIT_EM_LineScroll(WND *wnd, EDITSTATE *es, INT dx, INT dy)
dx = -es->x_offset;
if (dx > es->text_width - es->x_offset)
dx = es->text_width - es->x_offset;
nyoff = MAX(0, es->y_offset + dy);
nyoff = max(0, es->y_offset + dy);
if (nyoff >= es->line_count)
nyoff = es->line_count - 1;
dy = (es->y_offset - nyoff) * es->line_height;
@ -2294,7 +2294,7 @@ static LRESULT EDIT_EM_PosFromChar(WND *wnd, EDITSTATE *es, INT index, BOOL afte
HFONT old_font = 0;
SIZE size;
index = MIN(index, len);
index = min(index, len);
dc = GetDC(wnd->hwndSelf);
if (es->font)
old_font = SelectObject(dc, es->font);
@ -2654,12 +2654,12 @@ static void EDIT_EM_SetLimitText(WND *wnd, EDITSTATE *es, INT limit)
{
if (es->style & ES_MULTILINE) {
if (limit)
es->buffer_limit = MIN(limit, BUFLIMIT_MULTI);
es->buffer_limit = min(limit, BUFLIMIT_MULTI);
else
es->buffer_limit = BUFLIMIT_MULTI;
} else {
if (limit)
es->buffer_limit = MIN(limit, BUFLIMIT_SINGLE);
es->buffer_limit = min(limit, BUFLIMIT_SINGLE);
else
es->buffer_limit = BUFLIMIT_SINGLE;
}
@ -2739,8 +2739,8 @@ static void EDIT_EM_SetSel(WND *wnd, EDITSTATE *es, UINT start, UINT end, BOOL a
start = es->selection_end;
end = es->selection_end;
} else {
start = MIN(start, len);
end = MIN(end, len);
start = min(start, len);
end = min(end, len);
}
es->selection_start = start;
es->selection_end = end;
@ -3724,7 +3724,7 @@ static void EDIT_WM_Paint(WND *wnd, EDITSTATE *es, WPARAM wParam)
GetClipBox(dc, &rcRgn);
if (es->style & ES_MULTILINE) {
INT vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
for (i = es->y_offset ; i <= MIN(es->y_offset + vlc, es->y_offset + es->line_count - 1) ; i++) {
for (i = es->y_offset ; i <= min(es->y_offset + vlc, es->y_offset + es->line_count - 1) ; i++) {
EDIT_GetLineRect(wnd, es, i, 0, -1, &rcLine);
if (IntersectRect(&rc, &rcRgn, &rcLine))
EDIT_PaintLine(wnd, es, dc, i, rev);

View File

@ -839,9 +839,9 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner,
lpitem->rect.right += size.cx;
if (TWEAK_WineLook == WIN31_LOOK)
lpitem->rect.bottom += MAX( size.cy, GetSystemMetrics(SM_CYMENU) );
lpitem->rect.bottom += max( size.cy, GetSystemMetrics(SM_CYMENU) );
else
lpitem->rect.bottom += MAX (size.cy, GetSystemMetrics(SM_CYMENU)-1);
lpitem->rect.bottom += max(size.cy, GetSystemMetrics(SM_CYMENU)-1);
lpitem->xTab = 0;
if (menuBar)
@ -905,17 +905,17 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop, HWND hwndOwner )
MENU_CalcItemSize( hdc, lpitem, hwndOwner, orgX, orgY, FALSE );
if (lpitem->fType & MF_MENUBARBREAK) orgX++;
maxX = MAX( maxX, lpitem->rect.right );
maxX = max( maxX, lpitem->rect.right );
orgY = lpitem->rect.bottom;
if (IS_STRING_ITEM(lpitem->fType) && lpitem->xTab)
{
maxTab = MAX( maxTab, lpitem->xTab );
maxTabWidth = MAX(maxTabWidth,lpitem->rect.right-lpitem->xTab);
maxTab = max( maxTab, lpitem->xTab );
maxTabWidth = max(maxTabWidth,lpitem->rect.right-lpitem->xTab);
}
}
/* Finish the column (set all items to the largest width found) */
maxX = MAX( maxX, maxTab + maxTabWidth );
maxX = max( maxX, maxTab + maxTabWidth );
for (lpitem = &lppop->items[start]; start < i; start++, lpitem++)
{
lpitem->rect.right = maxX;
@ -923,7 +923,7 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop, HWND hwndOwner )
lpitem->xTab = maxTab;
}
lppop->Height = MAX( lppop->Height, orgY );
lppop->Height = max( lppop->Height, orgY );
}
lppop->Width = maxX;
@ -986,7 +986,7 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect,
if (i != start) break;
else lpitem->rect.right = lprect->right;
}
maxY = MAX( maxY, lpitem->rect.bottom );
maxY = max( maxY, lpitem->rect.bottom );
orgX = lpitem->rect.right;
}

View File

@ -255,7 +255,7 @@ static BOOL SCROLL_GetScrollBarRect( HWND hwnd, INT nBar, RECT *lprect,
}
else
{
INT max = info->MaxVal - MAX( info->Page-1, 0 );
INT max = info->MaxVal - max( info->Page-1, 0 );
if (info->MinVal >= max)
*thumbPos = *arrowSize - SCROLL_ARROW_THUMB_OVERLAP;
else
@ -292,7 +292,7 @@ static UINT SCROLL_GetThumbVal( SCROLLBAR_INFO *infoPtr, RECT *rect,
if ((pixels -= thumbSize) <= 0) return infoPtr->MinVal;
pos = MAX( 0, pos - (GetSystemMetrics(SM_CXVSCROLL) - SCROLL_ARROW_THUMB_OVERLAP) );
pos = max( 0, pos - (GetSystemMetrics(SM_CXVSCROLL) - SCROLL_ARROW_THUMB_OVERLAP) );
if (pos > pixels) pos = pixels;
if (!infoPtr->Page) pos *= infoPtr->MaxVal - infoPtr->MinVal;
@ -1350,8 +1350,8 @@ INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar,
if (infoPtr->CurVal < infoPtr->MinVal)
infoPtr->CurVal = infoPtr->MinVal;
else if (infoPtr->CurVal > infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 ))
infoPtr->CurVal = infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 );
else if (infoPtr->CurVal > infoPtr->MaxVal - max( infoPtr->Page-1, 0 ))
infoPtr->CurVal = infoPtr->MaxVal - max( infoPtr->Page-1, 0 );
TRACE(" new values: page=%d pos=%d min=%d max=%d\n",
infoPtr->Page, infoPtr->CurVal,
@ -1367,7 +1367,7 @@ INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar,
if (info->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL))
{
new_flags = infoPtr->flags;
if (infoPtr->MinVal >= infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 ))
if (infoPtr->MinVal >= infoPtr->MaxVal - max( infoPtr->Page-1, 0 ))
{
/* Hide or disable scroll-bar */
if (info->fMask & SIF_DISABLENOSCROLL)

View File

@ -852,7 +852,7 @@ DSA_Create (INT nSize, INT nGrow)
hdsa->pData = NULL;
hdsa->nMaxCount = 0;
hdsa->nItemSize = nSize;
hdsa->nGrow = MAX(1, nGrow);
hdsa->nGrow = max(1, nGrow);
}
return hdsa;
@ -1189,7 +1189,7 @@ DPA_Create (INT nGrow)
hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA));
if (hdpa) {
hdpa->nGrow = MAX(8, nGrow);
hdpa->nGrow = max(8, nGrow);
hdpa->hHeap = COMCTL32_hHeap;
hdpa->nMaxCount = hdpa->nGrow * 2;
hdpa->ptrs =
@ -1250,7 +1250,7 @@ DPA_Grow (const HDPA hdpa, INT nGrow)
if (!hdpa)
return FALSE;
hdpa->nGrow = MAX(8, nGrow);
hdpa->nGrow = max(8, nGrow);
return TRUE;
}
@ -1553,7 +1553,7 @@ DPA_DeletePtr (const HDPA hdpa, INT i)
/* free memory ?*/
if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) {
INT nNewItems = MAX(hdpa->nGrow * 2, hdpa->nItemCount);
INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount);
nSize = nNewItems * sizeof(LPVOID);
lpDest = (LPVOID)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
hdpa->ptrs, nSize);
@ -1790,7 +1790,7 @@ DPA_CreateEx (INT nGrow, HANDLE hHeap)
hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA));
if (hdpa) {
hdpa->nGrow = MIN(8, nGrow);
hdpa->nGrow = min(8, nGrow);
hdpa->hHeap = hHeap ? hHeap : COMCTL32_hHeap;
hdpa->nMaxCount = hdpa->nGrow * 2;
hdpa->ptrs =

View File

@ -121,7 +121,7 @@ TRACKBAR_CalcChannel (HWND hwnd, TRACKBAR_INFO *infoPtr)
GetClientRect (hwnd, &lpRect);
if (dwStyle & TBS_ENABLESELRANGE)
cyChannel = MAX(infoPtr->uThumbLen - 8, 4);
cyChannel = max(infoPtr->uThumbLen - 8, 4);
else
cyChannel = 4;

View File

@ -824,7 +824,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
UNKNOWN_PARAM(UDM_GETACCEL, wParam, lParam);
return 0;
}
temp = MIN(infoPtr->AccelCount, wParam);
temp = min(infoPtr->AccelCount, wParam);
memcpy((void *)lParam, infoPtr->AccelVect, temp*sizeof(UDACCEL));
return temp;

View File

@ -167,7 +167,7 @@ static int CC_HSLtoRGB(char c,int hue,int sat,int lum)
}
/* l below 120 */
maxrgb=(256*MIN(120,lum))/120; /* 0 .. 256 */
maxrgb=(256*min(120,lum))/120; /* 0 .. 256 */
if (hue< 80)
res=0;
else
@ -193,7 +193,7 @@ static int CC_HSLtoRGB(char c,int hue,int sat,int lum)
if (lum>120 && res<256)
res+=((lum-120) * (256-res))/120;
return MIN(res,255);
return min(res,255);
}
/***********************************************************************
@ -204,10 +204,10 @@ static int CC_RGBtoHSL(char c,int r,int g,int b)
WORD maxi,mini,mmsum,mmdif,result=0;
int iresult=0;
maxi=MAX(r,b);
maxi=MAX(maxi,g);
mini=MIN(r,b);
mini=MIN(mini,g);
maxi=max(r,b);
maxi=max(maxi,g);
mini=min(r,b);
mini=min(mini,g);
mmsum=maxi+mini;
mmdif=maxi-mini;
@ -642,7 +642,7 @@ static void CC_PaintLumBar(HWND16 hDlg,int hue,int sat)
ydif=client.bottom/YSTEPS+1;
for(lum=0;lum<240+ldif;lum+=ldif)
{
rect.top=MAX(0,rect.bottom-ydif);
rect.top=max(0,rect.bottom-ydif);
r=CC_HSLtoRGB('R',hue,sat,lum);
g=CC_HSLtoRGB('G',hue,sat,lum);
b=CC_HSLtoRGB('B',hue,sat,lum);

View File

@ -1401,7 +1401,7 @@ VOID __cdecl CRTDLL__splitpath(LPCSTR path, LPSTR drive, LPSTR directory, LPSTR
drivechar = strchr(path,':');
dirchar = strrchr(path,'/');
namechar = strrchr(path,'\\');
dirchar = MAX(dirchar,namechar);
dirchar = max(dirchar,namechar);
if (dirchar)
namechar = strrchr(dirchar,'.');
else

View File

@ -420,7 +420,7 @@ HRESULT WINAPI HGLOBALStreamImpl_Read(
* Using the known size of the stream, calculate the number of bytes
* to read from the block chain
*/
bytesToReadFromBuffer = MIN( This->streamSize.s.LowPart - This->currentPosition.s.LowPart, cb);
bytesToReadFromBuffer = min( This->streamSize.s.LowPart - This->currentPosition.s.LowPart, cb);
/*
* Lock the buffer in position and copy the data.

View File

@ -372,7 +372,7 @@ HRESULT WINAPI HGLOBALLockBytesImpl_ReadAt(
* Using the known size of the array, calculate the number of bytes
* to read.
*/
bytesToReadFromBuffer = MIN(This->byteArraySize.s.LowPart -
bytesToReadFromBuffer = min(This->byteArraySize.s.LowPart -
ulOffset.s.LowPart, cb);
/*

View File

@ -334,7 +334,7 @@ HRESULT WINAPI StgStreamImpl_Read(
* Using the known size of the stream, calculate the number of bytes
* to read from the block chain
*/
bytesToReadFromBuffer = MIN( This->streamSize.s.LowPart - This->currentPosition.s.LowPart, cb);
bytesToReadFromBuffer = min( This->streamSize.s.LowPart - This->currentPosition.s.LowPart, cb);
/*
* Depending on the type of chain that was opened when the stream was constructed,

View File

@ -4171,7 +4171,7 @@ BOOL BlockChainStream_ReadAt(BlockChainStream* This,
* Calculate how many bytes we can copy from this big block.
*/
bytesToReadInBuffer =
MIN(This->parentStorage->bigBlockSize - offsetInBlock, size);
min(This->parentStorage->bigBlockSize - offsetInBlock, size);
/*
* Copy those bytes to the buffer
@ -4261,7 +4261,7 @@ BOOL BlockChainStream_WriteAt(BlockChainStream* This,
* Calculate how many bytes we can copy from this big block.
*/
bytesToWrite =
MIN(This->parentStorage->bigBlockSize - offsetInBlock, size);
min(This->parentStorage->bigBlockSize - offsetInBlock, size);
/*
* Copy those bytes to the buffer
@ -4900,7 +4900,7 @@ BOOL SmallBlockChainStream_ReadAt(
* Calculate how many bytes we can copy from this small block.
*/
bytesToReadInBuffer =
MIN(This->parentStorage->smallBlockSize - offsetInBlock, size);
min(This->parentStorage->smallBlockSize - offsetInBlock, size);
/*
* Calculate the offset of the small block in the small block file.
@ -4990,7 +4990,7 @@ BOOL SmallBlockChainStream_WriteAt(
* Calculate how many bytes we can copy to this small block.
*/
bytesToWriteInBuffer =
MIN(This->parentStorage->smallBlockSize - offsetInBlock, size);
min(This->parentStorage->smallBlockSize - offsetInBlock, size);
/*
* Calculate the offset of the small block in the small block file.

View File

@ -101,7 +101,7 @@ static BOOL MMDRV_GetDescription16(const char* fname, char* buf, int buflen)
if (_lread(hFile, &dw, 4) != 4) E(("Can't read nr table offset\n"));
if (_llseek(hFile, dw, SEEK_SET) < 0) E(("Can't seek to nr table %lu\n", dw));
if (_lread(hFile, buf, 1) != 1) E(("Can't read descr length\n"));
buflen = MIN((BYTE)buf[0], buflen - 1);
buflen = min((BYTE)buf[0], buflen - 1);
if (_lread(hFile, buf, buflen) != buflen) E(("Can't read descr (%d)\n", buflen));
buf[buflen] = '\0';
ret = TRUE;

View File

@ -629,7 +629,7 @@ static DWORD WAVE_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
}
whidx = 0;
left = MIN(wmw->dwLength, end - wmw->dwPosition);
left = min(wmw->dwLength, end - wmw->dwPosition);
wmw->hEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
wmw->dwEventCount = 1L; /* for first buffer */
@ -637,7 +637,7 @@ static DWORD WAVE_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
/* FIXME: this doesn't work if wmw->dwPosition != 0 */
while (left > 0 && wmw->dwStatus != MCI_MODE_STOP && wmw->dwStatus != MCI_MODE_NOT_READY) {
count = mmioRead(wmw->hFile, waveHdr[whidx].lpData, MIN(bufsize, left));
count = mmioRead(wmw->hFile, waveHdr[whidx].lpData, min(bufsize, left));
TRACE("mmioRead bufsize=%ld count=%ld\n", bufsize, count);
if (count < 1)
break;

View File

@ -532,7 +532,7 @@ static FOURCC MMIO_ParseExt(LPCSTR szFileName)
if (extEnd - extStart - 1 > 4)
WARN("Extension length > 4\n");
lstrcpynA(ext,extStart + 1,MIN(extEnd-extStart,5));
lstrcpynA(ext,extStart + 1,min(extEnd-extStart,5));
TRACE("Got extension: %s\n", debugstr_a(ext));
/* FOURCC codes identifying file-extentions must be uppercase */
ret = mmioStringToFOURCCA(ext, MMIO_TOUPPER);

View File

@ -410,7 +410,7 @@ static BOOL WINAPI proc_PlaySound(LPCSTR lpszSoundName, UINT uFlags)
PlaySound_Stop = PlaySound_Loop = FALSE;
break;
}
count = mmioRead(hmmio, waveHdr[index].lpData, MIN(bufsize, left));
count = mmioRead(hmmio, waveHdr[index].lpData, min(bufsize, left));
if (count < 1) break;
left -= count;
waveHdr[index].dwBufferLength = count;
@ -992,7 +992,7 @@ UINT WINAPI mixerGetControlDetailsW(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd,
case MIXER_GETCONTROLDETAILSF_LISTTEXT:
{
LPVOID paDetailsW = lpmcd->paDetails;
int size = MAX(1, lpmcd->cChannels) * sizeof(MIXERCONTROLDETAILS_LISTTEXTA);
int size = max(1, lpmcd->cChannels) * sizeof(MIXERCONTROLDETAILS_LISTTEXTA);
if (lpmcd->u.cMultipleItems != 0 && lpmcd->u.cMultipleItems != lpmcd->u.hwndOwner) {
size *= lpmcd->u.cMultipleItems;
@ -3091,11 +3091,11 @@ static BOOL MMSYSTEM_MidiStream_MessageHandler(WINE_MIDIStream* lpMidiStrm, LPWI
DWORD i;
BYTE ch;
for (i = 0; i < MIN(16, lpMidiHdr->dwBufferLength - dwToGo); i++)
for (i = 0; i < min(16, lpMidiHdr->dwBufferLength - dwToGo); i++)
printf("%02x ", lpData[dwToGo + i]);
for (; i < 16; i++)
printf(" ");
for (i = 0; i < MIN(16, lpMidiHdr->dwBufferLength - dwToGo); i++) {
for (i = 0; i < min(16, lpMidiHdr->dwBufferLength - dwToGo); i++) {
ch = lpData[dwToGo + i];
printf("%c", (ch >= 0x20 && ch <= 0x7F) ? ch : '.');
}

View File

@ -222,7 +222,7 @@ static WORD timeSetEventInternal(UINT wDelay, UINT wResol,
EnterCriticalSection(&iData->cs);
for (lpTimer = iData->lpTimerList; lpTimer != NULL; lpTimer = lpTimer->lpNext) {
wNewID = MAX(wNewID, lpTimer->wTimerID);
wNewID = max(wNewID, lpTimer->wTimerID);
}
lpNewTimer->lpNext = iData->lpTimerList;

View File

@ -389,7 +389,7 @@ static DWORD CALLBACK wodPlayer(LPVOID pmt)
TRACE("imhere[1]\n");
MsgWaitForMultipleObjects(0, NULL, FALSE,
(wwo->state == WINE_WS_PLAYING) ?
(MAX(wwo->wFragsUsedInQueue, 4) - 2) * dwSleepTime :
(max(wwo->wFragsUsedInQueue, 4) - 2) * dwSleepTime :
/*INFINITE*/100,
QS_POSTMESSAGE);
TRACE("imhere[2]\n");

View File

@ -524,7 +524,7 @@ BOOL DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf,
const char *p = strchr( name, '/' );
int len = p ? (int)(p - name) : strlen(name);
if ((p = strchr( name, '\\' ))) len = MIN( (int)(p - name), len );
if ((p = strchr( name, '\\' ))) len = min( (int)(p - name), len );
/* Ignore trailing dots */
while (len > 1 && name[len-1] == '.') len--;
if (long_len < len + 1) return FALSE;

View File

@ -923,7 +923,7 @@ static UINT DRIVE_GetCurrentDirectory( UINT buflen, LPSTR buf )
assert(s);
ret = strlen(s) + 3; /* length of WHOLE current directory */
if (ret >= buflen) return ret + 1;
lstrcpynA( buf, "A:\\", MIN( 4, buflen ) );
lstrcpynA( buf, "A:\\", min( 4, buflen ) );
if (buflen) buf[0] += DRIVE_GetCurrentDrive();
if (buflen > 3) lstrcpynA( buf + 3, s, buflen - 3 );
return ret;

View File

@ -1488,7 +1488,7 @@ UINT16 WINAPI SetHandleCount16( UINT16 count )
*/
UINT WINAPI SetHandleCount( UINT count )
{
return MIN( 256, count );
return min( 256, count );
}

View File

@ -149,7 +149,7 @@ static void PROFILE_CopyEntry( char *buffer, const char *value, int len,
const char *env_p;
const char *p2 = strchr( p, '}' );
if (!p2) continue; /* ignore it */
lstrcpynA(env_val, p + 2, MIN( sizeof(env_val), (int)(p2-p)-1 ));
lstrcpynA(env_val, p + 2, min( sizeof(env_val), (int)(p2-p)-1 ));
if ((env_p = getenv( env_val )) != NULL)
{
lstrcpynA( buffer, env_p, len );

View File

@ -48,10 +48,10 @@ EMFDRV_LineTo( DC *dc, INT x, INT y )
if(!EMFDRV_WriteRecord( dc, &emr.emr ))
return FALSE;
bounds.left = MIN(x, dc->w.CursPosX);
bounds.top = MIN(y, dc->w.CursPosY);
bounds.right = MAX(x, dc->w.CursPosX);
bounds.bottom = MAX(y, dc->w.CursPosY);
bounds.left = min(x, dc->w.CursPosX);
bounds.top = min(y, dc->w.CursPosY);
bounds.right = max(x, dc->w.CursPosX);
bounds.bottom = max(y, dc->w.CursPosY);
EMFDRV_UpdateBBox( dc, &bounds );
@ -116,10 +116,10 @@ EMFDRV_ArcChordPie( DC *dc, INT left, INT top, INT right, INT bottom,
if(angleEnd < 0) angleEnd += 2 * M_PI;
if(angleEnd < angleStart) angleEnd += 2 * M_PI;
bounds.left = MIN(xinterStart, xinterEnd);
bounds.top = MIN(yinterStart, yinterEnd);
bounds.right = MAX(xinterStart, xinterEnd);
bounds.bottom = MAX(yinterStart, yinterEnd);
bounds.left = min(xinterStart, xinterEnd);
bounds.top = min(yinterStart, yinterEnd);
bounds.right = max(xinterStart, xinterEnd);
bounds.bottom = max(yinterStart, yinterEnd);
for(i = 0; i <= 8; i++) {
if(i * M_PI / 2 < angleStart) /* loop until we're past start */

View File

@ -173,10 +173,10 @@ void EMFDRV_UpdateBBox( DC *dc, RECTL *rect )
*bounds = *rect;
return;
}
bounds->left = MIN(bounds->left, rect->left);
bounds->top = MIN(bounds->top, rect->top);
bounds->right = MAX(bounds->right, rect->right);
bounds->bottom = MAX(bounds->bottom, rect->bottom);
bounds->left = min(bounds->left, rect->left);
bounds->top = min(bounds->top, rect->top);
bounds->right = max(bounds->right, rect->right);
bounds->bottom = max(bounds->bottom, rect->bottom);
return;
}

View File

@ -369,7 +369,7 @@ BOOL MFDRV_WriteRecord( DC *dc, METARECORD *mr, DWORD rlen)
}
physDev->mh->mtSize += rlen / 2;
physDev->mh->mtMaxRecord = MAX(physDev->mh->mtMaxRecord, rlen / 2);
physDev->mh->mtMaxRecord = max(physDev->mh->mtMaxRecord, rlen / 2);
return TRUE;
}

View File

@ -668,8 +668,8 @@ X11DRV_RoundRect( DC *dc, INT left, INT top, INT right,
/* Make sure ell_width and ell_height are >= 1 otherwise XDrawArc gets
called with width/height < 0 */
ell_width = MAX(abs( ell_width * dc->vportExtX / dc->wndExtX ), 1);
ell_height = MAX(abs( ell_height * dc->vportExtY / dc->wndExtY ), 1);
ell_width = max(abs( ell_width * dc->vportExtX / dc->wndExtX ), 1);
ell_height = max(abs( ell_height * dc->vportExtY / dc->wndExtY ), 1);
/* Fix the coordinates */

View File

@ -3065,10 +3065,10 @@ BOOL X11DRV_GetCharWidth( DC *dc, UINT firstChar, UINT lastChar,
if (CI_NONEXISTCHAR(cs)) cs = def;
} else cs = def;
if(pfo->lpX11Trans)
*buffer++ = MAX(cs->attributes, 0) *
*buffer++ = max(cs->attributes, 0) *
pfo->lpX11Trans->pixelsize / 1000.0 * pfo->rescale;
else
*buffer++ = MAX(cs->width, 0 ) * pfo->rescale;
*buffer++ = max(cs->width, 0 ) * pfo->rescale;
}
}

View File

@ -421,25 +421,14 @@ typedef LRESULT (CALLBACK *WNDPROC)(HWND,UINT,WPARAM,LPARAM);
((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
#endif /* 1 */
/* MIN and MAX macros */
#ifdef MAX
#undef MAX
#endif
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#ifdef MIN
#undef MIN
#endif
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define __max(a,b) MAX(a,b)
#define __min(a,b) MIN(a,b)
/* min and max macros */
#define __max(a,b) (((a) > (b)) ? (a) : (b))
#define __min(a,b) (((a) < (b)) ? (a) : (b))
#ifndef max
#define max(a,b) MAX(a,b)
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) MIN(a,b)
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#define _MAX_PATH 260

View File

@ -397,8 +397,8 @@ static int calc_vma_size( HMODULE hModule )
pe_seg->NumberOfRelocations,
pe_seg->NumberOfLinenumbers,
pe_seg->Characteristics);
vma_size=MAX(vma_size, pe_seg->VirtualAddress+pe_seg->SizeOfRawData);
vma_size=MAX(vma_size, pe_seg->VirtualAddress+pe_seg->Misc.VirtualSize);
vma_size=max(vma_size, pe_seg->VirtualAddress+pe_seg->SizeOfRawData);
vma_size=max(vma_size, pe_seg->VirtualAddress+pe_seg->Misc.VirtualSize);
pe_seg++;
}
return vma_size;

View File

@ -839,7 +839,7 @@ INT16 WINAPI LoadString16( HINSTANCE16 instance, UINT16 resource_id,
TRACE("strlen = %d\n", (int)*p );
if (buffer == NULL) return *p;
i = MIN(buflen - 1, *p);
i = min(buflen - 1, *p);
if (i > 0) {
memcpy(buffer, p + 1, i);
buffer[i] = '\0';
@ -889,7 +889,7 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id,
TRACE("strlen = %d\n", (int)*p );
if (buffer == NULL) return *p;
i = MIN(buflen - 1, *p);
i = min(buflen - 1, *p);
if (i > 0) {
memcpy(buffer, p + 1, i * sizeof (WCHAR));
buffer[i] = (WCHAR) 0;
@ -995,7 +995,7 @@ INT WINAPI LoadMessageA( HMODULE instance, UINT id, WORD lang,
}
slen=mre->Length;
TRACE(" - strlen=%d\n",slen);
i = MIN(buflen - 1, slen);
i = min(buflen - 1, slen);
if (buffer == NULL)
return slen;
if (i>0) {

View File

@ -639,7 +639,7 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, DWORD size,
}
size += sizeof(SUBHEAP) + sizeof(ARENA_FREE);
if (!(subheap = HEAP_CreateSubHeap( heap, heap->flags, size,
MAX( HEAP_DEF_SIZE, size ) )))
max( HEAP_DEF_SIZE, size ) )))
return NULL;
TRACE("created new sub-heap %08lx of %08lx bytes for heap %08lx\n",

View File

@ -390,7 +390,7 @@ BOOL16 WINAPI LocalInit16( HANDLE16 selector, WORD start, WORD end )
}
ptr = PTR_SEG_OFF_TO_LIN( selector, 0 );
start = LALIGN( MAX( start, sizeof(INSTANCEDATA) ) );
start = LALIGN( max( start, sizeof(INSTANCEDATA) ) );
heapInfoArena = LALIGN(start + sizeof(LOCALARENA) );
freeArena = LALIGN( heapInfoArena + ARENA_HEADER_SIZE
+ sizeof(LOCALHEAPINFO) );
@ -857,7 +857,7 @@ static HLOCAL16 LOCAL_GetBlock( HANDLE16 ds, WORD size, WORD flags )
}
size += ARENA_HEADER_SIZE;
size = LALIGN( MAX( size, sizeof(LOCALARENA) ) );
size = LALIGN( max( size, sizeof(LOCALARENA) ) );
#if 0
notify_done:

View File

@ -475,7 +475,7 @@ DWORD WINAPI GetWinFlags16(void)
GetSystemInfo(&si);
/* There doesn't seem to be any Pentium flag. */
result = cpuflags[MIN (si.wProcessorLevel, 4)] | WF_ENHANCED | WF_PMODE | WF_80x87 | WF_PAGING;
result = cpuflags[min(si.wProcessorLevel, 4)] | WF_ENHANCED | WF_PMODE | WF_80x87 | WF_PAGING;
if (si.wProcessorLevel >= 4) result |= WF_HASCPUID;
ovi.dwOSVersionInfoSize = sizeof(ovi);
GetVersionExA(&ovi);

View File

@ -820,12 +820,12 @@ static int INT21_FindNextFCB( CONTEXT86 *context )
if (p && p[1] && (p != entry.cAlternateFileName))
{
memcpy( pResult->filename, entry.cAlternateFileName,
MIN( (p - entry.cAlternateFileName), 8 ) );
memcpy( pResult->filename + 8, p + 1, MIN( strlen(p), 3 ) );
min( (p - entry.cAlternateFileName), 8 ) );
memcpy( pResult->filename + 8, p + 1, min( strlen(p), 3 ) );
}
else
memcpy( pResult->filename, entry.cAlternateFileName,
MIN( strlen(entry.cAlternateFileName), 8 ) );
min( strlen(entry.cAlternateFileName), 8 ) );
}
return 1;
}

View File

@ -177,9 +177,9 @@ UINT WINAPI GetEnhMetaFileHeader(
if (!buf) return sizeof(ENHMETAHEADER);
emh = EMF_GetEnhMetaHeader(hmf);
if(!emh) return FALSE;
memmove(buf, emh, MIN(sizeof(ENHMETAHEADER), bufsize));
memmove(buf, emh, min(sizeof(ENHMETAHEADER), bufsize));
EMF_ReleaseEnhMetaHeader(hmf);
return MIN(sizeof(ENHMETAHEADER), bufsize);
return min(sizeof(ENHMETAHEADER), bufsize);
}
@ -213,7 +213,7 @@ UINT WINAPI GetEnhMetaFileDescriptionA(
size - first - 1);
EMF_ReleaseEnhMetaHeader(hmf);
return MIN(size, emh->nDescription);
return min(size, emh->nDescription);
}
/*****************************************************************************
@ -244,9 +244,9 @@ UINT WINAPI GetEnhMetaFileDescriptionW(
}
memmove(buf, (char *) emh + emh->offDescription,
MIN(size,emh->nDescription));
min(size,emh->nDescription));
EMF_ReleaseEnhMetaHeader(hmf);
return MIN(size, emh->nDescription);
return min(size, emh->nDescription);
}
/****************************************************************************
@ -303,7 +303,7 @@ UINT WINAPI GetEnhMetaFileBits(
}
/* Copy the lesser of the two byte counts */
uEnhMetaFileSize = MIN( uEnhMetaFileSize, bufsize );
uEnhMetaFileSize = min( uEnhMetaFileSize, bufsize );
/* Copy everything */
lpEnhMetaFile = EMF_GetEnhMetaHeader( hmf );
@ -1375,7 +1375,7 @@ INT CALLBACK cbEnhPaletteCopy( HDC a,
{
PEMREOF lpEof = (PEMREOF)lpEMR;
EMF_PaletteCopy* info = (EMF_PaletteCopy*)lpData;
DWORD dwNumPalToCopy = MIN( lpEof->nPalEntries, info->cEntries );
DWORD dwNumPalToCopy = min( lpEof->nPalEntries, info->cEntries );
TRACE( "copying 0x%08lx palettes\n", dwNumPalToCopy );

View File

@ -1543,7 +1543,7 @@ static void REGION_RegionOp(
* have to worry about using too much memory. I hope to be able to
* nuke the Xrealloc() at the end of this function eventually.
*/
newReg->size = MAX(reg1->numRects,reg2->numRects) * 2;
newReg->size = max(reg1->numRects,reg2->numRects) * 2;
if (! (newReg->rects = HeapAlloc( GetProcessHeap(), 0,
sizeof(RECT) * newReg->size )))
@ -1614,8 +1614,8 @@ static void REGION_RegionOp(
*/
if (r1->top < r2->top)
{
top = MAX(r1->top,ybot);
bot = MIN(r1->bottom,r2->top);
top = max(r1->top,ybot);
bot = min(r1->bottom,r2->top);
if ((top != bot) && (nonOverlap1Func != (void (*)())NULL))
{
@ -1626,8 +1626,8 @@ static void REGION_RegionOp(
}
else if (r2->top < r1->top)
{
top = MAX(r2->top,ybot);
bot = MIN(r2->bottom,r1->top);
top = max(r2->top,ybot);
bot = min(r2->bottom,r1->top);
if ((top != bot) && (nonOverlap2Func != (void (*)())NULL))
{
@ -1656,7 +1656,7 @@ static void REGION_RegionOp(
* Now see if we've hit an intersecting band. The two bands only
* intersect if ybot > ytop
*/
ybot = MIN(r1->bottom, r2->bottom);
ybot = min(r1->bottom, r2->bottom);
curBand = newReg->numRects;
if (ybot > ytop)
{
@ -1699,7 +1699,7 @@ static void REGION_RegionOp(
r1BandEnd++;
}
(* nonOverlap1Func) (newReg, r1, r1BandEnd,
MAX(r1->top,ybot), r1->bottom);
max(r1->top,ybot), r1->bottom);
r1 = r1BandEnd;
} while (r1 != r1End);
}
@ -1714,7 +1714,7 @@ static void REGION_RegionOp(
r2BandEnd++;
}
(* nonOverlap2Func) (newReg, r2, r2BandEnd,
MAX(r2->top,ybot), r2->bottom);
max(r2->top,ybot), r2->bottom);
r2 = r2BandEnd;
} while (r2 != r2End);
}
@ -1786,8 +1786,8 @@ static void REGION_IntersectO(WINEREGION *pReg, RECT *r1, RECT *r1End,
while ((r1 != r1End) && (r2 != r2End))
{
left = MAX(r1->left, r2->left);
right = MIN(r1->right, r2->right);
left = max(r1->left, r2->left);
right = min(r1->right, r2->right);
/*
* If there's any overlap between the two rectangles, add that
@ -2026,10 +2026,10 @@ static void REGION_UnionRegion(WINEREGION *newReg, WINEREGION *reg1,
REGION_RegionOp (newReg, reg1, reg2, (voidProcp) REGION_UnionO,
(voidProcp) REGION_UnionNonO, (voidProcp) REGION_UnionNonO);
newReg->extents.left = MIN(reg1->extents.left, reg2->extents.left);
newReg->extents.top = MIN(reg1->extents.top, reg2->extents.top);
newReg->extents.right = MAX(reg1->extents.right, reg2->extents.right);
newReg->extents.bottom = MAX(reg1->extents.bottom, reg2->extents.bottom);
newReg->extents.left = min(reg1->extents.left, reg2->extents.left);
newReg->extents.top = min(reg1->extents.top, reg2->extents.top);
newReg->extents.right = max(reg1->extents.right, reg2->extents.right);
newReg->extents.bottom = max(reg1->extents.bottom, reg2->extents.bottom);
newReg->type = (newReg->numRects) ?
((newReg->numRects > 1) ? COMPLEXREGION : SIMPLEREGION)
: NULLREGION ;
@ -2711,8 +2711,8 @@ HRGN WINAPI CreatePolyPolygonRgn(const POINT *Pts, const INT *Count,
(Pts[2].x == Pts[3].x) &&
(Pts[3].y == Pts[0].y))))
{
SetRectRgn( hrgn, MIN(Pts[0].x, Pts[2].x), MIN(Pts[0].y, Pts[2].y),
MAX(Pts[0].x, Pts[2].x), MAX(Pts[0].y, Pts[2].y) );
SetRectRgn( hrgn, min(Pts[0].x, Pts[2].x), min(Pts[0].y, Pts[2].y),
max(Pts[0].x, Pts[2].x), max(Pts[0].y, Pts[2].y) );
GDI_HEAP_UNLOCK( hrgn );
return hrgn;
}

View File

@ -229,7 +229,7 @@ static BOOL HLPFILE_DoReadHlpFile(HLPFILE *hlpfile, LPCSTR lpszPath)
buf = topic.map[0] + 0xc;
while(buf + 0xc < topic.end)
{
BYTE *end = MIN(buf + GET_UINT(buf, 0), topic.end);
BYTE *end = min(buf + GET_UINT(buf, 0), topic.end);
UINT next, index, offset;
switch (buf[0x14])
@ -772,7 +772,7 @@ static BOOL HLPFILE_Uncompress1_Topic()
/* I don't know why, it's necessary for printman.hlp */
if (ptr + 0x44 > end) ptr = end - 0x44;
newsize += HLPFILE_Uncompressed1_Size(ptr + 0xc, MIN(end, ptr + 0x1000));
newsize += HLPFILE_Uncompressed1_Size(ptr + 0xc, min(end, ptr + 0x1000));
}
topic.hMap = GlobalAlloc(GMEM_FIXED, topic.wMapLen * sizeof(topic.map[0]));
@ -788,7 +788,7 @@ static BOOL HLPFILE_Uncompress1_Topic()
if (ptr + 0x44 > end) ptr = end - 0x44;
topic.map[i] = newptr - 0xc;
newptr = HLPFILE_Uncompress1(ptr + 0xc, MIN(end, ptr + 0x1000), newptr);
newptr = HLPFILE_Uncompress1(ptr + 0xc, min(end, ptr + 0x1000), newptr);
}
return TRUE;

View File

@ -161,7 +161,7 @@ VOID MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
button->wParam = WH_FIRST_BUTTON;
for (b = &win->first_button; *b; b = &(*b)->next)
button->wParam = MAX(button->wParam, (*b)->wParam + 1);
button->wParam = max(button->wParam, (*b)->wParam + 1);
*b = button;
SendMessage(win->hMainWnd, WM_USER, 0, 0);

View File

@ -225,8 +225,8 @@ VOID WINHELP_CreateHelpWindow(LPCSTR lpszFile, LONG lHash, LPCSTR lpszWindow,
origin = *mouse;
ClientToScreen(hParentWnd, &origin);
origin.x -= size.cx / 2;
origin.x = MIN(origin.x, GetSystemMetrics(SM_CXSCREEN) - size.cx);
origin.x = MAX(origin.x, 0);
origin.x = min(origin.x, GetSystemMetrics(SM_CXSCREEN) - size.cx);
origin.x = max(origin.x, 0);
}
/* Initialize WINHELP_WINDOW struct */
@ -466,8 +466,8 @@ static LRESULT WINHELP_ButtonBoxWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPA
lstrlen(button->lpszName), &textsize);
ReleaseDC(button->hWnd, hDc);
button_size.cx = MAX(button_size.cx, textsize.cx + BUTTON_CX);
button_size.cy = MAX(button_size.cy, textsize.cy + BUTTON_CY);
button_size.cx = max(button_size.cx, textsize.cx + BUTTON_CX);
button_size.cy = max(button_size.cy, textsize.cy + BUTTON_CY);
}
x = 0;
@ -787,13 +787,13 @@ static BOOL WINHELP_SplitLines(HWND hWnd, LPSIZE newsize)
textlen = low;
while (textlen && text[textlen] && text[textlen] != ' ') textlen--;
}
if (!part && !textlen) textlen = MAX(low, 1);
if (!part && !textlen) textlen = max(low, 1);
if (free_width <= 0 || !textlen)
{
part = 0;
space.cx = rect.left + indent;
space.cx = MIN(space.cx, rect.right - rect.left - 1);
space.cx = min(space.cx, rect.right - rect.left - 1);
continue;
}
@ -807,7 +807,7 @@ static BOOL WINHELP_SplitLines(HWND hWnd, LPSIZE newsize)
}
if (newsize)
newsize->cx = MAX(newsize->cx, (*line)->rect.right + INTERNAL_BORDER_WIDTH);
newsize->cx = max(newsize->cx, (*line)->rect.right + INTERNAL_BORDER_WIDTH);
len -= textlen;
text += textlen;
@ -892,7 +892,7 @@ static BOOL WINHELP_AppendText(WINHELP_LINE ***linep, WINHELP_LINE_PART ***partp
part->rect.top =
((*partp) ? line->rect.top : line->rect.bottom) + *line_ascent - ascent;
part->rect.bottom = part->rect.top + textsize->cy;
line->rect.bottom = MAX(line->rect.bottom, part->rect.bottom);
line->rect.bottom = max(line->rect.bottom, part->rect.bottom);
part->hSelf = handle;
part->lpsText = ptr;
part->wTextLen = textlen;

View File

@ -350,7 +350,7 @@ static struct key *alloc_key( const WCHAR *name, time_t modif )
static void touch_key( struct key *key )
{
key->modif = time(NULL);
key->level = MAX( key->level, current_level );
key->level = max( key->level, current_level );
}
/* try to grow the array of subkeys; return 1 if OK, 0 on error */
@ -1186,7 +1186,7 @@ static int load_value( struct key *key, const char *buffer, struct file_load_inf
value->len = len;
value->type = type;
/* update the key level but not the modification time */
key->level = MAX( key->level, current_level );
key->level = max( key->level, current_level );
return 1;
error:

View File

@ -172,13 +172,13 @@ static void dump_varargs_get_socket_event_reply( const struct get_socket_event_r
static void dump_varargs_read_process_memory_reply( const struct read_process_memory_request *req )
{
int count = MIN( req->len, get_req_size( req->data, sizeof(int) ) );
int count = min( req->len, get_req_size( req->data, sizeof(int) ) );
dump_bytes( (unsigned char *)req->data, count * sizeof(int) );
}
static void dump_varargs_write_process_memory_request( const struct write_process_memory_request *req )
{
int count = MIN( req->len, get_req_size( req->data, sizeof(int) ) );
int count = min( req->len, get_req_size( req->data, sizeof(int) ) );
dump_bytes( (unsigned char *)req->data, count * sizeof(int) );
}

View File

@ -369,9 +369,9 @@ static void AssignOrdinals(void)
{
if (!strcmp( Names[i]->name, Names[i+1]->name ))
{
Line = MAX( Names[i]->lineno, Names[i+1]->lineno );
Line = max( Names[i]->lineno, Names[i+1]->lineno );
fatal_error( "'%s' redefined (previous definition at line %d)\n",
Names[i]->name, MIN( Names[i]->lineno, Names[i+1]->lineno ) );
Names[i]->name, min( Names[i]->lineno, Names[i+1]->lineno ) );
}
}

View File

@ -499,7 +499,7 @@ static HGLOBAL16 CURSORICON_CreateFromResource( HINSTANCE16 hInstance, HGLOBAL16
*/
if ((pInfo = (BITMAPINFO *)HeapAlloc( GetProcessHeap(), 0,
MAX(size, sizeof(BITMAPINFOHEADER) + 2*sizeof(RGBQUAD)))))
max(size, sizeof(BITMAPINFOHEADER) + 2*sizeof(RGBQUAD)))))
{
memcpy( pInfo, bmi, size );
pInfo->bmiHeader.biHeight /= 2;

View File

@ -411,10 +411,10 @@ static BOOL DCE_GetVisRect( WND *wndPtr, BOOL clientArea, RECT *lprect )
goto fail;
}
lprect->left = MAX( lprect->left, wndPtr->rectClient.left );
lprect->right = MIN( lprect->right, wndPtr->rectClient.right );
lprect->top = MAX( lprect->top, wndPtr->rectClient.top );
lprect->bottom = MIN( lprect->bottom, wndPtr->rectClient.bottom );
lprect->left = max( lprect->left, wndPtr->rectClient.left );
lprect->right = min( lprect->right, wndPtr->rectClient.right );
lprect->top = max( lprect->top, wndPtr->rectClient.top );
lprect->bottom = min( lprect->bottom, wndPtr->rectClient.bottom );
WIN_ReleaseWndPtr(wndPtr);
}

View File

@ -155,7 +155,7 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSA lpmb)
}
}
}
bw = MAX(bw, bh * 2);
bw = max(bw, bh * 2);
/* Button white space */
bh = bh * 2;
bw = bw * 2;
@ -168,14 +168,14 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSA lpmb)
DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_CALCRECT);
/* Min text width corresponds to space for the buttons */
tleft = 2 * ileft + iwidth;
twidth = MAX((bw + bspace) * buttons + bspace - tleft, rect.right);
twidth = max((bw + bspace) * buttons + bspace - tleft, rect.right);
theight = rect.bottom;
if (hFont)
SelectObject(hdc, hPrevFont);
ReleaseDC(hItem, hdc);
tiheight = 16 + MAX(iheight, theight);
tiheight = 16 + max(iheight, theight);
wwidth = tleft + twidth + ileft + borwidth;
wheight = 8 + tiheight + bh + borheight;

View File

@ -2157,23 +2157,23 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
SetRect(&mouseRect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
if (ON_LEFT_BORDER(hittest))
{
mouseRect.left = MAX( mouseRect.left, sizingRect.right-maxTrack.x );
mouseRect.right = MIN( mouseRect.right, sizingRect.right-minTrack.x );
mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x );
mouseRect.right = min( mouseRect.right, sizingRect.right-minTrack.x );
}
else if (ON_RIGHT_BORDER(hittest))
{
mouseRect.left = MAX( mouseRect.left, sizingRect.left+minTrack.x );
mouseRect.right = MIN( mouseRect.right, sizingRect.left+maxTrack.x );
mouseRect.left = max( mouseRect.left, sizingRect.left+minTrack.x );
mouseRect.right = min( mouseRect.right, sizingRect.left+maxTrack.x );
}
if (ON_TOP_BORDER(hittest))
{
mouseRect.top = MAX( mouseRect.top, sizingRect.bottom-maxTrack.y );
mouseRect.bottom = MIN( mouseRect.bottom,sizingRect.bottom-minTrack.y);
mouseRect.top = max( mouseRect.top, sizingRect.bottom-maxTrack.y );
mouseRect.bottom = min( mouseRect.bottom,sizingRect.bottom-minTrack.y);
}
else if (ON_BOTTOM_BORDER(hittest))
{
mouseRect.top = MAX( mouseRect.top, sizingRect.top+minTrack.y );
mouseRect.bottom = MIN( mouseRect.bottom, sizingRect.top+maxTrack.y );
mouseRect.top = max( mouseRect.top, sizingRect.top+minTrack.y );
mouseRect.bottom = min( mouseRect.bottom, sizingRect.top+maxTrack.y );
}
if (wndPtr->dwStyle & WS_CHILD)
{
@ -2231,10 +2231,10 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
case VK_RIGHT: pt.x += 8; break;
}
pt.x = MAX( pt.x, mouseRect.left );
pt.x = MIN( pt.x, mouseRect.right );
pt.y = MAX( pt.y, mouseRect.top );
pt.y = MIN( pt.y, mouseRect.bottom );
pt.x = max( pt.x, mouseRect.left );
pt.x = min( pt.x, mouseRect.right );
pt.y = max( pt.y, mouseRect.top );
pt.y = min( pt.y, mouseRect.bottom );
dx = pt.x - capturePoint.x;
dy = pt.y - capturePoint.y;

View File

@ -183,10 +183,10 @@ BOOL16 WINAPI IntersectRect16( LPRECT16 dest, const RECT16 *src1,
SetRectEmpty16( dest );
return FALSE;
}
dest->left = MAX( src1->left, src2->left );
dest->right = MIN( src1->right, src2->right );
dest->top = MAX( src1->top, src2->top );
dest->bottom = MIN( src1->bottom, src2->bottom );
dest->left = max( src1->left, src2->left );
dest->right = min( src1->right, src2->right );
dest->top = max( src1->top, src2->top );
dest->bottom = min( src1->bottom, src2->bottom );
return TRUE;
}
@ -204,10 +204,10 @@ BOOL WINAPI IntersectRect( LPRECT dest, const RECT *src1,
SetRectEmpty( dest );
return FALSE;
}
dest->left = MAX( src1->left, src2->left );
dest->right = MIN( src1->right, src2->right );
dest->top = MAX( src1->top, src2->top );
dest->bottom = MIN( src1->bottom, src2->bottom );
dest->left = max( src1->left, src2->left );
dest->right = min( src1->right, src2->right );
dest->top = max( src1->top, src2->top );
dest->bottom = min( src1->bottom, src2->bottom );
return TRUE;
}
@ -232,10 +232,10 @@ BOOL16 WINAPI UnionRect16( LPRECT16 dest, const RECT16 *src1,
if (IsRectEmpty16(src2)) *dest = *src1;
else
{
dest->left = MIN( src1->left, src2->left );
dest->right = MAX( src1->right, src2->right );
dest->top = MIN( src1->top, src2->top );
dest->bottom = MAX( src1->bottom, src2->bottom );
dest->left = min( src1->left, src2->left );
dest->right = max( src1->right, src2->right );
dest->top = min( src1->top, src2->top );
dest->bottom = max( src1->bottom, src2->bottom );
}
}
return TRUE;
@ -262,10 +262,10 @@ BOOL WINAPI UnionRect( LPRECT dest, const RECT *src1,
if (IsRectEmpty(src2)) *dest = *src1;
else
{
dest->left = MIN( src1->left, src2->left );
dest->right = MAX( src1->right, src2->right );
dest->top = MIN( src1->top, src2->top );
dest->bottom = MAX( src1->bottom, src2->bottom );
dest->left = min( src1->left, src2->left );
dest->right = max( src1->right, src2->right );
dest->top = min( src1->top, src2->top );
dest->bottom = max( src1->bottom, src2->bottom );
}
}
return TRUE;

View File

@ -255,7 +255,7 @@ static UINT TIMER_SetTimer( HWND hwnd, UINT id, UINT timeout,
if (proc) WINPROC_SetProc( &pTimer->proc, proc, type, WIN_PROC_TIMER );
pTimer->expired = FALSE;
pTimer->hService = SERVICE_AddTimer( MAX( timeout * 1000L, SYS_TIMER_RATE ),
pTimer->hService = SERVICE_AddTimer( max( timeout * 1000L, SYS_TIMER_RATE ),
TIMER_CheckTimer, (ULONG_PTR)pTimer );
TRACE("Timer added: %p, %04x, %04x, %04x, %08lx\n",

View File

@ -69,7 +69,7 @@ WORD WINAPI GetFreeSystemResources16( WORD resType )
default:
return 0;
}
return (WORD)MIN( userPercent, gdiPercent );
return (WORD)min( userPercent, gdiPercent );
}

View File

@ -1142,9 +1142,9 @@ void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT *maxSize, POINT *maxPos,
MinMax.ptMaxPosition.x, MinMax.ptMaxPosition.y,
MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.y,
MinMax.ptMinTrackSize.x, MinMax.ptMinTrackSize.y);
MinMax.ptMaxTrackSize.x = MAX( MinMax.ptMaxTrackSize.x,
MinMax.ptMaxTrackSize.x = max( MinMax.ptMaxTrackSize.x,
MinMax.ptMinTrackSize.x );
MinMax.ptMaxTrackSize.y = MAX( MinMax.ptMaxTrackSize.y,
MinMax.ptMaxTrackSize.y = max( MinMax.ptMaxTrackSize.y,
MinMax.ptMinTrackSize.y );
if (maxSize) *maxSize = MinMax.ptMaxSize;
@ -2087,8 +2087,8 @@ LONG WINPOS_HandleWindowPosChanging( WND *wndPtr, WINDOWPOS *winpos )
((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0))
{
WINPOS_GetMinMaxInfo( wndPtr, &maxSize, NULL, NULL, NULL );
winpos->cx = MIN( winpos->cx, maxSize.x );
winpos->cy = MIN( winpos->cy, maxSize.y );
winpos->cx = min( winpos->cx, maxSize.x );
winpos->cy = min( winpos->cy, maxSize.y );
}
return 0;
}
@ -2239,8 +2239,8 @@ nocopy:
r.left = Wnd->rectClient.left - Wnd->rectWindow.left;
r.top = Wnd->rectClient.top - Wnd->rectWindow.top;
r.right = r.left + MIN( ocw, ncw );
r.bottom = r.top + MIN( och, nch );
r.right = r.left + min( ocw, ncw );
r.bottom = r.top + min( och, nch );
REGION_CropRgn( hrgnValid, hrgnValid, &r,
(uFlags & SWP_EX_PAINTSELF) ? NULL : (POINT*)&(Wnd->rectWindow));

View File

@ -1620,7 +1620,7 @@ INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32, WPARAM wParam32,
case LB_GETSELITEMS:
{
LPINT16 items;
*pwparam16 = (WPARAM16)MIN( wParam32, 0x7f80 ); /* Must be < 64K */
*pwparam16 = (WPARAM16)min( wParam32, 0x7f80 ); /* Must be < 64K */
if (!(items = SEGPTR_ALLOC( *pwparam16 * sizeof(INT16)
+ sizeof(LPARAM)))) return -1;
*((LPARAM *)items)++ = *plparam; /* Store the previous lParam */
@ -1633,7 +1633,7 @@ INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32, WPARAM wParam32,
{
INT i;
LPINT16 stops;
*pwparam16 = (WPARAM16)MIN( wParam32, 0x7f80 ); /* Must be < 64K */
*pwparam16 = (WPARAM16)min( wParam32, 0x7f80 ); /* Must be < 64K */
if (!(stops = SEGPTR_ALLOC( *pwparam16 * sizeof(INT16)
+ sizeof(LPARAM)))) return -1;
for (i = 0; i < *pwparam16; i++) stops[i] = *((LPINT)*plparam+i);
@ -1765,7 +1765,7 @@ INT WINPROC_MapMsg32ATo16( HWND hwnd, UINT msg32, WPARAM wParam32,
case WM_GETTEXT:
{
LPSTR str;
*pwparam16 = (WPARAM16)MIN( wParam32, 0xff80 ); /* Must be < 64K */
*pwparam16 = (WPARAM16)min( wParam32, 0xff80 ); /* Must be < 64K */
if (!(str = SEGPTR_ALLOC(*pwparam16 + sizeof(LPARAM)))) return -1;
*((LPARAM *)str)++ = *plparam; /* Store the previous lParam */
*plparam = (LPARAM)SEGPTR_GET(str);