Re: [fltk.bugs] [MOD] STR #2772: Remove possibly dead code in fl_draw.cxx::fl_measure()
[STR Closed w/Resolution] Link: http://www.fltk.org/str.php?L2772 Version: 1.3-current Fix Version: 1.3-current (r9869) Fixed in Subversion repository. Link: http://www.fltk.org/str.php?L2772 Version: 1.3-current Fix Version: 1.3-current (r9869) ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2772: Remove possibly dead code in fl_draw.cxx::fl_measure()
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR Active] Link: http://www.fltk.org/str.php?L2772 Version: 1.3-current Attaching a patch to simplify fl_measure()'s handling of symbols. Result should give same results as old code, but should probably check odd combos of @ symbols. Suggest making unittest specifically check @ symbol measurements for all odd conditions, including @@, abutting @@'s, etc. Will leave patch here for a while to sleep on it and for comments, and commit on a later date. Link: http://www.fltk.org/str.php?L2772 Version: 1.3-currentIndex: fl_draw.cxx === --- fl_draw.cxx (revision 9847) +++ fl_draw.cxx (working copy) @@ -413,29 +413,20 @@ int lines; double width=0; int W = 0; - char symbol[2][255], *symptr; int symwidth[2], symtotal; - // count how many lines and put the last one into the buffer: - symbol[0][0] = '\0'; - symwidth[0] = 0; + symwidth[0] = 0; // size of symbol at beginning of string (if any) + symwidth[1] = 0; // size of symbol at end of string (if any) - symbol[1][0] = '\0'; - symwidth[1] = 0; - if (draw_symbols) { -if (str str[0] == '@' str[1] str[1] != '@') { - // Start with a symbol... - for (symptr = symbol[0]; - *str !isspace(*str) symptr (symbol[0] + sizeof(symbol[0]) - 1); - *symptr++ = *str++); - *symptr = '\0'; - if (isspace(*str)) str++; +// Symbol at beginning of string? +if (str[0] == '@' str[1] != '@') { + while ( *str !isspace(*str) ) { ++str; } // skip over symbol + if (isspace(*str)) ++str; symwidth[0] = h; } - -if (str (p = strrchr(str, '@')) != NULL p (str + 1) p[-1]!='@') { - strlcpy(symbol[1], p, sizeof(symbol[1])); +// Symbol at end of string? +if ( (p=strchr(str,'@'))!=NULL p[1] != '@') { symwidth[1] = h; } } ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2772: Remove possibly dead code in fl_draw.cxx::fl_measure()
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2772 Version: 1.3-current Taking ownership of this.. Link: http://www.fltk.org/str.php?L2772 Version: 1.3-current ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2772: Remove possibly dead code in fl_draw.cxx::fl_measure()
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2772 Version: 1.3-current Link: http://www.fltk.org/str.php?L2772 Version: 1.3-current ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
[fltk.bugs] [MOD] STR #2772: Remove possibly dead code in fl_draw.cxx::fl_measure()
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2772 Version: 1.3-current As David pointed out on fltk.general, it would appear the symbol[] array symptr calculations, are all dead code and should be removed. I think what happened is fl_measure() was written starting with the code in fl_draw(), which has these same variables, but actually makes use of them. Link: http://www.fltk.org/str.php?L2772 Version: 1.3-current ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs