On Fri, Oct 24, 2003 at 03:48:59PM +0200, Andre Poenitz spake thusly:
 
> On Fri, Oct 24, 2003 at 02:44:48PM +0000, Angus Leeming wrote:
> > Martin Vermeer wrote:
> > 
> > > Fixes the delimiter borkage.
> > > 
> > > OK to commit?
> > > 
> > > - Martin
> > 
> > No.
> > 
> > namespace {
> > 
> > static int const delim_rversion[] = {...};
> > static int const delim_size = sizeof(delim_rversion) / sizeof(int);
> 
>  static int const delim_size = sizeof(delim_rversion) / sizeof(delim_rversion[0]);
> 
> is even more robust to type changes.
> 
> Not that I'd ever change that...
> 
> Andre'

OKOKOK... attached.

It even works.

- Martin 

-- 
Martin Vermeer  [EMAIL PROTECTED]
Helsinki University of Technology 
Dept. of Surveying, Inst. of Geodesy
P.O. Box 1200, FIN-02015 HUT, Finland
:wq
Index: FormMathsDelim.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormMathsDelim.C,v
retrieving revision 1.44
diff -u -p -r1.44 FormMathsDelim.C
--- FormMathsDelim.C    15 Sep 2003 10:59:55 -0000      1.44
+++ FormMathsDelim.C    24 Oct 2003 14:18:52 -0000
@@ -31,11 +31,14 @@ using std::ostringstream;
 #include "delim1.xpm"
 
 
+namespace {
+
 static int const delim_rversion[] = {
 1,1,3,3,4,5,7,7,9,9,10,11,
-
+13,13,15,15,16,17,19,19,20,21,22
 };
-
+static int const delim_size = 
+       sizeof(delim_rversion) / sizeof(delim_rversion[0]);
 
 static char const * delim_values[] = {
        "(", ")", "lceil",  "rceil",  "uparrow",  "Uparrow",
@@ -45,6 +48,8 @@ static char const * delim_values[] = {
 };
 
 
+} // namespace anon
+
 
 typedef FormController<ControlMath, FormView<FD_maths_delim> > base_class;
 
@@ -116,7 +121,7 @@ ButtonPolicy::SMInput FormMathsDelim::in
                        if (both) {
                                right = delim_rversion[i];
                                // Add left delimiter in "both" case if right one was 
pressed:
-                               for (int j = 0; j <= 23; ++j) {
+                               for (int j = 0; j < delim_size; ++j) {
                                        if (delim_rversion[j] == left) {
                                                right = left;
                                                left = j;

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to