[Libreoffice-commits] core.git: sw/source
Matteo Casalin
matteo.casalin at yahoo.com
Sat Nov 23 06:35:16 PST 2013
sw/source/filter/ww8/ww8par.cxx | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
New commits:
commit e3b7e62b0dc34787f66c504230252b2c5edd18c3
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat Nov 23 15:34:09 2013 +0100
Remove STRING_MAXLEN and cleanup code
Change-Id: I933b69af09c8d58a71d9d82d7e13b1b893e57ec0
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 747796e..06c1287 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3309,29 +3309,25 @@ void SwWW8ImplReader::simpleAddTextToParagraph(const OUString& rAddString)
if (!pNd)
return;
- if ((pNd->GetTxt().getLength() + rAddString.getLength()) < STRING_MAXLEN-1)
+ const sal_Int32 nCharsLeft = SAL_MAX_INT32 - pNd->GetTxt().getLength();
+ if (nCharsLeft > 0)
{
- rDoc.InsertString(*pPaM, rAddString);
- }
- else
- {
-
- if (pNd->GetTxt().getLength() < STRING_MAXLEN -1)
+ if (rAddString.getLength() <= nCharsLeft)
{
- OUString sTempStr = rAddString.copy( 0,
- STRING_MAXLEN - pNd->GetTxt().getLength() -1);
- rDoc.InsertString(*pPaM, sTempStr);
- sTempStr = rAddString.copy(sTempStr.getLength(),
- rAddString.getLength() - sTempStr.getLength());
- AppendTxtNode(*pPaM->GetPoint());
- rDoc.InsertString(*pPaM, sTempStr);
+ rDoc.InsertString(*pPaM, rAddString);
}
else
{
+ rDoc.InsertString(*pPaM, rAddString.copy(0, nCharsLeft));
AppendTxtNode(*pPaM->GetPoint());
- rDoc.InsertString(*pPaM, rAddString);
+ rDoc.InsertString(*pPaM, rAddString.copy(nCharsLeft));
}
}
+ else
+ {
+ AppendTxtNode(*pPaM->GetPoint());
+ rDoc.InsertString(*pPaM, rAddString);
+ }
bReadTable = false;
}
More information about the Libreoffice-commits
mailing list