From: root Date: Wed, 21 Dec 2005 14:19:19 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=6562f326d0af339a64a2678970d0dcf0b34090e5;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/src/command.C b/src/command.C index 5b37711b..e5b83150 100644 --- a/src/command.C +++ b/src/command.C @@ -1602,7 +1602,7 @@ rxvt_term::x_cb (XEvent &ev) scroll_selection_lines = Pixel2Height (dist) / SELECTION_SCROLL_LINE_SPEEDUP + 1; - MIN_IT (scroll_selection_lines, + min_it (scroll_selection_lines, SELECTION_SCROLL_MAX_LINES); } else @@ -2453,8 +2453,8 @@ rxvt_term::check_our_parents () sy = 0; } - MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); - MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); + min_it (nw, (unsigned int) (wrootattr.width - sx)); + min_it (nh, (unsigned int) (wrootattr.height - sy)); XSync (disp, False); allowedxerror = -1; diff --git a/src/init.C b/src/init.C index e4acca9a..0e2d998b 100644 --- a/src/init.C +++ b/src/init.C @@ -371,15 +371,17 @@ rxvt_term::init_resources (int argc, const char *const *argv) } if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0) - saveLines = BOUND_POSITIVE_INT16 (i); + saveLines = min (i, MAX_POSITIVE_INT16); #if ENABLE_FRILLS if (rs[Rs_int_bwidth] && (i = atoi (rs[Rs_int_bwidth])) >= 0) - int_bwidth = min (i, 100); /* arbitrary limit */ + int_bwidth = min (i, MAX_POSITIVE_INT16); + if (rs[Rs_ext_bwidth] && (i = atoi (rs[Rs_ext_bwidth])) >= 0) - ext_bwidth = min (i, 100); /* arbitrary limit */ + ext_bwidth = min (i, MAX_POSITIVE_INT16); + if (rs[Rs_lineSpace] && (i = atoi (rs[Rs_lineSpace])) >= 0) - lineSpace = min (i, 100); /* arbitrary limit */ + lineSpace = min (i, MAX_POSITIVE_INT16); #endif #ifdef POINTER_BLANK @@ -523,7 +525,7 @@ rxvt_term::init_env () * i = (int) (ceil (log10 ((unsigned int)parent[0]))) */ for (i = 0, u = (unsigned int)parent[0]; u; u /= 10, i++) ; - MAX_IT (i, 1); + max_it (i, 1); env_windowid = (char *)rxvt_malloc ((i + 10) * sizeof (char)); sprintf (env_windowid, "WINDOWID=%u", diff --git a/src/main.C b/src/main.C index fb221f44..1af3feb8 100644 --- a/src/main.C +++ b/src/main.C @@ -720,13 +720,13 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) if (flags & WidthValue) { - ncol = BOUND_POSITIVE_INT16 (w); + ncol = clamp (w, 0, MAX_POSITIVE_INT16); szHint.flags |= USSize; } if (flags & HeightValue) { - nrow = BOUND_POSITIVE_INT16 (h); + nrow = clamp (h, 0, MAX_POSITIVE_INT16); szHint.flags |= USSize; } @@ -797,7 +797,7 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) } else { - MIN_IT (width, max_width); + min_it (width, max_width); szHint.width = szHint.base_width + width; } @@ -808,7 +808,7 @@ rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) } else { - MIN_IT (height, max_height); + min_it (height, max_height); szHint.height = szHint.base_height + height; } diff --git a/src/menubar.C b/src/menubar.C index 9de7f33f..babf7c7f 100644 --- a/src/menubar.C +++ b/src/menubar.C @@ -1969,7 +1969,7 @@ rxvt_term::menubar_dispatch (char *str) { short l = item->len + item->len2; - MAX_IT (BuildMenu->width, l); + max_it (BuildMenu->width, l); } } } diff --git a/src/rxvt.h b/src/rxvt.h index e2e46866..af5ee86c 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -164,17 +164,7 @@ struct mouse_event { unsigned int button; /* detail */ }; -#define MAX_IT(current, other) if ((other) > (current)) (current) = (other) -#define MIN_IT(current, other) if ((other) < (current)) (current) = (other) -#define SWAP_IT(one, two, typeof) \ - do { \ - typeof swapittmp; \ - (swapittmp) = (one); (one) = (two); (two) = (swapittmp); \ - } while (/* CONSTCOND */ 0) -#define BOUND_POSITIVE_INT16(val) \ - (int16_t) ((val) <= 0 \ - ? 0 \ - : min ((val), (((uint16_t)-1)>>1))) +#define MAX_POSITIVE_INT16 (((uint16_t)-1)>>1) // TODO: configure/limits #if ENABLE_FRILLS typedef struct _mwmhints { @@ -1493,7 +1483,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { l.t = (text_t *)talloc->alloc (l.t, prev_ncol * sizeof (text_t)); l.r = (rend_t *)ralloc->alloc (l.r, prev_ncol * sizeof (rend_t)); - MIN_IT (l.l, (int16_t)ncol); + l.l = min (l.l, ncol); if (ncol > prev_ncol) scr_blank_line (l, prev_ncol, ncol - prev_ncol, DEFAULT_RSTYLE); diff --git a/src/rxvtutil.h b/src/rxvtutil.h index 6be9bf6d..91624c59 100644 --- a/src/rxvtutil.h +++ b/src/rxvtutil.h @@ -22,8 +22,7 @@ template static inline void max_it (T &a, U b) { a = template static inline T clamp (T v, U a, V b) { return v < (T)a ? a : v >(T)b ? b : v; } template static inline void clamp_it (T &v, U a, V b) { v = v < (T)a ? a : v >(T)b ? b : v; } -template -static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; } +template static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; } // in range including end #define IN_RANGE_INC(val,beg,end) \ diff --git a/src/screen.C b/src/screen.C index 11394f66..a1952ca0 100644 --- a/src/screen.C +++ b/src/screen.C @@ -1480,7 +1480,7 @@ rxvt_term::scr_insdel_chars (int count, int insdel) if (line->is_longer ()) /* break line continuation */ line->l = ncol; - max_it (line->l - count, 0); + line->l = max (line->l - count, 0); if (selection.op && current_screen == selection.screen && ROWCOL_IN_ROW_AT_OR_AFTER (selection.beg, screen.cur))