From: Valentin Hübner Date: Thu, 5 Apr 2018 19:20:28 +0000 (+0200) Subject: Rename `min()` to `_min()` to prevent collision X-Git-Url: https://jcornell.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=17ffc7808d7eb015dfb8e8e1017077f8c8a64a85;p=blitzmax.git Rename `min()` to `_min()` to prevent collision This fixes a compiler error of "min was not declared in this scope". --- diff --git a/mod/maxgui.mod/fltkmaxgui.mod/src/fl_draw.cxx b/mod/maxgui.mod/fltkmaxgui.mod/src/fl_draw.cxx index 6f691c4..35269d6 100644 --- a/mod/maxgui.mod/fltkmaxgui.mod/src/fl_draw.cxx +++ b/mod/maxgui.mod/fltkmaxgui.mod/src/fl_draw.cxx @@ -32,7 +32,7 @@ // Expands all unprintable characters to ^X or \nnn notation // Aligns them against the inside of the box. -#define min(a,b) ((a)<(b)?(a):(b)) +#define _min(a,b) ((a)<(b)?(a):(b)) #include #include #include @@ -48,12 +48,12 @@ char fl_draw_shortcut; // set by fl_labeltypes.cxx static char* underline_at; -/** +/** utf8 multibyte char seq. detection an pass-thru routine. \retval false if no utf8 seq detected, no change made. true if utf8 and d copied with s seq. note that for n bytes copied dest incremented of n, but s of n-1 for compatible loop use see below. */ -#define C_IN(c,a,b) ((c)>=(a) && (c)<=(b)) +#define C_IN(c,a,b) ((c)>=(a) && (c)<=(b)) #define C_UTF8(c) C_IN(c,0x80,0xBF) static bool handle_utf8_seq(const char * &s,char * &d) { @@ -96,7 +96,7 @@ static bool handle_utf8_seq(const char * &s,char * &d) { // planes 16 } else { // non utf8 compliant, maybe CP125x or broken utf8 string // fprintf(stderr, "Not UTF8 char \n"); - return false; + return false; } return true; // we did handled and copied the utf8 multibyte char seq. } @@ -111,7 +111,7 @@ static bool handle_utf8_seq(const char * &s,char * &d) { Sets width to the width of the string in the current font. */ const char* -fl_expand_text(const char* from, char* buf, int maxbuf, double maxw, int& n, +fl_expand_text(const char* from, char* buf, int maxbuf, double maxw, int& n, double &width, int wrap, int draw_symbols) { char* o = buf; char* e = buf+(maxbuf-4); @@ -145,7 +145,7 @@ fl_expand_text(const char* from, char* buf, int maxbuf, double maxw, int& n, if (o > e) break; // don't overflow buffer if (c == '\t') { - for (c = fl_utf_nb_char((uchar*)buf, o-buf)%8; c<8 && o (str + 1) && p[-1] != '@') { strlcpy(symbol[1], p, sizeof(symbol[1])); - symwidth[1] = min(w,h); + symwidth[1] = _min(w,h); } } symtotal = symwidth[0] + symwidth[1]; imgtotal = (img && (align&FL_ALIGN_IMAGE_NEXT_TO_TEXT)) ? img->w() : 0; - + int strw = 0; int strh; if (str) { for (p = str, lines=0; p;) { - e = fl_expand_text(p, buf, MAXBUF, w - symtotal - imgtotal, buflen, width, + e = fl_expand_text(p, buf, MAXBUF, w - symtotal - imgtotal, buflen, width, align&FL_ALIGN_WRAP, draw_symbols); if (strwh() - 1) / 2; img->draw(xpos, yimg); } - + // now draw all the lines: if (str) { int desc = fl_descent(); for (p=str; ; ypos += height) { - if (lines>1) e = fl_expand_text(p, buf, MAXBUF, w - symtotal - imgtotal, buflen, + if (lines>1) e = fl_expand_text(p, buf, MAXBUF, w - symtotal - imgtotal, buflen, width, align&FL_ALIGN_WRAP, draw_symbols); else e = ""; @@ -382,10 +382,10 @@ void fl_draw( { if ((!str || !*str) && !img) return; if (w && h && !fl_not_clipped(x, y, w, h) && (align & FL_ALIGN_INSIDE)) return; - if (align & FL_ALIGN_CLIP) + if (align & FL_ALIGN_CLIP) fl_push_clip(x, y, w, h); fl_draw(str, x, y, w, h, align, fl_draw, img, draw_symbols); - if (align & FL_ALIGN_CLIP) + if (align & FL_ALIGN_CLIP) fl_pop_clip(); } @@ -435,10 +435,10 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) { } symtotal = symwidth[0] + symwidth[1]; - + for (p = str, lines=0; p;) { // e = expand(p, buf, w - symtotal, buflen, width, w != 0, draw_symbols); - e = fl_expand_text(p, buf, MAXBUF, w - symtotal, buflen, width, + e = fl_expand_text(p, buf, MAXBUF, w - symtotal, buflen, width, w != 0, draw_symbols); if ((int)ceil(width) > W) W = (int)ceil(width); lines++; @@ -463,13 +463,13 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) { but with the advent of XFT, there are (currently) complexities that seem to only be solved by asking the font what its actual font height is. (See STR#2115) - + This function was originally undocumented in 1.1.x, and was used only by Fl_Text_Display. We're now documenting it in 1.3.x so that apps that need precise height info can get it with this function. \returns the height of the font in pixels. - + \todo In the future, when the XFT issues are resolved, this function should simply return the 'size' value. */