changeset 1716:c805b4e0b7ce

make dillo compile with clang * Variable length arrays are not allowed in C++. They are supported in C99 and gcc seems to accept them in C++ mode. Replace the few places where variable length arrays are used. * The widget member in ComplexButtonResource was colliding with the widget member of FltkResource, so rename it to childWidget.
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Sat, 09 Oct 2010 22:50:26 +0200
parents 493343d3d7ae
children 545f885ab62d 92b899247f72
files dpi/downloads.cc dw/fltkplatform.cc dw/fltkui.cc dw/fltkviewbase.cc dw/ui.cc dw/ui.hh
diffstat 6 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/dpi/downloads.cc	Sat Oct 09 14:38:41 2010 -0400
+++ b/dpi/downloads.cc	Sat Oct 09 22:50:26 2010 +0200
@@ -593,7 +593,7 @@
 static void read_log_cb(int fd_in, void *data)
 {
    DLItem *dl_item = (DLItem *)data;
-   int BufLen = 4096;
+   const int BufLen = 4096;
    char Buf[BufLen];
    ssize_t st;
    int ret = -1;
--- a/dw/fltkplatform.cc	Sat Oct 09 14:38:41 2010 -0400
+++ b/dw/fltkplatform.cc	Sat Oct 09 22:50:26 2010 +0200
@@ -353,7 +353,7 @@
 int FltkPlatform::textWidth (core::style::Font *font, const char *text,
                              int len)
 {
-   char chbuf[MB_CUR_MAX];
+   char chbuf[4];
    wchar_t wc, wcu;
    int width = 0;
    FltkFont *ff = (FltkFont*) font;
--- a/dw/fltkui.cc	Sat Oct 09 14:38:41 2010 -0400
+++ b/dw/fltkui.cc	Sat Oct 09 22:50:26 2010 +0200
@@ -989,7 +989,7 @@
          itemWidget->set_selected();
          if (setSelectedItems ()) {
             // Handle multiple item selection.
-            int pos[widgetStack->stack->size ()];
+            int *pos = new int[widgetStack->stack->size ()];
             int i;
             Iterator <TypedPointer < ::fltk::Menu> > it;
             for (it = widgetStack->stack->iterator (),
@@ -1000,6 +1000,7 @@
                pos[i] =  p->getTypedValue()->children () - 1;
             }
             widgetStack->widget->set_item (pos, widgetStack->stack->size ());
+            delete [] pos;
          }
       }
    }
--- a/dw/fltkviewbase.cc	Sat Oct 09 14:38:41 2010 -0400
+++ b/dw/fltkviewbase.cc	Sat Oct 09 22:50:26 2010 +0200
@@ -494,7 +494,7 @@
       int viewX = translateCanvasXToViewX (x),
           viewY = translateCanvasYToViewY (y);
       int curr = 0, next = 0, nb;
-      char chbuf[MB_CUR_MAX];
+      char chbuf[4];
       wchar_t wc, wcu;
 
       if (font->fontVariant == 1) {
--- a/dw/ui.cc	Sat Oct 09 14:38:41 2010 -0400
+++ b/dw/ui.cc	Sat Oct 09 22:50:26 2010 +0200
@@ -280,7 +280,7 @@
 
 void ComplexButtonResource::init (Widget *widget)
 {
-   this->widget = widget;
+   this->childWidget = widget;
 
    layout = new Layout (createPlatform ());
    setLayout (layout);
@@ -292,7 +292,7 @@
 {
    ButtonResource::setEmbed (embed);
 
-   if (widget->usesHints ())
+   if (childWidget->usesHints ())
       embed->setUsesHints ();
 }
 
@@ -304,7 +304,7 @@
 void ComplexButtonResource::sizeRequest (Requisition *requisition)
 {
    Requisition widgetRequisition;
-   widget->sizeRequest (&widgetRequisition);
+   childWidget->sizeRequest (&widgetRequisition);
    requisition->width = widgetRequisition.width + 2 * reliefXThickness ();
    requisition->ascent = widgetRequisition.ascent + reliefYThickness ();
    requisition->descent = widgetRequisition.descent + reliefYThickness ();
@@ -313,7 +313,7 @@
 void ComplexButtonResource::getExtremes (Extremes *extremes)
 {
    Extremes widgetExtremes;
-   widget->getExtremes (&widgetExtremes);
+   childWidget->getExtremes (&widgetExtremes);
    extremes->minWidth = widgetExtremes.minWidth + 2 * reliefXThickness ();
    extremes->maxWidth = widgetExtremes.maxWidth + 2 * reliefXThickness ();
 }
@@ -324,17 +324,17 @@
 
 void ComplexButtonResource::setWidth (int width)
 {
-   widget->setWidth (width - 2 * reliefXThickness ());
+   childWidget->setWidth (width - 2 * reliefXThickness ());
 }
 
 void ComplexButtonResource::setAscent (int ascent)
 {
-   widget->setAscent (ascent - reliefYThickness ());
+   childWidget->setAscent (ascent - reliefYThickness ());
 }
 
 void ComplexButtonResource::setDescent (int descent)
 {
-   widget->setDescent (descent - reliefYThickness ());
+   childWidget->setDescent (descent - reliefYThickness ());
 }
 
 Iterator *ComplexButtonResource::iterator (Content::Type mask, bool atEnd)
--- a/dw/ui.hh	Sat Oct 09 14:38:41 2010 -0400
+++ b/dw/ui.hh	Sat Oct 09 22:50:26 2010 +0200
@@ -382,7 +382,7 @@
    friend class LayoutReceiver;
    LayoutReceiver layoutReceiver;
 
-   Widget *widget;
+   Widget *childWidget;
 
 protected:
    Layout *layout;