diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-10-09 22:50:26 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-10-09 22:50:26 +0200 |
commit | 289364d31a9dcc694d0e277b503c512787402482 (patch) | |
tree | 0cd933ca96ba15e741c1c5ae12dcf9d5dca2963f | |
parent | 61c58bd97a4bf9d217bd5e29ec3f76f92e398360 (diff) |
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.
-rw-r--r-- | dpi/downloads.cc | 2 | ||||
-rw-r--r-- | dw/fltkplatform.cc | 2 | ||||
-rw-r--r-- | dw/fltkui.cc | 3 | ||||
-rw-r--r-- | dw/fltkviewbase.cc | 2 | ||||
-rw-r--r-- | dw/ui.cc | 14 | ||||
-rw-r--r-- | dw/ui.hh | 2 |
6 files changed, 13 insertions, 12 deletions
diff --git a/dpi/downloads.cc b/dpi/downloads.cc index 5aa7a87c..69750320 100644 --- a/dpi/downloads.cc +++ b/dpi/downloads.cc @@ -593,7 +593,7 @@ void DLItem::update_size(int new_sz) 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; diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc index d491cfee..010aa113 100644 --- a/dw/fltkplatform.cc +++ b/dw/fltkplatform.cc @@ -353,7 +353,7 @@ void FltkPlatform::detachView (core::View *view) 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; diff --git a/dw/fltkui.cc b/dw/fltkui.cc index c1bfd873..07874f2c 100644 --- a/dw/fltkui.cc +++ b/dw/fltkui.cc @@ -989,7 +989,7 @@ template <class I> void FltkSelectionResource<I>::addItem (const char *str, 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 @@ template <class I> void FltkSelectionResource<I>::addItem (const char *str, pos[i] = p->getTypedValue()->children () - 1; } widgetStack->widget->set_item (pos, widgetStack->stack->size ()); + delete [] pos; } } } diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc index efc5c952..3fb43cb1 100644 --- a/dw/fltkviewbase.cc +++ b/dw/fltkviewbase.cc @@ -494,7 +494,7 @@ void FltkWidgetView::drawText (core::style::Font *font, 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) { @@ -280,7 +280,7 @@ ComplexButtonResource::ComplexButtonResource () void ComplexButtonResource::init (Widget *widget) { - this->widget = widget; + this->childWidget = widget; layout = new Layout (createPlatform ()); setLayout (layout); @@ -292,7 +292,7 @@ void ComplexButtonResource::setEmbed (Embed *embed) { ButtonResource::setEmbed (embed); - if (widget->usesHints ()) + if (childWidget->usesHints ()) embed->setUsesHints (); } @@ -304,7 +304,7 @@ ComplexButtonResource::~ComplexButtonResource () 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::sizeRequest (Requisition *requisition) 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::sizeAllocate (Allocation *allocation) 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) @@ -382,7 +382,7 @@ private: friend class LayoutReceiver; LayoutReceiver layoutReceiver; - Widget *widget; + Widget *childWidget; protected: Layout *layout; |