aboutsummaryrefslogtreecommitdiff
path: root/dw/textblock_linebreaking.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2012-12-08 22:21:55 +0100
committerSebastian Geerken <devnull@localhost>2012-12-08 22:21:55 +0100
commit7a47cd331d30a780e7437b77aeb994c8ed2061b8 (patch)
treebc74d5bece41c29f2c78e559b53361b9169d0b8c /dw/textblock_linebreaking.cc
parenta6a78074bfe343a3e2362247131ac0c69521a245 (diff)
Fixed a problem with realloc.
Diffstat (limited to 'dw/textblock_linebreaking.cc')
-rw-r--r--dw/textblock_linebreaking.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc
index e33cfe62..4900a9a2 100644
--- a/dw/textblock_linebreaking.cc
+++ b/dw/textblock_linebreaking.cc
@@ -651,9 +651,9 @@ void Textblock::handleWordExtremes (int wordIndex)
core::Extremes wordExtremes;
getWordExtremes (word, &wordExtremes);
- //printf ("[%p] HANDLE_WORD_EXTREMES (%d):", this, wordIndex);
+ //printf ("[%p] HANDLE_WORD_EXTREMES (%d): ", this, wordIndex);
//printWordWithFlags (word);
- //printf ("=> %d / %d\n", wordExtremes.minWidth, wordExtremes.maxWidth);
+ //printf (" => %d / %d\n", wordExtremes.minWidth, wordExtremes.maxWidth);
if (wordIndex == 0) {
wordExtremes.minWidth += line1Offset;
@@ -664,9 +664,9 @@ void Textblock::handleWordExtremes (int wordIndex)
words->getRef(paragraphs->getLastRef()->lastWord)
->badnessAndPenalty.lineMustBeBroken (1)) {
// Add a new paragraph.
- Paragraph *prevPar =
- paragraphs->size() == 0 ? NULL : paragraphs->getLastRef();
paragraphs->increase ();
+ Paragraph *prevPar = paragraphs->size() == 1 ?
+ NULL : paragraphs->getRef(paragraphs->size() - 2);
Paragraph *par = paragraphs->getLastRef();
par->firstWord = par->lastWord = wordIndex;
@@ -709,8 +709,9 @@ void Textblock::handleWordExtremes (int wordIndex)
lastPar->parMax += wordExtremes.maxWidth + word->hyphenWidth + corrDiffMax;
lastPar->maxParMax = misc::max (lastPar->maxParMax, lastPar->parMax);
- PRINTF (" => parMin = %d, parMax = %d\n",
- lastPar->parMin, lastPar->parMax);
+ PRINTF (" => parMin = %d (max = %d), parMax = %d (max = %d)\n",
+ lastPar->parMin, lastPar->maxParMin, lastPar->parMax,
+ lastPar->maxParMax);
lastPar->lastWord = wordIndex;
}