diff options
Diffstat (limited to 'dw')
-rw-r--r-- | dw/fltkcomplexbutton.cc | 2 | ||||
-rw-r--r-- | dw/fltkimgbuf.cc | 6 | ||||
-rw-r--r-- | dw/fltkplatform.cc | 2 | ||||
-rw-r--r-- | dw/fltkui.cc | 2 | ||||
-rw-r--r-- | dw/layout.cc | 8 | ||||
-rw-r--r-- | dw/style.cc | 14 | ||||
-rw-r--r-- | dw/table.cc | 1 | ||||
-rw-r--r-- | dw/textblock.cc | 33 | ||||
-rw-r--r-- | dw/textblock.hh | 2 | ||||
-rw-r--r-- | dw/textblock_iterator.cc | 5 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 6 |
11 files changed, 61 insertions, 20 deletions
diff --git a/dw/fltkcomplexbutton.cc b/dw/fltkcomplexbutton.cc index 76af3713..e287b689 100644 --- a/dw/fltkcomplexbutton.cc +++ b/dw/fltkcomplexbutton.cc @@ -63,6 +63,7 @@ int ComplexButton::handle(int event) { return 1; case FL_PUSH: if (Fl::visible_focus() && handle(FL_FOCUS)) Fl::focus(this); + /* fallthrough */ case FL_DRAG: if (Fl::event_inside(this)) { newval = !oldval; @@ -107,6 +108,7 @@ int ComplexButton::handle(int event) { value(0); return 1; } + /* fallthrough */ default: return 0; } diff --git a/dw/fltkimgbuf.cc b/dw/fltkimgbuf.cc index df387dfb..4eae450b 100644 --- a/dw/fltkimgbuf.cc +++ b/dw/fltkimgbuf.cc @@ -324,7 +324,8 @@ inline void FltkImgbuf::scaleBuffer (const core::byte *src, int srcWidth, gammaMap2 = findGammaCorrectionTable (1 / gamma); } - for(int x = 0; x < destWidth; x++) + int *v = new int[bpp]; + for(int x = 0; x < destWidth; x++) { for(int y = 0; y < destHeight; y++) { int xo1 = x * srcWidth / destWidth; int xo2 = lout::misc::max ((x + 1) * srcWidth / destWidth, xo1 + 1); @@ -332,7 +333,6 @@ inline void FltkImgbuf::scaleBuffer (const core::byte *src, int srcWidth, int yo2 = lout::misc::max ((y + 1) * srcHeight / destHeight, yo1 + 1); int n = (xo2 - xo1) * (yo2 - yo1); - int v[bpp]; for(int i = 0; i < bpp; i++) v[i] = 0; @@ -349,6 +349,8 @@ inline void FltkImgbuf::scaleBuffer (const core::byte *src, int srcWidth, pd[i] = scaleMode == BEAUTIFUL_GAMMA ? gammaMap1[v[i] / n] : v[i] / n; } + } + delete[] v; } void FltkImgbuf::copyRow (int row, const core::byte *data) diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc index 948c1444..0b7ee2e9 100644 --- a/dw/fltkplatform.cc +++ b/dw/fltkplatform.cc @@ -497,7 +497,7 @@ void FltkPlatform::detachView (core::View *view) { if (this->view != view) MSG_ERR("FltkPlatform::detachView: this->view: %p view: %p\n", - this->view, view); + (void *) this->view, (void *) view); for (container::typed::Iterator <ui::FltkResource> it = resources->iterator (); it.hasNext (); ) { diff --git a/dw/fltkui.cc b/dw/fltkui.cc index 712b914f..e454f85b 100644 --- a/dw/fltkui.cc +++ b/dw/fltkui.cc @@ -460,7 +460,7 @@ void FltkResource::detachView (FltkView *view) { if (this->view != view) MSG_ERR("FltkResource::detachView: this->view: %p view: %p\n", - this->view, view); + (void *) this->view, (void *) view); this->view = NULL; } diff --git a/dw/layout.cc b/dw/layout.cc index a6b77aaf..5b3000c0 100644 --- a/dw/layout.cc +++ b/dw/layout.cc @@ -504,8 +504,10 @@ void Layout::attachView (View *view) void Layout::detachView (View *view) { - if (this->view != view) - MSG_ERR("detachView: this->view: %p view %p\n", this->view, view); + if (this->view != view) { + MSG_ERR("detachView: this->view: %p view %p\n", + (void *) this->view, (void *) view); + } view->setLayout (NULL); platform->detachView (view); @@ -865,7 +867,7 @@ void Layout::resizeIdle () enterResizeIdle (); - static int calls = 0; + //static int calls = 0; // There are two commits, 2863:b749629fbfc9 and 4645:ab70f9ce4353, the second // reverting the former. Interrestingly, the second fixes a bug. However, it diff --git a/dw/style.cc b/dw/style.cc index 4c4351a8..f362710e 100644 --- a/dw/style.cc +++ b/dw/style.cc @@ -773,6 +773,7 @@ static void drawBorderTop(View *view, Style *style, break; case BORDER_DOTTED: dotted = true; + /* fallthrough */ case BORDER_DASHED: w = style->borderWidth.top; view->drawTypedLine(style->borderColor.top, shading, @@ -782,6 +783,7 @@ static void drawBorderTop(View *view, Style *style, case BORDER_SOLID: case BORDER_INSET: inset = true; + /* fallthrough */ case BORDER_OUTSET: if (style->borderStyle.top != BORDER_SOLID) shading = (inset) ? Color::SHADING_DARK : Color::SHADING_LIGHT; @@ -801,6 +803,7 @@ static void drawBorderTop(View *view, Style *style, break; case BORDER_RIDGE: ridge = true; + /* fallthrough */ case BORDER_GROOVE: d = style->borderWidth.top & 1; points[0].x = x1; @@ -870,6 +873,7 @@ static void drawBorderBottom(View *view, Style *style, break; case BORDER_DOTTED: dotted = true; + /* fallthrough */ case BORDER_DASHED: w = style->borderWidth.bottom; view->drawTypedLine(style->borderColor.bottom, shading, @@ -879,6 +883,7 @@ static void drawBorderBottom(View *view, Style *style, case BORDER_SOLID: case BORDER_INSET: inset = true; + /* fallthrough */ case BORDER_OUTSET: if (style->borderStyle.bottom != BORDER_SOLID) shading = (inset) ? Color::SHADING_LIGHT : Color::SHADING_DARK; @@ -898,6 +903,7 @@ static void drawBorderBottom(View *view, Style *style, break; case BORDER_RIDGE: ridge = true; + /* fallthrough */ case BORDER_GROOVE: w = style->borderWidth.bottom; d = w & 1; @@ -969,6 +975,7 @@ static void drawBorderLeft(View *view, Style *style, break; case BORDER_DOTTED: dotted = true; + /* fallthrough */ case BORDER_DASHED: w = style->borderWidth.left; view->drawTypedLine(style->borderColor.left, shading, @@ -978,6 +985,7 @@ static void drawBorderLeft(View *view, Style *style, case BORDER_SOLID: case BORDER_INSET: inset = true; + /* fallthrough */ case BORDER_OUTSET: if (style->borderStyle.left != BORDER_SOLID) shading = (inset) ? Color::SHADING_DARK : Color::SHADING_LIGHT; @@ -996,6 +1004,7 @@ static void drawBorderLeft(View *view, Style *style, break; case BORDER_RIDGE: ridge = true; + /* fallthrough */ case BORDER_GROOVE: w = style->borderWidth.left; d = w & 1; @@ -1066,6 +1075,7 @@ static void drawBorderRight(View *view, Style *style, break; case BORDER_DOTTED: dotted = true; + /* fallthrough */ case BORDER_DASHED: w = style->borderWidth.right; view->drawTypedLine(style->borderColor.right, shading, @@ -1075,6 +1085,7 @@ static void drawBorderRight(View *view, Style *style, case BORDER_SOLID: case BORDER_INSET: inset = true; + /* fallthrough */ case BORDER_OUTSET: if (style->borderStyle.right != BORDER_SOLID) shading = (inset) ? Color::SHADING_LIGHT : Color::SHADING_DARK; @@ -1093,6 +1104,7 @@ static void drawBorderRight(View *view, Style *style, break; case BORDER_RIDGE: ridge = true; + /* fallthrough */ case BORDER_GROOVE: w = style->borderWidth.right; d = w & 1; @@ -1419,6 +1431,7 @@ void numtostr (int num, char *buf, int buflen, ListStyleType listStyleType) case LIST_STYLE_TYPE_LOWER_ALPHA: case LIST_STYLE_TYPE_LOWER_LATIN: start_ch = 'a'; + /* fallthrough */ case LIST_STYLE_TYPE_UPPER_ALPHA: case LIST_STYLE_TYPE_UPPER_LATIN: i0 = num - 1; @@ -1433,6 +1446,7 @@ void numtostr (int num, char *buf, int buflen, ListStyleType listStyleType) break; case LIST_STYLE_TYPE_LOWER_ROMAN: low = true; + /* fallthrough */ case LIST_STYLE_TYPE_UPPER_ROMAN: i0 = num; i1 = i0/10; i2 = i1/10; i3 = i2/10; diff --git a/dw/table.cc b/dw/table.cc index b16eedfc..582c8184 100644 --- a/dw/table.cc +++ b/dw/table.cc @@ -714,6 +714,7 @@ void Table::setColExtreme (int col, ExtrMod mod, void *data, int value) switch (mod) { case DATA: ((misc::SimpleVector<int>*)data)->set (col, value); + /* fallthrough */ default: setExtreme (colExtremes->getRef(col), mod, value); diff --git a/dw/textblock.cc b/dw/textblock.cc index 0cef739b..870ff9e6 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -1309,7 +1309,7 @@ void Textblock::drawWord (Line *line, int wordIndex1, int wordIndex2, totalWidth += w->size.width; } - char text[l + (drawHyphen ? strlen (hyphenDrawChar) : 0) + 1]; + char *text = new char[l + (drawHyphen ? strlen (hyphenDrawChar) : 0) + 1]; int p = 0; for (int i = wordIndex1; i <= wordIndex2; i++) { const char * t = words->getRef(i)->content.text; @@ -1325,6 +1325,8 @@ void Textblock::drawWord (Line *line, int wordIndex1, int wordIndex2, drawWord0 (wordIndex1, wordIndex2, text, totalWidth, drawHyphen, style, view, area, xWidget, yWidgetBase); + + delete[] text; } } @@ -2066,10 +2068,13 @@ void Textblock::addText (const char *text, size_t len, // Store hyphen positions. int n = 0, totalLenCharRemoved = 0; - int partPenaltyIndex[numParts - 1]; - int partStart[numParts], partEnd[numParts]; - bool charRemoved[numParts - 1], canBeHyphenated[numParts + 1]; - bool permDivChar[numParts - 1], unbreakableForMinWidth[numParts - 1]; + int *partPenaltyIndex = new int[numParts - 1]; + int *partStart = new int[numParts]; + int *partEnd = new int[numParts]; + bool *charRemoved = new bool[numParts - 1]; + bool *canBeHyphenated = new bool[numParts + 1]; + bool *permDivChar = new bool[numParts - 1]; + bool *unbreakableForMinWidth = new bool[numParts - 1]; canBeHyphenated[0] = canBeHyphenated[numParts] = true; partStart[0] = 0; partEnd[numParts - 1] = len; @@ -2134,8 +2139,9 @@ void Textblock::addText (const char *text, size_t len, // Get text without removed characters, e. g. hyphens. const char *textWithoutHyphens; - char textWithoutHyphensBuf[len - totalLenCharRemoved]; - int *breakPosWithoutHyphens, breakPosWithoutHyphensBuf[numParts - 1]; + char *textWithoutHyphensBuf = new char[len - totalLenCharRemoved]; + int *breakPosWithoutHyphens; + int *breakPosWithoutHyphensBuf = new int[numParts - 1]; if (totalLenCharRemoved == 0) { // No removed characters: take original arrays. @@ -2164,7 +2170,7 @@ void Textblock::addText (const char *text, size_t len, PUTCHAR(textWithoutHyphens[i]); PRINTF("'\n"); - core::Requisition wordSize[numParts]; + core::Requisition *wordSize = new core::Requisition[numParts]; calcTextSizes (textWithoutHyphens, len - totalLenCharRemoved, style, numParts - 1, breakPosWithoutHyphens, wordSize); @@ -2228,6 +2234,17 @@ void Textblock::addText (const char *text, size_t len, correctLastWordExtremes (); } } + + delete[] partPenaltyIndex; + delete[] partStart; + delete[] partEnd; + delete[] charRemoved; + delete[] canBeHyphenated; + delete[] permDivChar; + delete[] unbreakableForMinWidth; + delete[] textWithoutHyphensBuf; + delete[] breakPosWithoutHyphensBuf; + delete[] wordSize; } DBG_OBJ_LEAVE (); diff --git a/dw/textblock.hh b/dw/textblock.hh index 0e635b99..d02e6b7b 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -8,7 +8,7 @@ // These were used when improved line breaking and hyphenation were implemented. // Should be, bit by bit, replaced by RTFL (see ../lout/debug.hh). -#define PRINTF(fmt, ...) +#define PRINTF(...) #define PUTCHAR(ch) #ifdef DBG_RTFL diff --git a/dw/textblock_iterator.cc b/dw/textblock_iterator.cc index 14631eba..b0c20eb2 100644 --- a/dw/textblock_iterator.cc +++ b/dw/textblock_iterator.cc @@ -113,10 +113,11 @@ void Textblock::TextblockIterator::highlight (int start, int end, oldEndIndex != textblock->hlEnd[layer].index || oldEndChar != textblock->hlEnd[layer].nChar) textblock->queueDrawRange (index1, index2); - } else + } else { highlightOOF (start, end, layer); + } - DBG_OBJ_LEAVE_O (getWidget ()); + DBG_OBJ_LEAVE_O (getWidget ()); } void Textblock::TextblockIterator::unhighlight (int direction, diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index c02453f7..713ad530 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -1421,7 +1421,7 @@ int Textblock::hyphenateWord (int wordIndex, int *addIndex1) if (numBreaks > 0) { Word origWord = *hyphenatedWord; - core::Requisition wordSize[numBreaks + 1]; + core::Requisition *wordSize = new core::Requisition[numBreaks + 1]; calcTextSizes (origWord.content.text, strlen (origWord.content.text), origWord.style, numBreaks, breakPos, wordSize); @@ -1506,8 +1506,10 @@ int Textblock::hyphenateWord (int wordIndex, int *addIndex1) origWord.spaceStyle->unref (); free (breakPos); - } else + delete[] wordSize; + } else { words->getRef(wordIndex)->flags &= ~Word::CAN_BE_HYPHENATED; + } return numBreaks; } |