Use min/max instead of MIN/MAX.
diff --git a/controls/edit.c b/controls/edit.c index c10729e..29cf1ee 100644 --- a/controls/edit.c +++ b/controls/edit.c
@@ -977,7 +977,7 @@ 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 = ¤t_def->next; @@ -1138,8 +1138,8 @@ */ 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 @@ 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 @@ 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 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { 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 @@ 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 @@ 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);
diff --git a/controls/menu.c b/controls/menu.c index 6eeb608..5afe241 100644 --- a/controls/menu.c +++ b/controls/menu.c
@@ -839,9 +839,9 @@ 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 @@ 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 @@ lpitem->xTab = maxTab; } - lppop->Height = MAX( lppop->Height, orgY ); + lppop->Height = max( lppop->Height, orgY ); } lppop->Width = maxX; @@ -986,7 +986,7 @@ 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; }
diff --git a/controls/scroll.c b/controls/scroll.c index 6748222..1bd8721 100644 --- a/controls/scroll.c +++ b/controls/scroll.c
@@ -255,7 +255,7 @@ } 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 @@ 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 @@ 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 @@ 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)