Duncan Simpson <[EMAIL PROTECTED]> writes:

| g++ 3.3 complains about passing insettext.C passing a non-lvalue to max. The 
| following patch fixes this problem. Someone please apply.

Hmm... are you able to compile with gcc 3.3? I get an ICE whenever I
try?

What version of LyX?
 
| 
| --- src/insets/insettext.C.dist       Tue Feb  4 10:21:03 2003
| +++ src/insets/insettext.C    Tue Feb  4 10:25:08 2003
| @@ -312,7 +312,9 @@
|  
|  int InsetText::width(BufferView * bv, LyXFont const &) const
|  {
| -     insetWidth = max(textWidth(bv), (int)getLyXText(bv)->width) +
| +     int wd;
| +     wd=getLyXText(bv)->width;

Note that you are not writing C now, but C++:

        int wd = getLyXText(bv)->width;

| +     insetWidth = max(textWidth(bv), wd) +
|               (2 * TEXT_TO_INSET_OFFSET);
|       insetWidth = max(insetWidth, 10);
|       return insetWidth;
| @@ -321,15 +323,15 @@
|  
|  int InsetText::textWidth(BufferView * bv, bool fordraw) const
|  {
| -     int w;
| +     int w, wd;
|       if (!autoBreakRows) {
|               w = -1;
|       } else {
|               w = getMaxWidth(bv, this);
|       }

I guess this should be changed to:

        int w = (autoBreakRows ? getMaxWidth(bv, this) : -1);

|       if (fordraw) {
| -             return max(w - (2 * TEXT_TO_INSET_OFFSET),
| -                        (int)getLyXText(bv)->width);
| +             wd=getLyXText(bv)->width;

        int wd = getLyXText(bv)->width;

| +             return max(w - (2 * TEXT_TO_INSET_OFFSET), wd);
|       } else if (w < 0) {
|           return -1;
|       }

-- 
        Lgb

Reply via email to